on master help sign in
Fixed some accidentally wrong renamings.
17bab90Ahmad Salim Al-Sibahi
test/error004/FunErrTest.idr+1−1
@@ -16,7 +16,7 @@ cadr (x :: []) {cons1=Refl} {cons2=Refl} impossible
16cadr [] {cons1=Refl} {cons2=Refl} impossible
16cadr [] {cons1=Refl} {cons2=Refl} impossible
17
17
18extractList : TT -> Maybe TT
18extractList : TT -> Maybe TT
19−extractList (App (App ReflCon (App isCons lst)) _) = Just lst
19+extractList (App (App reflCon (App isCons lst)) _) = Just lst
20extractList _ = Nothing
20extractList _ = Nothing
21
21
22total
22total
test/proof002/Reflect.idr+24−24
@@ -9,7 +9,7 @@ using (xs : List a, ys : List a, G : List (List a))
9 Stop : Elem x (x :: xs)
9 Stop : Elem x (x :: xs)
10 Pop : Elem x ys -> Elem x (y :: xs)
10 Pop : Elem x ys -> Elem x (y :: xs)
11
11
12−-- Expr is a Reflection of a list, indexed over the concrete list,
12+-- Expr is a reflection of a list, indexed over the concrete list,
13-- and over a set of list variables.
13-- and over a set of list variables.
14
14
15 data Expr : List (List a) -> List a -> Type where
15 data Expr : List (List a) -> List a -> Type where
@@ -76,7 +76,7 @@ using (xs : List a, ys : List a, G : List (List a))
76 eqExpr ENil ENil = Just Refl
76 eqExpr ENil ENil = Just Refl
77 eqExpr _ _ = Nothing
77 eqExpr _ _ = Nothing
78
78
79−-- Given a couple of Reflected expressions, try to produce a proof that
79+-- Given a couple of reflected expressions, try to produce a proof that
80-- they are equal
80-- they are equal
81
81
82 buildProof : {xs : List a} -> {ys : List a} ->
82 buildProof : {xs : List a} -> {ys : List a} ->
@@ -91,7 +91,7 @@ using (xs : List a, ys : List a, G : List (List a))
91 let (rn ** (r', rPrf)) = reduce r in
91 let (rn ** (r', rPrf)) = reduce r in
92 buildProof l' r' lPrf rPrf
92 buildProof l' r' lPrf rPrf
93
93
94−-- Given a Reflected equality, try to produce a proof that holds
94+-- Given a reflected equality, try to produce a proof that holds
95
95
96 prove : ListEq G t -> Maybe t
96 prove : ListEq G t -> Maybe t
97 prove (EqP xs ys) = testEq xs ys
97 prove (EqP xs ys) = testEq xs ys
@@ -103,7 +103,7 @@ using (xs : List a, ys : List a, G : List (List a))
103-- Some helpers for later... 'prim__syntactic_eq' is a primitive which
103-- Some helpers for later... 'prim__syntactic_eq' is a primitive which
104-- (at compile-time only) attempts to construct a proof that its arguments
104-- (at compile-time only) attempts to construct a proof that its arguments
105-- are syntactically equal. We'll find this useful for referring to variables
105-- are syntactically equal. We'll find this useful for referring to variables
106−-- in Reflected terms.
106+-- in reflected terms.
107
107
108 isElem : (x : a) -> (xs : List a) -> Maybe (Elem x xs)
108 isElem : (x : a) -> (xs : List a) -> Maybe (Elem x xs)
109 isElem x [] = Nothing
109 isElem x [] = Nothing
@@ -122,44 +122,44 @@ using (xs : List a, ys : List a, G : List (List a))
122 weaken G' ENil = ENil
122 weaken G' ENil = ENil
123
123
124
124
125−-- Now, some Reflection magic.
125+-- Now, some reflection magic.
126−-- %Reflection means a function runs on syntax, rather than on constructors.
126+-- %reflection means a function runs on syntax, rather than on constructors.
127−-- So, 'ReflectList' builds a Reflected List expression as defined above.
127+-- So, 'reflectList' builds a reflected List expression as defined above.
128
128
129−-- It also converts (x :: xs) into a Reflected [x] ++ xs so that the above
129+-- It also converts (x :: xs) into a reflected [x] ++ xs So that the above
130-- reduction will work the right way.
130-- reduction will work the right way.
131
131
132−%Reflection
132+%reflection
133−ReflectList : (G : List (List a)) ->
133+reflectList : (G : List (List a)) ->
134 (xs : List a) -> (G' ** Expr (G' ++ G) xs)
134 (xs : List a) -> (G' ** Expr (G' ++ G) xs)
135−ReflectList G [] = ([] ** ENil)
135+reflectList G [] = ([] ** ENil)
136
136
137−ReflectList G (x :: xs) with (ReflectList G xs)
137+reflectList G (x :: xs) with (reflectList G xs)
138 | (G' ** xs') with (isElem (List.(::) x []) (G' ++ G))
138 | (G' ** xs') with (isElem (List.(::) x []) (G' ++ G))
139 | Just p = (G' ** App (Var p) xs')
139 | Just p = (G' ** App (Var p) xs')
140 | Nothing = ([x] :: G' ** App (Var Stop) (weaken [[x]] xs'))
140 | Nothing = ([x] :: G' ** App (Var Stop) (weaken [[x]] xs'))
141
141
142−ReflectList G (xs ++ ys) with (ReflectList G xs)
142+reflectList G (xs ++ ys) with (reflectList G xs)
143− | (G' ** xs') with (ReflectList (G' ++ G) ys)
143+ | (G' ** xs') with (reflectList (G' ++ G) ys)
144 | (G'' ** ys') = ((G'' ++ G') **
144 | (G'' ** ys') = ((G'' ++ G') **
145 rewrite (sym (appendAssociative G'' G' G)) in
145 rewrite (sym (appendAssociative G'' G' G)) in
146 App (weaken G'' xs') ys')
146 App (weaken G'' xs') ys')
147−ReflectList G t with (isElem t G)
147+reflectList G t with (isElem t G)
148 | Just p = ([] ** Var p)
148 | Just p = ([] ** Var p)
149 | Nothing = ([t] ** Var Stop)
149 | Nothing = ([t] ** Var Stop)
150
150
151
151
152−-- Similarly, ReflectEq converts an equality proof on Lists into the ListEq
152+-- Similarly, reflectEq converts an equality proof on Lists into the ListEq
153−-- Reflection. Note that it isn't total, and we have to give the element type
153+-- reflection. Note that it isn't total, and we have to give the element type
154-- explicitly because it can't be inferred from P.
154-- explicitly because it can't be inferred from P.
155
155
156−-- This is not really a problem - we'll want different Reflections for different
156+-- This is not really a problem - we'll want different reflections for different
157-- forms of equality proofs anyway.
157-- forms of equality proofs anyway.
158
158
159−%Reflection
159+%reflection
160−ReflectEq : (a : Type) -> (G : List (List a)) -> (P : Type) -> (G' ** ListEq (G' ++ G) P)
160+reflectEq : (a : Type) -> (G : List (List a)) -> (P : Type) -> (G' ** ListEq (G' ++ G) P)
161−ReflectEq a G (the (List a) xs = the (List a) ys) with (ReflectList G xs)
161+reflectEq a G (the (List a) xs = the (List a) ys) with (reflectList G xs)
162− | (G' ** xs') with (ReflectList (G' ++ G) ys)
162+ | (G' ** xs') with (reflectList (G' ++ G) ys)
163 | (G'' ** ys') = ((G'' ++ G') **
163 | (G'' ** ys') = ((G'' ++ G') **
164 rewrite (sym (appendAssociative G'' G' G)) in
164 rewrite (sym (appendAssociative G'' G' G)) in
165 EqP (weaken G'' xs') ys')
165 EqP (weaken G'' xs') ys')
@@ -196,14 +196,14 @@ Reflect.bp1 = proof {
196
196
197-- "quoteGoal x by p in e" does some magic
197-- "quoteGoal x by p in e" does some magic
198-- The effect is to bind x to p applied to the current goal. If 'p' is a
198-- The effect is to bind x to p applied to the current goal. If 'p' is a
199−-- Reflection function (which is the most likely thing to be useful...)
199+-- reflection function (which is the most likely thing to be useful...)
200-- then we can feed the result to the above 'prove' function and pull out
200-- then we can feed the result to the above 'prove' function and pull out
201-- the proof, if it exists.
201-- the proof, if it exists.
202
202
203-- The syntax declaration below just gives us an easy way to invoke the
203-- The syntax declaration below just gives us an easy way to invoke the
204-- prover.
204-- prover.
205
205
206−syntax AssocProof [ty] = quoteGoal x by ReflectEq ty [] in
206+syntax AssocProof [ty] = quoteGoal x by reflectEq ty [] in
207 getJust (prove (getProof x)) ItIsJust
207 getJust (prove (getProof x)) ItIsJust
208
208
209
209
test/reg009/reg009.lidr+6−6
@@ -4,15 +4,15 @@
4
4
5> filterTagP : (p : alpha -> Bool) ->
5> filterTagP : (p : alpha -> Bool) ->
6> (as : Vect n alpha) ->
6> (as : Vect n alpha) ->
7−> so (isAnyBy p (n ** as)) ->
7+> So (isAnyBy p (n ** as)) ->
8−> (m : Nat ** (Vect m (a : alpha ** so (p a)), so (m > Z)))
8+> (m : Nat ** (Vect m (a : alpha ** So (p a)), So (m > Z)))
9> filterTagP {n = S m} p (a :: as) q with (p a)
9> filterTagP {n = S m} p (a :: as) q with (p a)
10> | True = (_
10> | True = (_
11> **
11> **
12−> ((a ** believe_me oh)
12+> ((a ** believe_me Oh)
13> ::
13> ::
14−> (fst (getProof (filterTagP p as (believe_me oh)))),
14+> (fst (getProof (filterTagP p as (believe_me Oh)))),
15−> oh
15+> Oh
16> )
16> )
17> )
17> )
18−> | False = filterTagP p as (believe_me oh)
18+> | False = filterTagP p as (believe_me Oh)
test/reg012/reg012.lidr+10−10
@@ -1,21 +1,21 @@
1−> total soElim : (C : (b : Bool) -> so b -> Type) ->
1+> total soElim : (C : (b : Bool) -> So b -> Type) ->
2−> C True oh ->
2+> C True Oh ->
3−> (b : Bool) -> (s : so b) -> (C b s)
3+> (b : Bool) -> (s : So b) -> (C b s)
4−> soElim C coh .True .oh = coh
4+> soElim C coh .True .Oh = coh
5
5
6−> soFalseElim : so False -> a
6+> soFalseElim : So False -> a
7> soFalseElim x = FalseElim (soElim C () False x)
7> soFalseElim x = FalseElim (soElim C () False x)
8> where
8> where
9−> C : (b : Bool) -> so b -> Type
9+> C : (b : Bool) -> So b -> Type
10> C True s = ()
10> C True s = ()
11> C False s = _|_
11> C False s = _|_
12
12
13−> soTrue : so b -> b = True
13+> soTrue : So b -> b = True
14> soTrue {b = False} x = soFalseElim x
14> soTrue {b = False} x = soFalseElim x
15> soTrue {b = True} x = Refl
15> soTrue {b = True} x = Refl
16
16
17> class Eq alpha => ReflEqEq alpha where
17> class Eq alpha => ReflEqEq alpha where
18−> Reflexive_eqeq : (a : alpha) -> so (a == a)
18+> reflexive_eqeq : (a : alpha) -> So (a == a)
19
19
20> modifyFun : (Eq alpha) =>
20> modifyFun : (Eq alpha) =>
21> (alpha -> beta) ->
21> (alpha -> beta) ->
@@ -28,7 +28,7 @@
28> (ab : (alpha, beta)) ->
28> (ab : (alpha, beta)) ->
29> modifyFun f ab (fst ab) = snd ab
29> modifyFun f ab (fst ab) = snd ab
30> modifyFunLemma f (a,b) =
30> modifyFunLemma f (a,b) =
31−> rewrite soTrue (Reflexive_eqeq a) in Refl
31+> rewrite soTrue (reflexive_eqeq a) in Refl
32
32
33 replace {P = \ z => boolElim (a == a) b (f a) = boolElim z b (f a)}
33 replace {P = \ z => boolElim (a == a) b (f a) = boolElim z b (f a)}
34− (soTrue (Reflexive_eqeq a)) Refl
34+ (soTrue (reflexive_eqeq a)) Refl
test/reg026/reg026.idr+1−1
@@ -1,7 +1,7 @@
1module Test
1module Test
2
2
3X : Nat -> Type
3X : Nat -> Type
4−X t = (c : Nat ** so (c < 5))
4+X t = (c : Nat ** So (c < 5))
5
5
6column : X t -> Nat
6column : X t -> Nat
7column = getWitness
7column = getWitness
test/reg035/reg035a.lidr+7−7
@@ -6,9 +6,9 @@
6> (q : beta -> Bool) ->
6> (q : beta -> Bool) ->
7> (a : alpha) ->
7> (a : alpha) ->
8> (b : beta) ->
8> (b : beta) ->
9−> so (p a) ->
9+> So (p a) ->
10−> so (q b) ->
10+> So (q b) ->
11−> so (p a && q b)
11+> So (p a && q b)
12
12
13> hasNoDuplicates : (Eq alpha) => List alpha -> Bool
13> hasNoDuplicates : (Eq alpha) => List alpha -> Bool
14> hasNoDuplicates as = as == nub as
14> hasNoDuplicates as = as == nub as
@@ -33,7 +33,7 @@
33
33
34> postulate reflexive_Set_eqeq : (Eq a) =>
34> postulate reflexive_Set_eqeq : (Eq a) =>
35> (as : Set a) ->
35> (as : Set a) ->
36−> so (as == as)
36+> So (as == as)
37
37
38> unwrap : Set a -> List a
38> unwrap : Set a -> List a
39> unwrap (setify as) = as
39> unwrap (setify as) = as
@@ -53,14 +53,14 @@
53
53
54> partitionLemma0 : (Eq alpha) =>
54> partitionLemma0 : (Eq alpha) =>
55> (ass : Set (Set alpha)) ->
55> (ass : Set (Set alpha)) ->
56−> so (arePairwiseDisjoint ass) ->
56+> So (arePairwiseDisjoint ass) ->
57−> so (ass `isPartition` union ass)
57+> So (ass `isPartition` union ass)
58> partitionLemma0 ass asspd = (soAndIntro (\ xss => arePairwiseDisjoint xss)
58> partitionLemma0 ass asspd = (soAndIntro (\ xss => arePairwiseDisjoint xss)
59> (\ xs => union ass == xs)
59> (\ xs => union ass == xs)
60> ass
60> ass
61> (union ass)
61> (union ass)
62> asspd
62> asspd
63> uasseqas) where
63> uasseqas) where
64−> uasseqas : so (union ass == union ass)
64+> uasseqas : So (union ass == union ass)
65> uasseqas = reflexive_Set_eqeq (union ass)
65> uasseqas = reflexive_Set_eqeq (union ass)
66
66
test/reg047/reg047.idr+3−3
@@ -8,11 +8,11 @@ data Nat = zero | succ Nat
8Id : (A : Type) -> A -> A -> Type
8Id : (A : Type) -> A -> A -> Type
9Id A = (=) {a0 = A} {b0 = A}
9Id A = (=) {a0 = A} {b0 = A}
10
10
11−Refl : (A : Type) -> (a : A) -> Id A a a
11+IdRefl : (A : Type) -> (a : A) -> Id A a a
12−Refl A a = Refl {a}
12+IdRefl A a = Refl {a}
13
13
14zzz : Id Nat zero zero
14zzz : Id Nat zero zero
15−zzz = Refl Nat zero
15+zzz = IdRefl Nat zero
16
16
17eep : TTSigma Nat (\ a => Id Nat a zero)
17eep : TTSigma Nat (\ a => Id Nat a zero)
18eep = sigma Nat (\ a => Id Nat a zero) zero zzz
18eep = sigma Nat (\ a => Id Nat a zero) zero zzz
test/reg047/reg047a.idr+4−4
@@ -8,17 +8,17 @@ data MNat = zero | succ MNat
8Id : (A : Type) -> A -> A -> Type
8Id : (A : Type) -> A -> A -> Type
9Id = \A,x,y => x = y -- {a = A} {b = A}
9Id = \A,x,y => x = y -- {a = A} {b = A}
10
10
11−Refl : (A : Type) -> (a : A) -> Id A a a
11+IdRefl : (A : Type) -> (a : A) -> Id A a a
12−Refl A a = Refl {a}
12+IdRefl A a = Refl {a}
13
13
14zzzz : Id MNat zero zero
14zzzz : Id MNat zero zero
15−zzzz = Refl MNat zero
15+zzzz = IdRefl MNat zero
16
16
17eep : TTSigma MNat (\ c => Id MNat c zero)
17eep : TTSigma MNat (\ c => Id MNat c zero)
18eep = (sigma MNat (\b => Id MNat b zero) zero zzzz)
18eep = (sigma MNat (\b => Id MNat b zero) zero zzzz)
19
19
20eep2 : TTSigma MNat (\ c => Id MNat c zero)
20eep2 : TTSigma MNat (\ c => Id MNat c zero)
21−eep2 = (sigma MNat (\b => Id MNat b zero) zero (Refl MNat zero))
21+eep2 = (sigma MNat (\b => Id MNat b zero) zero (IdRefl MNat zero))
22
22
23
23
24
24
test/totality006/expected+1−1
@@ -1,2 +1,2 @@
1totality006.idr:6:1:Main.prf is not total as there are missing cases
1totality006.idr:6:1:Main.prf is not total as there are missing cases
2−totality006a.idr:9:6:prf' (S _) (S _) oh is a valid case
2+totality006a.idr:9:6:prf' (S _) (S _) Oh is a valid case
test/totality006/totality006.idr+5−5
@@ -1,11 +1,11 @@
1−antitrue : so False -> a
1+antitrue : So False -> a
2−antitrue oh impossible
2+antitrue Oh impossible
3
3
4total
4total
5−prf : (a:Nat) -> (b:Nat) -> so (a > b) -> GT a b
5+prf : (a:Nat) -> (b:Nat) -> So (a > b) -> GT a b
6−prf Z Z oh impossible
6+prf Z Z Oh impossible
7prf Z (S k) um = antitrue um
7prf Z (S k) um = antitrue um
8prf (S k) Z um = lteSucc lteZero
8prf (S k) Z um = lteSucc lteZero
9−-- prf (S _) (S _) oh impossible
9+-- prf (S _) (S _) Oh impossible
10
10
11
11
test/totality006/totality006a.idr+5−5
@@ -1,10 +1,10 @@
1−antitrue : so False -> a
1+antitrue : So False -> a
2−antitrue oh impossible
2+antitrue Oh impossible
3
3
4total
4total
5−prf' : (a:Nat) -> (b:Nat) -> so (a > b) -> GT a b
5+prf' : (a:Nat) -> (b:Nat) -> So (a > b) -> GT a b
6−prf' Z Z oh impossible
6+prf' Z Z Oh impossible
7prf' Z (S k) um = antitrue um
7prf' Z (S k) um = antitrue um
8prf' (S k) Z um = lteSucc lteZero
8prf' (S k) Z um = lteSucc lteZero
9−prf' (S _) (S _) oh impossible
9+prf' (S _) (S _) Oh impossible
10
10