-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArrMp.agda
61 lines (41 loc) · 1.1 KB
/
ArrMp.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
56
57
58
59
60
61
-- Minimal implicational logic, PHOAS approach, initial encoding
module Pi.ArrMp where
-- Types
infixr 0 _=>_
data Ty : Set where
UNIT : Ty
_=>_ : Ty -> Ty -> Ty
-- Context and truth judgement
Cx : Set1
Cx = Ty -> Set
isTrue : Ty -> Cx -> Set
isTrue a tc = tc a
-- Terms
module ArrMp where
infixl 1 _$_
data Tm (tc : Cx) : Ty -> Set where
var : forall {a} -> isTrue a tc -> Tm tc a
lam' : forall {a b} -> (isTrue a tc -> Tm tc b) -> Tm tc (a => b)
_$_ : forall {a b} -> Tm tc (a => b) -> Tm tc a -> Tm tc b
lam'' : forall {tc a b} -> (Tm tc a -> Tm tc b) -> Tm tc (a => b)
lam'' f = lam' \x -> f (var x)
syntax lam'' (\a -> b) = lam a => b
Thm : Ty -> Set1
Thm a = forall {tc} -> Tm tc a
open ArrMp public
-- Example theorems
aI : forall {a} -> Thm (a => a)
aI =
lam x => x
aK : forall {a b} -> Thm (a => b => a)
aK =
lam x =>
lam _ => x
aS : forall {a b c} -> Thm ((a => b => c) => (a => b) => a => c)
aS =
lam f =>
lam g =>
lam x => f $ x $ (g $ x)
tSKK : forall {a} -> Thm (a => a)
tSKK {a = a} =
aS {b = a => a} $ aK $ aK