Mathematical Tools MPRI 2–6: Abstract Interpretation, Application to Verification and Static Analysis

Mathematical Tools MPRI 2–6: Abstract Interpretation, Application to Verification and Static Analysis

Mathematical Tools MPRI 2{6: Abstract Interpretation, application to verification and static analysis Antoine Min´e CNRS, Ecole´ normale sup´erieure course 1, 2012{2013 course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 1 / 44 Order theory course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 2 / 44 Partial orders Partial orders course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 3 / 44 Partial orders Partial orders Given a set X , a relation v2 X × X is a partial order if it is: 1 reflexive: 8x 2 X ; x v x 2 antisymmetric: 8x; y 2 X ; x v y ^ y v x =) x = y 3 transitive: 8x; y; z 2 X ; x v y ^ y v z =) x v z. (X ; v) is a poset (partially ordered set). If we drop antisymmetry, we have a preorder instead. course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 4 / 44 Partial orders Examples of posets (Z; ≤) is a poset (in fact, completely ordered) (P(X ); ⊆) is a poset (not completely ordered) (S; =) is a poset for any S course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 5 / 44 Partial orders Examples of posets (cont.) Given by a Hasse diagram, e.g.: g e f g v g c d f v f ; g e v e; g b d v d; f ; g c v c; e; f ; g b v b; c; d; e; f ; g a a v a; b; c; d; e; f ; g course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 6 / 44 Partial orders Examples of posets (cont.) Infinite Hasse diagram for (N [ f 1 g; ≤): oo 3 2 1 v 1 1 ··· 1 v 1; 2;:::; 1 0 v 0; 1; 2;:::; 1 0 course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 7 / 44 Partial orders Informal uses of posets Posets are a very useful notion to discuss about: logic: ordered by implication =) approximations: v is an information order program verification: program semantics v specification course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 8 / 44 Partial orders (Least) Upper bounds c is an upper bound of a and b if: a v c and b v c c is a least upper bound(lub or join) of a and b if c is an upper bound of a and b for every upper bound d of a and b, c v d The lub is unique and noted a t b. (proof: assume that c and d are both lubs of a and b; by definition of lubs, c v d and d v c; by antisymmetry of v, c = d) Generalized to upper bounds of arbitrary (even infinite) sets t Y ; Y ⊆ X (well-defined, as t is commutative and associative). Similarly, we define greatest lower bounds(glb, meet) a u b, u Y . (a u b v a; b and 8c; c v a; b =) c v a u b) Note: not all posets have lubs, glbs; e.g., (f a; b g; =). course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 9 / 44 Partial orders (Least) Upper bounds upper bounds of a and b a t b upper bound of b a b course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 10 / 44 Partial orders Complete partial order (CPO) C ⊆ X is a chain in (X ; v) if it is totally ordered (8x; y 2 C; x v y _ y v x). A poset (X ; v) is a complete partial order (CPO) if every chain C (including ;) has a least upper bound t C. A CPO has a least element t ;, denoted ?. Examples: (N; ≤) is not complete, but( N [ f 1 g; ≤) is complete. (f x 2 Q j 0 ≤ x ≤ 1 g; ≤) is not complete, but (f x 2 R j 0 ≤ x ≤ 1 g; ≤) is complete. (P(Y ); ⊆) is complete for any Y . course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 11 / 44 Lattices Lattices course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 12 / 44 Lattices Lattices A lattice( X ; v; t; u) is a poset with 1 a lub a t b for every pair of elements a and b; 2 a glb a u b for every pair of elements a and b. Examples: integer intervals( f [a; b] j a; b 2 Z; a ≤ b g [ f ; g; ⊆; t; \) where [a; b] t [a0; b0] def= [min(a; a0); max(b; b0)]. ∗ divisibility( N ; j; gcd; lcm) def where xjy ()9 k 2 N; kx = y. If we drop one condition, we have a (join or meet) semilattice. See Birkhoff [Birk76]. course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 13 / 44 Lattices Example: the divisibility lattice 36 8 12 18 27 4 6 9 2 3 5 1 course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 14 / 44 Lattices Complete lattices A complete lattice( X ; v; t; u; ?; >) is a poset with 1 a lub t S for every set S ⊆ X 2 a glb u S for every set S ⊆ X 3 a least element ? 4 a greatest element > Notes: 1 implies 2 as u X = t f y j 8x 2 X ; y v x g (and 2 implies 1 as well), 1 and 2 imply 3 and 4: ? = t ; = u X , > = u ; = t X , a complete lattice is also a CPO. course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 15 / 44 Lattices Complete lattice examples real segment [0; 1]:(f x 2 R j 0 ≤ x ≤ 1 g; ≤; max; min; 0; 1) powersets( P(S); ⊆; [; \; ;; S) any finite lattice (t Y and u Y for finite Y ⊆ X are always defined). integer intervals with finite and infinite bounds: (f [a; b] j a 2 Z [ f −∞ g; b 2 Z [ f +1 g; a ≤ b g [ f ; g; ⊆; t; \; ;; [−∞; +1]) def with ti2I [ai ; bi ] = [mini2I ai ; maxi2I bi ]. course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 16 / 44 Lattices Example: the powerset complete lattice Example: (P(f 0; 1; 2 g); ⊆; [; \; ;; f 0; 1; 2 g) f0; 1; 2g f0; 2g f0; 1g f1; 2g f1g 0g f2gf ; course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 17 / 44 Lattices Derivation Given (complete) posets or lattices (X ; vX ;:::), (Y ; vY ;:::) we can derive new ones by: duality( X ; wX ;:::) 0 0 0 8x; x ; x wX x () x vX x adding a least element ? (lifting) (X [ f ? g; v;:::) 0 0 def 0 8x; x ; x v x () x = ?_ x vX x product (X × Y ; v;:::) 0 0 0 0 def 0 0 8x; x ; y; y ; (x; y) v (x ; y ) () x vX x ^ y vY y point-wise lifting by some set S (S ! X ; v;:::) 0 0 def 0 8x; x ; x v x ()8 s 2 S; x(s) vX x (s) sublattice 0 0 (X ; vX ; tX ; uX ) where X ⊆ X is closed by tX and uX course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 18 / 44 Fixpoints Fixpoints course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 19 / 44 Fixpoints Functions A function f :(X ; vX ;:::) ! (Y ; vY ;:::) is monotonic if 0 0 0 8x; x ; x vX x =) f (x) vY f (x ) (aka: increasing, isotone, order-preserving, morphism) strict if f (?X ) = ?Y continuous between CPOs if 8C chain ⊆ X ; f f (c) j c 2 C g is a chain in Y and f (tX C) = tY f f (c) j c 2 C g a (complete) t−morphism between (complete) lattices if 8S ⊆ X ; f (tX S) = tY f f (s) j s 2 S g extensive if X = Y and 8x; x vX f (x) course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 20 / 44 Fixpoints Fixpoints Given f :(X ; v) ! (X ; v) x is a fixpoint of f if f (x) = x x is a prefixpoint of f if x v f (x) x is a postfixpoint of f if f (x) v x We may have several (or none) fixpoints fp(f ) def= f x 2 X j f (x) = x g def lfpx f = minv f y 2 fp(f ) j x v y g if it exists (least fixpoints) def lfp f = lfp? f dually, gfpx f , gfp f (greatest fixpoints) course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 21 / 44 Fixpoints Tarski's fixpoint theorem Tarksi's theorem If f : X ! X is monotonic in a complete lattice X then fp(f ) is a complete lattice. Proved by Knaster and Tarski [Tars55]. course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 22 / 44 Fixpoints Tarski's fixpoint theorem Tarksi's theorem If f : X ! X is monotonic in a complete lattice X then fp(f ) is a complete lattice. Proof: We prove lfp f = u f x j f (x) v x g (meet of postfixpoints). Let f ∗ = f x j f (x) v x g and a = u f ∗. 8x 2 f ∗; a v x (by definition of u) so f (a) v f (x) (as f is monotonic) so f (a) v x (as x is a postfixpoint). We deduce that f (a) v u f ∗, i.e. f (a) v a. course 1, 2012{2013 Mathematical Tools Antoine Min´e p. 22 / 44 Fixpoints Tarski's fixpoint theorem Tarksi's theorem If f : X ! X is monotonic in a complete lattice X then fp(f ) is a complete lattice.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    54 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us