Lattice Tutorial Version 1.0

Similar documents
Chapter 3. Set Theory. 3.1 What is a Set?

Binary Relations Part One

10/11/2018. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings. Partial Orderings

Power Set of a set and Relations

AXIOMS FOR THE INTEGERS

Binary Relations McGraw-Hill Education

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

14.1 Encoding for different models of computation

Introduction to Sets and Logic (MATH 1190)

Math 187 Sample Test II Questions

Binary Relations Part One

Sets. Sets. Subset, universe. Specifying sets, membership. Examples: Specifying a set using a predicate. Examples

Sets. Margaret M. Fleck. 15 September 2010

CS 441 Discrete Mathematics for CS Lecture 24. Relations IV. CS 441 Discrete mathematics for CS. Equivalence relation

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

9.5 Equivalence Relations

Discrete Mathematics. Kruskal, order, sorting, induction

3.1 Constructions with sets

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

Relations, Equivalence Relations, and Partial Orders

MITOCW watch?v=kz7jjltq9r4

Relations I. Margaret M. Fleck. 7 November 2008

Graph Theory Questions from Past Papers

Relations and Graphs

CS422 - Programming Language Design

Algebra of Sets. Aditya Ghosh. April 6, 2018 It is recommended that while reading it, sit with a pen and a paper.

INCREMENTAL SOFTWARE CONSTRUCTION WITH REFINEMENT DIAGRAMS

Assignment 4 Solutions of graph problems

Discrete mathematics , Fall Instructor: prof. János Pach

Cantor s Diagonal Argument for Different Levels of Infinity

Compiler Optimisation

Module 11. Directed Graphs. Contents

Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Sets Fall / 31

SETS. Sets are of two sorts: finite infinite A system of sets is a set, whose elements are again sets.

Recursively Enumerable Languages, Turing Machines, and Decidability

Slides for Faculty Oxford University Press All rights reserved.


Höllische Programmiersprachen Hauptseminar im Wintersemester 2014/2015 Determinism and reliability in the context of parallel programming

LECTURE 8: SETS. Software Engineering Mike Wooldridge

1.2 Adding Integers. Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line

(Refer Slide Time: 0:19)

Simple graph Complete graph K 7. Non- connected graph


CS103 Spring 2018 Mathematical Vocabulary

Solutions to Homework 10

Relational Database: The Relational Data Model; Operations on Database Relations

PARTIALLY ORDERED SETS. James T. Smith San Francisco State University

What is Set? Set Theory. Notation. Venn Diagram

Theory of Computation

A set with only one member is called a SINGLETON. A set with no members is called the EMPTY SET or 2 N

Digraphs and Relations

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Discrete Mathematics

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

Sets. Sets. Examples. 5 2 {2, 3, 5} 2, 3 2 {2, 3, 5} 1 /2 {2, 3, 5}

Topology and Topological Spaces

Fundamental Properties of Graphs

Discrete Mathematics Lecture 4. Harper Langston New York University

c) the set of students at your school who either are sophomores or are taking discrete mathematics

Concurrent Models of Computation

Computer Science and Mathematics. Part I: Fundamental Mathematical Concepts Winfried Kurth

Ramsey s Theorem on Graphs

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Intro. Scheme Basics. scm> 5 5. scm>

A Category-Theoretic Approach to Syntactic Software Merging

2 Introduction to operational semantics

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

Lecture 20 : Trees DRAFT

Set and Set Operations

Nano-Lisp The Tutorial Handbook

1 Finite Representations of Languages

To illustrate what is intended the following are three write ups by students. Diagonalization

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

SET DEFINITION 1 elements members

CS450 - Structure of Higher Level Languages

SOFTWARE ENGINEERING DESIGN I

CISC 1400 Discrete Structures

MITOCW watch?v=4dj1oguwtem

Ying Gao. May 18th, rd Annual PRIMES Conference. Depths of Posets Ordered by Refinement. Ying Gao. Mentored by Sergei Bernstein.

Chapter 4. Relations & Graphs. 4.1 Relations. Exercises For each of the relations specified below:

What Is A Relation? Example. is a relation from A to B.

COMP combinational logic 1 Jan. 18, 2016

A.1 Numbers, Sets and Arithmetic

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

2 Sets. 2.1 Notation. last edited January 26, 2016

3.7 Denotational Semantics

CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014

Distributed minimum spanning tree problem

Lecture 3: Recursion; Structural Induction

Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.

Propositional Logic. Part I

INTRODUCTION TO ALGEBRAIC GEOMETRY, CLASS 6

What is a Graphon? Daniel Glasscock, June 2013

6.001 Notes: Section 6.1

Math 202 Test Problem Solving, Sets, and Whole Numbers 19 September, 2008

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Chapter S:V. V. Formal Properties of A*

3. Determine whether f is a function from the set of all bit strings to the set of integers if

Transcription:

Lattice Tutorial Version 1.0 Nenad Jovanovic Secure Systems Lab www.seclab.tuwien.ac.at enji@infosys.tuwien.ac.at November 3, 2005 1 Introduction This tutorial gives an introduction to a number of concepts of lattice theory, especially to those needed for understanding data flow analysis. It starts with the basics, requires only little previous knowledge, and tries to illustrate the topics with concrete examples. I felt the need for such a tutorial because other works in this area that I came across so far have at least one of the following drawbacks: They are too short and shallow. They are too complex, filled with cross-references, and not self-contained. They are too long and usually not available online (books). They are slideshows, which tend to be rather unappealing without additional explanations by a human speaker. The covered material deviates from the topics needed for data-flow analysis too strongly. You can find the latest version of this tutorial under the following URL: http://www.infosys.tuwien.ac.at/staff/enji/lattice tutorial.pdf 2 Sets As already mentioned, only little previous knowledge is required to understand this tutorial. Sets belong to these things you need to know about - you probably learned this at school already. For the beginning, our running gag will be the set of natural numbers from 1 to 3: {1, 2, 3}. 1

3 Binary Relations A binary relation R over a set is quite simple: It takes two elements from this set as input and returns true or false as output. For instance, consider the relation lesser than or equal to ( ) over the set {1,2,3}. If you give the input (1,2) to this relation, it returns true (since 1 2). For (3,2), it returns false. 4 Partial Order Relations Partial order relations belong to the class of binary relations, but additionaly have the following special characteristics: Reflexivity: If we take an element a of the underlying set, then the relation for the pair (a,a) must be true. For instance, the pair (1, 1) returns true for the relation. As a shorthand, we write ara for relation R returns true for the input (a,a). Antisymmetry: If arb and bra, then a must be equal to b. For example, 1 x and x 1 can only be true if x = 1. Transitivity: From arb and brc, it follows that arc (e.g. 1 2 and 2 3 leads to 1 3). As we saw in the examples for reflexivity, antisymmetry and transitivity, the relation satisfies all these properties, and therefore is a partial order relation. 5 Partially Ordered Sets A set together with a partial order relation is called partially ordered set (short name: poset). You might have wondered what the word partial is supposed to mean in this context. It means that there does not need to be an order for all pairs of elements from the underlying set. If there is an order for all pairs, we are dealing with a special form of partially ordered set, namely the totally ordered set. In fact, the example we were discussing so far (the set {1,2,3} with the relation ) is a totally ordered set. For demonstrating a partially ordered set which is not a totally ordered set, first consider the powerset of {1,2,3}. This is a set containing all subsets of {1,2,3}: { {1,2,3}, {1,2}, {1,3}, {2,3}, {1}, {2}, {3}, {} } Note that a powerset also includes the empty set, since the empty set is a subset of every set. The notation for the powerset of some set S is P(S) or 2 S. Now we define a partial order on this set, namely the subset inclusion. Here are some pairs for which this relation is true: ({1}, {1,2}) because {1} {1,2} ({2}, {1,2,3})... ({2,3}, {1,2,3} ({}, {1}) because the empty set is subset of every set This powerset is not totally ordered, but only partially ordered. The reason is that it contains pairs elements of elements for which no order exists, such as: 2

{1,2,3} {1,2} {1,3} {2,3} {1} {2} {3} {} Figure 1: A Hasse diagram. ({1}, {2}) because neither {1} {2} nor {2} {1} ({1,2}, {2,3})... Now we have already seen two partial order relations: and. From now on, we will write to denote some arbitrary partial order relation. Posets can be depicted graphically. We can represent the poset elements as nodes and the relation between pairs of elements as directed edges (i.e. edges with an arrow at one end). However, this method is rather awkward because the number of edges increases rapidly with the number of elements. A more elegant way is to use a Hasse diagram, which makes some of the explicit information implicit and hence becomes smaller. More precisely, it does the following: Reflexive edges (i.e. edges whose source and target nodes are identical) are omitted. This can be done because as soon as we look at a Hasse diagram, we are supposed to know that there is an implicit reflexive edge for each node. Transitive edges are omitted, i.e., if there is an edge from {1} to {1,2} and one from {1,2} to {1,2,3}, there is no need to draw an additional transitive edge from {1} to {1,2,3}. By convention, all edges are drawn upwards, so we don t have to paint arrows at their ends. Figure 1 illustrates the Hasse diagram for the poset we already encountered a number of times. 6 Bounds An upper bound u of two elements a and b in a poset is defined in the following way: Both a u and b u must be true. For example, the elements {1,2} and {1,3} have the upper bound {1,2,3}, which can be easily read from the Hasse diagram in Figure 1. The elements {1} and {1,2} have the following upper bounds: {1,2}, {1,2,3}. This shows that there can be multiple upper bounds, and that upper bounds don t have to be different from the elements they are computed for. 3

{a,b} {a} {b} Figure 2: A poset that is not a lattice. The least upper bound (also called supremum or join) is quite straightforward once you know what an upper bound is. It is simply an upper bound that is all other upper bounds. For example, the least upper bound of {1} and {1,2} (written as {1} {1, 2}) is {1,2}, and {1, 2} {1, 3} = {1, 2, 3}. The least upper bound is always unique 1, but doesn t have to be different from the elements it is computed for. The notions of lower bounds and greatest lower bounds (also known as infimum or meet) are defined analogously. Upper and lower bounds (as well as their least and greatest variants) can also be computed for multiple elements (i.e. sets of elements) instead of only for two elements. For example, the least upper bound of {1}, {2}, and {3} is {1,2,3}. In short: ({1}, {2}, {3}) = {1, 2, 3} The greatest element of a set of elements inside a poset has the following property: It must be among the given set of elements, and all other elements in the given set must be this greatest element. For example, the greatest element of the set {{1}, {1,2}, {1,2,3}} is {1,2,3}. The least element can be defined analogously to the greatest element. Note that there also exist maximal and minimal elements, which are different from greatest and least elements. However, these notions are not necessary for the understanding of lattices and are skipped in this tutorial. 7 Lattices A lattice is a poset in which all nonempty finite subsets have both a least upper bound and a greatest lower bound. We will come to speak about infinite subsets later, so don t get confused by this now. The powerset example from previous sections is such a lattice: No matter which and how many elements you take, you can always compute a least upper bound as well as a greatest lower bound for them. For a better understanding of the concept of lattices, it might be useful to see an example for a poset that is not a lattice, so one is given in Figure 2. It shows a poset with three elements ordered by subset inclusion. Since there is no greatest lower bound for the elements a and b, this poset doesn t satisfy the lattice condition. A complete lattice is a poset in which all subsets have both a least upper bound and a greatest lower bound. Note the difference between complete lattices and normal lattices: While for complete lattices, the bounds condition has to be satisfied by all subsets, normal lattices have to satisfy it only for nonempty finite subsets. It can be shown that all lattices with a finite number of elements are always complete lattices. Hence, we will need a lattice with an infinite number of elements to demonstrate the difference. For instance, con- 1 if it exists 4

sider a poset with all integers (Z = {..., 3, 2, 1, 0, 1, 2, 3,...}) as its elements and the usual as partial order relation. Obviously, this poset is infinite, and it satisifies the normal lattice condition. However, one of the subsets in this lattice is the set Z itself. Since neither a least upper bound nor a greatest lower bound can be computed for this subset, the condition for a complete lattice is not satisfied. We can simply turn this normal lattice into a complete lattice by adding the elements and to the underlying set. Intuitively, this means that a complete lattice must always have a greatest element (the top element, written as ) as well as a least element (the bottom element, written as ). By the way: Note that the above definition of a complete lattice can be cut down to requiring only a least upper bound for all subsets, or only a greatest lower bound for all subsets. The reason is that one condition automatically implies the other, which can be shown mathematically. Now we come to the illumination of a rather confusing aspect of complete lattices, which has to do with the empty subset (written as ). Beware: You must not confuse the empty subset of a lattice with a simple element of a lattice. For instance, consider a powerset lattice with the elements {{}, {1}, {2}, {1,2}}. One of the elements is the empty set {}, but this is not the empty subset of this lattice. You get the empty subset by taking nothing from the lattice, not even the element {}. So far, so good - here comes the tricky part. The following equation is true, even though it might appear odd at the first glance: = = Until now, we have already computed the least upper bounds for lattice subsets consisting of two or more lattice elements. The least upper bound of a single lattice element is quite straightforward, it is simply identical to the element itself. But what about the least upper bound of no element, as in this case? The key to this question is the fact that you can say virtually everything about all elements of, simply because they don t exist. For instance, you can say every element of is green, and it would be true because you won t find any element to refute this statement. Therefore, we can also say that every element of is any element of the complete lattice L. This means that all elements of L are upper bounds of. Hence, the least upper bound of is the least element of L, namely. With an analogous argumentation, we get that the greatest lower bound of is. Note that is the only subset of L for which the greatest lower bound is larger than the least upper bound (that s what usually confuses people in the first place). Besides, all this also leads to the insight that complete lattices must always have one or more elements. Otherwise, the least upper bound of the empty subset would not exist - but according to the definition of a complete lattice, it has to exist. Normal lattices are happy because they don t have to think about issues related to, since their definition only talks about nonempty subsets. In older literature, you might find the term semilattice. As the name implies, it resembles a normal lattice, with the difference that only one of the two demands has to be satisfied: It is a poset in which all nonempty finite subsets have a least upper bound or a greatest lower bound. Compared to the normal lattice definition, the and was replaced by an or. Depending on which 5

of the two conditions a semilattice satisfies, it is called a join-semilattice or a meet-semilattice, respectively. 8 Conclusion This tutorial should have provided you with a solid basic understanding of lattices and related concepts. In case you spotted any errors, omissions or imprecisions, please contact me under the email address given on the front page. 6