-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExamples.agda
67 lines (51 loc) · 1.32 KB
/
Examples.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
62
63
module Examples where
open import Relation.Binary.PropositionalEquality as Eq
open import Data.String hiding (show)
open import Data.Nat.Show
open import Data.List hiding (_++_)
open import Data.Nat as N
open import Data.Product
using (_,_)
renaming (proj₁ to fst ; proj₂ to snd)
open import Syntax
open import AssocList ℕ N._≟_ as AL
open import Unification
open import W
open import Print
--------------------------------------------------------------------------------
-- ε ⊢ λ x. x : ∀ α. α → α
id : Expr
id = `λ 0 (` 0)
empty : TypeAss
empty = ε
ty = 𝒲 empty id
S = fst ty
τ = snd ty
_ : print (mgt id) ≡ "∀ {b} (b → b)"
_ = refl
--------------------------------------------------------------------------------
-- Church naturals.
C0 : Expr
C0 = `λ 1 (`λ 0 (` 0))
_ : print (mgt C0) ≡ "∀ {b,c} (b → (c → c))"
_ = refl
C1 : Expr
C1 = `λ 1
(`λ 0
((` 1) · (` 0)))
_ : print (mgt C1) ≡ "∀ {c} ((c → c) → (c → c))"
_ = refl
--------------------------------------------------------------------------------
-- let polymorphic terms.
-- λ x. x
-- (let
-- f := λ x. x
-- In (f · (λ x. x)) (f tt))
M : String
M = print (mgt
(`λ 10
(` 10 ·
(Let
0 := (`λ 1 (` 1))
In
(((` 0) · (`λ 2 (` 2))) · ((` 0) · tt))))))