Dagstuhl Seminar Mathematics, Algorithms, Proofs 10-14 January, 2005 Strong normalization for λ -calculi with recursion Ulrich Berger Swansea 1
Motivation: Computational content of classical mathematics 1958 G¨ odel Dialectica Interpretation of PA 1962 Spector Dialectica Interpretation of PA2 1998 Berardi,Bezem, Realizability Interpretation of Coquand Classical Countable Choice These interpretations use strong computation principles with difficult termination proofs. 2
The problem Given a strongly normalizing type theory T and a system of rewrite rules R , show that the combined system T + R is strongly normalizing. We are mainly interested in higher-order rewrite rules that go beyond structural recursion. Example T = simple types over the booleans and the natural numbers R = G¨ odel primitive recursion + modified bar recursion: 3
( λx.M ) N �→ M [ N/x ] R 0 �→ x RS ( k ) �→ fk ( R k ) Φ s �→ y ( λk. Ψ sk ( k < | s | )) Ψ sk T �→ s k Ψ sk F �→ gk ( λx. Φ( s ∗ x )) s : ρ ∗ y : ( nat → ρ ) → nat 4
The Solution 1. Interpret T + R in a strict domain model. 2. Show that any term not denoting ⊥ is SN. 3. Show that all constants are total. By 3., all terms are total, hence � = ⊥ , hence SN, by 2. Remarks 1. and 2. are independent of the type system and will hence be carried out in a type free fashion. Strictness and continuity are essential. Proofs are elementary. In 3., the notion of totality is given by the type theory T reflecting its proof-theoretic strength. The proof that constants are total uses the mathematical strength of R . 5
Related work 1971 Tait WN for Barrecursion using infinite terms 1976 Vogel SN for Barrecursion 1977 Plotkin Adequacy of call-by-name w.r.t. domain semantics 1980 Gandy Syntactic strictness argument ( λI -calculus) for WN → SN 6
1985 Bezem SN for BR without using infinite terms 1995 van de Pol, SN using strict monotone functionals Schwichtenberg 1999 Blanqui, SN for CC+rewriting using Jouannaud, syntactic arguments Okada 7
Contents of the talk 1. The type-free λ -calculus with constructors and recursion 2. A strict domain model for strong normalization 3. Strongly normalizing and total type systems 4. Applications 5. References 8
1. The type-free λ -calculus with constructors and recursion x | co ( M 1 , . . . , M k ) | c | λ xM | MN Rewrite rules R cP 1 . . . P n �→ R • P i variable disjoint constructor patterns (built from variables and constructors) • FV ( cP 1 . . . P n ) ⊆ FV ( R ) • left hand sides of different rules non-unifiable 9
The rewrite system MBR of modified bar recursion R xf 0 �→ x R xf S ( k ) �→ fk ( R xfk ) Φ ygs �→ y ( λk. Ψ ygsk ( k < | s | )) Ψ ygsk T �→ s k Ψ ygsk F �→ gk ( λx. Φ yg ( s ∗ x )) 10
2. A strict domain model for strong normalization D = Σ co D arity ( co ) + D → D • case ( co ( � a )) = co case ( abst ( f )) = abst • co − 1 i ( co ( � a )) = a i • app ( abst ( f ) , b ) = f ( b ) 11
Strict interpretation of terms [ x ] α η = η ( x ) [ c ] α η = α ( c ) [ λx M ] α η strict ( abst )( λ a ∈ D . [ M ] α η a = x ) [ MN ] α η strict ( app )([ M ] α η, [ N ] α η ) = [ co ( M 1 , . . . , M k )] α η strict ( co )([ M 1 ] α η, . . . , [ M k ] α η ) = f ( � a ) if ⊥ / ∈ � a strict ( f )( � a ) := ⊥ otherwise 12
Interpretation of constants w.r.t. a rewrite system R If there is no rule for c , then α R ( c ) := ⊥ . Otherwise α R ( c ) := abst ( f ) where f : D k → D is defined by if c� P �→ R ∈ R and � P − 1 ( � [ R ] α R η a ) = Just ( η ) if � a ) = Nothing for all c� P − 1 ( � f ( � a ) := dummy P �→ R ∈ R ⊥ otherwise P − 1 is the generalization of co − 1 • � to constructor patterns. i • dummy ∈ D is arbitrary, but fixed. [ M ] R := [ M ] α R 13
The stratification R <ω of a rewrite system R { c n +1 � P �→ R [ n ] | c� R <ω := P �→ R ∈ R , n ∈ N } • c n new constants • M [ n ] := M [ d n /d | d constant ] A � M : ⇔ A is obtained from M by replacing every occurrence of a constant c by some c n 14
Proposition 1 If [ M ] R � = ⊥ and all M [ n ] are SN w.r.t. R <ω , then M is SN w.r.t. R . Proof (1) If c 0 ∈ A , then [ A ] R <ω = ⊥ (2) [ M ] R = � n [ M [ n ] ] R <ω (3) If A → R <ω B , then [ A ] R <ω ⊑ [ B ] R <ω (4) If A � M , c 0 �∈ A and M → R N , then A → R <ω B with B � N . The proposition follows. 15
3. Strongly normalizing and total type systems Type systems A type system consists of a set T of types and a function that assigns to every set of constants C a set ⊢ C ⊆ T C × Λ 0 ( C ) × T which is stable under type respecting constant substitutions: If ∆ ⊢ C M : ρ and ∆ = ∆ ′ ◦ θ , then ∆ ′ , Γ ⊢ C ′ Mθ : ρ ( ∆ ∈ T C , M ∈ Λ 0 ( T ) , ρ ∈ T , θ : C → C ′ , ∆ ′ ∈ T C ′ ) 16
Type sound conversion systems A conversion system R for Λ( C ) is type-sound w.r.t. ∆ ∈ T C if ∆ ⊢ C λ� xL : ρ ⇒ ∆ ⊢ C λ� xR : ρ for every rule L �→ R ∈ R with FV ( L ) = � ρ and ρ ∈ T . Strongly normalizing type systems The type system T , ⊢ is called strongly normalizing if for any set of constants C , any type assignment ∆ ∈ T C and any stratified type-sound conversion system R for Λ( C ) all typeable closed terms are strongly normalizing w.r.t. R . 17
Totality of a type systems w.r.t. a type interpretation A type interpretation for T is a mapping that assigns to every ρ ∈ T a subset [ [ ρ ] ] of D \ {⊥} . α ∈ D C is total w.r.t. [ ] and ∆ ∈ T C if α ( c ) ∈ [ [ · ] [∆( c )] ] for every c ∈ C . The type system T , ⊢ is total w.r.t. a type interpretation [ [ · ] ] if whenever ∆ ⊢ C M : ρ , then [ M ] is total w.r.t. [ [ · ] ] , ∆ , ρ , i.e. [ M ] α ∈ [ [ ρ ] ] for all α that are total w.r.t. [ [ · ] ] and ∆ . 18
A rewrite system R is total if α R ( c ) is total for each constant c . Proposition 1 implies Proposition 2 Let T , ⊢ be a strongly normalizing type system which is ] . Let ∆ ∈ T C be a total w.r.t. the type interpretation [ [ · ] type assignment and R a type-sound and total rewrite system. Then all typeable closed terms are strongly normalizing w.r.t. R . 19
4. Application: System F + G¨ odel primitive recursion + modified bar recursion 20
System F . . . Γ , x : ρ ⊢ C x : ρ Γ , x : ρ ⊢ C M : σ Γ ⊢ C λx.M : ρ → σ Γ ⊢ C M : ρ → σ Γ ⊢ C N : ρ Γ ⊢ C MN : σ Γ ⊢ C M : ∀ p ρ Γ ⊢ C M : ρ (*) ∀ + ∀ − Γ ⊢ C M : ∀ p ρ Γ ⊢ C M : ρ [ σ/p ] 21
. . . extended by constants and data types ( c ∈ C ) ∆ , Γ ⊢ C c : ∆( c ) ∆ , Γ ⊢ C T : boole ∆ , Γ ⊢ C F : boole ∆ , Γ ⊢ C M : nat ∆ , Γ ⊢ C 0: nat ∆ , Γ ⊢ C S ( M ): nat ∆ , Γ ⊢ C []: ∀ p list ( p ) ∆ , Γ ⊢ C M : ρ ∆ , Γ ⊢ C N : list ( ρ ) ∆ , Γ ⊢ C cons ( M, N ): list ( ρ ) 22
In the following: System F := system F with constants and data types Proposition 3 System F is a strongly normalizing type system. Proof The proposition states that typeable terms are SN w.r.t. β -conversion and arbitrary type sound stratified rewrite systems. This can be proven by a straightforward extension of any of the known proofs of SN for system F . 23
We wish to apply Proposition to prove SN for system F extended by bar recursion. Preparation: dummy = abst ( λ a ∈ D . dummy ) ˜ P ( D ) := { A ⊆ D | dummy ∈ A and ⊥ �∈ A } Note that if A, B ∈ ˜ P ( D ) , so is A → B := { abst ( f ) ∈ D | ∀ a ∈ D ( a ∈ A → f ( a ) ∈ B ) } 24
The interpretation [ [ ρ ] ] τ of a type ρ w.r.t. an assignment τ : Typevariables → ˜ P ( D ) [ [ p ] ] τ = τ ( p ) [ [ ρ → σ ] ] τ = [ [ ρ ] ] τ → [ [ σ ] ] τ ] τ A � [ [ ∀ p ρ ] ] τ = [ [ ρ ] p A ∈ ˜ P ( D ) [ [ list ( ρ )] ] τ = the least L ⊆ D s.t. • [] ∈ L ; • if a ∈ [ [ ρ ] ] τ and l ∈ L , then cons ( a, l ) ∈ L ; • abst ( f ) ∈ L for every continuous f : D → D . 25
Proposition 4 System F is total w.r.t. [ [ · ] ] . Proof Easy induction on typing judgments. Proposition 5 The rewrite system MBR is total. Proof G¨ odel primitive recursion: straightforward induction. Φ , Ψ : The intuitive continuity argument why these functionals are well-defined easily works. 26
Altogether we have Theorem System F + G¨ odel primitive recursion + modified bar recursion is strongly normalizing. Also works for other forms of bar recursion and open recursion and, hopefully, for stronger type systems. 27
References [1] C. Spector. Provably recursive functionals of analysis: a consistency proof of analysis by an extension of principles in current intuitionistic mathematics. In F. D. E. Dekker, editor, Recursive Function Theory: Proc. Symposia in Pure Mathematics , volume 5, pages 1–27. American Mathematical Society, Providence, Rhode Island, 1962. [2] W.W. Tait. Normal form theorem for barrecursive functions of finite type. In J.E. Fenstad, editor, Proceedings of the Second Scandinavian Logic Symposium , pages 353–367. North–Holland, Amsterdam, 1971. [3] H. Vogel. Ein starker Normalisationssatz f¨ ur die barrekursiven Funktionale. Archive for Mathematical Logic , 18:81–84, 1985. 28
Recommend
More recommend