VU-VFS-2025. Lecture 4 - First Order Theories [0032]
- December 2, 2025
VU-VFS-2025. Lecture 4 - First Order Theories [0032]
- December 2, 2025
1. Signatures and Axioms
- December 2, 2025
1. Signatures and Axioms
- December 2, 2025
Definition 1.1. First Order Theory \(T\) [0033]
- December 2, 2025
Definition 1.1. First Order Theory \(T\) [0033]
- December 2, 2025
A first order theory (FOT) \(T\) is defined by two main components:
- A signature \(\Sigma \) of a set of constant, function, and predicate symbols
- A set of axioms \(\mathcal A\) consisting of closed (i.e. no free variables) formulas over the signature \(\Sigma \)
We say that a formula constructed from only from the contents of the signature \(\Sigma \) is a \(\Sigma \)-formula.
Quiz 1.2. Signatures and Axioms (FOL) [0034]
- December 2, 2025
Quiz 1.2. Signatures and Axioms (FOL) [0034]
- December 2, 2025
Consider a theory withthe following signature:
\[ \Sigma _H : \{R = \{\texttt {taller}\}, C = F = \emptyset \} \]And the axiom:
\[ \forall x.\ \forall y.\ (\texttt {taller}(x, y) \to \neg \texttt {taller}(y, x)) \]Are the following legal \(\Sigma _H\)-formulas?
- \( \exists x.\ \forall y.\ (\texttt {taller}(x, z) \land \texttt {taller}(y, w)) \)
- \( \exists x.\ \forall z.\ \texttt {taller}(x, z) \land \texttt {taller}(\text {joe}, \text {tom}) \)
Solution.
- December 2, 2025
Solution.
- December 2, 2025
- Yes
- No, there are no constants in the signature, so \text {joe} and \text {tom} are not valid terms.
2. Models of Theories
- December 2, 2025
2. Models of Theories
- December 2, 2025
Definition 2.1. Structure & Model of \(T\) (FOT) [0035]
- December 2, 2025
Definition 2.1. Structure & Model of \(T\) (FOT) [0035]
- December 2, 2025
A structure which we denote as:
\[ M \triangleq \langle U, I \rangle \]Is a model of a theory \(T\) (or \(T\)-model) iff:
\[ \forall A \in \mathcal A_T.\ M \vDash A \]where:
- \(U\) is the universe or more commonly the domain
- \(I\) is the interpretation which assigns some meaning to our formula
Quiz 2.2. Models of \(T_H\) [0036]
- December 2, 2025
Quiz 2.2. Models of \(T_H\) [0036]
- December 2, 2025
consider a structure consisting of a universe \(U\) and interpretation \(I\) as follows:
\[ U = \{A, B\} \quad I = \{\texttt {taller} \mapsto \{\langle A, A\rangle , \langle B, B\rangle \}\} \]Are the following models of the theory \(T\) or not:
- Is \(\langle U, I\rangle \) a model of \(T\)
- If we change the interpretation to \[ I = \{\texttt {taller} \mapsto \{\langle A, B\rangle \}\} \] is the structure now a model of \(T\)?
- If we add the following axiom \[ \forall x, y, z.\ (\texttt {taller}(x, y) \land \texttt {taller}(y, z) \to \texttt {taller}(x, z)) \] and we change the interpretation to \[ I = \{\texttt {taller} \mapsto \{\langle A, B \rangle , \langle B, C \rangle \}\} \] then is the structure a model of \(T\)?
Solution.
- December 2, 2025
Solution.
- December 2, 2025
As a reminder we are working with the axiom:
\[ \forall x, y.\ (\texttt {taller}(x, y) \to \neg \texttt {taller}(y, x)) \]- Clearly no, as if we take \(x = A\) and \(y = A\) we have that both \(\texttt {taller}(A, A)\) and \(\texttt {taller}(A, A)\) hold, violating the axiom.
- Here we are chaning or interpretation to just the relation \(\texttt {taller}(A, B)\) holding. In this case the axiom is satisfied as there are no values of \(x\) and \(y\) such that both \(\texttt {taller}(x, y)\) and \(\texttt {taller}(y, x)\) hold. So yes this is a model of \(T\).
- No, as if we take \(x = A\), \(y = B\) and \(z = C\) we have that both \(\texttt {taller}(A, B)\) and \(\texttt {taller}(B, C)\) hold, but \(\texttt {taller}(A, C)\) does not hold (so not in our interpretation for the \(\texttt {taller}\) relationship), violating the axiom.
3. Satisfiability Modulo \(T\)
- December 2, 2025
3. Satisfiability Modulo \(T\)
- December 2, 2025
Definition 3.1. Satisfiable & Valid modulo \(T\) [0037]
- December 2, 2025
Definition 3.1. Satisfiable & Valid modulo \(T\) [0037]
- December 2, 2025
We say that a formula \(F\) is satisfiable modulo \(T\) iff there exists a \(T\)-model \(M\) and a variable assignment \(\sigma \) such that:
\[ M, \sigma \vDash F \]We say that a formula \(F\) is valid modulo \(T\) iff forall \(T\)-models \(M\) and all variable assignments \(\sigma \) we have:
\[ M, \sigma \vDash F \]
Definition 3.2. FOL Validity vs Valid modulo \(T\) [0039]
- December 2, 2025
Definition 3.2. FOL Validity vs Valid modulo \(T\) [0039]
- December 2, 2025
We can compare the two notions by understanding validity in modulo \(T\) as a restriction of validity in FOL to only those models that are \(T\)-models. So the implication of that is that if a formula is valid (true in all models), then its clearly also valid in the subset/restriction to only \(T\)-models. However, the other way around does not hold, since a formula can be true in all \(T\)-models, but false in some non-\(T\)-model. Hence we have the following:
But the other way around does not hold in general:
Quiz 3.3. Satisfiability in FOL vs FOT [0038]
- December 2, 2025
Quiz 3.3. Satisfiability in FOL vs FOT [0038]
- December 2, 2025
Consider some arbitrary first order theory \(T\)
- If a formula is valid in FOL, then is it also valid in modulo \(T\)?
- If a formula is valid modulo \(T\), then is it also valid in FOL?
Solution.
- December 2, 2025
Solution.
- December 2, 2025
- Yes, if its valid in FOL that means its valid in all models which includes those models that are \(T\)-models. Hence its also valid modulo \(T\).
- No, a formula can be valid in all \(T\)-models, but false in some non-\(T\)-model. Hence its not necessarily valid in FOL.
4. Theory of Equality & Congruence
- December 2, 2025
4. Theory of Equality & Congruence
- December 2, 2025
Definition 4.1. Theory of Equality \(T\) [003a]
- December 2, 2025
Definition 4.1. Theory of Equality \(T\) [003a]
- December 2, 2025
The theory of equality \(T_=\) is a first order theory over the signature \(\Sigma _=\) which contains:
\[ \sigma _= : \{=, s\} \]Where \(=\) is a binary relation symbol and \(s\) is any constant function or predicate symbol. The axioms of the theory of equality are:
Quiz 4.2. Theory of Equality [003b]
- December 2, 2025
Quiz 4.2. Theory of Equality [003b]
- December 2, 2025
Consider the universe:
\[ U = \{\alpha , \beta \} \]which of the following interpetations of \(=\) are allowd by the axioms of \(T_=\):
- \(I(=) \triangleq \{\langle \alpha , \beta \rangle , \langle \beta \alpha \rangle \}\)
- \(I(=) \triangleq \{\langle \alpha , \alpha \rangle , \langle \beta , \beta \rangle \}\)
- \(I(=) \triangleq \{\langle \alpha , \alpha \rangle , \langle \alpha , \beta \rangle , \langle \beta , \alpha \rangle , \langle \beta , \beta \rangle \}\)
Solution.
- December 2, 2025
Solution.
- December 2, 2025
- No, violates reflexivity axiom since neither \(\alpha = \alpha \) nor \(\beta = \beta \) are in the interpretation
- Yes, satisfies all axioms of equality
- Yes, satisfies all axioms of equality
Definition 4.3. (Left & Right) Congruence Relations (FOT) [003c]
- December 2, 2025
Definition 4.3. (Left & Right) Congruence Relations (FOT) [003c]
- December 2, 2025
In the most general sense we say that a relation \(R\) over a set \(A\) is a congruence with respect to a function \(f : A^n \to A\) if for all \(a_1, \ldots , a_n, b_1, \ldots , b_n \in A\) such that \(a_i\ R\ b_i\) for all \(1 \leq i \leq n\) we have:
\[ f(a_1, \ldots , a_n)\ R\ f(b_1, \ldots , b_n) \]if we denote \(\overline x\) as a vector of elements \(x_1, \ldots , x_n\) we can rewrite this more succinctly as:
\[ \forall \overline a, \overline b \in A^n.\ (\forall i.\ a_i\ R\ b_i) \to f(\overline a)\ R\ f(\overline b) \]In the case of first order theories we can then instantiate \(R\) with things like equality or other relations defined in the theory. Additionally we can \(f\) represent a function or predicate symbol from the signature of the theory. In the case of binary functions or predicates we can also define left and right congruence as follows:
- A relation \(R\) is a left congruence with respect to a binary function or predicate \(f : A \times A \to A\) if for all \(a, b, c \in A\) such that \(a\ R\ b\) we have: \[ f(a, c)\ R\ f(b, c) \]
- A relation \(R\) is a right congruence with respect to a binary function or predicate \(f : A \times A \to A\) if for all \(a, b, c \in A\) such that \(a\ R\ b\) we have: \[ f(c, a)\ R\ f(c, b) \]
Quiz 4.4. Function & Predicate congruence [003d]
- December 2, 2025
Quiz 4.4. Function & Predicate congruence [003d]
- December 2, 2025
Consider the universe:
\[ U = \{a, b, c\} \]and the interpretation:
\[ I(=) \triangleq \{\langle a, a \rangle , \langle a, b \rangle , \langle b, a \rangle , \langle b, b \rangle , \langle c, c \rangle \} \]- Does the interpetation \(I(=)\) satisfy the axioms of equality?
-
Which interpretations for a function \(f\) satisfy the axioms of congruence?
- \(I(f) \triangleq \{b \to a, a \to c, c \to c\}\)
- \(I(f) \triangleq \{b \to b, a \to b, c \to b\}\)
- \(I(f) \triangleq \{b \to a, a \to b, c \to c\}\)
Solution.
- December 2, 2025
Solution.
- December 2, 2025
- Yes, the interpretation satisfies the axioms of equality
-
Going through them one by one:
- No, because \(f(a) = c\) and \(f(b) = a\) but \(a\ I(=)\ b\) yet \(c\ not\ I(=)\ a\)
- Yes, because \(f(a) = b\) and \(f(b) = b\) and \(a\ I(=)\ b\) thus \(b\ I(=)\ b\), similarly for \(c\)
- Yes, because \(f(a) = b\) and \(f(b) = a\) and \(a\ I(=)\ b\) thus \(b\ I(=)\ a\), similarly for \(c\)
5. Theory of Peano Arithmetic
- December 2, 2025
5. Theory of Peano Arithmetic
- December 2, 2025
Definition 5.1. Theory of Peano Arithmetic [003e]
- December 2, 2025
Definition 5.1. Theory of Peano Arithmetic [003e]
- December 2, 2025
Peano Arithmetic (PA) is a first order theory over the signature \(\Sigma _{PA}\) which contains:
\[ \Sigma _{PA} : \{0, S, +, \times , =\} \]Where \(0\) is a constant symbol representing zero, \(S\) is a unary function symbol representing the successor function, \(+\) and \(\times \) are binary function symbols representing addition and multiplication respectively, and \(=\) is a binary relation symbol representing equality. The axioms of Peano Arithmetic are:
Quiz 5.2. Theory of Peano Arithmetic [003f]
- December 2, 2025
Quiz 5.2. Theory of Peano Arithmetic [003f]
- December 2, 2025
Are the following well-formed \(T_{\text {PA}} formulae?\)
- \(x + y = 1 \land f(x) = 1 + 1\)
- \(\forall x.\ \exists y.\ \exists z.\ x + y = 1\land z \times x = 1 + 1\)
- \(2x = y\)
Solution.
- December 2, 2025
Solution.
- December 2, 2025
- No, the theory of Peano Arithmetic does not include function symbols like \(f\), nor does it include numerals like \(1\) or \(2\). All terms must be constructed using the constant symbol \(0\), the successor function \(S\), and the function symbols \(+\) and \(\times \).
- Yes, this is a well-formed formula. It uses only the symbols and constructs allowed in the theory of Peano Arithmetic.
- No, this is not a well-formed formula. The expression \(2x\) is not a valid term in Peano Arithmetic, as numerals like \(2\) are not part of the language. Terms must be built using \(0\), \(S\), \(+\), and \(\times \). A valid way to express the same idea would be \(S(S(0)) \times x = y\). Or if we replace \(S\) with \(1\) then we could do \((1 + 1) \times x = y\)
6. Theory of Rationals & Integers
- December 2, 2025
6. Theory of Rationals & Integers
- December 2, 2025
Definition 6.1. Theory of Rationals \(T_{\mathbb {Q}}\) [003i]
- December 2, 2025
Definition 6.1. Theory of Rationals \(T_{\mathbb {Q}}\) [003i]
- December 2, 2025
The theory of rationals \(T_{\mathbb {Q}}\) is a first-order theory over the signature \(\Sigma _{\mathbb {Q}}\) which contains:
\[ \Sigma _{\mathbb {Q}} : \{0, 1, +, -, =, \geq \} \](Axioms ommitted for brevity.)
Some important properties of \(T_{\mathbb {Q}}\) are:
- Full theory is decidable but doubly exponential.
- Conjunctive quantifier-free fragment is efficiently decidable (polynomial time).
- \(T_{\mathbb {Q}}\) is the basis for arithemtic reasoning in SMT solvers such as Z3.
- In practice the simplex algorithm is used.
Definition 6.2. Theory of Presburger Arithmetic [003h]
- December 2, 2025
Definition 6.2. Theory of Presburger Arithmetic [003h]
- December 2, 2025
Presburger Arithmetic (PA) is a first order theory over the signature \(\Sigma _{\mathbb {N}}\) which contains:
\[ \Sigma _{\mathbb {N}} : \{0, 1, +, =\} \]Where \(0\) and \(1\) are constant symbols representing zero and one respectively, \(+\) is a binary function symbol representing addition, and \(=\) is a binary relation symbol representing equality. The axioms of Presburger Arithmetic are:
Some important properties of \(T_{\mathbb {N}} are\):
- Validity in quantifer-free Presburger Arithmetic is decidable.
- Validity in full Presburger Arithmetic is decidable.
- Validity in Presburger Arithmetic has a super exponential complexity \(O(2^{2^n})\)
- \(T_{\mathbb {N}}\) is complete, i.e. \[ \forall F.\ T_{\mathbb {N}} \models F \lor T_{\mathbb {N}} \models \neg F \]
Quiz 6.3. Theory of rationals \(T_{\mathbb {Q}}\) [003k]
- December 2, 2025
Quiz 6.3. Theory of rationals \(T_{\mathbb {Q}}\) [003k]
- December 2, 2025
Consider the following formula:
\[ \exists x.\ (1 + 1) x = 1 + 1 + 1 \]- Is this formula valid in \(T_{\mathbb {Q}}\)
- Is this formula valid in \(T_{\mathbb {Z}}\)
Solution.
- December 2, 2025
Solution.
- December 2, 2025
- Yes, this formula is valid in \(T_{\mathbb {Q}}\). In the theory of rationals, we can find a rational number \(x = \frac {3}{2}\) that satisfies the equation \((1 + 1) x = 1 + 1 + 1\). Therefore, there exists an \(x\) in the rationals that makes the equation true.
- No, this formula is not valid in \(T_{\mathbb {Z}}\). In the theory of integers, there is no integer \(x\) that satisfies the equation \((1 + 1) x = 1 + 1 + 1\), since \(\frac {3}{2}\) is not an integer. Thus, there does not exist an integer \(x\) that makes the equation true.
7. Theory of Data structures
- December 2, 2025
7. Theory of Data structures
- December 2, 2025
Definition 7.1. Theory of Arrays [003l]
- December 2, 2025
Definition 7.1. Theory of Arrays [003l]
- December 2, 2025
The theory of arrays is a first-order theory that models arrays as functions from indices to values. Its signature includes:
\[ \Sigma _A \triangleq \{- [ - ], \langle - \triangleleft - \rangle , =\} \]where:
- \(-[ - ]\): read operation, which takes an array and an index and returns the value at that index.
- \(\langle - \triangleleft - \rangle \): write operation, which takes an array, an index, and a value, and returns a new array with the value at the specified index updated.
- \(=\): equality relation, which checks if two arrays are identical.
The axioms of the theory of arrays are:
Quiz 7.2. Theory of arrays \(T_A\) [003m]
- December 2, 2025
Quiz 7.2. Theory of arrays \(T_A\) [003m]
- December 2, 2025
Which of the following formula is valid/satisfiable/unsatisfiable ?
- \(a[3] = 2\)
- \(a \langle 3 \triangleleft 5 \rangle [3] = 5\)
- \(a \langle 3 \triangleleft 5 \rangle [3] = 3\)
- \(a[3] = 2\land a \langle 3 \triangleleft 5 \rangle [3] = 5\)
Solution.
- December 2, 2025
Solution.
- December 2, 2025
- This formula is satisfiable. For example, if we have an array \(a\) such that \(a[3] = 2\), then the formula holds true.
- This formula is valid. According to the Read-Over-Write axiom, when we write a value to an index in an array and then read from that same index, we get the value we just wrote. So regardless of the initial contents of array \(a\), after performing the write operation \(a \langle 3 \triangleleft 5 \rangle \), reading from index \(3\) will always yield \(5\) hence making it always true (valid).
- This formula is unsatisfiable. According to the Read-Over-Write axiom, when we write a value to an index in an array and then read from that same index, we get the value we just wrote. Therefore, after performing the write operation \(a \langle 3 \triangleleft 5 \rangle \), reading from index \(3\) will always yield \(5\), making it impossible for it to equal \(3\).
- This formula is satisfiable. For example, if we have an array \(a\) such that \(a[3] = 2\), then after performing the write operation \(a \langle 3 \triangleleft 5 \rangle \), reading from index \(3\) will yield \(5\). Thus, both parts of the conjunction can be true simultaneously though are not valid in all interpretations.