on master help sign in
Explicit arguments in views

If they're not explicit, they might get erased which would really hurt complexity (the whole point is that the view holds them rather than the structure after all)

commit88c538534e024c17a047c999ccff5892df858cb1 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateTue 12 Apr 2016, 16:25 (11 years ago) parent4a4548e
3 files changed+13−10
libs/base/Data/List/Views.idr+7−4 libs/base/Data/Nat/Views.idr+4−4 libs/prelude/Prelude/WellFounded.idr+2−2
libs/base/Data/List/Views.idr+7−4
@@ -27,7 +27,8 @@ public export
2727data Split : List a -> Type where
2828 SplitNil : Split []
2929 SplitOne : Split [x]
30− SplitPair : Split (x :: xs ++ y :: ys)
30+ SplitPair : {x, y : a} -> {xs, ys : List a} -> -- Explicit, don't erae
31+ Split (x :: xs ++ y :: ys)
3132
3233splitHelp : (head : a) ->
3334 (xs : List a) ->
@@ -53,8 +54,9 @@ split (x :: xs) = splitHelp x xs xs
5354public export
5455data SplitRec : List a -> Type where
5556 SplitRecNil : SplitRec []
56− SplitRecOne : SplitRec [x]
57− SplitRecPair : Lazy (SplitRec xs) -> Lazy (SplitRec ys) -> SplitRec (xs ++ ys)
57+ SplitRecOne : {x : a} -> SplitRec [x]
58+ SplitRecPair : {xs, ys : List a} -> -- Explicit, don't erase
59+ Lazy (SplitRec xs) -> Lazy (SplitRec ys) -> SplitRec (xs ++ ys)
5860
5961total
6062splitRecFix : (xs : List a) -> ((ys : List a) -> smaller ys xs -> SplitRec ys) ->
@@ -76,7 +78,8 @@ splitRec xs = accInd splitRecFix xs (smallerAcc xs)
7678public export
7779data SnocList : List a -> Type where
7880 Empty : SnocList []
79− Snoc : SnocList xs -> SnocList (xs ++ [x])
81+ Snoc : {x : a} -> {xs : List a} -> -- Explicit, so don't erase
82+ SnocList xs -> SnocList (xs ++ [x])
8083
8184snocListHelp : SnocList xs -> (ys : List a) -> SnocList (xs ++ ys)
8285snocListHelp {xs} x [] = rewrite appendNilRightNeutral xs in x
libs/base/Data/Nat/Views.idr+4−4
@@ -2,14 +2,14 @@ module Data.Nat.Views
22
33public export
44data Half : Nat -> Type where
5− HalfOdd : Half (S (n + n))
6− HalfEven : Half (n + n)
5+ HalfOdd : {n : Nat} -> Half (S (n + n))
6+ HalfEven : {n : Nat} -> Half (n + n)
77
88public export
99data HalfRec : Nat -> Type where
1010 HalfRecZ : HalfRec Z
11− HalfRecEven : Lazy (HalfRec n) -> HalfRec (n + n)
12− HalfRecOdd : Lazy (HalfRec n) -> HalfRec (S (n + n))
11+ HalfRecEven : {n : Nat} -> Lazy (HalfRec n) -> HalfRec (n + n)
12+ HalfRecOdd : {n : Nat} -> Lazy (HalfRec n) -> HalfRec (S (n + n))
1313
1414export
1515half : (n : Nat) -> Half n
libs/prelude/Prelude/WellFounded.idr+2−2
@@ -22,8 +22,8 @@ data Accessible : (rel : a -> a -> Type) -> (x : a) -> Type where
2222 ||| Accessibility
2323 |||
2424 ||| @ x the accessible element
25− ||| @ acc' a demonstration that all smaller elements are also accessible
26− Access : (acc' : (y : a) -> rel y x -> Accessible rel y) ->
25+ ||| @ rec a demonstration that all smaller elements are also accessible
26+ Access : (rec : (y : a) -> rel y x -> Accessible rel y) ->
2727 Accessible rel x
2828
2929||| A relation `rel` on `a` is well-founded if all elements of `a` are