-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ new ] Quantity for proof in with-clauses
- Loading branch information
Showing
14 changed files
with
72 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,7 @@ Timmy Jose | |
Tim Süberkrüb | ||
Tom Harley | ||
troiganto | ||
Viktor Yudov | ||
Wen Kokke | ||
Wind Wong | ||
Zoe Stafford | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module WithProof0 | ||
|
||
%default total | ||
|
||
%hide List.filter | ||
|
||
filter : (p : a -> Bool) -> (xs : List a) -> List a | ||
filter p [] = [] | ||
filter p (x :: xs) with (p x) | ||
filter p (x :: xs) | False = filter p xs | ||
filter p (x :: xs) | True = x :: filter p xs | ||
|
||
|
||
filterSquared : (p : a -> Bool) -> (xs : List a) -> | ||
filter p (filter p xs) === filter p xs | ||
filterSquared p [] = Refl | ||
filterSquared p (x :: xs) with (p x) proof 0 eq | ||
filterSquared p (x :: xs) | False = filterSquared p xs -- easy | ||
filterSquared p (x :: xs) | True | ||
= rewrite eq in cong (x ::) (filterSquared p xs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module WithProof1 | ||
|
||
%default total | ||
|
||
%hide List.filter | ||
|
||
filter : (p : a -> Bool) -> (xs : List a) -> List a | ||
filter p [] = [] | ||
filter p (x :: xs) with (p x) | ||
filter p (x :: xs) | False = filter p xs | ||
filter p (x :: xs) | True = x :: filter p xs | ||
|
||
consumeEq : (1 _ : x === y) -> () | ||
consumeEq Refl = () | ||
|
||
filterSquared : (p : a -> Bool) -> (xs : List a) -> | ||
filter p (filter p xs) === filter p xs | ||
filterSquared p [] = Refl | ||
filterSquared p (x :: xs) with (p x) proof 1 eq | ||
filterSquared p (x :: xs) | False = case consumeEq eq of | ||
() => filterSquared p xs | ||
filterSquared p (x :: xs) | True = case consumeEq eq of | ||
() => rewrite eq in cong (x ::) (filterSquared p xs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1/1: Building WithProof0 (WithProof0.idr) | ||
1/1: Building WithProof1 (WithProof1.idr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
. ../../../testutils.sh | ||
|
||
check WithProof0.idr | ||
check WithProof1.idr |