1 introduction

Formal verification is about rigorously proving that a computer system satisfies a specification.

  1. define a mathematically rigorous notion of a system satisfying a specification
  2. use combination of automated tools and human effort to construct the proof

Theorem provers:

1.1 transition system

A transition system M = (S, I, r, A):

\bar r = \{(s, s') : \exists_a \in A (s, a, s') \in r\}

1.1.1 traces

Traces(M) is the set of all traces of M. A trace is a sequence from the initial state to any intermediate state.

Reach(M) = \{s_n : \exists_{n} \exists(s_0, a_0, s_1, a_1, \cdots, s_n\} \in Traces(M)\} are reachable states of M.

Reach(M) = \bar r^*[I]

1.1.2 post

If X \subseteq S, post(X) = \bar r[X]

\bigcup_{n \ge 0} post^n(I) = Reach(M)

1.1.3 invariant and inductive invariant

1.2 sequential circuits

Encoding finite transition systems using bits with sequential circuits. If we pick n \ge \log_2|S| and m \ge \log_2|A|:

1.2.1 boolean function representation

Since r \subseteq \{0, 1\}^n \times \{0, 1\}^m \times \{0, 1\}^n, then ((s_1, \cdots, s_n), (a_1, \cdots, a_m), (s'_1, \cdots, s'_n)) \in r can be represented as a propositional formula with variables above that is true when the tuple belongs to r.

Let p^1 = p and p^0 = \neg p for some propositional formula p. We represent r in the disjunctive normal form:

\bigvee_{((v_1, \cdots, v_n), (u_1, \cdots, u_m), (v'_1, \cdots, v'_n)) \in r} (\bigwedge_{1 \le i \le n}s_i^{v_i} \land \bigwedge_{1 \le i \le m}a_i^{u_i} \land \bigwedge_{1 \le i \le n}(s'_i)^{v'_i})

1.2.2 environment

An environment e is a partial map from propositional variables to \{0, 1\}. For \bar p = (p_1, \cdots, p_n) and \bar v = (v_1, \cdots, v_n) we denote [\bar p \to \bar v] the environment given by e(p_i) = v_i.

\llbracket F \rrbracket_e = 1 \iff e \mid= F meaning F is true under the environment e.

1.2.3 satisfiability

Formula F is satisfiable iff there exists e such that e \mid= F. Otherwise F is unsatisfiable. SAT determines satisfiability given a formula.

1.2.4 free variables

Free variables are propositional variables in a formula except the quantified ones. Free variables of a formula are denoted by FV(F). We denote quantification by F[c := G] where every occurrence of c in F is replaced with G.

1.2.5 validity and equivalence

A formula is valid iff for all e, e \mid= F. F is valid iff \neg F is unsatisfiable.

Formulas F and G are equivalent iff for every e, e \mid= F \iff e \mid= G. F and G are equivalent iff F = G is valid.

1.2.6 representation

So a sequential circuit is C = (\bar S, Init, R, \bar x, \bar a) where

The transition system for C is (S = \{0, 1\}^n, I, r, A = \{0, 1\}^m)

1.2.7 checking invariants

To check whether Inv is an inductive invariant we check the negation of conditions.

  1. Init \land \neg Inv
  2. Inv \land R \land \neg Inv[\bar s := \bar s']

If these SAT queries return unsat, we know Inv is an inductive invariant.