Consistent import of DB

* Re-export test examples from Chapter DeBruijn in Chapter More.

  * In Chapter Inference, as well as Assignment 4, import the
    instrinsically-typed λ-calculus as follows:
      `import plfa.part2.More as DB`
This commit is contained in:
Orestis Melkonian 2019-10-28 17:20:44 +00:00
parent c0d9e7851e
commit eb3a727606
3 changed files with 31 additions and 2 deletions

View file

@ -449,7 +449,7 @@ _ = ƛ ƛ (# 1 · (# 1 · # 0))
```
### Test examples
### Test examples {#examples}
We repeat the test examples from
Chapter [Lambda]({{ site.baseurl }}/Lambda/).

View file

@ -263,7 +263,7 @@ can compare with our previous development, we import
module `plfa.part2.DeBruijn`:
```
import plfa.part2.DeBruijn as DB
import plfa.part2.More as DB
```
The phrase `as DB` allows us to refer to definitions

View file

@ -1232,6 +1232,35 @@ Note the arguments need to be swapped and `W` needs to have
its context adjusted via renaming in order for the right-hand
side to be well typed.
## Test examples
We repeat the [test examples]({{ site.baseurl }}/DeBruijn/#examples) from Chapter [DeBruijn]({{ site.baseurl }}/DeBruijn),
in order to make sure we have not broken anything in the process of extending our base calculus.
```
two : ∀ {Γ} → Γ ⊢ `
two = `suc `suc `zero
plus : ∀ {Γ} → Γ ⊢ ` ⇒ ` ⇒ `
plus = μ ƛ ƛ (case (# 1) (# 0) (`suc (# 3 · # 0 · # 1)))
2+2 : ∀ {Γ} → Γ ⊢ `
2+2 = plus · two · two
Ch : Type → Type
Ch A = (A ⇒ A) ⇒ A ⇒ A
twoᶜ : ∀ {Γ A} → Γ ⊢ Ch A
twoᶜ = ƛ ƛ (# 1 · (# 1 · # 0))
plusᶜ : ∀ {Γ A} → Γ ⊢ Ch A ⇒ Ch A ⇒ Ch A
plusᶜ = ƛ ƛ ƛ ƛ (# 3 · # 1 · (# 2 · # 1 · # 0))
sucᶜ : ∀ {Γ} → Γ ⊢ ` ⇒ `
sucᶜ = ƛ `suc (# 0)
2+2ᶜ : ∀ {Γ} → Γ ⊢ `
2+2ᶜ = plusᶜ · twoᶜ · twoᶜ · sucᶜ · `zero
```
## Unicode