Presburger Arithmetic: Cooper’S Algorithm Top- Ics in Em- Michael R
Total Page:16
File Type:pdf, Size:1020Kb
02917 Ad- 02917 Advanced Topics in Embedded Systems vanced Presburger Arithmetic: Cooper’s algorithm Top- ics in Em- Michael R. Hansen bed- ded Sys- tems Michael R. Hansen 1 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Introduction 02917 Ad- vanced Presburger Arithmetic (introduced by Mojzesz Presburger in 1929), is Top- the first-order theory of natural numbers with addition. ics in Em- Examples of formulas are: ∃x.2x = y and ∃x.∀y.x + y > z. bed- ded Unlike Peano Arithmetic, which also includes multiplication, Sys- Presburger Arithmetic is a decidable theory. tems Michael R. Hansen We shall consider the algorithm introduced by D.C Cooper in 1972. The presentation is based on: Chapter 7: Quantified Linear Arithmetic of The Calculus of Computation by Bradley and Manna. 2 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Introduction 02917 Ad- vanced Presburger Arithmetic (introduced by Mojzesz Presburger in 1929), is Top- the first-order theory of natural numbers with addition. ics in Em- Examples of formulas are: ∃x.2x = y and ∃x.∀y.x + y > z. bed- ded Unlike Peano Arithmetic, which also includes multiplication, Sys- Presburger Arithmetic is a decidable theory. tems Michael R. Hansen We shall consider the algorithm introduced by D.C Cooper in 1972. The presentation is based on: Chapter 7: Quantified Linear Arithmetic of The Calculus of Computation by Bradley and Manna. 3 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Introduction 02917 Ad- vanced Presburger Arithmetic (introduced by Mojzesz Presburger in 1929), is Top- the first-order theory of natural numbers with addition. ics in Em- Examples of formulas are: ∃x.2x = y and ∃x.∀y.x + y > z. bed- ded Unlike Peano Arithmetic, which also includes multiplication, Sys- Presburger Arithmetic is a decidable theory. tems Michael R. Hansen We shall consider the algorithm introduced by D.C Cooper in 1972. The presentation is based on: Chapter 7: Quantified Linear Arithmetic of The Calculus of Computation by Bradley and Manna. 4 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Introduction 02917 Ad- vanced Presburger Arithmetic (introduced by Mojzesz Presburger in 1929), is Top- the first-order theory of natural numbers with addition. ics in Em- Examples of formulas are: ∃x.2x = y and ∃x.∀y.x + y > z. bed- ded Unlike Peano Arithmetic, which also includes multiplication, Sys- Presburger Arithmetic is a decidable theory. tems Michael R. Hansen We shall consider the algorithm introduced by D.C Cooper in 1972. The presentation is based on: Chapter 7: Quantified Linear Arithmetic of The Calculus of Computation by Bradley and Manna. 5 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Presburger terms 02917 Ad- The terms are generated from vanced ∙ integer constants ..., −2, −1, 0, 1, 2,... and Top- ∙ variables x, y, z,... ics in Em- using the following operations: bed- ∙ addition + and subtraction − and ded ∙ multiplication by constants: ..., −2⋅, −1⋅, 0⋅, 1⋅, 2⋅, ... Sys- tems Notice Michael R. Hansen ∙ terms are interpreted over integers ∙ the terms do not really allow multiplication as, e.g. 3 ⋅ x is equal to x + x + x ∙ a term like 3 ⋅ x is usually written 3x 6 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Presburger terms 02917 Ad- The terms are generated from vanced ∙ integer constants ..., −2, −1, 0, 1, 2,... and Top- ∙ variables x, y, z,... ics in Em- using the following operations: bed- ∙ addition + and subtraction − and ded ∙ multiplication by constants: ..., −2⋅, −1⋅, 0⋅, 1⋅, 2⋅, ... Sys- tems Notice Michael R. Hansen ∙ terms are interpreted over integers ∙ the terms do not really allow multiplication as, e.g. 3 ⋅ x is equal to x + x + x ∙ a term like 3 ⋅ x is usually written 3x 7 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Presburger terms 02917 Ad- The terms are generated from vanced ∙ integer constants ..., −2, −1, 0, 1, 2,... and Top- ∙ variables x, y, z,... ics in Em- using the following operations: bed- ∙ addition + and subtraction − and ded ∙ multiplication by constants: ..., −2⋅, −1⋅, 0⋅, 1⋅, 2⋅, ... Sys- tems Notice Michael R. Hansen ∙ terms are interpreted over integers ∙ the terms do not really allow multiplication as, e.g. 3 ⋅ x is equal to x + x + x ∙ a term like 3 ⋅ x is usually written 3x 8 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Presburger terms 02917 Ad- The terms are generated from vanced ∙ integer constants ..., −2, −1, 0, 1, 2,... and Top- ∙ variables x, y, z,... ics in Em- using the following operations: bed- ∙ addition + and subtraction − and ded ∙ multiplication by constants: ..., −2⋅, −1⋅, 0⋅, 1⋅, 2⋅, ... Sys- tems Notice Michael R. Hansen ∙ terms are interpreted over integers ∙ the terms do not really allow multiplication as, e.g. 3 ⋅ x is equal to x + x + x ∙ a term like 3 ⋅ x is usually written 3x 9 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Formulas 02917 We consider formulas F, G, F1, G1, F2 . of the following forms: Ad- ∙ s = t, s < t, s > t, s ≤ t, and s ≥ t (comparisons) vanced Top- ∙ 1∣s, 2∣s, 3∣s,... (divisibility constraints) ics in Em- ∙ ⊤ (true) and ⊥ (false) (propositionalconstants) bed- ∙ F ∨ G (disjunction), F ∧ G (conjunction) and ¬F (negation) ded (propositional connectives) Sys- tems ∙ ∃x.F (reads ”there exists an x such that F”) and Michael R. Hansen ∀x.F (reads ”for all x: F”) (first-orderfragment) where s and t are terms and x is a variable. Furthermore, We allow brackets in formulas. Notice: The formulas are interpreted over the integers. 10 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Formulas 02917 We consider formulas F, G, F1, G1, F2 . of the following forms: Ad- ∙ s = t, s < t, s > t, s ≤ t, and s ≥ t (comparisons) vanced Top- ∙ 1∣s, 2∣s, 3∣s,... (divisibility constraints) ics in Em- ∙ ⊤ (true) and ⊥ (false) (propositionalconstants) bed- ∙ F ∨ G (disjunction), F ∧ G (conjunction) and ¬F (negation) ded (propositional connectives) Sys- tems ∙ ∃x.F (reads ”there exists an x such that F”) and Michael R. Hansen ∀x.F (reads ”for all x: F”) (first-orderfragment) where s and t are terms and x is a variable. Furthermore, We allow brackets in formulas. Notice: The formulas are interpreted over the integers. 11 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Formulas 02917 We consider formulas F, G, F1, G1, F2 . of the following forms: Ad- ∙ s = t, s < t, s > t, s ≤ t, and s ≥ t (comparisons) vanced Top- ∙ 1∣s, 2∣s, 3∣s,... (divisibility constraints) ics in Em- ∙ ⊤ (true) and ⊥ (false) (propositionalconstants) bed- ∙ F ∨ G (disjunction), F ∧ G (conjunction) and ¬F (negation) ded (propositional connectives) Sys- tems ∙ ∃x.F (reads ”there exists an x such that F”) and Michael R. Hansen ∀x.F (reads ”for all x: F”) (first-orderfragment) where s and t are terms and x is a variable. Furthermore, We allow brackets in formulas. Notice: The formulas are interpreted over the integers. 12 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Formulas 02917 We consider formulas F, G, F1, G1, F2 . of the following forms: Ad- ∙ s = t, s < t, s > t, s ≤ t, and s ≥ t (comparisons) vanced Top- ∙ 1∣s, 2∣s, 3∣s,... (divisibility constraints) ics in Em- ∙ ⊤ (true) and ⊥ (false) (propositionalconstants) bed- ∙ F ∨ G (disjunction), F ∧ G (conjunction) and ¬F (negation) ded (propositional connectives) Sys- tems ∙ ∃x.F (reads ”there exists an x such that F”) and Michael R. Hansen ∀x.F (reads ”for all x: F”) (first-orderfragment) where s and t are terms and x is a variable. Furthermore, We allow brackets in formulas. Notice: The formulas are interpreted over the integers. 13 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Formulas 02917 We consider formulas F, G, F1, G1, F2 . of the following forms: Ad- ∙ s = t, s < t, s > t, s ≤ t, and s ≥ t (comparisons) vanced Top- ∙ 1∣s, 2∣s, 3∣s,... (divisibility constraints) ics in Em- ∙ ⊤ (true) and ⊥ (false) (propositionalconstants) bed- ∙ F ∨ G (disjunction), F ∧ G (conjunction) and ¬F (negation) ded (propositional connectives) Sys- tems ∙ ∃x.F (reads ”there exists an x such that F”) and Michael R. Hansen ∀x.F (reads ”for all x: F”) (first-orderfragment) where s and t are terms and x is a variable. Furthermore, We allow brackets in formulas. Notice: The formulas are interpreted over the integers. 14 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Formulas 02917 We consider formulas F, G, F1, G1, F2 . of the following forms: Ad- ∙ s = t, s < t, s > t, s ≤ t, and s ≥ t (comparisons) vanced Top- ∙ 1∣s, 2∣s, 3∣s,... (divisibility constraints) ics in Em- ∙ ⊤ (true) and ⊥ (false) (propositionalconstants) bed- ∙ F ∨ G (disjunction), F ∧ G (conjunction) and ¬F (negation) ded (propositional connectives) Sys- tems ∙ ∃x.F (reads ”there exists an x such that F”) and Michael R. Hansen ∀x.F (reads ”for all x: F”) (first-orderfragment) where s and t are terms and x is a variable. Furthermore, We allow brackets in formulas. Notice: The formulas are interpreted over the integers. 15 DTU Informatics, Technical University of Denmark Presburger Arithmetic: Cooper’s algorithm MRH 17/06/2010 Formulas 02917 We consider formulas F, G, F1, G1, F2 .