1 first order theories. 2 satisfiability the classic sat problem: given a propositional formula , is...
TRANSCRIPT
![Page 1: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/1.jpg)
1
First order theories
![Page 2: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/2.jpg)
2
Satisfiability
The classic SAT problem: given a propositional formula , is satisfiable ?
Example:
Let x1,x2 be propositional variables
Let := (x1 → x2) Æ (x1 Æ :: x2)
Is satisfiable ?
![Page 3: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/3.jpg)
3
Satisfiability Modulo Theories
Now let the predicates be equalities
Example:
Let x1,x2,x3 2 Z
Let := ((x1 = x2) → (x2 = x3)) Æ x1 x3
Is satisfiable ?
![Page 4: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/4.jpg)
4
Satisfiability Modulo Theories
Now let the predicates be from linear arithmetic
Example:
Let x1,x2,x3 2 R
Let := ((x1 + 2x3 < 5) Ç :(x3 · 1) Æ (x1 ¸ 3))
Is satisfiable ?
![Page 5: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/5.jpg)
5
Satisfiability Modulo Theories
Now let the predicates represent arrays
Example:
Let i,j,a[] 2 Z
Let := (i = j Æ a[j] = 1) Æ a[i] 1
Is satisfiable ?
![Page 6: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/6.jpg)
6
Generalization
Equalities, linear predicates, arrays, ... Is there a general framework to define them ?
Yes ! It is called first-order logic
Each of the above examples is a first-order theory.
![Page 7: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/7.jpg)
7
Some useful first-order theories
The SMT web page: http://combination.cs.uiowa.edu/smtlib/
![Page 8: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/8.jpg)
8
What lies ahead...
As in the case of propositional logic, we need to define Syntax Semantics
But it is more difficult, because: First-order logic is a template for defining theories Semantics cannot be defined with truth-tables
The domains can be infinite !
![Page 9: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/9.jpg)
9
First-order logic: Terms & predicates
Let x,y be variables f,g be function symbols (unary & binary, respectively) a,b,c be propositional variables p be a binary predicate symbol
Example of terms: x f(f(x)) g(f(x),g(y,z)))
Example of predicates: a p(f(x),g(x,y))
![Page 10: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/10.jpg)
10
First-order logic – Grammar
A FOL formula is a predicate, or An application of a propositional connective over FOL
formula(s) An application of a quantifier (9, 8) over a FOL formula
Examples:
![Page 11: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/11.jpg)
11
First-order Logic / scopes
Each quantifier has a scope
If a variable is not quantified, it is called free
A formula without free variables is called a sentence
Here, b is free
![Page 12: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/12.jpg)
13
First order logic
We distinguish between Logical symbols: Æ Ç : 8 9 ( ) Non-logical Symbols :
function symbols (incl. constants) predicate symbols
is the ‘signature’ of the theory restricts the syntax The theory also restricts the semantics of the symbols in
We will see how...
![Page 13: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/13.jpg)
14
Example 1
= {0,1,f,p} ‘0’,’1’ are constant symbols ‘f’ is a binary function symbol ‘p’ is a binary predicate
An example of a -formula:
9y 8x. p(x, y)
Is it true ? depends on the interpretation we give to p. Does there exists a satisfying interpretation?
![Page 14: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/14.jpg)
15
Example 2
= {1,p1,p2, p3} ‘1’ is a constant symbol p1, p2 are binary predicates p3 is a unary predicate
An example -formula:
8n 9k. p2(n,1) ! p3(k) Æ p1(n,k) Æ p1(k, 2n).
is this formula satisfiable ? i.e., is there an interpretation that makes it true ?
![Page 15: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/15.jpg)
16
Example 2, interpreted
set p1 = ‘>’, p2 = ‘<‘, p3 = isPrime.
So now the formula is:
8n 9k. n > 1 ! isprime(k) Æ n < k < 2n.
This is Bertrand’s postulate Proven separately by Chhebyshev, Ramanujan, Erdos.
![Page 16: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/16.jpg)
17
Without interpretations...
Technically, we should also assign interpretation to symbols that are already ‘taken’: ‘+’,’*’, ‘<‘, ... In practice no one in their right mind gives them non-
standard interpretation.
Example: Let = {0,1,+,=} where 0,1 are
constants, + is a binary function and = a predicate.
Let = 9x. x + 0 = 1 Q: Is true in N0 ?
![Page 17: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/17.jpg)
18
An interpretation is given by a structure A structure is given by:
1. A domain to each variable
2. An interpretation of the nonlogical symbols: i.e., Maps each function symbol to a function of the same arity Maps each constant symbol to a domain element Maps each predicate symbol to a predicate of the same arity
3. An assignment of a domain element to each free (unquantified) variable
![Page 18: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/18.jpg)
19
Structures
= 9x. f(x, 0) = 1 Consider the structure S:
Domain: N0
Interpretation: ‘f’ * (multiplication) ‘0’ and ‘1’ are mapped to 0 and 1 in N0
‘=‘ = (equality)
Now, is true in S ?
![Page 19: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/19.jpg)
20
Satisfying structures
Definition: A formula is satisfiable if there exists a structure that satisfies it
Example: = 9x. f(x, 0) = 1 is satisfiable Consider the structure S’:
Domain: N0
Interpretation: ‘0’ and ‘1’ are mapped to 0 and 1 in N0
‘=’ = (equality) ‘f’ + (addition)
is satisfied by S’. S’ is a model of .
![Page 20: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/20.jpg)
21
Two ways to define a theory
We can define a theory
1. The easy, “direct” way, Define the grammar, Assume standard interpretation of the symbols.
2. The hard, “formal” way. Define the signature Restrict possible interpretations with sentences/axioms
Very useful for defining algorithms and proving
general theorems
![Page 21: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/21.jpg)
22
1. Defining a theory: the easy way
Example: The quantifier-free theory of equalities
Grammar: A Boolean combination of predicates of the form “x = y”, where x,y 2 R.
Example: x = y Ç :(y = z ! x = z)
Note that here... we implicitly say that ‘=‘ is the equality predicate, and we predefine the domain of the variables
![Page 22: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/22.jpg)
23
2. Defining a theory: the hard way
Let be a signature
A theory defined over is called a -theory
A -theory restricts the interpretations that we can give the symbols in . How ?
![Page 23: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/23.jpg)
24
2. Definitions...
For a signature :
-formula: a formula over symbols + logical symbols.
A -theory T is defined by a set of -sentences.
![Page 24: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/24.jpg)
25
2. Definitions…
Let T be a -theory
A -formula is T-satisfiable if there exists a structure
that satisfies both and the sentences defining T.
A -formula is T-valid if all structures that satisfy the
sentences defining T also satisfy .
![Page 25: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/25.jpg)
26
2. Theories through axioms
The number of sentences that are necessary for defining a theory might be large or infinite.
Instead, it is common to define a theory through a set of axioms.
The theory is defined by these axioms, and everything that can be inferred from them by a sound
inference system.
![Page 26: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/26.jpg)
27
2. Axioms for some ‘famous’ predicates Let ‘T’ be: (defining ‘=‘):
Example: = ((x = y) Æ :(y = z)) ! :(x = z) Is Á T-valid ?
Every structure that satisfies these axioms, satisfies . Hence is T-valid.
8 x. x = x(reflexivity)
8 x,y. x = y ! y = x (symmetry)
8 x,y,z. x = y Æ y = z ! x = z (transitivity)
![Page 27: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/27.jpg)
28
2. Axioms for some ‘famous’ predicates Let ‘T’ be: (defining ‘<‘)
Example: Á: 8x. 9y. y < x Is Á T-satisfiable?
We will show a model for it. Domain: Z ‘< ‘ <
8x,y,z. x < y Æ y < z → x < z (transitivity)
8x,y. x < y → :(y < x) (anti-symmetry)
![Page 28: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/28.jpg)
29
2. Axioms for some ‘famous’ predicates Let ‘T’ be: (defining ‘<‘)
Example: Á: 8x. 9y. y < x Is Á T-valid?
8x,y,z. x < y Æ y < z → x < z (transitivity)
8x,y. x < y → :(y < x) (anti-symmetry)
We will show a structure to the contrary
Domain: N0
‘<‘ <
![Page 29: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/29.jpg)
30
2. Axioms for some ‘famous’ predicates Let = {‘<‘} Consider the -formula Á: 8x. 9y. y < x Consider the theory T:
Is Á T-valid?
We will show a structure to the contrary Domain: N0
‘<‘ <
8x,y,z. x < y Æ y < z → x < z (transitivity)
8x,y. x < y → :(y < x) (anti-symmetry)
![Page 30: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/30.jpg)
31
Fragments
So far we only restricted the nonlogical symbols. Sometimes we want to
restrict the grammar restrict the allowed logical symbols.
These are called logic fragments.
Examples: The quantifier-free fragment over = {=,+,0,1} The conjunctive fragment over = {=,+,0,1}
![Page 31: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/31.jpg)
32
Fragments
Let = {} (T must be empty: no nonlogical symbols to interpret)
Q: What is the quantifier-free fragment of T ? A: propositional logic
Thus, propositional logic is also a first-order theory. A very degenerate one.
![Page 32: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/32.jpg)
33
Theories
Let = {} (T must be empty: no nonlogical symbols to interpret)
Q: What is T ? A: Quantified Boolean Formulas (QBF)
Example: 8x1 9x2 8x3. x1 → (x2 Ç x3)
![Page 33: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/33.jpg)
34
Some famous theories
Presburger arithmetic: = {0,1,+,=} Peano arithmetic: = {0,1,+,*,=} Theory of reals Theory of integers Theory of arrays Theory of pointers Theory of sets Theory of recursive data structures …
![Page 34: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/34.jpg)
35
Expressiveness of a theory
Each formula defines a language:the set of satisfying assignments (‘models’) are the words accepted by this language.
Consider the fragment ‘2-CNF’formula : ( literal Ç literal ) | formula Æ formulaliteral: Boolean-variable | :Boolean-variable
(x1 Ç :x2) Æ (:x3 Ç x2)
![Page 35: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/35.jpg)
36
Expressiveness of a theory
Now consider a Propositional Logic formula (x1 Ç x2 Ç x3).
Q: Can we express this language with 2-CNF? A: No.
Proof: The language accepted by has 7 words: all assignments
other than x1 = x2 = x3 = F. The first 2-CNF clause removes ¼ of the assignments,
which leaves us with 6 accepted words. Additional clauses only remove more assignments.
![Page 36: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/36.jpg)
37
Expressiveness of a theory
Claim: 2-CNF Á Propositional Logic Generally there is only a partial order between
theories.
Languages defined by L2
Languages defined by L1
L2 is more expressive than L1.
Denote: L1 Á L2
![Page 37: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/37.jpg)
38
The tradeoff
So we see that theories can have different expressive power
Q: why would we want to restrict ourselves to a theory or a fragment ? why not take some ‘maximal theory’…
A: Adding axioms to the theory may make it harder to decide or even undecidable.
![Page 38: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/38.jpg)
39
Example: First Order Peano Arithmetic = {0,1,‘+’, ‘*’, ‘=’} Domain: Natural numbers
Axioms (“semantics”):1. 8 x. (0 x + 1) 2. 8 x, y. (x y) ! (x + 1 y + 1) 3. Induction4. 8 x. x + 0 = x 5. 8 x, y. (x + y) + 1 = x + (y + 1) 6. 8 x. x * 0 = 0 7. 8 x, y. x * (y + 1) = x * y + x
+
*
Undecidable!
These axioms define the semantics of ‘+’
![Page 39: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/39.jpg)
40
Example: First Order Presburger Arithmetic = {0,1,‘+’, ‘*’, ‘=’} Domain: Natural numbers
Axioms (“semantics”):1. 8 x. (0 x + 1) 2. 8 x, y. (x y) ! (x + 1 y + 1) 3. Induction4. 8 x. x + 0 = x 5. 8 x, y. (x + y) + 1 = x + (y + 1) 6. 8 x. x * 0 = 0 7. 8 x, y. x * (y + 1) = x * y + x
+
*
decidable!
These axioms define the semantics of ‘+’
![Page 40: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/40.jpg)
41
Tradeoff: expressiveness/computational hardness. Assume we are given theories L1 Á … Á Ln
More expressiveEasier to decide
UndecidableDecidable
Intractable(exponential)
Tractable(polynomial)
Computational Challenge! LnL1
Our course
![Page 41: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/41.jpg)
42
When is a specific theory useful?
1. Expressible enough to state something interesting.
2. Decidable (or semi-decidable) and more efficiently solvable than richer theories.
3. More expressive, or more natural for expressing some models in comparison to ‘leaner’ theories.
![Page 42: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/42.jpg)
43
Expressiveness and complexity
Q1: Let L1 and L2 be two theories whose satisfiability problem is decidable and in the same complexity class. Is the satisfiability problem of an L1 formula reducible to a satisfiability problem of an L2 formula?
![Page 43: 1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is satisfiable ? Example: Let x 1,x 2 be propositional](https://reader035.vdocument.in/reader035/viewer/2022062407/56649d9f5503460f94a8a1d1/html5/thumbnails/43.jpg)
44
Expressiveness and complexity
Q2: Let L1 and L2 be two theories whose satisfiability problems are reducible to one another. Are L1 and L2 in the same complexity class ?