contents objectives of the lecture
play

Contents/Objectives of the lecture Definition and properties of - PowerPoint PPT Presentation

Contents/Objectives of the lecture Definition and properties of rewriting Rule-based programming in ELAN Logic and calculus for rewriting Compilation or how to get efficiency? Applications and future developments ESSLLI2001


  1. Contents/Objectives of the lecture • Definition and properties of rewriting • Rule-based programming in ELAN • Logic and calculus for rewriting • Compilation or how to get efficiency? Applications and future developments • ESSLLI’2001 — Rule-based deduction and computation 1

  2. Rule-based computation and deduction Applications and extensions H´ el` ene Kirchner and Pierre-Etienne Moreau LORIA – CNRS – INRIA Nancy, France

  3. Introduction

  4. Overview • Rule-based programming: computation and deduction in application • How to use rule-based techniques in various environments? • How to build a new environment ? Adding objects in ELAN • Other typical problems of the field ESSLLI’2001 — Rule-based deduction and computation Introduction 4

  5. � � � � � Rules for computing, solving, proving Rule system � �������������� � � � � � � � � � � � � Deterministic Non Deterministic Non Deterministic Decidable Undecidable Decidable Efficiency Infinite Search Finite Search � � ���������� � � � � � � � � � Computing Solving Proving � � � � � ������������� � ���������� � � � � � � � � � � � � � � � � � � � � � � � Programming Theorem with Proving with Constraints Constraints � ������������������ � � � � � � � � � � � � � � Deduction Modulo ESSLLI’2001 — Rule-based deduction and computation Introduction 5

  6. Rewriting for computing log ( x × y ) → log ( x ) + log ( y ) if x ≥ 0 ∧ y ≥ 0 | x | → x if x ≥ 0 | x | → − x if x < 0 fib (0) → 1 fib (1) → 1 fib ( n ) → fib ( n − 1) + fib ( n − 2) if n > 1 ESSLLI’2001 — Rule-based deduction and computation Introduction 6

  7. Rewriting for solving Equation solving Does it exist x, y, z such that: x +( z ∗ y ) = y +( x ∗ z ) There is an infinity of solutions but a most general one x = y = z ===> syntactic unification ESSLLI’2001 — Rule-based deduction and computation Introduction 7

  8. The rules for syntactic unification P & s = ? s Delete → P P & f ( s 1 , . . . , s n ) = ? f ( t 1 , . . . , t n ) Decompose P & s 1 = ? t 1 & . . . & s n = ? t n → P & f ( s 1 , . . . , s n ) = ? g ( t 1 , . . . , t p ) Conflict → if f � = g F P & x = ? y Coalesce { x �→ y } P & x = ? y → if x, y ∈ V ar P ∧ x � = y ESSLLI’2001 — Rule-based deduction and computation Introduction 8

  9. x 1 = ? s 1 [ x 2 ] & . . . Check* P & . . . & x n = ? s n [ x 1 ] → if s i / ∈ X for some i ∈ [1 ..n ] F P & x = ? s & x = ? t Merge P & x = ? s & s = ? t → if 0 < | s | ≤ | t | P & x = ? s Check → if x ∈ V ar s and s / ∈ X F P & x = ? s Eliminate { x �→ s } P & x = ? s → if x / ∈ V ar s, s / ∈ X , x ∈ V ar P ESSLLI’2001 — Rule-based deduction and computation Introduction 9

  10. Example x +( z ∗ y ) = y +( x ∗ z ) → decompose x = y & z ∗ y = x ∗ z → decompose x = y & z = x & y = z → coalesce y = z & x = z & z = x → coalesce z = x & y = x & x = x → delete z = x & y = x ESSLLI’2001 — Rule-based deduction and computation Introduction 10

  11. Rewriting for Proving Completion procedure: Allows to relate • Equational deduction with a set of axioms E • Rewrite deduction with a set of rules R From a set of axioms, deduce an equivalent set of rewrite rules deduction rules for completion. computations: order terms, compute critical pairs, normalise. ESSLLI’2001 — Rule-based deduction and computation Introduction 11

  12. Simplification orderings A simplification ordering is an irreflexive transitive relation > on terms, closed under context and substitution, that contains the subterm ordering. R is simply terminating if there exists a simplification ordering > such that for any rule l → r in R , l > r . When the set F of operator symbols is finite, a rewrite system R is terminating if R is simply terminating [DershowitzTCS-1982]. Simplification orderings can be built from a well-founded ordering on the function symbols F called a precedence. Example: lexicographic path ordering. ESSLLI’2001 — Rule-based deduction and computation Introduction 12

  13. Lexicographic path ordering LPO Let > F be a precedence on F . s = f ( s 1 , .., s n ) > lpo t = g ( t 1 , . . . , t m ) if one at least of the following conditions holds: 1. f = g and ( s 1 , . . . , s n ) > lex lpo ( t 1 , . . . , t m ) and ∀ j ∈ { 1 , . . . , m } , s > lpo t j 2. f > F g and ∀ j ∈ { 1 , . . . , m } , s > lpo t j 3. ∃ i ∈ { 1 , . . . , n } such that either s i > lpo t or s i = t . ESSLLI’2001 — Rule-based deduction and computation Introduction 13

  14. LPO in ELAN [] lpo(s,t) => true if not(isvar(s)) and not(isvar(t)) choose try if head(s) ==sig head(t) where b:= () lpo3(s,t) if b try if head(s) >sig head(t) where b:= () lpo2(s,t) if b end end ESSLLI’2001 — Rule-based deduction and computation Introduction 14

  15. Critical Pairs Superposition l 1 → r 1 l 2 [ u ] → r 2 l 2 [ r 1 ] σ = r 2 σ u is a non-variable sub-term of l 2 σ is the mgu ( u, l 1 ) (i.e. uσ = l 1 σ ) All critical pair should satisfy: ∗ ∗ l 2 [ r 1 ] σ − → R ◦ R ← − r 2 σ ESSLLI’2001 — Rule-based deduction and computation Introduction 15

  16. The saturation rules Orient P ∪ { p = q } , R �→ �→ P, R ∪ { p → q } if p > q Deduce P, R �→ �→ P ∪ { p = q } , R if ( p, q ) ∈ CP ( R ) P ∪ { p ′ = q } , R Simplify P ∪ { p = q } , R �→ �→ if p → R p ′ Delete P ∪ { p = p } , R �→ �→ P, R P, R ∪ { l → r ′ } Compose P, R ∪ { l → r } �→ �→ if r → R r ′ P ∪ { l ′ = r } , R Collapse P, R ∪ { l → r } �→ �→ l ′ and l → r > if l → g → d > g → d R ESSLLI’2001 — Rule-based deduction and computation Introduction 16

  17. The main result The sets of persisting rules and pairs are defined as: P ∞ = � � j>i P j and R ∞ = � � j>i R j . i ≥ 0 i ≥ 0 If the derivation ( P 0 , R 0 ) �→ �→ ( P 1 , R 1 ) �→ �→ · · · satisfies • all critical pairs have been computed ( CP ( R ∞ ) is a subset of � i ≥ 0 P i ), • R ∞ is reduced and • P ∞ is empty, then R ∞ is Church-Rosser and terminating. ∗ ∗ Moreover ← → P 0 ∪ R 0 and ← → R ∞ coincides. ESSLLI’2001 — Rule-based deduction and computation Introduction 17

  18. An additive group G is defined by the set of equalities x + e = x x + e → x x + ( y + z ) = ( x + y ) + z e + x → x x + i ( x ) = e x + ( y + z ) → ( x + y ) + z x + i ( x ) → e i ( x ) + x → e i ( e ) → e ( y + i ( x )) + x → y ( y + x ) + i ( x ) → y i ( i ( x )) → x i ( x + y ) → i ( y ) + i ( x ) ESSLLI’2001 — Rule-based deduction and computation Introduction 18

  19. How to use rule-based techniques for combining deduction and computation in various environments? ESSLLI’2001 — Rule-based deduction and computation Introduction 19

  20. How to use rule-based techniques for combining deduction and computation in various environments? • Encode your problem in ELAN ESSLLI’2001 — Rule-based deduction and computation Introduction 19

  21. How to use rule-based techniques for combining deduction and computation in various environments? • Encode your problem in ELAN • Design by yourself a rewrite engine in your system ESSLLI’2001 — Rule-based deduction and computation Introduction 19

  22. How to use rule-based techniques for combining deduction and computation in various environments? • Encode your problem in ELAN • Design by yourself a rewrite engine in your system • Connect an existing rewrite tool and trust or check its results ESSLLI’2001 — Rule-based deduction and computation Introduction 19

  23. How to use rule-based techniques for combining deduction and computation in various environments? • Encode your problem in ELAN • Design by yourself a rewrite engine in your system • Connect an existing rewrite tool and trust or check its results • Use TOM a pattern matching preprocessor ESSLLI’2001 — Rule-based deduction and computation Introduction 19

  24. Rewriting techniques in automated theorem provers • Boolean algebras and rings Applications to proof search in first order logic (Hsiang, 1985). • Proof of commutativity in specific rings ( ∀ x, x n = x ) ⇒ ∀ x, y, ( x ∗ y = y ∗ x ) n = 3 (Stickel, 1984), n even (Kapur,Zhang, 1991). • The Robbins conjecture In a Boolean algebra x + y + x + y = y implies x + y + x + y = y (McCune, 1996) ESSLLI’2001 — Rule-based deduction and computation Introduction 20

  25. ELAN for equational reasoning in CoQ Efficient tools to implement decision procedures using rewriting for CoQ. • ELAN is used as a rewrite engine to find a computation. • Reflection is used in CoQ to translate back the delegated rewrite computation. • A trace is returned by ELAN and replayed by CoQ, to ensure correctness and build a complete proof term. Examples: Groups, rings,...Stalmarck’s algorithm. ESSLLI’2001 — Rule-based deduction and computation Introduction 21

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