-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c5c373
commit 21106d4
Showing
6 changed files
with
84 additions
and
6 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 @@ | ||
data Bool : U where | ||
| true : ... | ||
| false : ... | ||
|
||
fun not (_ : Bool) : Bool | ||
| true = false | ||
| false = true | ||
|
||
fun and (_ _ : Bool) : Bool | ||
| true true = true | ||
| _ _ = false | ||
|
||
fun or (_ _ : Bool) : Bool | ||
| false false = false | ||
| _ _ = true |
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 @@ | ||
#load "Nat.shitt" | ||
#load "Bool.shitt" | ||
|
||
data Exp : (_ : U) -> U where | ||
| nat : (_ : N) -> ... N | ||
| bool : (_ : Bool) -> ... Bool | ||
| andF : ... (Bool -> Bool -> Bool) | ||
| notF : ... (Bool -> Bool) | ||
| addF : ... (N -> N -> N) | ||
| app : {a b : U} (f : Exp (a -> b)) (arg : Exp a) -> ... b | ||
|
||
axiom partial fun sorry {A: U} : A | ||
|
||
fun eval {A: U} (e : Exp A) : A | ||
| nat x = x | ||
| bool b = b | ||
| andF = and | ||
| notF = not | ||
| addF = add | ||
| app f x = eval f (eval x) |
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,11 @@ | ||
data Id {A : U} : (x y : A) -> U where | ||
| refl : (t : A) -> ... t t | ||
|
||
fun sym {A : U} {x y : A} (p : Id x y) : Id y x where | ||
| (refl _) = refl _ | ||
|
||
fun trans {A : U} {x y z : A} (_ : Id x y) (_ : Id y z) : Id x z where | ||
| (refl _) (refl _) = refl _ | ||
|
||
fun cong {A B : U} {x y : A} (f : A -> B) (p : Id x y) : Id (f x) (f y) where | ||
| f (refl _) = refl _ |
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,25 @@ | ||
#load "Id.shitt" | ||
|
||
data N : U where | ||
| zero : ... | ||
| succ : (pre : N) -> ... | ||
|
||
fun add (m n : N) : N where | ||
| zero n = n | ||
| (succ m) n = succ (add m n) | ||
|
||
fun addAssoc (x y z : N) : Id (add (add x y) z) (add x (add y z)) where | ||
| zero y z = refl _ | ||
| (succ x) y z = cong succ (addAssoc x y z) | ||
|
||
fun addIdR (x : N) : Id (add x zero) x where | ||
| zero = refl _ | ||
| (succ x) = cong succ (addIdR x) | ||
|
||
fun addSucc (x y : N) : Id (add (succ x) y) (add x (succ y)) where | ||
| zero y = refl _ | ||
| (succ x) y = cong succ (addSucc x y) | ||
|
||
fun addComm (x y : N) : Id (add x y) (add y x) where | ||
| zero y = sym (addIdR _) | ||
| (succ x) y = trans (cong succ (addComm x y)) (addSucc y x) |
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