Decision Procedures for Flat Array Properties F. Alberti 1 , 3 , S. Ghilardi 2 , N. Sharygina 1 1 University of Lugano, Switzerland 2 University of Milan, Italy 3 Verimag, Grenoble, France SMT July 17, 2014 Talk based on the paper published at TACAS, 2014.
Context: quantified fragments of array theories Many applications: Properties of the heap Checking user provided assertions Parameterized systems ⇒ Verifying array programs: CEGAR-based approaches for array programs [AlbertiBG + 12] Accelerations of relations over arrays [AlbertiGS13] F. Alberti Decision Procedures for Flat Array Properties 1 / 21
Accelerations of relations over arrays l I τ 0 l I τ 0 l L ✔ Decision Acceleration τ + τ 1 l L Procedure 1 τ 2 l L τ 2 ✘ τ 2 l E l E F. Alberti Decision Procedures for Flat Array Properties 2 / 21
Accelerations of relations over arrays l I τ 0 l I τ 0 l L ✔ Decision Acceleration τ + τ 1 l L Procedure 1 τ 2 l L τ 2 ✘ τ 2 l E l E ✔ Accelerations of a class of relation over arrays is definable via ∃ ∗ ∀ ∗ -formulæ [AlbertiGS13] � Accelerations might be outside known decidable fragments [BradleyMS06, HabermehlIV08, GedM09]. F. Alberti Decision Procedures for Flat Array Properties 2 / 21
Accelerations of relations over arrays i ′ = i + ¯ a ′ = store ( a , i, t ( a [ i ])) τ := G ( i, a [ i ]) ∧ k ∧ ⇓ i ≤ j < i + ¯ � � ∀ j. k · y ∧ D ¯ k ( j − i ) → G ( j, a ( j ) ) ∧ τ + := ∃ y > 0 . i ′ = i + ¯ k · y ∧ a ′ ( j ) = U ( i, j, y, a ( j ) ) � � ∀ j. F. Alberti Decision Procedures for Flat Array Properties 3 / 21
Quantified fragments of array theories Related work Theory of arrays: “base” theory T + free functions a Fragment of interest: ϕ := ∃ c ∀ i ψ ( c , i , a ( t ) ) F. Alberti Decision Procedures for Flat Array Properties 4 / 21
Quantified fragments of array theories Related work Theory of arrays: “base” theory T + free functions a Fragment of interest: ϕ := ∃ c ∀ i ψ ( c , i , a ( t ) ) In general, undecidable If constrained, two main strategies to show decidability: 1 Instantiation-based 2 Automata-based F. Alberti Decision Procedures for Flat Array Properties 4 / 21
Quantified fragments of array theories Related work Bradley et al. “What’s decidable about arrays?”, VMCAI 2006. Array property: ϕ := ∀ i .F ( i ) → G ( a ( i ) ) F ( i ) is a conjunction of atoms of the kind i ≤ j , i ≤ t , t ≤ i I. Identify an index set I II. Instantiate i over I to obtain a quantifier-free ψ 1 ∧ · · · ∧ ψ n III. Standard theory-combination approaches on ψ 1 ∧ · · · ∧ ψ n Complexity: NExpTime (NP if we fix the number of index variables) F. Alberti Decision Procedures for Flat Array Properties 5 / 21
Quantified fragments of array theories Related work Habermehl et al. “A Logic of Singly Indexed Arrays”, LPAR 2008. ϕ := ∀ i .F ( i ) → G ( i , a ( i + ¯ k )) No disjunctions in G Atoms are difference logic constraints (with equations modulo ¯ k ) I. Translate ϕ into a FCADBM 1 A ϕ II. Check the emptiness of L ( A ϕ ) Complexity: unknown 1 Deterministic flat counter automata with difference bound transition rules F. Alberti Decision Procedures for Flat Array Properties 6 / 21
Quantified fragments of array theories Our contribution wrt related work APF SIL
Quantified fragments of array theories Our contribution wrt related work Presburger APF SIL
Quantified fragments of array theories Our contribution wrt related work Presburger + exp Presburger APF SIL Real Arithmetic
Quantified fragments of array theories Our contribution wrt related work Presburger + exp Flat Array Properties Presburger APF SIL Real Arithmetic F. Alberti Decision Procedures for Flat Array Properties 7 / 21
Our contribution Flat Array Properties ϕ := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) a ( t ) allowed only if t is a variable F. Alberti Decision Procedures for Flat Array Properties 8 / 21
Our contribution Flat Array Properties ϕ := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) a ( t ) allowed only if t is a variable Mono-sorted theory: T ∪ { a 1 , . . . , a n } | i | = 1 Requirement: T -decidability of ∃ ∗ ∀∃ ∗ -formulæ Complexity: quadratic instance of a ∃ ∗ ∀∃ ∗ T -satisfiability problem F. Alberti Decision Procedures for Flat Array Properties 8 / 21
Our contribution Flat Array Properties ϕ := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) a ( t ) allowed only if t is a variable Mono-sorted theory: T ∪ { a 1 , . . . , a n } | i | = 1 Requirement: T -decidability of ∃ ∗ ∀∃ ∗ -formulæ Complexity: quadratic instance of a ∃ ∗ ∀∃ ∗ T -satisfiability problem Multi-sorted theory: T I ∪ T E ∪ { a 1 , . . . , a n } INDEX atoms with at most one universally quantified variable Requirement: T I -decidability of ∃ ∗ ∀ -formulæ Requirement: T E -decidability of quantifier-free formulæ Complexity if T I , T E are P + : NExpTime -complete F. Alberti Decision Procedures for Flat Array Properties 8 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) M | = F F. Alberti Decision Procedures for Flat Array Properties 9 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) M | = F a M ELEM M INDEX M F. Alberti Decision Procedures for Flat Array Properties 9 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) M | = F a M ELEM M INDEX M a M is a total function from INDEX M to ELEM M F. Alberti Decision Procedures for Flat Array Properties 9 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) Step I. Guess the set of INDEX types ELEM M INDEX M F. Alberti Decision Procedures for Flat Array Properties 10 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) Step I. Guess the set of INDEX types ELEM M INDEX M F. Alberti Decision Procedures for Flat Array Properties 10 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) Step I. Guess the set of INDEX types Consider the set K of all INDEX atoms in F (plus equalities with the c constants) Let { M 1 , . . . , M q } be the the set of maximal and consistent sets of literals built out of K Each L ( x, c ) in every M h is an atom of K or its negation All the M h ’s are mutually exclusive Every element of INDEX M has to realize a type M h : q � � M I | = ∀ x. L ( x, c ) j =1 L ∈ M j F. Alberti Decision Procedures for Flat Array Properties 11 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) Step II. For each type M h take a b h ∈ INDEX M realizing it ELEM M INDEX M F. Alberti Decision Procedures for Flat Array Properties 12 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) Step II. For each type M h take a b h ∈ INDEX M realizing it ELEM M INDEX M F. Alberti Decision Procedures for Flat Array Properties 12 / 21
Decision Procedure for the multi-sorted case F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) Step II. For each type M h take a b h ∈ INDEX M realizing it 1. Each b h realizes the corresponding type q � � M I | = L ( b j , c ) j =1 L ∈ M j 2. The instantiation � ψ ( i σ, a ( i σ ) , c , a ( c ) ) σ : i → b is consistent F. Alberti Decision Procedures for Flat Array Properties 13 / 21
Decision Procedure for ARR 2 ( T I , T E ) F := ∃ c ∀ i .ψ ( i , a ( i ) , c , a ( c ) ) q � � ∧ ∀ x. L ( x, c ) j =1 L ∈ M j q F 1 := ∃ b ∃ c � � L ( b j , c ) ∧ j =1 L ∈ M j � ψ ( i σ, a ( i σ ) , c , a ( c )) σ : i → b F. Alberti Decision Procedures for Flat Array Properties 14 / 21
Decision Procedure for the multi-sorted case Step III. Substitute the tuple a ( b ) ∗ a ( c ) with a tuple e of ELEM constants ELEM M INDEX M F. Alberti Decision Procedures for Flat Array Properties 15 / 21
Decision Procedure for the multi-sorted case Step III. Substitute the tuple a ( b ) ∗ a ( c ) with a tuple e of ELEM constants ELEM M INDEX M F. Alberti Decision Procedures for Flat Array Properties 15 / 21
Decision Procedure for the multi-sorted case . . . ∧ F 1 := ∃ b ∃ c � ψ ( i σ, a ( i σ ) , c , a ( c )) σ : i → b Step III. Substitute the tuple a ( b ) ∗ a ( c ) with a tuple e of ELEM constants F. Alberti Decision Procedures for Flat Array Properties 16 / 21
Decision Procedure for the multi-sorted case . . . ∧ F 1 := ∃ b ∃ c � ψ ( i σ, a ( i σ ) , c , a ( c )) σ : i → b Step III. Substitute the tuple a ( b ) ∗ a ( c ) with a tuple e of ELEM constants a ( b ) ∗ a ( c ) � e . . . ∧ ¯ ψ ( b , c , e ) ∧ F 2 := ∃ b ∃ c s � � ( d m = d n → e l,m = e l,n ) d m ,d n ∈ b ∗ c l =1 functional consistency F. Alberti Decision Procedures for Flat Array Properties 16 / 21
Recommend
More recommend