Exercises on -calculus and Deduction Systems Akim Demaille - - PowerPoint PPT Presentation
Exercises on -calculus and Deduction Systems Akim Demaille - - PowerPoint PPT Presentation
Exercises on -calculus and Deduction Systems Akim Demaille akim@lrde.epita.fr EPITA cole Pour lInformatique et les Techniques Avances June 10, 2016 Exercises on -calculus and Deduction Systems 1 -calculus Deduction Systems 2
Exercises on λ-calculus and Deduction Systems
1
λ-calculus
2
Deduction Systems
- A. Demaille
Exercises on λ-calculus and Deduction Systems 2 / 27
λ-calculus
1
λ-calculus Untyped λ-calculus Simply Typed λ-calculus
2
Deduction Systems
- A. Demaille
Exercises on λ-calculus and Deduction Systems 3 / 27
Untyped λ-calculus
1
λ-calculus Untyped λ-calculus Simply Typed λ-calculus
2
Deduction Systems
- A. Demaille
Exercises on λ-calculus and Deduction Systems 4 / 27
Substitutions
[λz · zz/x]λy · xy ≡
- A. Demaille
Exercises on λ-calculus and Deduction Systems 5 / 27
Substitutions
[λz · zz/x]λy · xy ≡ λy · (λz · zz)y [yy/z](λxy · zy) ≡
- A. Demaille
Exercises on λ-calculus and Deduction Systems 5 / 27
Substitutions
[λz · zz/x]λy · xy ≡ λy · (λz · zz)y [yy/z](λxy · zy) ≡ λxu · yyu
- A. Demaille
Exercises on λ-calculus and Deduction Systems 5 / 27
β-Reductions
(λx · xyx)λz · z →
- A. Demaille
Exercises on λ-calculus and Deduction Systems 6 / 27
β-Reductions
(λx · xyx)λz · z → (λz · z)y(λz · z) (λx · x)((λy · y)x) →
- A. Demaille
Exercises on λ-calculus and Deduction Systems 6 / 27
β-Reductions
(λx · xyx)λz · z → (λz · z)y(λz · z) (λx · x)((λy · y)x) → (λx · x)(x) (λx · x)((λy · y)x) →
- A. Demaille
Exercises on λ-calculus and Deduction Systems 6 / 27
β-Reductions
(λx · xyx)λz · z → (λz · z)y(λz · z) (λx · x)((λy · y)x) → (λx · x)(x) (λx · x)((λy · y)x) → ((λy · y)x) (λx · x)((λy · y)x)
∗
→
- A. Demaille
Exercises on λ-calculus and Deduction Systems 6 / 27
β-Reductions
(λx · xyx)λz · z → (λz · z)y(λz · z) (λx · x)((λy · y)x) → (λx · x)(x) (λx · x)((λy · y)x) → ((λy · y)x) (λx · x)((λy · y)x)
∗
→ x (λx · xx)((λx · xx)y)
∗
→
- A. Demaille
Exercises on λ-calculus and Deduction Systems 6 / 27
β-Reductions
(λx · xyx)λz · z → (λz · z)y(λz · z) (λx · x)((λy · y)x) → (λx · x)(x) (λx · x)((λy · y)x) → ((λy · y)x) (λx · x)((λy · y)x)
∗
→ x (λx · xx)((λx · xx)y)
∗
→ yy(yy) (λx · xx)((λx · x)y)
∗
→
- A. Demaille
Exercises on λ-calculus and Deduction Systems 6 / 27
β-Reductions
(λx · xyx)λz · z → (λz · z)y(λz · z) (λx · x)((λy · y)x) → (λx · x)(x) (λx · x)((λy · y)x) → ((λy · y)x) (λx · x)((λy · y)x)
∗
→ x (λx · xx)((λx · xx)y)
∗
→ yy(yy) (λx · xx)((λx · x)y)
∗
→ yy (λx · x)((λx · xx)y)
∗
→
- A. Demaille
Exercises on λ-calculus and Deduction Systems 6 / 27
β-Reductions
(λx · xyx)λz · z → (λz · z)y(λz · z) (λx · x)((λy · y)x) → (λx · x)(x) (λx · x)((λy · y)x) → ((λy · y)x) (λx · x)((λy · y)x)
∗
→ x (λx · xx)((λx · xx)y)
∗
→ yy(yy) (λx · xx)((λx · x)y)
∗
→ yy (λx · x)((λx · xx)y)
∗
→ yy
- A. Demaille
Exercises on λ-calculus and Deduction Systems 6 / 27
Simply Typed λ-calculus
1
λ-calculus Untyped λ-calculus Simply Typed λ-calculus
2
Deduction Systems
- A. Demaille
Exercises on λ-calculus and Deduction Systems 7 / 27
Simply Typed λ-calculus
Type derivations are trees built from the following nodes. M : σ → τ N : σ MN : τ
- A. Demaille
Exercises on λ-calculus and Deduction Systems 8 / 27
Simply Typed λ-calculus
Type derivations are trees built from the following nodes. M : σ → τ N : σ MN : τ x : σ · · · M : τ
- A. Demaille
Exercises on λ-calculus and Deduction Systems 8 / 27
Simply Typed λ-calculus
Type derivations are trees built from the following nodes. M : σ → τ N : σ MN : τ [x : σ] · · · M : τ λx · M : σ → τ
- A. Demaille
Exercises on λ-calculus and Deduction Systems 8 / 27
Type Statements
Type λfx · f (fx)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 9 / 27
Type Statements
Type λfx · f (fx)
⊢ λfx · f (fx) : (σ → σ) → σ → σ
- A. Demaille
Exercises on λ-calculus and Deduction Systems 9 / 27
Type Statements
Type λfx · f (fx)
⊢ λfx · f (fx) : (σ → σ) → σ → σ [f : σ → σ](2) [f : σ → σ](2) [x : σ](1) fx : σ f (fx) : σ (1) λx · f (fx) : σ → σ (2) λfx · f (fx) : (σ → σ) → σ → σ
- A. Demaille
Exercises on λ-calculus and Deduction Systems 9 / 27
Type Statements
Type λxy · x
- A. Demaille
Exercises on λ-calculus and Deduction Systems 10 / 27
Type Statements
Type λxy · x
⊢ λxy · x : σ → τ → σ
- A. Demaille
Exercises on λ-calculus and Deduction Systems 10 / 27
Type Statements
Type λxy · x
⊢ λxy · x : σ → τ → σ [x : σ](1) λy · x : τ → σ (1) λxy · x : σ → τ → σ
- A. Demaille
Exercises on λ-calculus and Deduction Systems 10 / 27
Deduction Systems
1
λ-calculus
2
Deduction Systems Natural Deduction Sequent Calculus
- A. Demaille
Exercises on λ-calculus and Deduction Systems 11 / 27
Natural Deduction
1
λ-calculus
2
Deduction Systems Natural Deduction Sequent Calculus
- A. Demaille
Exercises on λ-calculus and Deduction Systems 12 / 27
Intuitionistic Natural Deduction
[A] · · · B ⇒I A ⇒ B A A ⇒ B ⇒E B ⊥ ⊥E A ¬A := A ⇒ ⊥ A B ∧I A ∧ B A ∧ B ∧lE A A ∧ B ∧rE B A ∨lI A ∨ B B ∨rI A ∨ B A ∨ B [A] · · · C [B] · · · C ∨E C
- A. Demaille
Exercises on λ-calculus and Deduction Systems 13 / 27
Prove A ∧ B ⇒ B ∧ A
- A. Demaille
Exercises on λ-calculus and Deduction Systems 14 / 27
Prove A ∧ B ⇒ B ∧ A
[A ∧ B]1 ∧rE B [A ∧ B]1 ∧lE A ∧I B ∧ A ⇒I1 A ∧ B ⇒ B ∧ A
- A. Demaille
Exercises on λ-calculus and Deduction Systems 14 / 27
Prove A ∧ (B ∨ C) ⊢ (A ∧ B) ∨ (A ∧ C)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 15 / 27
Prove A ∧ (B ∨ C) ⊢ (A ∧ B) ∨ (A ∧ C)
A ∧ (B ∨ C) ∧rE B ∨ C A ∧ (B ∨ C) ∧lE A [B]1 ∧I A ∧ B ∨lI (A ∧ B) ∨ (A ∧ C) A ∧ (B ∨ C) ∧lE A [C]1 ∧I A ∧ C ∨rI (A ∧ B) ∨ (A ∧ C)
∨E1 (A ∧ B) ∨ (A ∧ C)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 15 / 27
Prove (A ⇒ A) ⇒ A ⇒ A (LOFO-2005)
Remember, ⇒ is right-associative.
- A. Demaille
Exercises on λ-calculus and Deduction Systems 16 / 27
Prove (A ⇒ A) ⇒ A ⇒ A (LOFO-2005)
Remember, ⇒ is right-associative. [A]2 [A ⇒ A]1 ⇒E A ⇒I2 A ⇒ A ⇒I1 (A ⇒ A) ⇒ A ⇒ A
- A. Demaille
Exercises on λ-calculus and Deduction Systems 16 / 27
Prove (A ⇒ A) ⇒ A ⇒ A (LOFO-2005)
Remember, ⇒ is right-associative. [A]2 [A ⇒ A]1 ⇒E A ⇒I2 A ⇒ A ⇒I1 (A ⇒ A) ⇒ A ⇒ A [A]1 ⇒I1 A ⇒ A ⇒I (A ⇒ A) ⇒ A ⇒ A
- A. Demaille
Exercises on λ-calculus and Deduction Systems 16 / 27
Prove (A ⇒ A) ⇒ A ⇒ A (LOFO-2005)
Remember, ⇒ is right-associative. [A]2 [A ⇒ A]1 ⇒E A ⇒I2 A ⇒ A ⇒I1 (A ⇒ A) ⇒ A ⇒ A [A]1 ⇒I1 A ⇒ A ⇒I (A ⇒ A) ⇒ A ⇒ A [A ⇒ A]1 ⇒I1 (A ⇒ A) ⇒ A ⇒ A
- A. Demaille
Exercises on λ-calculus and Deduction Systems 16 / 27
Prove A ⇒ B, B ⇒ C ⊢ A ⇒ (B ∧ C) (LOFO-2005)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 17 / 27
Prove A ⇒ B, B ⇒ C ⊢ A ⇒ (B ∧ C) (LOFO-2005)
[A]1 A ⇒ B ⇒E B [A]1 A ⇒ B ⇒E B B ⇒ C ⇒E C ∧I B ∧ C ⇒I1 A ⇒ (B ∧ C)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 17 / 27
Prove A ∨ B, ¬B ⊢ A (Intuitionistic) (LOFO-2005)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 18 / 27
Prove A ∨ B, ¬B ⊢ A (Intuitionistic) (LOFO-2005)
Recall that ¬B := B ⇒ ⊥.
- A. Demaille
Exercises on λ-calculus and Deduction Systems 18 / 27
Prove A ∨ B, ¬B ⊢ A (Intuitionistic) (LOFO-2005)
Recall that ¬B := B ⇒ ⊥. A ∨ B [A]1 [B]1 B ⇒ ⊥ ⇒E ⊥ ⊥E A ∨E1 A
- A. Demaille
Exercises on λ-calculus and Deduction Systems 18 / 27
Sequent Calculus
1
λ-calculus
2
Deduction Systems Natural Deduction Sequent Calculus
- A. Demaille
Exercises on λ-calculus and Deduction Systems 19 / 27
Classical Sequent Calculus
Γ ⊢ ∆ ⊢X Γ ⊢ τ(∆) Γ ⊢ ∆ X⊢ σ(Γ) ⊢ ∆ Γ ⊢ ∆ ⊢W Γ ⊢ A, ∆ Γ ⊢ ∆ W⊢ Γ, A ⊢ ∆ Γ ⊢ A, A, ∆ ⊢C Γ ⊢ A, ∆ Γ, A, A ⊢ ∆ C⊢ Γ, A ⊢ ∆ Id F ⊢ F Γ ⊢ A, ∆ Γ′, A ⊢ ∆′ Cut Γ, Γ′ ⊢ ∆, ∆′ Γ, A ⊢ ∆ ⊢¬ Γ ⊢ ¬A, ∆ Γ ⊢ A, ∆ ¬⊢ Γ, ¬A ⊢ ∆ Γ ⊢ A, ∆ Γ ⊢ B, ∆ ⊢∧ Γ ⊢ A ∧ B, ∆ Γ, A ⊢ ∆ l∧⊢ Γ, A ∧ B ⊢ ∆ Γ, B ⊢ ∆ r∧⊢ Γ, A ∧ B ⊢ ∆ Γ ⊢ A, ∆ ⊢l∨ Γ ⊢ A ∨ B, ∆ Γ ⊢ B, ∆ ⊢r∨ Γ ⊢ A ∨ B, ∆ Γ, A ⊢ ∆ Γ, B ⊢ ∆ ∨⊢ Γ, A ∨ B ⊢ ∆ Γ ⊢ ∆, A Γ′, B ⊢ ∆′ ⇒ ⊢ Γ, Γ′, A ⇒ B ⊢ ∆, ∆′ Γ, A ⊢ B, ∆ ⊢ ⇒ Γ ⊢ A ⇒ B, ∆
Prove A ∧ B ⊢ A ∧ B
- A. Demaille
Exercises on λ-calculus and Deduction Systems 21 / 27
Prove A ∧ B ⊢ A ∧ B
A ⊢ A l∧⊢ A ∧ B ⊢ A B ⊢ B r∧⊢ A ∧ B ⊢ B ⊢∧ A ∧ B ⊢ A ∧ B
- A. Demaille
Exercises on λ-calculus and Deduction Systems 21 / 27
Prove A ∧ B ⊢ A ∨ B
- A. Demaille
Exercises on λ-calculus and Deduction Systems 22 / 27
Prove A ∧ B ⊢ A ∨ B
A ⊢ A l∧⊢ A ∧ B ⊢ A ⊢r∨ A ∧ B ⊢ A ∨ B
- A. Demaille
Exercises on λ-calculus and Deduction Systems 22 / 27
Prove A ∨ B ⊢ A ∨ B
- A. Demaille
Exercises on λ-calculus and Deduction Systems 23 / 27
Prove A ∨ B ⊢ A ∨ B
A ⊢ A ⊢l∨ A ⊢ A ∨ B B ⊢ B ⊢r∨ B ⊢ A ∨ B ∨⊢ A ∨ B ⊢ A ∨ B
- A. Demaille
Exercises on λ-calculus and Deduction Systems 23 / 27
Prove (F ∧ G) ⇒ H ⊢ (F ⇒ H) ∨ (G ⇒ H)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 24 / 27
Prove (F ∧ G) ⇒ H ⊢ (F ⇒ H) ∨ (G ⇒ H)
F ⊢ F W⊢ F, G ⊢ F G ⊢ G W⊢ F, G ⊢ G ⊢∧ F, G ⊢ F ∧ G H ⊢ H ⇒ ⊢ F, G, (F ∧ G) ⇒ H ⊢ H ⊢W F, G, (F ∧ G) ⇒ H ⊢ H, H ⊢ ⇒ F, (F ∧ G) ⇒ H ⊢ H, G ⇒ H ⊢ ⇒ (F ∧ G) ⇒ H ⊢ F ⇒ H, G ⇒ H ⊢r∨ (F ∧ G) ⇒ H ⊢ (F ⇒ H) ∨ (G ⇒ H), G ⇒ H ⊢l∨ (F ∧ G) ⇒ H ⊢ (F ⇒ H) ∨ (G ⇒ H), (F ⇒ H) ∨ (G ⇒ H) ⊢C (F ∧ G) ⇒ H ⊢ (F ⇒ H) ∨ (G ⇒ H)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 24 / 27
Prove (A ⇒ A) ⇒ A ⇒ A (LOFO-2005)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 25 / 27
Prove (A ⇒ A) ⇒ A ⇒ A (LOFO-2005)
A ⊢ A A ⊢ A ⇒ ⊢ A, A ⇒ A ⊢ A ⊢ ⇒ A ⇒ A ⊢ A ⇒ A ⊢ ⇒ ⊢ (A ⇒ A) ⇒ A ⇒ A
- A. Demaille
Exercises on λ-calculus and Deduction Systems 25 / 27
Prove A ⇒ B, B ⇒ C ⊢ A ⇒ (B ∧ C) (LOFO-2005)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 26 / 27
Prove A ⇒ B, B ⇒ C ⊢ A ⇒ (B ∧ C) (LOFO-2005)
A ⊢ A B ⊢ B ⇒ ⊢ A, A ⇒ B ⊢ B W⊢ A, A ⇒ B, B ⇒ C ⊢ B A ⊢ A C ⊢ C ⇒ ⊢ A, B ⇒ C ⊢ C W⊢ A, A ⇒ B, B ⇒ C ⊢ C ∧⊢ A, A ⇒ B, A, B ⇒ C ⊢ B ∧ C C⊢ A, A ⇒ B, B ⇒ C ⊢ B ∧ C
- A. Demaille
Exercises on λ-calculus and Deduction Systems 26 / 27
Prove A ∨ B, ¬B ⊢ A (Classical) (LOFO-2005)
- A. Demaille
Exercises on λ-calculus and Deduction Systems 27 / 27
Prove A ∨ B, ¬B ⊢ A (Classical) (LOFO-2005)
A ⊢ A W⊢ A, ¬B ⊢ A B ⊢ B ⊢W B ⊢ B, A ⊢¬ B, ¬B ⊢ A ∨⊢ A ∨ B, ¬B ⊢ A
- A. Demaille
Exercises on λ-calculus and Deduction Systems 27 / 27