Formalization in Constructive Type Theory of the Standardization - - PowerPoint PPT Presentation

formalization in constructive type theory of the
SMART_READER_LITE
LIVE PREVIEW

Formalization in Constructive Type Theory of the Standardization - - PowerPoint PPT Presentation

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda Calculus using Multiple Substitution LFMTP 2018 M. Copes, N. Szasz, A. Tasistro Universidad ORT Uruguay 7th of July 2018 M. Copes, N. Szasz, A. Tasistro


slide-1
SLIDE 1

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda Calculus using Multiple Substitution

LFMTP 2018

  • M. Copes, N. Szasz, A. Tasistro

Universidad ORT Uruguay

7th of July 2018

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 1 / 27

slide-2
SLIDE 2

Outline

1

Introduction

2

Preliminaries

3

Proof of the Standardization Theorem

4

Proof of the Leftmost Reduction Theorem

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 2 / 27

slide-3
SLIDE 3

Previous work: Formal metatheory of the Lambda Calculus using Stoughton’s substitution

  • E. Copello, N. Szasz, and A. Tasistro

Formalization of the Lambda Calculus in Agda using one sort of names for both free and bound variables. Multiple substitution based on Stoughton’s paper (1988). Structural inductive proofs for the Church-Rosser theorem and Subject Reduction. Library with definitions and lemmas for manipulating substitution. Fully checked in Agda.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 3 / 27

slide-4
SLIDE 4

Present work

Our goals

Extend these metatheoretical results by proving:

Standardization Theorem for β-reduction Leftmost Reduction Theorem

Assess the extent at which the library can be reused for this development. Attempt to use structural induction only.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 4 / 27

slide-5
SLIDE 5

The Standardization Theorem

Definition (Standard reduction sequence)

A reduction sequence is said to be standard if successive redexes are contracted from left to right, possibly with some jumps.

Theorem (Standardization)

If a term M β-reduces to a term N, then there exists a standard β-reduction sequence from M to N.

Corollary (Leftmost reduction)

If a term has a β normal form, then the leftmost-outermost reduction strategy will find this normal form

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 5 / 27

slide-6
SLIDE 6

Proofs of the Standardization Theorem

Barendregt 1982

Uses residuals to define standard reductions. Distinguishes between internal and head reductions. Based on the FD and FD!

Takahashi 1995

Follows a similar structure to Barendregt’s. Relies on Martin-L¨

  • f’s parallel reductions to represent the reduction of

a set of redexes. Inductive structure.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 6 / 27

slide-7
SLIDE 7

Ryo Kashima

2000

Inductive definition of β-reducibility with a standard sequence. Uses neither residuals nor the separation between internal and head reductions. All of the definitions and proofs follow an inductive structure.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 7 / 27

slide-8
SLIDE 8

Plan

1

Introduction

2

Preliminaries

3

Proof of the Standardization Theorem

4

Proof of the Leftmost Reduction Theorem

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 8 / 27

slide-9
SLIDE 9

Lambda terms

One set of names for both bound and free variables without identifying alpha-equivalent terms.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 9 / 27

slide-10
SLIDE 10

Multiple Substitution

Σ = V − → Λ Functions mapping every variable to a term. Constructed from the identity substitution ι : Σ and an update

  • perator ≺+ : Σ −

→ V x Λ − → Σ The application of a substitution σ to a term M is noted as M • σ and defined by structural recursion on M. The case for the abstraction renames the abstraction variable according to χ which guarantees certain choice axioms: (λx.M) • σ = λy.(M • σ ≺ + (x, y)), where y = χ(σ, λx.M), is the first variable not free in σ ⇂ M.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 10 / 27

slide-11
SLIDE 11

Alpha Conversion

Alpha equivalent terms become equivalent when submitted to the same substitution.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 11 / 27

slide-12
SLIDE 12

Alpha Reflexive Transitive Closure

One-step and transitivity can be proven from the previous definition.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 12 / 27

slide-13
SLIDE 13

Beta reducibility

Equivalent to the classical inductive definition of beta reducibility.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 13 / 27

slide-14
SLIDE 14

Plan

1

Introduction

2

Preliminaries

3

Proof of the Standardization Theorem

4

Proof of the Leftmost Reduction Theorem

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 14 / 27

slide-15
SLIDE 15

Standard reduction sequence

A sequence of β-reductions A0 − →

n1 A1 −

n2 . . . −

nk Ak is called

standard if n1 ≤ n2 ≤ · · · ≤ nk We add an index to represent the lower bound of subsequent reductions, i.e. the number of the last redex reduced. Allows performing explicit α-conversion steps inside a reduction sequence.

Theorem (Standardization)

(∀M, N) (M ։β N = ⇒ (∃n) (seqβst M N n))

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 15 / 27

slide-16
SLIDE 16

Head reduction in application

(λx.A0) A1 A2 . . . An − →hap A0[x := A1] A2 . . . An

Lemma

(∀M, N, σ) (M ։hap N = ⇒ M • σ ։hap N • σ)

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 16 / 27

slide-17
SLIDE 17

Key Idea: Standard Reduction Relation

Kashima defines an inductive relation that captures the existence of a Stardard Reduction Sequence between two terms. We now prove that: M ։β N = ⇒ M ։st N = ⇒ (∃n) (seqβst M N n)

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 17 / 27

slide-18
SLIDE 18

Standard compatibility with substitution

Lemma

(∀M, N, σ, σ′) (M ։st N ∧ σ →st σ′ = ⇒ M • σ ։st N • σ′) By induction on M ։st N The case for the abstraction requires the use of multiple substitution in order to use the induction hypothesis.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 18 / 27

slide-19
SLIDE 19

Beta = ⇒ Standard

(∀x, M, A, B) (M ։st (λxA) B = ⇒ M ։st A[x := B]) (∀M, N) (M ։st N ∧ N − →β P = ⇒ M ։st P)

Lemma

(∀M, N) (M ։β N = ⇒ M ։st N)

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 19 / 27

slide-20
SLIDE 20

Standard = ⇒ Standard Sequence

(∀M, N) (M ։hap N = ⇒ seqβst M N 0) (∀M, N, n, x) (seqβst M N n = ⇒ seqβst (λxM) (λxN) n)

Lemma

(∀M, N) (M ։st N = ⇒ (∃n) (seqβst M N n)) Notice that the converse holds as well.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 20 / 27

slide-21
SLIDE 21

Standardization

Theorem (Standardization)

(∀M, N) (M ։β N = ⇒ (∃n) (seqβst M N n)) Follows directly from the previous lemmas.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 21 / 27

slide-22
SLIDE 22

Plan

1

Introduction

2

Preliminaries

3

Proof of the Standardization Theorem

4

Proof of the Leftmost Reduction Theorem

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 22 / 27

slide-23
SLIDE 23

Leftmost Reduction Theorem

As a corollary of the Standardization Theorem

Theorem

If M has a normal form, then the leftmost-outermost reduction strategy always finds it. Interesting metatheoretical result about reduction strategies. Beta-equality is decidable for normalizing terms.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 23 / 27

slide-24
SLIDE 24

Leftmost Reduction Theorem

Formalization in Agda

Theorem

(∀M, N) (M ։β N ∧ nf N = ⇒ M ։l N)

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 24 / 27

slide-25
SLIDE 25

Leftmost Reduction Theorem

Proof

Lemma

(∀M, N, n) (M β N @ n ∧ nf N = ⇒ n ≡ 0) By induction on M β N @ n

Lemma

(∀M, N, n) (seqβst M N n ∧ nf N = ⇒ M ։l N) By induction on seqβst M N n using the previous lemma for the case β − step. Now the Leftmost Reduction Theorem follows directly from M ։β N = ⇒ (∃n) (seqβst M N n) = ⇒ M ։l N, for N in normal form.

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 25 / 27

slide-26
SLIDE 26

Conclusions

Kashima’s proof is correct! (completely certified in Agda). Using Stoughton’s substitution, the theorem only requires structural

  • induction. Novel in relation to previous approaches:

McKinna and Pollack (1999) Guidi (2012) Emerich and Ignas Vysniauskas (2014)

Only a few lemmas had to be added to the substitution library in

  • rder to prove the theorem.

Proof of equivalence between Kashima’s notion of beta-reducibility and the classical one. Introduction of a new inductive definition of a standard reduction sequence, namely seqβst. Leftmost Reduction Theorem

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 26 / 27

slide-27
SLIDE 27

Thank you!

  • M. Copes, N. Szasz, A. Tasistro (Universidad ORT Uruguay)

Formalization in Constructive Type Theory of the Standardization Theorem for the Lambda 7th of July 2018 27 / 27