reduction without rule
play

reduction without rule Randy Pollack and Masahiko Sato Version of - PowerPoint PPT Presentation

Syntax Operations on preterms reduction Generalized instantiation Reduction without reduction without rule Randy Pollack and Masahiko Sato Version of September 7, 2017 Syntax Operations on preterms reduction Generalized


  1. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η β reduction without rule ξ Randy Pollack and Masahiko Sato Version of September 7, 2017

  2. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Overview A concrete representation of lambda terms. Locally nameless: indexes for bound positions, names for free variables. Canonical: α conversion is syntactic identity. Abstraction, lam x M , is a defined function. Using the defined abstraction, the language looks like conventional notation. We can define various reduction relations without rule ξ . Only works for some relations. Apparently fails for η .

  3. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Preterms and well formedness Let i , j , m , n , p , q , range over natural numbers. Fix a countable set of names , ranged over by x , y , z . The raw syntax of preterms (ranged over by M , N , P , Q ) is pt ::= X n x | J n j | ⌈ M , N ⌉ n In preterm syntax, n is the height of the preterm, written hgt M . Well formedness (written W M ) is defined inductively by j < n W P W Q n ≤ hgt P n ≤ hgt Q W X n x W J n j W ⌈ P , Q ⌉ n Well formed preterms are called terms .

  4. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Intended meaning of well formed terms j < n W P W Q n ≤ hgt P n ≤ hgt Q W X n x W J n j W ⌈ P , Q ⌉ n X n x represents λ 1 . . . λ n x (so X 0 x represents x ). J n j represents λ 1 . . . λ n j . Require j < n for well formedness; otherwise j would be unbound. If M 1 represents t 1 and M 2 represents t 2 then ⌈ M 1 , M 2 ⌉ 0 represents ( t 1 t 2 ) . Terms are de Bruijn closed using only the black text. What are the red premises for?

  5. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Abstraction defined as a function on preterms lam x ( X n y ) := if x = y then J n + 1 0 else X n + 1 y lam x ( J n j ) := J n + 1 ( j + 1 ) lam x ⌈ M , N ⌉ n := ⌈ lam x M , lam x N ⌉ n + 1 Abstraction preserves well formedness and raises height by one. W M = ⇒ W ( lam x M ) hgt ( lam x M ) = hgt M + 1 Conversely, every term with height a successor is an abstraction. W M ∧ hgt M = n + 1 = ⇒ ∃ P , x . M = lam x P The red premises of well-formedness are needed for this lemma. We use A , B as metavariables over abstractions.

  6. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Examples Using lam x M we can write lambda terms as usual Notations: write lam xy M for lam x lam y M . x for X 0 x . Some combinators: (assuming x � = y , x � = z , y � = z ) I = λ x . x lam x x = J 1 0 K = λ x y . x lam xy x = J 2 0 false = λ x y . y lam xy y = J 2 1 S = λ x y z . ( x z ) ( y z ) lam xyz ⌈⌈ x , z ⌉ 0 , ⌈ y , z ⌉ 0 ⌉ 0 = ⌈⌈ J 3 0 , J 3 2 ⌉ 3 , ⌈ J 3 1 , J 3 2 ⌉ 3 ⌉ 3

  7. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Adequacy Let t range over lambda terms (e.g. Nominal Isabelle lambda terms). As usual, M ranges over our terms. the relation between lambda terms and our terms is given by: t 1 ∼ M 1 t 2 ∼ M 2 t ∼ M x ∼ X 0 x ( t 1 t 2 ) ∼ ⌈ M 1 , M 2 ⌉ 0 λ x . t ∼ lam x M ∼ respects W : t ∼ M = ⇒ W M ∼ is total, single-valued, and injective. We must define substitution and check that ∼ respects substitution

  8. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Lifting To define instantiation we first introduce a lifting function ( X n y ) ↑ := X n + 1 y ( J n j ) ↑ := J n + 1 ( j + 1 ) ( ⌈ M , N ⌉ n ) ↑ := ⌈ ( M ) ↑ , ( N ) ↑ ⌉ n + 1 which we iterate as: ( M ) ↑ 0 := M ( M ) ↑ m + 1 := (( M ) ↑ m ) ↑ Lifting preserves well formedness and raises height by one. hgt ( M ) ↑ = hgt M + 1 ⇒ W ( M ) ↑ W M =

  9. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Instantiation Instantiation is a binary function, M [ N ] . If hgt M = 0 ( M is under no binders), M [ N ] = M . Otherwise M [ N ] fills any holes J n + 1 0 in M and adjusts the rest of the term: X n + 1 y [ N ] := X n y J n + 1 0 [ N ] := ( N ) ↑ n J n + 1 ( j + 1 )[ N ] := J n j ⌈ M , P ⌉ n + 1 [ N ] := ⌈ M [ N ] , P [ N ] ⌉ n Instantiation is not substitution. Instantiation preserves well formedness: W M ∧ W N = ⇒ W ( M [ N ]) ∧ ( hgt M ) − 1 ≤ hgt M [ N ]

  10. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Substitution Substitution is defined in terms of instantiation: M [ x ← P ] := ( lam x M )[ P ] All the expected properties hold. Usual substitution lemma: x � = y ∧ x / ∈ FV ( P ) ∧ W ( M , P , N ) = ⇒ M [ x ← N ][ y ← P ] = M [ y ← P ][ x ← N [ y ← P ]] Now we can finish adequacy: ∼ respects substitution: s ∼ M ∧ t ∼ N = ⇒ t [ x ← s ] ∼ N [ x ← M ]

  11. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η β reduction as usual Using abstraction we have a natural definition of β reduction: W M W N ( β ) β ⌈ lam x M , N ⌉ 0 → M [ x ← N ] β β → M ′ → N ′ M W N W M N β β ⌈ M , N ⌉ 0 → ⌈ M ′ , N ⌉ 0 ⌈ M , N ⌉ 0 → ⌈ M , N ′ ⌉ 0 β M → N ( ξ ) β lam x M → lam x N Any preterm that participates in this relation is well-formed. Correct β reduction w.r.t. the meaning of terms given above, Still contains rule ξ

  12. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Properties of usual β reduction As usual, rule ξ is invertible: β β lam x M → lam x N = ⇒ M → N β reduction does not lower height: β M → N = ⇒ hgt M ≤ hgt N

  13. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Generalized lifting To eliminate rule ξ from our presentation of β reduction, we define generalized lifting . ( X n y ) i ⇑ := X n + 1 y � ( j < i ) J n + 1 j ( J n j ) i ⇑ := J n + 1 ( j + 1 ) ( j ≥ i ) ( ⌈ M , N ⌉ n ) i ⇑ := ⌈ ( M ) i ⇑ , ( N ) i ⇑ ⌉ n + 1 Preserves well formedness and raises height by one. Many useful properties of generalized lifting are used, e.g. Injectivity: W ( M , N ) ∧ ( M ) i ⇑ = ( N ) i ⇑ = ⇒ M = N . We iterate generalized lifting: ( M ) i ⇑ 0 := M ( M ) i ⇑ m + 1 := (( M ) i ⇑ m ) i ⇑

  14. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Generalized instantiation Generalized instantiation , M [ N ] i , leaves terms M of height 0 unchanged, and updates abstractions: X n + 1 y [ M ] i := X n y J n + 1 i [ M ] i := ( M ) i ⇑ n − i � J n j ( j < i ) J n + 1 j [ M ] i := J n ( j − 1 ) ( j > i ) ⌈ P , Q ⌉ n + 1 [ M ] i := ⌈ P [ M ] i , Q [ M ] i ⌉ n A [ P ] 0 = A [ P ] ⇒ n ≤ hgt ( A [ P ] n ) n < hgt A ∧ n ≤ hgt P = ⇒ W ( A [ P ] n ) n < hgt A ∧ n ≤ hgt P ∧ W A ∧ W P =

  15. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η β without rule ξ Claim the relation • > • defined without a ξ rule: W A n < hgt A W N n ≤ hgt N ( β ) ⌈ A , N ⌉ n > A [ N ] n M > M ′ n ≤ hgt M W N n ≤ hgt N ⌈ M , N ⌉ n > ⌈ M ′ , N ⌉ n N > N ′ n ≤ hgt N W M n ≤ hgt M ⌈ M , N ⌉ n > ⌈ M , N ′ ⌉ n β is equivalent to the relation • → • given above (and thus to the usual notion of β reduction). β Proof that M > N = ⇒ M → N : by induction on the relation M > N . β Both congruence rule cases use invertibility of rule ξ for relation → . The converse direction is straightforward. �

  16. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Tait–Martin-Löf parallel reduction: Usual presentation Parallel reduction (non-deterministic): p p → M ′ → N ′ M N ( β ) p p → M ′ [ x ← N ′ ] X 0 x → X 0 x ⌈ lam x M , N ⌉ 0 p p p → M ′ → N ′ M → N M N ( ξ ) p p → lam x N ⌈ M , N ⌉ 0 → ⌈ M ′ , N ′ ⌉ 0 lam x M Correct w.r.t. usual presentation. Overlap between rule ( β ) and application congruence. Complete development (deterministic, à la Takahashi): Remove overlap, forcing every β step to be taken: cd cd → M ′ → N ′ M N M not an abstraction cd ⌈ M , N ⌉ 0 → ⌈ M ′ , N ′ ⌉ 0

  17. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Parallel reduction without rule ξ Parallel reduction: j < n X n y ≫ X n y J n j ≫ J n j M ≫ M ′ N ≫ N ′ n ≤ hgt M n ≤ hgt N ⌈ M , N ⌉ n ≫ ⌈ M ′ , N ′ ⌉ n n < hgt A A ≫ B n ≤ hgt M M ≫ N ⌈ A , M ⌉ n ≫ B [ N ] n Complete development (remove overlap): M ≫ M ′ N ≫ N ′ n = hgt M n ≤ hgt N ⌈ M , N ⌉ n ≫ ⌈ M ′ , N ′ ⌉ n

  18. Syntax Operations on preterms β reduction Generalized instantiation Reduction without ξ η Church–Rosser theorem With parallel reduction and complete development, we can carry out Takahashi’s proof of Church–Rosser. Although there is no rule ξ , this proof is no easier than usual.

Recommend


More recommend