rank 3 inhabitation of intersection types revisited
play

Rank 3 Inhabitation of Intersection Types Revisited Andrej - PowerPoint PPT Presentation

Rank 3 Inhabitation of Intersection Types Revisited Andrej Dudenhefner Jan Bessai Boris D udder Jakob Rehof Technical University of Dortmund, Germany May 20, 2016 1 / 26 Contents Intersection Type System 1 Intersection Type


  1. Rank 3 Inhabitation of Intersection Types Revisited Andrej Dudenhefner Jan Bessai Boris D¨ udder Jakob Rehof Technical University of Dortmund, Germany May 20, 2016 1 / 26

  2. Contents Intersection Type System 1 Intersection Type Inhabitation 2 HTM ≤ IHP 3 2 / 26

  3. Intersection Type System (BCD) Characterizes normalization/strong normalization in λ -calculus [Pot80] Characterizes finite function tables [Sal+12] Framework for the study of semantic domains for the λ -calculus Undecidable type checking (does the given term have the given type) Undecidable typability (w/o rule ( ω )) (does the given term have any type) Undecidable inhabitation [Urz99] (is there any term having the given type) 3 / 26

  4. Intersection Type System (BCD) Definition (Intersection Types T ) T ∋ σ, τ, ρ ::= a | ω | σ → τ | σ ∩ τ where a ∈ A Definition (Subtyping ≤ ) Least preorder (reflexive and transitive relation) over T such that σ ≤ ω, ω ≤ ω → ω, σ ∩ τ ≤ σ, σ ∩ τ ≤ τ, ( σ → τ 1 ) ∩ ( σ → τ 2 ) ≤ σ → τ 1 ∩ τ 2 , if σ ≤ τ 1 and σ ≤ τ 2 then σ ≤ τ 1 ∩ τ 2 , if σ 2 ≤ σ 1 and τ 1 ≤ τ 2 then σ 1 → τ 1 ≤ σ 2 → τ 2 4 / 26

  5. Intersection Type System (BCD) Definition (Type Assignment) x : τ ∈ Γ ( Ax ) ( ω ) Γ ⊢ e : ω Γ ⊢ x : τ Γ , x : σ ⊢ e : τ Γ ⊢ e : σ Γ ⊢ e : τ ( ∩ I ) ( → I ) Γ ⊢ e : σ ∩ τ Γ ⊢ λ x . e : σ → τ Γ ⊢ e ′ : σ ( → E ) Γ ⊢ e : σ σ ≤ τ ( ≤ ) Γ ⊢ e : σ → τ Γ ⊢ ( e e ′ ) : τ Γ ⊢ e : τ 5 / 26

  6. Intersection Type Inhabitation Definition ( ⊢ ? : τ ) Given a type τ is there a λ -term e such that ⊢ e : τ ? Definition (Rank [Lei83]) rank ( τ ) = 0 if τ is a simple type rank ( σ → τ ) = max ( rank ( σ ) + 1 , rank ( τ )) rank ( σ ∩ τ ) = max ( 1 , rank ( σ ) , rank ( τ )) ⊢ ? : τ with rank ( τ ) ≤ 2 is E XP S PACE -complete [Urz09] ⊢ ? : τ with rank ( τ ) ≥ 3 is undecidable [Urz09] 6 / 26

  7. Which features of BCD contribute to undecidability of inhabitation? Can BCD proof search simulate a Turing machine directly ? Are there particular inhabitation instances which are hard to decide? 7 / 26

  8. Approach in [BDS13] (Lambda Calculus with Types) EQA ≤ ETW ≤ WTG ≤ IHP (15 pages w/o EQA theory) EQA Emptiness problem for queue automata ETW Emptiness problem for typewriter automata WTG Problem of winning a “tree game” IHP Intersection type inhabitation problem [BDS13] Barendregt, Dekkers and Statman. “Lambda calculus with types”. Cambridge University Press, 2013. 8 / 26

  9. Approach in [Sal+12; Loa01] WSTS ≤ LDF ≤ IHP (7+3 pages) WSTS Word problem in semi-Thue systems LDF λ -definability problem IHP Intersection type inhabitation problem [Loa01] Loader. “The undecidability of λ -definability”. Logic, Meaning and Computation. Springer Netherlands, 2001. [Sal+12] Salvati et al. “Loader and Urzyczyn are logically related”. Automata, Languages, and Programming. Springer Berlin Heidelberg, 2012. 9 / 26

  10. Approach in [Urz09] ELBA ≤ SSTS1 ≤ HETM ≤ IHP (6 pages) ELBA Emptiness problem for linear bounded automata SSTS1 Problem of deciding whether there is a word that can be rewritten to 1s in a simple semi-Thue system HETM Halting problem for expanding tape machines IHP Intersection type inhabitation problem [Urz09] Urzyczyn. “Inhabitation of low-rank intersection types”. Typed Lambda Calculi and Applications. Springer Berlin Heidelberg, 2009. 10 / 26

  11. Problematic aspects Introduced machinery is highly specialized Multiple degrees of non-determinism, alternation, parallelism Instructions create new instructions (higher order memory) λ -definability requires model theory Difficult to pinpoint necessary aspects 11 / 26

  12. Goal HTM ≤ IHP 12 / 26

  13. Intuition SSTS01 ≤ IHP Definition (Simple semi-Thue System, SSTS) A semi-Thue system over an alphabet Σ is simple , if each rule has the form ab ⇒ cd for some a , b , c , d ∈ Σ . Lemma (SSTS01) Given a simple semi-Thue system over Σ , it is undecidable whether ∃ n ∈ N . 0 n ։ 1 n 13 / 26

  14. Simultaneous Set of Judgments Proof search algorithm [Bun08] uses Simultaneous Set of Judgments 1 Γ 1 ⊢ ? : τ 1 , . . . , Γ n ⊢ ? : τ n where dom (Γ 1 ) = . . . = dom (Γ n ) with transformations such as Γ 1 ⊢ ? : τ 1 , Γ 2 ⊢ ? : σ ∩ τ � Γ 1 ⊢ ? : τ 1 , Γ 2 ⊢ ? : σ, Γ 2 ⊢ ? : τ Γ 1 ⊢ ? : σ 1 → τ 1 , Γ 2 ⊢ ? : σ 2 → τ 2 � Γ 1 ∪ { x : σ 1 } ⊢ ? : τ 1 , Γ 2 ∪ { x : σ 2 } ⊢ ? : τ 2 where x is fresh Γ 1 ⊢ ? : τ 1 , Γ 2 ⊢ ? : τ 2 where x : σ 1 1 → σ 2 1 → τ 1 ∈ Γ 1 and x : σ 1 2 → σ 2 2 → τ 2 ∈ Γ 2 � Γ 1 ⊢ ? : σ 1 Γ 2 ⊢ ? : σ 1 2 and Γ 1 ⊢ ? : σ 2 Γ 2 ⊢ ? : σ 2 1 , 1 , 2 1 logically same as Intersection Synchronous Logic [PRR12] 14 / 26

  15. Simple semi-Thue System Simulation Fix SSTS S over Σ with l , r , • �∈ Σ . Let Γ = { z : 1 } ∪ { x ab ⇒ cd : σ ab ⇒ cd | ab ⇒ cd ∈ S } where σ ab ⇒ cd = ( l → c → a ) ∩ ( r → d → b ) ∩ � ( • → e → e ) e ∈ Σ Let Γ 1 = Γ , Γ 2 = Γ , Γ 3 = Γ , Γ n − 2 = Γ , Γ n − 1 = Γ , Γ n = Γ , . . . y 1 : l y 1 : r y 1 : • . . . y 1 : • y 1 : • y 1 : • y 2 : • y 2 : l y 2 : r y 2 : • y 2 : • y 2 : • . . . . . . . . . . . . . . . . . . . . . . . . y n − 2 : • y n − 2 : • y n − 2 : • y n − 2 : • . . . y n − 2 : l y n − 2 : r y n − 1 : • y n − 1 : • y n − 1 : • . . . y n − 1 : • y n − 1 : l y n − 1 : r Intuitively: y : l , y : r in neighboring environments; y : • otherwise. 15 / 26

  16. Simple semi-Thue System Simulation ab ⇒ cd tabu ⇒ tcdu for n = 4 is simulated by Γ 1 ⊢ ? : t , Γ 2 ⊢ ? : a , Γ 3 ⊢ ? : b , Γ 4 ⊢ ? : u using x ab ⇒ cd : ( l → c → a ) ∩ ( r → d → b ) ∩ � ( • → e → e ) e ∈ Σ Γ 1 ⊢ ? : t , Γ 2 ⊢ ? : c , Γ 3 ⊢ ? : d , Γ 4 ⊢ ? : u and Γ 1 ⊢ ? : • , Γ 2 ⊢ ? : l , Γ 3 ⊢ ? : r , Γ 4 ⊢ ? : • The second condition is satisfied iff l , r are inhabited in exactly the neighboring contexts. Intuitively: type environments encode rewrite rule and order information; inhabited atoms encode current string. 16 / 26

  17. Simple semi-Thue System Simulation Γ 1 ⊢ ? : 1 , . . . , Γ n ⊢ ? : 1 is satisfied since z : 1 ∈ Γ i for 1 ≤ i ≤ n Lemma We have 0 n ։ 1 n iff Γ 1 ⊢ ? : 0 , . . . , Γ n ⊢ ? : 0 is satisfied. Next : construct Γ 1 ⊢ ? : 0 , . . . , Γ n ⊢ ? : 0 for arbitrary/unknown n 17 / 26

  18. σ ∗ = (( • → ∗ ) → ∗ ) ∩ (( l → ∗ ) → #) ∩ (( r → #) ∩ ( • → $) → $) σ 0 = (( • → 0 ) → ∗ ) ∩ (( l → 0 ) → #) ∩ (( r → 0 ) → $) τ = σ ∗ → σ 0 → 1 → σ t 1 → . . . → σ t k → ( l → ∗ ) ∩ ( r → #) ∩ ( • → $) τ Γ ( l → ∗ ) ∩ ( r → #) ∩ ( • → $) Relative Tags l left y 1 : r y 1 : • y 1 : l r right ∗ # $ • other Absolute Tags • → ∗ l → ∗ ( r → #) ∩ ( • → $) $ last y 2 : • y 2 : r y 2 : • y 2 : l # next to last ∗ ∗ # $ ∗ other y 3 : • y 3 : • y 3 : r y 3 : l 0 0 0 0 18 / 26

  19. Back to the Goal HTM ≤ IHP 19 / 26

  20. HTM ≤ IHP Fix a TM M = (Σ , Q , q 0 , q f , δ ) where Σ : finite set of tape symbols with ∈ Σ Q : finite set of states with q 0 , q f ∈ Q q 0 : initial state q f : final state δ : Q × Σ → Q × Σ × { + 1 , − 1 } : transition function Let A = Σ ˙ ∪{ l , r , •} ˙ ∪{� q , a � | q ∈ Q , a ∈ Σ } ˙ ∪{◦ , ∗ , # , $ } The configuration ( q , 3 , abcd ) is represented as ab � q , c � d 20 / 26

  21. TM simulation TM simulation using most n tape cells by Γ 1 ⊢ ? : � q 0 , � , Γ 2 ⊢ ? : , Γ n ⊢ ? : . . . , where � � σ f = a ∩ � q f , a � a ∈ Σ a ∈ Σ for t = (( q , c ) �→ ( q ′ , c ′ , + 1 )) ∈ δ ( • → a → a ) ∩ ( l → c ′ → � q , c � ) ∩ � � ( r → � q ′ , a � → a ) σ t = a ∈ Σ a ∈ Σ for t = (( q , c ) �→ ( q ′ , c ′ , − 1 )) ∈ δ ( • → a → a ) ∩ ( r → c ′ → � q , c � ) ∩ � � ( l → � q ′ , a � → a ) σ t = a ∈ Σ a ∈ Σ 21 / 26

  22. Γ 1 , . . . , Γ n Initialization σ ∗ = (( • → ◦ ) → ◦ ) ∩ (( • → ∗ ) → ∗ ) ∩ (( l → ∗ ) → #) ∩ (( r → #) ∩ ( • → $) → $) σ 0 = (( • → � q 0 , � ) → ◦ ) ∩ (( • → ) → ∗ ) ∩ (( l → ) → #) ∩ (( r → ) → $) τ ⋆ = σ 0 → σ ∗ → σ f → σ t 1 → . . . → σ t k → ( l → ◦ ) ∩ ( r → #) ∩ ( • → $) where δ = { t 1 , . . . , t k } ◦ marks the first symbol to be initialized to � q 0 , � Lemma M halts starting with the empty tape iff there exists a λ -term e such that ∅ ⊢ e : τ ⋆ 22 / 26

  23. Insights “Neighboring” judgments recognized using y : l and y : r TM simulation with fixed number of cells in rank 2 and order 2 Inhabitant directly encodes computation Initialization requires only one a ∩ b → c type in the environment to increase the number of simultaneous judgments τ ⋆ is of rank 3 and order 3 SSTS01 is convenient 23 / 26

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend