undecidability of higher order unification formalised in
play

Undecidability of Higher-Order Unification Formalised in Coq Simon - PowerPoint PPT Presentation

Undecidability of Higher-Order Unification Formalised in Coq Simon Spies, Yannick Forster 20 January 2020 CPP20 saarland university computer science Definition Undecidability Fragments Discussion Extending the Coq Library of


  1. Undecidability of Higher-Order Unification Formalised in Coq Simon Spies, Yannick Forster 20 January 2020 CPP’20 saarland university computer science

  2. Definition Undecidability Fragments Discussion Extending the Coq Library of Undecidable Problems TM PCP H10 U wCBV + Higher-Order Unification Library of Undecidable Problems 1 2 1 For an overview of the library see the talk at 4pm on Saturday at CoqPL

  3. Definition Undecidability Fragments Discussion Higher-Order Unification in Action 3

  4. Definition Undecidability Fragments Discussion Higher-Order Unification in Action 3

  5. Definition Undecidability Fragments Discussion Higher-Order Unification in Action 3

  6. Definition Undecidability Fragments Discussion Higher-Order Unification in Action 3

  7. Definition Undecidability Fragments Discussion Higher-Order Unification in Theory Instance ? P : N → P ⊢ ( ∀ n. P n ) = ( ∀ n. n + 0 = n ) : P containing constants, bound variables, free variables, and types. 4

  8. Definition Undecidability Fragments Discussion Higher-Order Unification in Theory Instance ? P : N → P ⊢ ( ∀ n. P n ) = ( ∀ n. n + 0 = n ) : P containing constants, bound variables, free variables, and types. Solution The substitution ( λn.n + 0 = n ) /P since ( ∀ n. ( λn.n + 0 = n ) n ) ≡ β ( ∀ n. n + 0 = n ) 4

  9. Definition Undecidability Fragments Discussion Why is this hard? 5

  10. Definition Undecidability Fragments Discussion Why is this hard? 5

  11. Definition Undecidability Fragments Discussion Why is this hard? 5

  12. Definition Undecidability Fragments Discussion Overview 6

  13. Definition Undecidability Fragments Discussion Overview Huet (1973) PCP � U 3+ k PCP Post-correspondence problem 6

  14. Definition Undecidability Fragments Discussion Overview Huet (1973) PCP � U 3+ k Goldfarb (1981) H10 � U 2 H10 Hilbert’s tenth problem PCP Post-correspondence problem 6

  15. Definition Undecidability Fragments Discussion Overview Huet (1973) PCP � U 3+ k Goldfarb (1981) H10 � U 2 Dowek (2001) H10 � U H10 Hilbert’s tenth problem PCP Post-correspondence problem 6

  16. Definition Undecidability Fragments Discussion Overview Huet (1973) PCP � U 3+ k Our Contributions 1. Coq formalisation Goldfarb (1981) 2. Simplification of Goldfarb’s proof H10 � U 2 3. Simplification of Huet’s proof 4. Same Calculus Dowek (2001) H10 � U H10 Hilbert’s tenth problem PCP Post-correspondence problem 6

  17. Definition Undecidability Fragments Discussion Simply-Typed λ -Calculus s, t ::= x | c | λx.s | s t ( c : C ) A, B ::= α | A → B Γ , ∆ ::= x 1 : A 1 , . . . , x n : A n Equality: β -equivalence s ≡ β t Substitution: capture-avoiding s [ σ ] Typing: Curry-style Γ ⊢ s : A 7

  18. Definition Undecidability Fragments Discussion Higher-Order Unification ? U (Γ ⊢ s = t : A ) 8

  19. Definition Undecidability Fragments Discussion Higher-Order Unification ? = t : A ) := U (Γ ⊢ s ∃ σ s [ σ ] ≡ β t [ σ ] 8

  20. Definition Undecidability Fragments Discussion Higher-Order Unification ? = t : A ) := U (Γ ⊢ s ∃ σ ∆ . ∆ ⊢ σ : Γ and s [ σ ] ≡ β t [ σ ] where ∆ ⊢ σ : Γ := ∀ ( x : A ) ∈ Γ . ∆ ⊢ σx : A 8

  21. Definition Undecidability Fragments Discussion Traditional Undecidability TM PCP H10 U wCBV Higher-Order Unification Undecidable Problems P undec. iff there is no TM deciding P P � Q iff there is a TM computable function f such that ∀ x. P ( x ) iff Q ( f ( x )) 9

  22. Definition Undecidability Fragments Discussion Synthetic Undecidabililty TM PCP H10 U wCBV Higher-Order Unification Undecidable Problems P undec. iff TM � P P � Q iff there is a Coq function f such that ∀ x. P ( x ) iff Q ( f ( x )) 10

  23. Definition Undecidability Fragments Discussion Reduction H10 � U 11

  24. Definition Undecidability Fragments Discussion Reduction H10 � SU � U ? = t i : A i | i = 1 , . . . , n } ) := SU ( { Γ ⊢ s i ∃ σ ∆ . ∆ ⊢ σ : Γ and ∀ i. s i [ σ ] ≡ β t i [ σ ] 11

  25. Definition Undecidability Fragments Discussion Hilbert’s tenth problem Diophantine Equations d ::= x ˙ = 1 θ � x ˙ = 1 iff θx = 1 | x + y ˙ = z θ � x + y ˙ = z iff θx + θy = θz | x · y ˙ = z θ � x · y ˙ = z iff θx · θy = θz 12

  26. Definition Undecidability Fragments Discussion Hilbert’s tenth problem H10 ( D ) := ∃ θ. ∀ d ∈ D. θ � d Diophantine Equations d ::= x ˙ = 1 θ � x ˙ = 1 iff θx = 1 | x + y ˙ = z θ � x + y ˙ = z iff θx + θy = θz | x · y ˙ = z θ � x · y ˙ = z iff θx · θy = θz 12

  27. Definition Undecidability Fragments Discussion H10 → SU following Dowek (2001) H10 � SU 13

  28. Definition Undecidability Fragments Discussion H10 → SU following Dowek (2001) H10 ( D ) iff SU ( f ( D )) 13

  29. Definition Undecidability Fragments Discussion H10 → SU following Dowek (2001) H10 ( D ) iff SU ( f ( D )) where f is given by ? f ( x ˙ = 1) := x = � 1 � cn ? f ( x + y ˙ = z ) := x ⊕ y = z ? f ( x · y ˙ = z ) := x ⊗ y = z and for every variable x a characteristic equation CN x . Church Numerals � n � cn := λaf.f n a ⊕ faithful ⊗ faithful 13

  30. Definition Undecidability Fragments Discussion Fragments ? ? x ⊕ y = z λaf.x ( y a f ) f = z where x, y, z : α → ( α → α ) → α 14

  31. Definition Undecidability Fragments Discussion Fragments Third-Order Unification ? ? x ⊕ y = z λaf.x ( y a f ) f = z where x, y, z : α → ( α → α ) → α 14

  32. Definition Undecidability Fragments Discussion Fragments First-Order Unification ? ? ? g u a = g a v g a v = w g u a = u Third-Order Unification ? ? x ⊕ y = z λaf.x ( y a f ) f = z where g : α → α → α a : α x, y, z : α → ( α → α ) → α u, v, w : α 14

  33. Definition Undecidability Fragments Discussion Fragments First-Order Unification ? ? ? g u a = g a v g a v = w g u a = u Second-Order Unification ? ? g a = h a h a = h ( h a ) Third-Order Unification ? ? x ⊕ y = z λaf.x ( y a f ) f = z where g : α → α → α a : α x, y, z : α → ( α → α ) → α u, v, w : α h : α → α 14

  34. Definition Undecidability Fragments Discussion Nth-Order Unification ? = t : A ) := U n (Γ ⊢ n s ∃ σ ∆ . ∆ ⊢ n σ : Γ and s [ σ ] ≡ β t [ σ ] where ∆ ⊢ n σ : Γ := ∀ ( x : A ) ∈ Γ . ∆ ⊢ n σx : A 15

  35. Definition Undecidability Fragments Discussion Conservativity Conservativity U n � id U n + k � id U for n ≥ 1 , k ≥ 0 Corollary U 1 � id U 2 � id U 2+ k � id U 16

  36. Definition Undecidability Fragments Discussion Second-Order Undecidability following Goldfarb (1981) H10 � U 2 with constants g : α → α → α and a : α . 17

  37. Definition Undecidability Fragments Discussion Goldfarb Numerals � n � cn � n � gn � n � gn := λa. S n a � n � cn := λaf.f n a to where S := g a with g : α → α → α and a : α 18

  38. Definition Undecidability Fragments Discussion Goldfarb Numerals � n � cn � n � gn � n � gn := λa. S n a � n � cn := λaf.f n a to where S := g a with g : α → α → α and a : α Operations ✓ addition ✓ characteristic equation ✗ multiplication s ⊗ t := λaf.s a ( λb.t b f ) � �� � 18 3rd-order

  39. Definition Undecidability Fragments Discussion Multiplication Following Goldfarb (1981), the equation x · y ˙ = z is encoded as λuv.G xyz ( g ( g ( z u ) ( x v )) a ) u v ? = λuv. g ( g u v ) ( G xyz a ( y u ) ( S v )) where G xyz : α → α → α → α and x, y, z : α → α Why? Explanation in the paper. 19

  40. Definition Undecidability Fragments Discussion Contributions in the context of the library TM � H10 � U 2 � U 2+ k � U Library Goldfarb Conservativity Recall P undec. iff TM � P P � Q iff there is a Coq function f such that ∀ x. P ( x ) iff Q ( f ( x )) 20

  41. Definition Undecidability Fragments Discussion Furthermore. . . First-Order Unification U 1 is decidable Simplifying Huet (1973) PCP � U 3 simplified to MPCP � U 3 Techniques for treating constants similar to Statman (1981) U { g , a } � U { g } � U { g } � U ∅ 2 2 3 3 U , SU , U n , and SU n are enumerable Future Work Decidability of monadic 2nd-order unification; Farmer (1988) Huet’s unification procedure; Huet (1975) 21

  42. Definition Undecidability Fragments Discussion Formalisation Details Coq Code Unification 3000 De Bruijn indices Undecidability 450 Normalisation for the STLC Second-Order 1000 Constant Replacement Other 3000 Total 7450 Meta Theory of the STLC Tools ♥ Autosubst 2 used for generating terms and substitution ♥ Equations used for defining first-order unification algorithm ♥ Setoid Rewriting used for reasoning about β -equivalence 22

  43. Definition Undecidability Fragments Discussion Coq Library of Undecidable Problems TM PCP ??? H10 + Your Contribution wCBV U 2 U U 2+ k Library under uds-psl on Github and 4pm on Saturday at CoqPL 23

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