TLC Flashcards
Proof by induction for ∀n ∈ N. A
– When x = 0 … hence A is true of 0.
– When x = k + 1, assume A holds of k
… A is true of k + 1
Proof by induction for ∀R ∈ REGEXP. A
– When R = ε … hence A is true of ε
– When R = φ … hence A is true of φ
– When R = a … hence A is true of a
– When R is of shape (R1 + R2), assume A holds of R1 and R2 separately … A is true of (R1 + R2)
– When R is of shape (R1· R2), assume A holds of R1 and R2 separately … A is true of (R1 + R2)
– When R is of shape R∗1, assume A holds of R1… A is true of R∗1
Subterm of term M
Includes M itself and is any substring that is itself a term except the variable between lambda and the . if it does not occur outside this position
Parentheses:
MN
MNP
λx.MN
λxy.M
x y (pred y)
(MN)
((MN)P)
(λx.(MN))
(λx.(λy.M))
((x y) (pred y))
Free variables:
FV(x)
FV(c)
FV(PQ)
FV(λx.N)
{x}
φ
FV(P) U FV(Q)
FV(N) \ {x}
a-equivalence?
λx.x and λy.y
λxy.x and λyx.y
λx.xy and λx.xz
Yes
Yes
No
Redex/contraction pair example
pred Z/Z
Confluence
If M ->* P and M->* Q then there exists a term N such that P->* N and Q->* N
Unique normal forms
If M->* N and M->* P with N and P normal forms, then N=P
Fixed point and example
Term N is a fixed point of another term M just if MN≈N e.g. id n ≈ n
Inversion
Suppose Γ⊢M:A is derivable then:
* If M is a variable x, then it must be that x:A ∈ Γ
* If M is a constant c, then it must be that c:A ∈ C
* If M is an application PQ, then there is a type B such that Γ ⊢ P : B → A and Γ ⊢ Q : B
* If M is an abstraction λx. P, then there are types B and C such that A = B → C, and Γ , x : B ⊢ P : C
Proof involving AVB
Assume A is true for first case
Assume B is true for second case
Conclude with statement that holds in both cases
Subject reduction
If Γ ⊢ M:A and M ->* N then Γ ⊢N:A
Progess
If Γ ⊢M:A then either M is a value or there is some N such that M -> N
Well-typed programs
If ⊢ M:A then M does not go wrong