equational logic
play

Equational Logic Steffen H olldobler International Center for - PowerPoint PPT Presentation

Equational Logic Steffen H olldobler International Center for Computational Logic Technische Universit at Dresden Germany Equational Systems Paramodulation Term Rewriting Systems Unification Theory Application:


  1. Equational Logic Steffen H¨ olldobler International Center for Computational Logic Technische Universit¨ at Dresden Germany ◮ Equational Systems ◮ Paramodulation ◮ Term Rewriting Systems ◮ Unification Theory ◮ Application: Multisets Steffen H¨ olldobler Equational Logic 1

  2. Equational Systems ◮ Consider a first order language with the following precedence hierarchy: {∀ , ∃} > ¬ > ∧ > ∨ > {← , →} > ↔ . ◮ Let ≈ be a binary predicate symbol written infix. ◮ An equation is an atom of the form s ≈ t . ◮ An equational system E is a finite set of universally closed equations. ◮ Notation Universal quantifiers are usually omitted. E 1 : ( X · Y ) · Z ≈ X · ( Y · Z ) , (associativity) 1 · X ≈ X , (left unit) X · 1 ≈ X , (right unit) X − 1 · X ≈ 1 , (left inverse) X · X − 1 ≈ 1 . (right inverse) Steffen H¨ olldobler Equational Logic 2

  3. Axioms of Equality ◮ The equality relation enjoys some typical properties expressed by the following universally closed axioms of equality E ≈ : X ≈ X , ( reflexivity ) X ≈ Y → Y ≈ X , ( symmetry ) X ≈ Y ∧ Y ≈ Z → X ≈ Z , ( transitivity ) � n i = 1 X i ≈ Y i → f ( X 1 , . . . , X n ) ≈ f ( Y 1 , . . . , Y n ) , ( f–substitutivity ) � n i = 1 X i ≈ Y i ∧ r ( X 1 , . . . , X n ) → r ( Y 1 , . . . , Y n ) . ( r–substitutivity ) ◮ Note ⊲ Substitutivity axioms are defined for each function symbol f and each relation symbol r in the underlying alphabet. ⊲ Universal quantifiers have been omitted. Steffen H¨ olldobler Equational Logic 3

  4. Equality and Logical Consequence ◮ We are interested in computing logical consequences of E ∪ E ≈ ⊲ E 1 ∪ E ≈ | = ( ∃ X ) X · a ≈ 1? ⊲ E 1 ∪ E ≈ ∪ { X · X ≈ 1 } | = ( ∀ X , Y ) X · Y ≈ Y · X ? ◮ One possibility is to apply resolution. ⊲ There are 10 21 resolution steps needed to solve the examples. ⊲ E ∪ E ≈ causes an extremely large search space. ◮ Idea Remove troublesome formulas from E ∪ E ≈ and built them into the deductive machinery. ⊲ Use additional rule of inference like paramodulation. ⊲ Build the equational theory into the unification computation. Steffen H¨ olldobler Equational Logic 4

  5. Least Congruence Relation ◮ E ∪ E ≈ is a set of definite clauses. ◮ There exists a least model for E ∪ E ≈ . ◮ Example ⊲ Let the only function symbols be the constants a , b , and the binary g . ⊲ Let E 2 = { a ≈ b } . ⊲ The least model of E 2 ∪ E ≈ is { t ≈ t | t is a ground term } ∪ { a ≈ b , b ≈ a } ∪ { g ( a , a ) ≈ g ( b , a ) , g ( a , a ) ≈ g ( a , b ) , g ( a , a ) ≈ g ( b , b ) , . . . } ◮ Define s ≈ E t iff E ∪ E ≈ | = ∀ s ≈ t . ⊲ g ( a , a ) ≈ E 2 g ( a , b ) , g ( X , a ) ≈ E 2 g ( X , b ) ⊲ ≈ E is the least congruence relation on terms generated by E . Steffen H¨ olldobler Equational Logic 5

  6. Paramodulation ◮ L ⌈ s ⌉ literal which contains an occurrence of the term s ; L ⌈ s / t ⌉ literal obtained from L by replacing s by t . ◮ Paramodulation [ L 1 ⌈ s ⌉ , . . . , L n ] [ l ≈ r , L n + 1 , . . . , L m ] θ = mgu ( s , l ) [ L 1 ⌈ s / r ⌉ , L 2 , . . . , L m ] θ Instead of ¬ s ≈ t we write s �≈ t . ◮ Notation ◮ Remember E ∪ E ≈ | = ∀ s ≈ t E∪E ≈ → ∀ s ≈ t is valid iff � ¬ ( � E∪E ≈ → ∀ s ≈ t ) is unsatisfiable iff E ∪ E ≈ ∪ {¬∀ s ≈ t } is unsatisfiable iff E ∪ E ≈ ∪ {∃ s �≈ t } is unsatisfiable. iff E ∪ E ≈ ∪ {∃ s �≈ t } is unsatisfiable iff there is a refutation of ◮ Theorem 1 E ∪ { X ≈ X } ∪ {∃ s �≈ t } wrt paramodulation, resolution and factoring. Steffen H¨ olldobler Equational Logic 6

  7. An Example E 1 ∪ { X ≈ X , X · X ≈ 1 } | = ( ∀ X , Y ) X · Y ≈ Y · X 1 a · b �≈ b · a initial query · hypothesis 2 1 · X 1 ≈ X 1 left unit a · b �≈ (( X 3 · X 3 ) · b ) · ( a · ( X 4 · X 4 )) 3 X 2 ≈ X 2 reflexivity associativity · 4 X 1 ≈ 1 · X 1 pm(2,3) a · b �≈ ( X 3 · (( X 3 · b ) · ( a · X 4 ))) · X 4 5 a · b �≈ ( 1 · b ) · a pm(1,4) · hypothesis 6 X 3 · X 3 ≈ 1 hypothesis a · b �≈ ( a · 1 ) · b 7 X 4 ≈ X 4 reflexivity · right unit 8 1 ≈ X 3 · X 3 pm(6,7) n a · b �≈ a · b n ′ 9 a · b �≈ (( X 3 · X 3 ) · b ) · a pm(5,8) X 5 ≈ X 5 reflexivity n ′′ res ( n , n ′ ) right unit [ ] · a · b �≈ (( X 3 · X 3 ) · b ) · ( a · 1 ) Steffen H¨ olldobler Equational Logic 7

  8. The Example in Shorthand Notation E 1 ∪ { X ≈ X , X · X ≈ 1 } | = ( ∀ X , Y ) X · Y ≈ Y · X 1 a · b �≈ b · a initial query · hypothesis 2 1 · X 1 ≈ X 1 left unit a · b �≈ (( X 3 · X 3 ) · b ) · ( a · ( X 4 · X 4 )) 3 X 2 ≈ X 2 reflexivity associativity · 4 X 1 ≈ 1 · X 1 pm(2,3) a · b �≈ ( X 3 · (( X 3 · b ) · ( a · X 4 ))) · X 4 5 a · b �≈ ( 1 · b ) · a pm(1,4) · hypothesis 6 X 3 · X 3 ≈ 1 hypothesis a · b �≈ ( a · 1 ) · b 7 X 4 ≈ X 4 reflexivity · right unit 8 1 ≈ X 3 · X 3 pm(6,7) n a · b �≈ a · b n ′ 9 a · b �≈ (( X 3 · X 3 ) · b ) · a pm(5,8) X 5 ≈ X 5 reflexivity n ′′ res ( n , n ′ ) right unit [ ] · a · b �≈ (( X 3 · X 3 ) · b ) · ( a · 1 ) Steffen H¨ olldobler Equational Logic 8

  9. The Example in Shorthand Notation Again b · a ≈ ( 1 · b ) · a left unit ≈ (( X 3 · X 3 ) · b ) · a hypothesis ≈ (( X 3 · X 3 ) · b ) · ( a · 1 ) right unit ≈ (( X 3 · X 3 ) · b ) · ( a · ( X 4 · X 4 )) hypothesis ≈ ( X 3 · (( X 3 · b ) · ( a · X 4 ))) · X 4 associativity ≈ ( a · 1 ) · b hypothesis ≈ a · b right unit ◮ Now, the search space is 10 11 instead of 10 21 steps. ⊲ Symmetry can be simulated, which leads to cycles. ⊲ All π ∈ P L 1 are candidates. ⊲ L 1 ⌈ π ⌉ may be a variable and can be unified with any l . ◮ There are still many redundant and useless steps. ◮ Idea Use equations only from left to right: term rewriting system. Steffen H¨ olldobler Equational Logic 9

  10. Term Rewriting Systems ◮ An expression of the form s → t is called rewrite rule. ◮ A term rewriting system is a finite set of rewrite rules. ◮ In the sequel, R shall denote a term rewriting system. ◮ s ⌈ u ⌉ denotes a term s which contains an occurrence of u , s ⌈ u / v ⌉ denotes the term obtained from s by replacing u with v . ◮ The rewrite relation → R on terms is defined as follows: s ⌈ u ⌉ → R t iff there exist l → r ∈ R and θ such that u = l θ and t = s ⌈ u / r θ ⌉ . R 3 = { append ([ ] , X ) → ◮ Example Let X , append ([ X | Y ] , Z ) → [ X | append ( Y , Z )] } . → R 3 [ 1 | append ([ 2 ] , [ 3 , 4 ])] ⊲ Then, append ([ 1 , 2 ] , [ 3 , 4 ]) → R 3 [ 1 , 2 | append ([ ] , [ 3 , 4 ])] → R 3 [ 1 , 2 , 3 , 4 ] . Steffen H¨ olldobler Equational Logic 10

  11. Matching ◮ Matching problem Given terms u and l , does there exist a substitution θ such that u = l θ ? If such a substitution exists, then it is called a matcher. ◮ If a matching problem is solvable, then there exists a most general matcher. ◮ If can be computed by a variant of the unification algorithm, where variables occurring in u are treated as (different new) constant symbols. ◮ Whereas unification is in the complexity class P , matching is in N C . Steffen H¨ olldobler Equational Logic 11

  12. Closures ∗ → R denotes the reflexive and transitive closure of → R . ◮ ∗ → R 3 [ 1 , 2 , 3 , 4 ] . ⊲ append ([ 1 , 2 ] , [ 3 , 4 ]) ◮ s ↔ R t iff s ← R t or s → R t . ⊲ Let R 4 = { a → b , c → b } , then a → R 4 b ← R 4 c and, consequently, a ↔ R 4 b ↔ R 4 c . ∗ ↔ R denotes the reflexive and transitive closure of ↔ R . ◮ ∗ ⊲ a ↔ R 4 c . ◮ We sometimes simply write → or ↔ instead of → R or ↔ R , respectively. Steffen H¨ olldobler Equational Logic 12

  13. Term Rewriting Systems and Equational Systems ◮ Let R be a term rewriting system. ◮ E R := { l ≈ r | l → r ∈ R} ∪ E ≈ . ⊲ For R 4 = { a → b , c → b } we obtain E R 4 = { a ≈ b , c ≈ b } ∪ E ≈ . ∗ → R t s ≈ E R t . ◮ Theorem 2 (i) s implies ∗ (ii) s ≈ E R t iff s ↔ R t . ◮ Proof � Exercise ⊲ g ( X , a ) → R 4 g ( X , b ) and g ( X , a ) ≈ E R 4 g ( X , b ) . ⊲ g ( X , a ) ≈ E R 4 g ( X , c ) and g ( X , a ) → R 4 g ( X , b ) ← R 4 g ( X , c ) . Steffen H¨ olldobler Equational Logic 13

  14. Reducibility and Normal Forms ◮ s is reducible wrt R iff there exists t such that s → R t ; otherwise it is irreducible. ∗ ◮ t is a normal form of s wrt R iff s → R t and t irreducible. ⊲ [ 1 , 2 , 3 , 4 ] is the normal form of append ([ 1 , 2 ] , [ 3 . 4 ]) wrt R 3 . ◮ Normal forms are not necessarily unique. Consider R 5 = { neg ( neg ( X )) → X , → neg ( or ( X , Y )) & ( neg ( X ) , neg ( Y )) , → neg ( & ( X , Y )) or ( neg ( X ) , neg ( Y )) , → & ( X , or ( Y , Z )) or ( & ( X , Y ) , & ( X , Z )) , → or ( & ( Y , Z ) , & ( Z , X )) } . & ( or ( X , Y ) , Z ) & ( or ( X , Y ) , or ( U , V )) has the normal forms or ( or ( & ( Y , U ) , & ( U , X )) , or ( & ( Y , V ) , & ( V , X ))) and or ( or ( & ( Y , U ) , & ( Y , V )) , or ( & ( V , X ) , & ( X , U ))) wrt R 5 . Steffen H¨ olldobler Equational Logic 14

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