FOL has predicates and functions. Their meaning is constrained through axioms,
To prove whether a property holds, we can proceed with:
Example FOL formula:
(\forall_x\exists_y R(x, y)) \land \\ (\forall_x\forall_y(R(x, y) \implies \forall_z R(x, f(y, z)))) \land \\ (\forall_x (P(x) \lor P(f(x, a)))) \implies \\ \forall_x\exists_y (R(x, y) \land P(y))
A signature (language) of FOL system is \mathcal Z a countable set of function symbols (constants are functions with arity 0 (ar(c) = 0)) and predicate symbols,
A first order interpretation is I = (D, e) where D \ne \emptyset and e maps constants, function and predicate symbols as follows:
We define \llbracket F \rrbracket_I \in \{0, 1\} to denote whether F is true or false.
An equivalent representation of a formula where only \lor and \land are used as propositional connectives and all negations can appear only in front of literals/predicates. We replace \iff, \implies etc with \lor and \land. Then we push all \neg down to literals/predicates using DeMorgan’s.
In a formula that is in negation normal form, replace a subformula \exists_y F(x_1, \cdots, x_n, y) with F(x_1, \cdots, x_n, g(x_1, \cdots, x_n)) where g is the Skolem function which takes as arguments all FV of the subformula.
We can transform a formula by putting all quantifiers in order on the outside of a formula.
Simple
\frac{C_1 \lor L \quad \neg L \lor C_2}{C_1 \lor C_2}
With instantiation
\frac{\frac{C_1' \lor L'}{C_1 \lor L} \quad \frac{\neg L'' \lor C_2''}{\neg L \lor C_2}}{C_1 \lor C_2}
To check if we can find a substitution to make L' and L'' identical we can use unification which has a linear time algorithm.
A model of a formula is its interpretation that makes a formula true.
We denote the domain as D and n-ary relations as r \subseteq D^n.
We look for substructures (sub-interpretations) (D', \alpha') of (D, \alpha) such that
D' defines a substructure iff it is closed under the interpretations of all function symbols. If a set of universal FOL formulas is true in a structure, it is true in all substructures.
Let \mathcal L be the language and \mathcal L_F \subseteq \mathcal L be the function symbols
\begin{aligned} D_0 &= \emptyset \\ D_{i+1} &= \bigcup_{f \in \mathcal L_F} \{\alpha(f)(x_1, \cdots, x_n) : x_1, \cdots, x_n \in D_i\} \\ D^* &= \bigcup_{i \ge 0} D_i \\ \end{aligned}
D^* is the domain of the smallest substructure of (D, \alpha). It is countable.
A formula containing no variables. GT_{\mathcal L} is the set of all ground terms in language \mathcal L
D^* = \{\llbracket t \rrbracket^\alpha : t \in GT_{\mathcal L}\}
GT^{i+1} = \{f(t_1, \cdots, t_n) : f \in \mathcal L \land t_1, \cdots, t_n \in GT^i\} with GT^0 = \emptyset.
Given a language \mathcal L we define an interpretation (GT_{\mathcal L}, \alpha_H), if there are no constants we add a new one to \mathcal L. \alpha_H(f)(t_1, \cdots, t_n) = f(t_1, \cdots, t_n). \alpha_H(R) = \{(t_1, \cdots, t_n) : (\llbracket t_1 \rrbracket^\alpha, \cdots, \llbracket t_n \rrbracket^\alpha) \in \alpha(R)\}
A set of FOL formulas is unsatisfiable iff for its skolemization there is a finite subset of ground instances which resolution derives empty clause.
Given a program and a specification how to express program correctness as a verification condition (a formula implying that program satisfies the specification)? Programs are formulas. Specifications are formulas.
An example specification is x > 0 \implies (x' > 2 \land y' > 12). We express that the program satisfies the specification as relation subset:
\{((x, y), (x', y')) : x' = x + 2 \land y' = x + 12\} \subseteq \{((x, y), (x', y')) : x > 0 \implies (x' > 2 \land y' > 12)\}
Which reduces to
x' = x + 2 \land y' = x + 12 \implies (x > 0 \implies (x' > 2 \land y' > 12))
Transforms:
Alternative syntax:
command c | \rho(c) |
---|---|
x = t | \{((x_1, \cdots, x_i, \cdots, x_n), (x_1, \cdots, x_i', \cdots, x_n)) : x_i' = t\} |
c_1;c_2 | \rho(c_1) \circ \rho(c_2) |
\text{if}(*)\ c_1\ \text{else}\ c_2 | \rho(c_1) \cup \rho(c_2) |
assume(F) | \Delta_{\{\bar x : F\}} |