Skip to content

Commit c407589

Browse files
committed
[ test ] Add failing tests for quantities of proofs
1 parent ae9a9a0 commit c407589

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module WithProof0Fail
2+
3+
%default total
4+
5+
%hide List.filter
6+
7+
data So : Bool -> Type where
8+
Oh : So True
9+
10+
eqToSo : b = True -> So b
11+
eqToSo Refl = Oh
12+
13+
data All : (0 p : a -> Type) -> List a -> Type where
14+
Nil : All p Nil
15+
(::) : {0 xs : List a} -> p x -> All p xs -> All p (x :: xs)
16+
17+
filter : (p : a -> Bool) -> (xs : List a) -> List a
18+
filter p [] = []
19+
filter p (x :: xs) with (p x)
20+
filter p (x :: xs) | False = filter p xs
21+
filter p (x :: xs) | True = x :: filter p xs
22+
23+
failing "While processing right hand side of with block in allFilter. prf is not accessible in this context"
24+
allFilter : (p : a -> Bool) -> (xs : List a) -> All (So . p) (filter p xs)
25+
allFilter p [] = []
26+
allFilter p (x :: xs) with (p x) proof 0 prf
27+
allFilter p (x :: xs) | False = allFilter p xs
28+
allFilter p (x :: xs) | True = eqToSo prf :: allFilter p xs
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module WithProof1Fail
2+
3+
%default total
4+
5+
%hide List.filter
6+
7+
filter : (p : a -> Bool) -> (xs : List a) -> List a
8+
filter p [] = []
9+
filter p (x :: xs) with (p x)
10+
filter p (x :: xs) | False = filter p xs
11+
filter p (x :: xs) | True = x :: filter p xs
12+
13+
failing "While processing right hand side of with block in filterSquared. There are 0 uses of linear name eq"
14+
filterSquared : (p : a -> Bool) -> (xs : List a) ->
15+
filter p (filter p xs) === filter p xs
16+
filterSquared p [] = Refl
17+
filterSquared p (x :: xs) with (p x) proof 1 eq
18+
filterSquared p (x :: xs) | False = filterSquared p xs
19+
filterSquared p (x :: xs) | True = filterSquared p xs

0 commit comments

Comments
 (0)