Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sets, POSets, and Lattice © Marcelo d’Amorim 2010.

Similar presentations


Presentation on theme: "Sets, POSets, and Lattice © Marcelo d’Amorim 2010."— Presentation transcript:

1 Sets, POSets, and Lattice http://pan.cin.ufpe.br © Marcelo d’Amorim 2010

2 SETS © Marcelo d’Amorim 2010

3 Set Collection of objects (elements) that carry no particular order Two ways of expression – Intentional A is the set of all odd integers – Extensional B = {2, 4, 5} – Obs. Ø is the empty set © Marcelo d’Amorim 2010

4 Set builder notation A = {a | a: int, a % 2 = 0} © Marcelo d’Amorim 2010 Set A includes integer elements with a 0 remainder for division by 2

5 Cardinality |A| denotes the number of elements in A © Marcelo d’Amorim 2010

6 Set relations Membership a ∈ A iff A includes a Subset A ⊂ B iff a ∈ A implies a ∈ B Superset A ⊃ B iff a ∈ B implies a ∈ A © Marcelo d’Amorim 2010

7 Set factories Intersection A ∩ B = {x | x ∈ A and x ∈ B} Union A U B = {x | x ∈ A or x ∈ B} Difference A - B = {x | x ∈ A and not (x ∈ B)} © Marcelo d’Amorim 2010

8 Power Set Def.: The set of all subsets of A Notations: P(A), 2 A Example – A={1,2,3}, 2 A ={ Ø,{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3} } © Marcelo d’Amorim 2010

9 Cartesian Product Def.: Set of ordered pairs from two sets: the first (resp., second) component comes from the first (resp., second) set. More formally: A x B = { (a,b) | a ∈ A and b ∈ B} Notes – | A x B | = | A | x | B | – A 2 is shorthand for A x A © Marcelo d’Amorim 2010

10 Relation Def.: Particular subset of a cartesian product Triple (A,B,G) defines relation R – A is the relation domain and B the codomain – G is the binary relationship Example: R = (Int,Int,<=) ⊂ Int x Int = {(a,b)| a,b: Int, a <= b} Notation aRb = (a,b) ∈ R © Marcelo d’Amorim 2010

11 Relation properties Reflexive Symmetric Anti-symmetry Transitive © Marcelo d’Amorim 2010

12 Relation properties Reflexive: ∀ a. aRa Symmetric: ∀ a,b. aRb implies bRa Anti-symmetry: ∀ a,b. aRb and bRa implies a=b Transitive: ∀ a, b, c. aRb and bRc implies aRc © Marcelo d’Amorim 2010

13 Function Def.: Relation R s.t. aRb and aRc implies b = c Notation f : A => B Mapping – Injective: f(a) = f(b) implies a = b – Surjective: ∀ y. ∃ _. f(_) = y © Marcelo d’Amorim 2010

14 PARTIAL ORDERING © Marcelo d’Amorim 2010

15 Partial Ordering Def.: Relation ≤ : L x L => {true,false} that is reflexive, transitive, and anti-symmetric Examples? © Marcelo d’Amorim 2010

16 Partial Ordering Def.: Relation ≤ : L x L => {true,false} that is reflexive, transitive, and anti-symmetric Examples? – ancestor of – phenomena causality © Marcelo d’Amorim 2010 Note: Important to characterize semantics of concurrent systems!

17 Total order Def.: Relation that is transitive, anti-symmetric and…total Total: ∀ a, b. aRb or bRa © Marcelo d’Amorim 2010 reflexivity implied

18 POSETS © Marcelo d’Amorim 2010

19 POSET Set L with a partial ordering ≤ Notation – (L, ≤) to describe POSET – l1 ≤ l2 to describe a particular pair © Marcelo d’Amorim 2010 ≤ is not necessarily the subset relation

20 Upper and Lower bounds For any subset Y of a poset L – u is an upper bound of Y if ∀ a. a ≤ u – l is a lower bound of Y if ∀ a. l ≤ a © Marcelo d’Amorim 2010

21 Least upper bound (lub) lub is an upper bound s.t. for any other upper bound u, lub ≤ u © Marcelo d’Amorim 2010 lub, when exist, is unique

22 Greatest lower bound (glb) Dual of lub… © Marcelo d’Amorim 2010

23 Meet and Join © Marcelo d’Amorim 2010 a b d f gh c d is the meet of {a,b,c} f is the join of {g,h}

24 COMPLETE LATTICE © Marcelo d’Amorim 2010

25 Complete lattice Poset (L,≤) s.t. all subsets of L have lubs and glbs. Also, Top = lub L and Bottom = glb L © Marcelo d’Amorim 2010

26 Exercises Considering the following cases, answer the questions: – What is L? – What is ≤? – Is the (Hasse) diagram a lattice? © Marcelo d’Amorim 2010

27 Example 1 © Marcelo d’Amorim 2010

28 Example 2 © Marcelo d’Amorim 2010

29 Example 3 © Marcelo d’Amorim 2010

30 Dataflow analysis encodes program information as an element in the lattice. Ordering denotes precision: l 0 ≤ l 1 indicates that l 1 carries more information than l 0. Dataflow analysis encodes program information as an element in the lattice. Ordering denotes precision: l 0 ≤ l 1 indicates that l 1 carries more information than l 0.

31 Dataflow analysis encodes program information as an element in the lattice. Ordering denotes precision: l 0 ≤ l 1 indicates that l 1 carries more information than l 0. Dataflow analysis encodes program information as an element in the lattice. Ordering denotes precision: l 0 ≤ l 1 indicates that l 1 carries more information than l 0. © Marcelo d’Amorim 2010 Accumulation of information (i.e., progress in the analysis) conceptually corresponds to ordered movements in the lattice. But when to stop such iteractive process?

32 Chain A subset Y of L is a chain if the elements are totally ordered © Marcelo d’Amorim 2010

33 Ascending (Descending) Chain A sequence [y0,y1,y2,…] denotes an ascending chain if y0 ≤ y1 ≤ y2 ≤ … Similar for descending chains © Marcelo d’Amorim 2010

34 Ascending chain condition A poset satisfies ascending chain conditions iff all ascending chains stabilize © Marcelo d’Amorim 2010 0 1 2 3 ∞ … satisfies ascending chain condition, but not descending

35 Fix Points Consider a monotone function f : L => L © Marcelo d’Amorim 2010 if L satisfies ascending chain condition and f is monotonic increasing then exists n such that f n (Bottom)=f n+1 (Bottom)

36 © Marcelo d’Amorim 2010 Lattices considered in program analysis typically have finite height. For example, due to finite number of program locations and variable names.

37 © Marcelo d’Amorim 2010 http://pan.cin.ufpe.br Recommended Bibliography – Appendix A from “Principles of Program Analysis”, Nielson, Nielson and Hanking, Springer 2005 – First chapters from “Introduction to Lattices and Order”, Davey and Priestley, Cambridge Press, 1990


Download ppt "Sets, POSets, and Lattice © Marcelo d’Amorim 2010."

Similar presentations


Ads by Google