{a, b, c} {a, b} {a, c} {b, c} {a}

Similar documents
COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

Section Summary. Relations and Functions Properties of Relations. Combining Relations

FALL 07 CSE 213: HW4

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

and e 2 ~ e 2 iff e 1

Theory of Computation

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

CS250, Fall 2010, Midterm 2, Tuesday November 9, 8am.

CSEP 590 Data Compression Autumn Arithmetic Coding

Lecture Notes: Selected Topics in Discrete Structures. Ulf Nilsson

Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai , India. Instructor N.Sadagopan Scribe: P.

Dynamic Programming. Shuang Zhao. Microsoft Research Asia September 5, Dynamic Programming. Shuang Zhao. Outline. Introduction.

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

Section 14.1 Computability then else

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

Theory of Computer Science

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

CS Automata, Computability and Formal Languages

1.2 Posets and Zorn s Lemma

Solution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc.

COMP 182 Algorithmic Thinking. Relations. Luay Nakhleh Computer Science Rice University

A Universal Turing Machine

FABER Formal Languages, Automata. Lecture 2. Mälardalen University

Discrete Mathematics. 2. Relations

Equivalence relations

1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A.

Semigroup presentations via boundaries in Cayley graphs 1

Discrete Structures, Final Exam

CMSC 330: Organization of Programming Languages. Regular Expressions and Finite Automata

CMSC 330: Organization of Programming Languages

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr.

C1.1 Introduction. Theory of Computer Science. Theory of Computer Science. C1.1 Introduction. C1.2 Alphabets and Formal Languages. C1.

CS 133 : Automata Theory and Computability

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

Chapter 4. Regular Expressions. 4.1 Some Definitions

Equivalence, Order, and Inductive Proof

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

CS375 Midterm Exam Solution Set (Fall 2017)

3. R = = on Z. R, S, A, T.

Theory of Computation

The Probability of Winning a Series. Gregory Quenell

Homework 1 (revised) Solutions

The Binomial Theorem.

Section 1.3 Ordered Structures

Math 242: Principles of Analysis Fall 2016 Homework 1 Part B solutions

Advanced Automata Theory 7 Automatic Functions

Learning Regular Sets

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Advanced Automata Theory 9 Automatic Structures in General

Basics of WQO theory, with some applications in computer science

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

HW 3 Solutions. Tommy November 27, 2012

AAA616: Program Analysis. Lecture 3 Denotational Semantics

Automata: a short introduction

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

CSCI 340: Computational Models. Regular Expressions. Department of Computer Science

Multiple Choice Questions for Review

CS A Term 2009: Foundations of Computer Science. Homework 2. By Li Feng, Shweta Srivastava, and Carolina Ruiz.

Tutorial Obtain the principal disjunctive normal form and principal conjunction form of the statement

Advanced Automata Theory 11 Regular Languages and Learning Theory

CS6902 Theory of Computation and Algorithms

6.8 The Post Correspondence Problem

Finite Automata and Regular Languages

Lecture 1 09/08/2017

The Pure Parsimony Problem

Solutions to Problem Set 3

Theoretical Computer Science

Summary of Last Lectures

Automata Theory Final Exam Solution 08:10-10:00 am Friday, June 13, 2008

Section 8.3 Higher-Order Logic A logic is higher-order if it allows predicate names or function names to be quantified or to be arguments of a

Homework 4 Solutions. 2. Find context-free grammars for the language L = {a n b m c k : k n + m}. (with n 0,

Well-Ordered Sets, Ordinals and Cardinals Ali Nesin 1 July 2001

Chapter 1. Introduction

Context-Free Grammars and Languages. Reading: Chapter 5

Learning Context Free Grammars with the Syntactic Concept Lattice

CS 373: Theory of Computation. Fall 2010

1 Alphabets and Languages

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Week Some Warm-up Questions

1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u,

In English, there are at least three different types of entities: letters, words, sentences.

Discrete Structures, Logic, and Computability Third Edition

Foreword. Grammatical inference. Examples of sequences. Sources. Example of problems expressed by sequences Switching the light

Introduction. Chapter 1

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

Proofs, Strings, and Finite Automata. CS154 Chris Pollett Feb 5, 2007.

Linear Classifiers (Kernels)

A canonical semi-deterministic transducer

Two-Way Automata and Descriptional Complexity

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages

Theory of Computation Turing Machine and Pushdown Automata

Einführung in die Computerlinguistik

MITOCW Lec 11 MIT 6.042J Mathematics for Computer Science, Fall 2010

Lecture 1: Lattice(I)

Basic Principles of Lossless Coding. Universal Lossless coding. Lempel-Ziv Coding. 2. Exploit dependences between successive symbols.

Regular Expressions [1] Regular Expressions. Regular expressions can be seen as a system of notations for denoting ɛ-nfa

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26

Transcription:

Section 4.3 Order Relations A binary relation is an partial order if it transitive and antisymmetric. If R is a partial order over the set S, we also say, S is a partially ordered set or S is a poset. To emphasize both S and R we write S, R and call it a poset. Example. Here are five sample posets. N,, N, <, N, divides, power({a, b, c}),, and Steps_of_a_Recipe, R where i R j iff step i is done before step j. Comparability. Let S, R be a poset. Then we have the following definitions. 1. x, y S are comparable if x R y or y R x. 2. If all pairs of elements are comparable, then R is a total (or linear) order. 3. A chain is a set of elements that are comparable to each other. Notation. We ll often use the symbols < and as general symbols for partial orders. If x < y, say x precedes y or x is a predecessor of y or y is a successor of x. An element x is an immediate predecessor of y or y is an immediate successor of x if {z x < z < y} =. Poset Diagram (Hasse Diagram): A graph representing a poset but with only immediate predecessor edges, and the edges are oriented up from x to y when x < y. Example. The poset power({a, b, c}), has the poset diagram shown in the picture. {a, b, c} {a, b} {a, c} {a} {b} {b, c} {c} 1

Minima, Maxima, and Bounds. Let S be a subset of a poset P. An element x S is a minimal element of S if it has no predecessors in S. A minimal element x S is the least element of S if x y for all y S. An element x P is a lower bound of S if x y for all y S. A lower bound x of S is the greatest lower bound of S, denoted glb(s), if y x for all lower bounds y of S. There are corresponding definitions for maximal element of S, greatest element of S, upper bound of S, and least upper bound of S, lub(s). Example. Let P = power({a, b, c}) shown in the picture and let S = {{a}, {a, b}, {a, c}}. Then {a} is the only minimal element of S, so {a} is the least element of S. The lower bounds of S are {a} and, with glb(s) = {a}. The maximal elements of S are {a, b} and {a, c}, but there is no greatest element of S. The only upper bound of S is {a, b, c}, so lub(s) = {a, b, c}. Quiz (2 minutes). Find the minima, maxima, and bounds for the subset S ={6, 7, 8} of the poset P pictured poset diagram. Solution. The minimal elements of S are 6 and 7, but there is no least element of S. The lower bounds of S are 1, 2, 4 with glb(s) = 4. The only maximal element of S is 8, so 8 is also the greatest element of S. The upper bounds of S are 8 and 9, with lub(s) = 8. P S 6 1 4 2 {a, b, c} {a, b} {a, c} {a} 9 8 {b} 7 S 5 3 {b, c} {c} 2 P

Lattices A lattice is a poset for which every pair of elements has a glb and a lub. lub(x, y) Example. For any set S the poset power(s), is a lattice because for any sets A and B, we have glb(a, B) = A B and lub(a, B) = A B. x y Example/Quiz. Is {1, 2, 3, 4, 5, 6}, a lattice? Answer: No. For example, there is no lub for 2 and 5. Quiz. Is {1, 2, 3, 6, 12}, a lattice? Answer: Yes. glb(x, y) Topological Sorting (Sorting a Poset) The idea is to output a minimal element and then remove it from the poset diagram and continue the process with the modified poset. The resulting output will always have the property that x is output before y if x < y. Algorithm. A typical algorithm keeps track of the number p(x) of immediate predecessors and the set s(x) of immediate successors of each element x, and the set Sources = {x p(x) = 0}. while Sources do Output a source x and remove it from Sources; Decrement p(y) for each y s(x) and update Sources od Example. The poset pictured has several possible topological sorts. The initial sources are 1, 2, 3. If we output 3, then the sources become 1, 2, 5. Two possible topological sorts are: 3, 5, 2, 1, 4, 7, 6, 8, 9 and 1, 2, 4, 6, 3, 5, 7, 8, 9. 6 1 4 2 9 8 7 5 3 3

Well-Founded Orders A poset is well-founded if every nonempty subset has a minimal element or, equivalently, every descending chain of elements x 1 > x 2 > is finite. To see the equivalence, notice that if all descending chains are finite, then the last element must be minimal. And, if all nonempty subsets have minimal elements, then you can t find a descending chain that goes forever since it would contradict minimality. Example. The posets N, < and power(finite set), are well-founded. Example. The posets Z, < and power(infinite set), are not well-founded. For example, an infinite descending chain in power(n) is N N {0} N {0, 1} N {0, 1,, n} Lexicograpic Ordering of N n The lexicographic ordering on n-tuples is defined by (x 1,, x n ) < (y 1,, y n ) iff x 1 < y 1 or (x i = y i for 1 i < j and x j < y j ). This ordering is well-founded. Notice that it is also linear. Example Proof: We ll show the lexicographic ordering on N 2 = N N is well-founded. First, notice that any descending chain of the form (x, y 1 ) > (x, y 2 ) > must stop since y 1 > y 2 > is a finite descending chain in N. To continue such a chain the first argument of a pair must decrease at some point. For example, (x 1, y 1 ) > (x 2, y 2 ) where x 1 > x 2. But there are only finitely many such changes possible because x 1 > x 2 > is a finite descending chain in N. So the lexicographic ordering on N 2 is well-founded. QED 4

Lexicograpic Ordering of A* Let A be an alphabet with some agreed upon ordering. If x and y are strings over A, then x < y iff either x is a proper prefix of y (i.e., y = xz with z Λ) or x and y have a longest common proper prefix u such that x = uw and y = uz, and head(w) < head(z) in A. NOTE: This is the usual dictionary ordering of strings and it is NOT well-founded, although it is a total order. For example, we have the following infinite descending chain of strings over {a, b} where we assume that a < b: b > ab > aab > aaab > Quiz (1 minute). Order all strings of length 3 over {a, b} where a < b. Answer: aaa < aab < aba < abb < baa < bab < bba < bbb. Standard Ordering of A* This is a well-founded ordering that orders strings by length and uses lexicographic for strings of the same length. Example. Here is the longest descending chain starting from aaa over {a, b} where a < b: aaa > bb > ba > ab > aa > b > a > Λ. A Simple Construction Technique for Well-Founded Orders Any function ƒ : S N defines a well-founded order on S by x < y iff ƒ(x) < ƒ(y). Example. Lists are well-founded by length. Binary trees are well-founded by depth, by number of nodes, or by number of leaves. Z is well-founded by absolute value. Derivations for a grammar are well-founded by length. These orders are nonlinear. 5

Example. Let ƒ : Z N be defined by ƒ(x) = if x 0 then 2x else 2x 1. The ordering on Z defined by x < y iff ƒ(x) < ƒ(y) is well-founded and linear: 0 < 1 < 1 < 2 < 2 <. Well-Founded Orders for Inductively Defined Sets If S is an inductively defined set and no two elements are defined in terms of each other, then the following methods can be used to establish a well-founded order for S. Method A. Define ƒ : S N by ƒ(b) = 0 for each basis element b; and if x is defined in terms of y 1,, y n, then ƒ(x) = 1 + max{ƒ(y 1 ),, ƒ(y n )}. Define x < y iff ƒ(x) < ƒ(y). Method B. The basis elements are the minimal elements of S and if x is defined in terms of y 1,, y n, then set y i < x for each i. Now take the transitive closure of the this ordering. Example. The set Z can be defined inductively by: Basis: 0 Z Induction: x Z implies x + 1, x 1 Z. Notice that 1 and 1 are constructed from 0 but 0 is also constructed from 1. So neither technique builds a poset. Example. The set N 2 can be defined inductively by: Basis: (0, 0) N 2 Induction: (x, y) N 2 implies (x, y + 1), (x + 1, y) N 2. In the ordering constructed by method A any pair (x, y) has n + 2 immediate successors if x + y = n. For example, the the immediate successors of (0, 1) are (0, 2), (1, 1) and (2, 0). In the ordering constructed by method B any pair (x, y) has exactly 2 immediate successors. For example, the the immediate successors of (0, 1) are (0, 2) and (1, 1). 6