backend module¶
- backend.IMC(S, T, P, interpolator=<function binary_interpolant>, print_info=True)[source]¶
Interpolating Model Checking
As specified at S. Fulvio Rollini, “Craig Interpolation and Proof Manipulation: Theory and Applications to Model Checking,” Università della Svizzera Italiana. p. 38. available at https://verify.inf.usi.ch/sites/default/files/RolliniPhDThesis.pdf
A property to be verified is encoded as a formula \(P\) , so that the system is safe if the error states where \(¬P\) holds are not reachable from \(S\).
Verifying that the system satisfies \(P\) reduces to prove that \(P\) is an inductive invariant property:
\[S ⊨ P\qquad P ∧ T ⊨ P'\]If (i) the initial states satisfy \(P\) and, (ii) assuming \(P\) holds, it also holds after applying the transition relation, then \(P\) holds in all reachable states. When the inductiveness of \(P\) cannot be directly proved, it might be possible to show that another formula \(\hat P\), stronger than \(P ( \hat P ⊨ P )\), is an inductive invariant, from which \(P\) would follow as a consequence; this algorithm, which combines interpolation and bounded model checking (BMC), is based on iteratively building such a \(\hat P\).
- Parameters
S (predicate.Predicate) –
T (predicate.Predicate) –
P (predicate.Predicate) –
interpolator (Callable[[pysmt.fnode.FNode, pysmt.fnode.FNode], pysmt.fnode.FNode]) –
print_info (bool) –
- backend.PDR(I, T, P, get_currently_known_invariant=<function <lambda>>, strengthen=<function <lambda>>, lift=<function _lift>, k_init=1, k_max=inf, pd=True, inc=<function <lambda>>, print_info=True)[source]¶
Iterative-Deepening k-Induction with Property Direction.
As specified at D. Beyer and M. Dangl, “Software Verification with PDR: Implementation and Empirical Evaluation of the State of the Art” arXiv:1908.06271 [cs], Feb. 2020, Accessed: Mar. 05, 2022. [Online]. Available https://arxiv.org/abs/1908.06271.
- Parameters
print_info – Whether info about the steps should be printed.
k_init (
int) – the initial value \(≥1\) for the bound kk_max (
int) – an upper limit for the bound kinc (
Callable[[int],int]) – a function \(ℕ → ℕ\) such that \(∀n ∈ ℕ: \inc(n) > n\)TS – Contains predicates defining the initial states and the transfer relation
P (
Predicate) – The safety propertyget_currently_known_invariant – used to obtain the strongest invariant currently available via a concurrently running (external) auxiliary-invariant generator
pd (
bool) – boolean flag pd (reminding of “property-directed”) is used to control whether failed induction checks are used to guide the algorithm towards a sufficient strengthening of the safety property P to prove correctness; if pd is set to false, the algorithm behaves exactly like standard k-induction.lift –
Given a failed attempt to prove some candidate invariant \(Q\) by induction, the function lift is used to obtain from a concrete counterexample-to-induction (CTI) state a set of CTI states described by a state predicate C. An implementation of the function \(k ∈ ℕ, \Inv ∈ ℕ × (S → 𝔹) × (S → 𝔹) × S → (S → 𝔹)\) and \(C = \lift(k, \Inv , Q, s)\), lift needs to satisfy the condition that for a CTI \(s ∈ S\) where \(S\) is the set of program states, the following holds:
\[C(s) ∧ \left( ∀s_n ∈ S: C(s_n) ⇒ \Inv(s_n) ∧ \displaystyle\bigwedge_{i=n}^{n+k−1} (Q(s_i) ∧ T(s_i ,s_{i+1})) ⇒ ¬Q(s_{n+k}) \right)\]which means that the CTI s must be an element of the set of states described by the resulting predicate C and that all states in this set must be CTIs, i.e., they need to be k-predecessors of \(¬Q\)-states, or in other words, each state in the set of states described by the predicate \(C\) must reach some \(¬Q\)-state via \(k\) unrollings of the transition relation \(T\).
strengthen – The function strengthen: \(ℕ × (S → 𝔹) × (S → 𝔹) → (S → 𝔹)\) is used to obtain for a k-inductive invariant a stronger k-inductive invariant, i.e., its result needs to imply the input invariant, and, just like the input invariant, it must not be violated within k loop iterations and must be k-inductive.
I (predicate.Predicate) –
T (predicate.Predicate) –
- Return type
bool|Status- Returns
True if P holds, Status.UNKNOWN if k > k_max , False otherwise.
- class backend.Status(value)[source]¶
Bases:
enum.EnumAn enumeration.
- SAFE = 2¶
- SAT = 5¶
- UNKNOWN = 7¶
- UNSAFE = 1¶
- UNSAFE1 = 3¶
- UNSAFE2 = 4¶
- UNSAT = 6¶
- backend.get_assignment_as_formula(F)[source]¶
If formula \(F\) is satisfiable, returns \(\displaystyle\bigwedge_{x_i ∈ \operatorname{vars}(F)} x_i ≡ v_i\), such that \(F\) is true if each \(x_i\) takes value \(v_i\).
- Return type
None|FNode- Parameters
F (pysmt.fnode.FNode) –
- backend.get_assignment_as_formula_from_model(M)[source]¶
- Return type
None|FNode- Returns
\(\displaystyle\bigwedge_{x ∈ \operatorname{vars}(M)}\left( x ≡ ⟦x⟧_M \right)\)
- Parameters
M (pysmt.solvers.solver.Model) –
- backend.get_base_case(k, I, T, P)[source]¶
- Return type
FNode- Returns
\(I(0) ∧ \displaystyle\bigvee_{n=0}^{k-1}\left(\displaystyle \bigwedge_{i=0}^{n-1} T(i,i+1) ∧ ¬P(n) \right)\)
- Parameters
k (int) –
I (predicate.Predicate) –
T (predicate.Predicate) –
P (predicate.Predicate) –
- backend.get_k_induction(I, T, P, k)[source]¶
Returns the K-Induction encoding at step K. The forumla is k-inductive if it’s unsat.
- backend.get_simple_path(I, T, P, k)[source]¶
Simple path constraint for k-induction: each time encodes a different state
- backend.get_step_case(k, T, P)[source]¶
We assume this means that the forumla returned is an assertion over any k sequenece of states.
- Return type
FNode- Returns
\(\displaystyle\bigvee_{i=n}^{n+k-1} \left( P(i) ∧ T(i,i+1) \right) ∧ ¬P(n)\) with the idea that making \(n=0\) in pySMT is equivalent to the formula above.
- Parameters
k (int) –
T (predicate.Predicate) –
P (predicate.Predicate) –