Exercises on -calculus and Deduction Systems Akim Demaille - - PowerPoint PPT Presentation

exercises on calculus and deduction systems
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Exercises on λ-calculus and Deduction Systems

Akim Demaille akim@lrde.epita.fr

EPITA — École Pour l’Informatique et les Techniques Avancées

June 10, 2016

slide-2
SLIDE 2

Exercises on λ-calculus and Deduction Systems

1

λ-calculus

2

Deduction Systems

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 2 / 27

slide-3
SLIDE 3

λ-calculus

1

λ-calculus Untyped λ-calculus Simply Typed λ-calculus

2

Deduction Systems

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 3 / 27

slide-4
SLIDE 4

Untyped λ-calculus

1

λ-calculus Untyped λ-calculus Simply Typed λ-calculus

2

Deduction Systems

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 4 / 27

slide-5
SLIDE 5

Substitutions

[λz · zz/x]λy · xy ≡

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 5 / 27

slide-6
SLIDE 6

Substitutions

[λz · zz/x]λy · xy ≡ λy · (λz · zz)y [yy/z](λxy · zy) ≡

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 5 / 27

slide-7
SLIDE 7

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

slide-8
SLIDE 8

β-Reductions

(λx · xyx)λz · z →

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 6 / 27

slide-9
SLIDE 9

β-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

slide-10
SLIDE 10

β-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

slide-11
SLIDE 11

β-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

slide-12
SLIDE 12

β-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

slide-13
SLIDE 13

β-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

slide-14
SLIDE 14

β-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

slide-15
SLIDE 15

β-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

slide-16
SLIDE 16

Simply Typed λ-calculus

1

λ-calculus Untyped λ-calculus Simply Typed λ-calculus

2

Deduction Systems

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 7 / 27

slide-17
SLIDE 17

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

slide-18
SLIDE 18

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

slide-19
SLIDE 19

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

slide-20
SLIDE 20

Type Statements

Type λfx · f (fx)

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 9 / 27

slide-21
SLIDE 21

Type Statements

Type λfx · f (fx)

⊢ λfx · f (fx) : (σ → σ) → σ → σ

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 9 / 27

slide-22
SLIDE 22

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

slide-23
SLIDE 23

Type Statements

Type λxy · x

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 10 / 27

slide-24
SLIDE 24

Type Statements

Type λxy · x

⊢ λxy · x : σ → τ → σ

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 10 / 27

slide-25
SLIDE 25

Type Statements

Type λxy · x

⊢ λxy · x : σ → τ → σ [x : σ](1) λy · x : τ → σ (1) λxy · x : σ → τ → σ

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 10 / 27

slide-26
SLIDE 26

Deduction Systems

1

λ-calculus

2

Deduction Systems Natural Deduction Sequent Calculus

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 11 / 27

slide-27
SLIDE 27

Natural Deduction

1

λ-calculus

2

Deduction Systems Natural Deduction Sequent Calculus

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 12 / 27

slide-28
SLIDE 28

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

slide-29
SLIDE 29

Prove A ∧ B ⇒ B ∧ A

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 14 / 27

slide-30
SLIDE 30

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

slide-31
SLIDE 31

Prove A ∧ (B ∨ C) ⊢ (A ∧ B) ∨ (A ∧ C)

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 15 / 27

slide-32
SLIDE 32

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

slide-33
SLIDE 33

Prove (A ⇒ A) ⇒ A ⇒ A (LOFO-2005)

Remember, ⇒ is right-associative.

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 16 / 27

slide-34
SLIDE 34

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

slide-35
SLIDE 35

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

slide-36
SLIDE 36

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

slide-37
SLIDE 37

Prove A ⇒ B, B ⇒ C ⊢ A ⇒ (B ∧ C) (LOFO-2005)

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 17 / 27

slide-38
SLIDE 38

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

slide-39
SLIDE 39

Prove A ∨ B, ¬B ⊢ A (Intuitionistic) (LOFO-2005)

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 18 / 27

slide-40
SLIDE 40

Prove A ∨ B, ¬B ⊢ A (Intuitionistic) (LOFO-2005)

Recall that ¬B := B ⇒ ⊥.

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 18 / 27

slide-41
SLIDE 41

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

slide-42
SLIDE 42

Sequent Calculus

1

λ-calculus

2

Deduction Systems Natural Deduction Sequent Calculus

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 19 / 27

slide-43
SLIDE 43

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, ∆

slide-44
SLIDE 44

Prove A ∧ B ⊢ A ∧ B

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 21 / 27

slide-45
SLIDE 45

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

slide-46
SLIDE 46

Prove A ∧ B ⊢ A ∨ B

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 22 / 27

slide-47
SLIDE 47

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

slide-48
SLIDE 48

Prove A ∨ B ⊢ A ∨ B

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 23 / 27

slide-49
SLIDE 49

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

slide-50
SLIDE 50

Prove (F ∧ G) ⇒ H ⊢ (F ⇒ H) ∨ (G ⇒ H)

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 24 / 27

slide-51
SLIDE 51

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

slide-52
SLIDE 52

Prove (A ⇒ A) ⇒ A ⇒ A (LOFO-2005)

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 25 / 27

slide-53
SLIDE 53

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

slide-54
SLIDE 54

Prove A ⇒ B, B ⇒ C ⊢ A ⇒ (B ∧ C) (LOFO-2005)

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 26 / 27

slide-55
SLIDE 55

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

slide-56
SLIDE 56

Prove A ∨ B, ¬B ⊢ A (Classical) (LOFO-2005)

  • A. Demaille

Exercises on λ-calculus and Deduction Systems 27 / 27

slide-57
SLIDE 57

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