forked from kino3/Mini-TT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example.agda
55 lines (42 loc) · 1.28 KB
/
Example.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module Example where
-- formalization of Mini-TT paper 6.3 in Agda
id : (A : Set) → A → A
id = λ A x → x
data Bool : Set where
true false : Bool
elimBool : (C : Bool → Set) → C false → C true → ((b : Bool) → C b)
elimBool C h0 h1 true = h1
elimBool C h0 h1 false = h0
-- fyi
if_then_else_ : {C : Bool → Set} → (b : Bool) → C true → C false → C b
if_then_else_ {C} b x y = elimBool C y x b
data Nat : Set where
zero : Nat
succ : Nat → Nat
data List (A : Set) : Set where
nil : List A
cons : A → List A → List A
natrec : (C : Nat → Set) → C zero → ((n : Nat) → C n → C (succ n)) → ((n : Nat) → C n)
natrec C a g zero = a
natrec C a g (succ n1) = g n1 (natrec C a g n1)
add : Nat → Nat → Nat
add x zero = x
add x (succ y1) = succ (add x y1)
eqNat : Nat → Nat → Bool
eqNat zero zero = true
eqNat zero (succ y) = false
eqNat (succ x) zero = false
eqNat (succ x) (succ y) = eqNat x y
open import Data.Product
ex : (Σ[ X ∈ Set ] (X → Set))
ex = V , T
where
mutual
data V : Set where
nat : V
pi : Σ[ x ∈ V ] (T x → V) → V
T : V → Set
T nat = Nat
T (pi (x , f)) = (y : T x) → T (f y)
hoge : V
hoge = pi (nat , (λ x → pi (nat , (λ y → {!!}))))