§ IC3 Invariants
- We exposit based on 'SAT based model checking without unrolling', while following intuitions from IC3: where monolithic and incremental meet.
- Maintain a set of frames Fi.
- Each Fi witnesses that all vertices in all i-length paths from the initial state are safe.
- Furthermore, each Fi⊆Fi+1, so they are a sequence of larger and larger sets of states.
- Also, δ(Fi)⊆Fi+1, where δ is the transition relation. This says that the image of Fi lives in Fi+1.
- Furthermore, each Fi⊆P (they are all subsets of the safety property).
- Finally, we have that I⊆F[0], so 0-step reachability is an overapproxiomation of the initial state.
§ Algorithmic Loop
§ Major Iteration (k > 0)
§ (A) Introduce New Frame
- We want to create a frame F[k+1] that is an overapproxiation of k+1 step reachability.
- Optimisitcally, we want to set F[k+1]=P, the full safety property (largest overapproximation available).
- We check if δ(F[k])⊆P.
§ (A.Subset) Yes, δ(F[k])⊆P
- We already know that F[k]⊆P, and now since δ(F[k])⊆P, we can set F[k+1]=P.
§ (A.Subset.Shrink) Shrink Overapproximations
- We know that a frame F[i] is comprised of its clauses c[i][1],c[i][2],….
- The set of x∈F[i] is given by the intersection of the sets x∈c[i][1] and x∈c[i][2] and x∈c[i][3] and so on.
- Thus, each clause c[i][l] can be thought of as a superset of F[i], where F[i]⊆c[i][l], and F[i]=∩lc[i][l].
- Now, for every i in 0≤i≤k (we will be indexing into i+1, so i only goes upto k):
- For every over-approximate good region c[i][l]∈F[i], we see if δ(F[i])⊆c[i][l]. (So we check the formula F[i]∧T⟹c[i][l]).
- If this is the case, then we intersect F[i+1] with c[i][l], so we add a cons-cell F[i+1]←c[i][l]::F[i+1].
- At the end of (A.A), we have shrunk the frames as much as possible, given the information we have at the current point in time.
- If we find that any of the F[i]=F[i+1], we are done, an we have found an inductive invariant.
§ (A.NotSubset) No, δ(F[k])⊊P
- In this case, we have found a state s∈F[k] such that δ(s)inP.
- This state has a path of length 1 that violates P.
- We now try to find the largest i in 0≤i≤k, such that s is inductive relative to it?
- TODO: why do we want the largest i and not the smallest i?
- That is, what is the latest timestep at which we can ban state s forever?
- Logically, we want to check that ¬s∧F∧T⟹¬s′.
- As sets, we want to check that sinδ(F[i]−s).
§ (A.NotSubset.NoIndInvariant) No i such that s∈δ(F[i]−s)
- Suppose no such i exists. Therefore, in particular, this does not work for i=0.
- This tells us that s∈δ(F[0]=I−s), and that therefore, s is reachable from I in one step.
- We are done, we have found a path from I to s in 1 step, where δ(s) is bad, so we have found a 2-step path from I to a bad state.
- Output
BAD
.
§ (A.NotSubset.FoundIndIvariant) Exists i such that s∈δ(F[i]−s)
§ If we find such an i, then i≥k−2 or larger.
- Proof by contradiction. First suppose i=k−2, similar proof holds if i<k−2 with some index juggling.
- Thus, we have that s∈δ(F[k−2]−s).
- Thus, there is some predecessor t∈F[k−2] such that t=s and δ(t)=s.
- Then, s must be a F[k−1] state (each F[k−1] is a overappox. of image of F[k−2]).
- Thus δ(s) must be in F[k], which contradicts the fact that F[k] is safe!
§ Continuing exposition: Found i such that s∈δ(F[i]−s)
- Let G≡U−s be the good set, where U is the universe of all states.
- We have found some i such that s∈δ(F[i]−s).
- Now, since each F[j≤i]⊆F[i], we know that δ(F[j]−s)⊆δ(F[i]−s), so we know that s∈δ(F[j]−s) for all j≤i.
- Also, since we know that this is an inductive invariant relative to F[i], we can also adjoin F[i+1]←G::F[i+1].
- This now cuts away the state s from the frames, by the addition of the good set G such that sinG.
- FOOTNOTE: the good set G may be a relative invariant for higher j′>i, so in practice, we try to push G as far along as it will go.
§ (A.NotSubset.FoundIndIvariantGeneralized) Found i such that s∈δ(F[i]−s), but generalized
- If we feel fancy, we can generalize the good set G to a smaller G′⊆G, which is still a relative invariant.
- That is: I⊆G, and δ(F[i]∩G)⊆G.
- We now claim that we can refine F[0≤j≤i]←G::F[j].
- Why? We can prove this by induction.
- First, by assumption, we know that I⊆G (why??) (I think, we need to check this when building a relative invariant). so it is safe to update F′[0]←G::F[0].
- Now, exactly as previously, for all j≤i, since F[j]⊆F[i], we must have that δ(F[j]∩G)⊆δ(F[i]∩G)⊆G
- since F[0] can be refined to F′[0]≡F[0]∩G, we must have that δ(F′[0])=δ(F[0]∩G)⊆G, and so we can refine F′[1]≡F[1]∩G. Continuing this way, we see that for all j≤i, the refinement holds.
- Now, we want to see if this F[i] refinement actually bans the state s at F[k].
§ A.NotSubset.FoundIndInvariantGeneralized.CutOutS: i=k−1 or i=k, so we cut out s from F[k]
- Suppose i=k or i=k−1. In this case, we will have conjoined a good set G to F[k]. Subsequent queries either show that δ(F[k])⊆P, or found a different counterexample than s∈F[k], since we know that s∈G and F[k]⊆G.
§ A.NotSubset.FoundIndInvariantGeneralized.RecurseToCutOutS: i<k−1, so we recurse.
- It is possible that i<k−1, so s is still an F[k] state that we have not successfully banned, but we have banned it from F[i]. (TODO: Why is this even useful?)
- Consider: Why is ¬s inductive relative to F[i], but not relative to F[k]?
- There must be a predecessor t=s such that δ(t)=s, and tinF[i], t∈F[i+1], so that s=δ(t)∈δ(F[i+1]).
- If i=0, then t may have an I state as a predecessor, in which case we have found a bad path (?).
- On the other hand, if i>0, then because each F[j] is an overapproxmation of j step reachability, G≡U−t must be relative to at least F[i−1]? (TODO: think??)
- So, we recur on t, and we treat t as a bad state which we are trying to ban from F[i], eliminating t at F[i+1].
- We keep recursing until we manage to show that ¬s is in fact inductive relative to F[k].