|
| ||
|
|
Start of topic | Skip to actions
Discussion of Next Topic
e \in \gamma \turn \dot : t iff
\gamma (x) = t ---------------- \gamma \turn x : t \gamma , x:t1 \turn e: t2 ---------------- \gamma \turn \lambda x.e : t1 -> t2 \gamma \turn e1 : t1 -> t2 \gamma \turn e2 : t1 ---------------- \gamma \turn e1 e2 : t2But we want to modify our BNF to simplify these rules. The modified BNF is:
n \in \mathbb{N}
e ::= #n | \lambda .e | e e | i
using static distance or De Bruijn naming.
Since variables are now defined by naturals, we can describe the case where e = #n using induction on the structure of the natural:
---------------- \gamma ,t \turn #0 : t \gamma \turn #(n) : t ---------------- \gamma ,t' \turn #(n+1) : tA trivial change needs to be made to the lambda case as well: \gamma ,t1 \turn e: t2 ---------------- \gamma \turn \lambda .e : t1 -> t2Now we can write the concoqtion type to represent this:
type (env, typ) term =
| TVarZero
let env':envType in
: (env' * typ, typ) term
| TVarPlus
let env':envType in
let t':typeType in
of (env, typ) term
: (env' * t', typ) term
| ...
Homework:
Topic Actions: Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
Webs: Main | TWiki | Africa | EmbeddedSystems | Gpce | Houston | International | K12 | MetaOCaml | MulticoreOCR | ProgrammingLanguages | RAP | RIDL | Sandbox | SpeechClub | Teaching | Texbot | WG211 Web Actions: | |
This work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.