Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some lib changes. Added basics.tt, fin.tt, pattern matching in lt.tt
darcs-hash:20070214010022-974a0-91b3647be1d8765a7e1ab24a311ba50a8831738a.gz
- Loading branch information
eb
committed
Feb 14, 2007
1 parent
9b5a1e4
commit eaddcae
Showing
5 changed files
with
61 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- Some generally useful definitions | ||
-- Heterogeneous equality, nats, maybe, bools, lists. | ||
|
||
Load "eq.tt"; | ||
Load "nat.tt"; | ||
|
||
Data Maybe (A:*) : * | ||
= nothing : Maybe A | ||
| just : (a:A)(Maybe A); | ||
|
||
Data Bool : * = true : Bool | false : Bool; | ||
|
||
Data List (A:*) : * | ||
= nil : List A | ||
| cons : (x:A)->(xs:List A)->(List A); |
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,15 @@ | ||
Load "basics.tt"; | ||
Load "lt.tt"; | ||
|
||
Data Fin : (n:Nat)* | ||
= fz : (k:Nat)(Fin (S k)) | ||
| fs : (k:Nat)(i:Fin k)(Fin (S k)); | ||
|
||
Match weaken : (n:Nat)(i:Fin n)->(Fin (S n)) = | ||
weaken _ (fz _) = fz _ | ||
| weaken _ (fs _ i) = fs _ (weaken _ i); | ||
|
||
Match fin2Nat : (n:Nat)(i:Fin n)->Nat = | ||
fin2Nat _ (fz _) = O | ||
| fin2Nat _ (fs _ i) = S (fin2Nat _ i); | ||
|
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