1 / 25

Preliminaries

Preliminaries . Language: Set of Strings. Specification and recognition of languages Sets Operations Defining sets ( inductively ) Proving properties about sets ( using induction ) Defining functions on sets ( using recursion ) Proving properties about functions ( using induction )

mitch
Download Presentation

Preliminaries

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Preliminaries Language: Set of Strings Preliminaries

  2. Specification and recognition of languages • Sets • Operations • Defining sets (inductively) • Proving properties about sets (using induction) • Defining functions on sets (using recursion) • Proving properties about functions (using induction) • Strings • Operations • Languages : set of strings • Operations Preliminaries

  3. Representation of Sets • Set: collection of objects • Finite : can use enumeration • E.g., {a,b,c} • Infinite : requires describing an infinite characteristic of members using finite terms • E.g., { n e N | even(n) /\ square(n) } Preliminaries

  4. Sets: Examples • Sets are denoted by { <collection of elements> } • Examples: • {} • {a,b} • {{}} • {1, 2, …, 100} • {0, 1, 2, …} • {0,2,4, …} • {2n | n  } “the empty set” “the set consisting of the elements a and b” “the set consisting of the empty set” “the set consisting of the first 100 natural numbers” “the set consisting of all natural numbers” “the set of all natural pair numbers” “the set of all natural pair numbers” Preliminaries

  5. Operations on Sets Set Inclusion and Set Equality • Definition: • Given 2 sets, A and B, A is contained in B, denoted by A  B, if every element in A is also an element in B True or false: • {e,i,t,c} {a, b, …, z} • for any set A, A  A • for any set A, A  {A} true true false • Definition: • Given 2 sets A and B, A is equal to B, denoted by A = B, if A  B and B  A Preliminaries

  6. Operations on Sets • Review: • Member • Union • Intersection • Subset • Powerset • Cartesian product Preliminaries

  7. Operations on Sets • Set Difference • DeMorgan’s Laws Preliminaries

  8. pair or 2-tuple Operations on Sets Cartesian Product • Definition: Given two sets, A and B, the Cartesian product of A and B, denoted by A  B, is the following set: {(a,b) | a A and b  B} • Examples: • What is: {1, 2 , 3}  {a,b} = • True or false: {(1,a), (3,b)}  {1, 2 , 3}  {a,b} • True or false: {1,2,3}  {1, 2 , 3}  {a,b} {(1,a), (1,b), (2,a), (2,b), (3,a), (3,b)} true false Preliminaries

  9. Triple or 3-tuple Operations on Sets Cartesian Product of More Than 2 Sets Definition: Given three sets, A, B and C, the Cartesian product of A, B, and C denoted by A  B  C, is the following set: {(a,b,c) | a A, b  B, c  C} x = x’, y = y’ and z = z’ Definition. (x,y,z) = (x’,y’, z’) only if These definitions can be extended to define the Cartesian product: A1 A2 …  An and equality between n-tuples Preliminaries

  10. Operations on Sets • Some Cartesian product problems to try out: • What is: {1, 2 , 3}  {a,b}  {,} = • What is the form of the set A  B  C  D • What is the form of the set A  B  (C  D) • What is the form of the set (A  B )  (C  D) Preliminaries

  11. Partition of a Set X The set of subsets of X is a partition of X iff • “covers all subsets” • “pair-wise disjoint” Collectively Exhaustive / Mutually Exclusive Preliminaries

  12. Examples • Set of Natural numbers is partitioned by “mod 5” relation into five “equivalence classes”: { {0,5,10,…}, {1,6,11,…}, {2,7,12,…}, {3,8,13,…}, {4,9,14,…} } • “String length” can be used to partition the set of all bit strings. { {},{0,1},{00,01,10,11},{000,…,111},… } Preliminaries

  13. Relations Definition: Given two sets, A and B, A relation R is any subset of A  B. In other words, R  A  B • Relations are used to describe how elements of different sets interact • Question: What does the relation A  B indicate? • Examples of relations • Simple: • {(c,s) | c is a class at KU, s is a student at KU, AND s is in C } Preliminaries

  14. Relations Example: • Let I be the set of all classroom instructors at Kutztown • Let S be the set of all students at Kutztown • Then, we can define the relation Students of an Instructor, over I x S, as follows: Students of an Instructor= {(i,s) | i I, s S, s is in a course of instructor i} Questions: • Does this relation represent an equivalence relation? • Suppose this instructor teaches courses c1, c2, and c3. Would the sets Students in instructor i’s course, for courses c1, c2, and c3, be disjoint? Preliminaries

  15. {(1,2),(1,3),…, (2,3),(2,4),…} {(a,b) | a and b are males between 35 and 40 years old} Equivalence Relations A relation R is an equivalence relation if R is reflexive, symmetric, and transitive • Relation R is: • reflexive if (a,a)  R for each a in the language • symmetric if when (a,b)  R then (b,a)  R • transitive if (a,b)  R and (b,c)  R, then (a,c)  R Equivalence relations are generalizations of the equality relation x “the relation x < y”  Preliminaries

  16. Functions • Definition: A function f from a set A to a set B, denoted by • f: A  B , is rule of correspondence between A and B such that there is a unique element in B assigned to each element in A • i.e. for each a A there is one and only one b B such that • (a,b) f • Note: • A is the domain of f • B is the range of f Question: Is the following relation also a function from the set of KU classes to the set of KU students? {(c,s) | c is a class at KU, s is a student at KU, AND s is in C } Preliminaries

  17. Functions • Kinds of Functions • Total • All domain elements map to an element in the range • One to one (injection) • Total, and each mapping from domain to range is unique • Onto (surjection) • All elements of the range are mapped to from a domain element • 1-1 & Onto (bijection) Preliminaries

  18. (Total) Function Domain Co-domain ( Range) A B f Preliminaries

  19. One to One Function (injection) Domain Co-domain ( Range) A B f Preliminaries

  20. Onto Function (surjection) Domain Co-domain ( Range) A B f Preliminaries

  21. 1-1 Onto Function (bijection) Domain Co-domain ( Range) A B f Preliminaries

  22. Inductive Definitions • Constructive • Example • Set of natural numbers N = {0,1,2,3,…} • Finite representation in terms of Seed element: zero Closure Operation: successor function {0,s(0),s(s(0)),s(s(s(0))),…} • Imposes additional structure on the domain. Preliminaries

  23. Basis case: • Recursive step: • Closure: only if it can be obtained from 0 by a finite number of applications of the operation s. (* Minimality condition to uniquely determine N *) Preliminaries

  24. Languages • A language can be specified as a set of strings. • Languages are classified by how they can be formed • Regular languages are the most constrained • Others • Context-free • Context-sensitive • Recursively enumerable Preliminaries

  25. Language Semantics - Syntax • Regular sets/languages • Generator • Regular Expressions, Regular Grammars • Recognizer • Finite State Automata • Context-free languages • Generator • Context-free Grammar • Recognizer • Push-down Automata Preliminaries

More Related