1 / 117

CSSE 350 Automata, Formal Languages, and Computability

CSSE 350 Automata, Formal Languages, and Computability. Mathematical Preliminaries and Background Sets Relations Functions Logic Graphs Trees Proof Techniques Languages and Strings Automaton. Sets. SETS. A set is a collection of elements, having a property that

umeko
Download Presentation

CSSE 350 Automata, Formal Languages, and Computability

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. CSSE 350 Automata, Formal Languages, and Computability

  2. Mathematical Preliminaries and Background • Sets • Relations • Functions • Logic • Graphs • Trees • Proof Techniques • Languages and Strings • Automaton

  3. Sets

  4. SETS A set is a collection of elements, having a property that characterizes those elements. We write Belongs To and Does not Belong To as:

  5. Set Representations • One way is to enumerate the elements completely. All the elements belonging to the set are explicitly given. • For example, A = {1,2,3,4,5} • Alternate way is to give the properties that characterize the elements of the set. • For example, B = {x | x is a positive integer less than or equal to 5} • Or B = {x : x is a positive integer less than or equal to 5} • Ellipses may be used in the set specification if the meaning is clear. For example, C = { a, b, …, z}, which stands for all the lower-case letters of the English alphabet

  6. Set Representations • C = { a, b, c, d, e, f, g, h, i, j, k } • C = { a, b, …, k } • S = { 2, 4, 6, … } • S = { j : j > 0, and j = 2k for some k>0 } • S = { j : j is nonnegative and even } finite set infinite set

  7. U A 6 8 2 3 1 7 4 5 9 10 A = { 1, 2, 3, 4, 5 } • Universal Set: all possible elements • U = { 1 , … , 10 }

  8. B A • Set Operations • A = { 1, 2, 3 } B = { 2, 3, 4, 5} • Union • A U B = { 1, 2, 3, 4, 5 } • Intersection • A B = { 2, 3 } • Difference • A - B = { 1 } • B - A = { 4, 5 } 2 4 1 3 5 U 2 3 1 Venn diagrams

  9. Complement • Universal set = {1, …, 7} • A = { 1, 2, 3 } A = { 4, 5, 6, 7} 4 A A 6 3 1 2 5 7 A = A

  10. { even integers } = { odd integers } Integers 1 odd 0 5 even 6 2 4 3 7

  11. DeMorgan’s Laws A U B = A B U A B = A U B U

  12. Empty, Null Set: = { } S U = S S = S - = S - S = U = Universal Set

  13. U A B U A B Subset A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 } Proper Subset: B A

  14. A B = U Disjoint Sets A = { 1, 2, 3 } B = { 5, 6} A B

  15. Set Cardinality • For finite sets A = { 2, 5, 7 } |A| = 3 (set size)

  16. Powersets A powerset is a set of sets S = { a, b, c } Powerset of S = the set of all the subsets of S 2S = { , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} } Observation: | 2S | = 2|S| ( 8 = 23 )

  17. Cartesian Product A = { 2, 4 } B = { 2, 3, 5 } A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 5) } |A X B| = |A| |B| Generalizes to more than two sets A X B X … X Z

  18. Set Identities • A, B, C represent arbitrary sets and ø is the empty set and U is the Universal Set. • The Commutative laws:              A  B = B  A              A  B = B  A • The Associative laws:              A  (B  C) = (A  B)  C              A  (B  C) = (A  B)  C • The Distributive laws:              A  (B  C) = (A  B)  (A  C)              A  (B  C) = (A  B)  (A  C)

  19. The Idempotent laws:              A  A = A              A  A = A • The Absorptive laws:              A  (A  B) = A              A  (A  B) = A • The De Morgan laws:              (A  B)' = A' B'             (A  B)' = A' B' • Other lawsinvolving Complements:              ( A' )' = A              A  A' = ø              A  A' = U

  20. Other laws involving the empty set             A  ø = A              A  ø = ø • Other laws involving the Universal Set:              A  U = U              A  U = A

  21. RELATIONS

  22. Relations • Let A and B be sets. A binary relation from A into B is any subset of the Cartesian product A  B. • For example: let A = {2, 3, 5, 6}, and B = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, and a relation R from A into B by (a, b)  R if and only if 2a = b So, R = {(2, 4), (3, 6), (5, 10), (6, 12)}.

  23. A typical element in R is an ordered pair (x, y). In some cases R can be described by actually listing the pairs which are in R, as in the previous example. This may not be convenient if R is relatively large. • Other notations are used depending on the past practice. Consider the following relation on real numbers. • R = {(x, y) | y is the square of x} and S = {(x, y) | x <= y}. • R could be more naturally expressed as R(x) = x2 or R(x) =y where y = x2.

  24. RELATIONS R = {(x1, y1), (x2, y2), (x3, y3), …} xi R yi e. g. if R = ‘>’: 2 > 1, 3 > 2, 3 > 1

  25. Relation on a Set • A relation from a set A into itself is called a relation on A. • For example, let A = {1, 2, 3, 4, 5, 6}, and a relation R from A to A itself by (a, b)  R if and only if a is a divisor of b • So, R = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 2), (2, 4), (2, 6), (3, 3), (3, 6), (4, 4), (5, 5), (6, 6)}. • Let A be a set of people and let P = {(a, b) | a  A  b  A  a is a child of b}. Then P is a relation on A which we might call a parent-child relation.

  26. Composition • Let R be a relation from a set A into set B, and S be a relation from set B into set C. The composition of R and S, written as RS, is the set of pairs of the form (a, c)  A  C, where (a, c)   RS if and only if there exists b  B such that (a, b)   R and (b, c)  S. • For example PP, where P is the parent-child relation given, is the composition of P with itself and it is a relation which we know as grandparent-grandchild relation.

  27. Properties of Relations • Assume R is a relation on set A; in other words, R  A  A. Let us write a R b to denote (a, b)  R. 1. Reflexive: R is reflexive if for every a  A, a R a.2. Symmetric: R is symmetric if for every a and b in A, if aRb, then bRa. 3. Transitive: R is transitive if for every a, b and c in A, if aRb and bRc, then aRc. 4. Equivalence: R is an equivalence relation on A if R is reflexive, symmetric and transitive. • For example, the equality relation (=) on a set of numbers such as {1, 2, 3} is an equivalence relation.

  28. Equivalence Relations • Reflexive: x R x • Symmetric: x R y y R x • Transitive: x R y and y R z x R z • Example: R = ‘=‘ • x = x • x = y y = x • x = y and y = z x = z

  29. FUNCTIONS

  30. Functions • A function is something that associates each element of a set with an element of another set (which may or may not be the same as the first set). • Or a function is a rule that assigns to elements of one set a unique element of another set. • For example, a social security number uniquely identifies a person, in this case, to each member of the set of social security number, some member of the set of person is assigned.

  31. FUNCTIONS domain range B 4 A f(1) = a a 1 2 b c 3 5 f : A -> B If A = domain then f is a total function otherwise f is a partial function

  32. Growth Rates of Functions • Let f(n) and g(n) to be two functions whose domain is a subset of the positive integers • If there exists a positive constant c such that for all sufficiently large n • f(n) ≤ cg(n) • f has the order at most g • f(n) = O(g(n)) cg(n) f(n)

  33. If there exists a positive constant c such that for all sufficiently large n • f(n)  cg(n) • f has the order at least g • f(n) =  (g(n)) f(n) cg(n)

  34. If there exist positive constant c1 and c2, such that for all sufficiently large n • c1g(n) ≤ f(n) ≤ c2g(n) • f and g have the same order of magnitude • f(n) =  (g(n)) f(n) c2g(n) c1g(n)

  35. Examples • Example 1: 2n is Θ(n) • f(n) = 2n, g(n) = n • For all integers n ≥ 0, 2n ≤ 2n, which is f(n) ≤ 2g(n); so constant c ≥ 2 suffices for the definition of O. • For all integers n ≥ 0, 2n ≥ n, which is f(n) ≥ 1g(n); so any 0 < c ≤ 2 suffices for the definition of Ω. • Since 2n is both O(n) and Ω(n), it is Θ(n).

  36. Example 2: n is O(n2) but not Ω(n2) • f(n) = n, g(n) = n2 • For all integers n ≥ 0, n ≤ n2; which is f(n) ≤ 1g(n); so constant c ≥ 1 suffices for the definition of O. • However, n cannot be Ω(n2) since no matter how small c>0 is chosen, for all n > 1/c, n = c(1/c)n < cnn = cn2.

  37. Logic Propositional Logic & Predicate Logic

  38. Propositional Logic • Proposition: a declarative statement having a specific truth-value, true or false. For example: • 8 is an even number. True • 4 is a negative number. False

  39. Two or more propositions can be combined together to make compound propositions with the help of logical connectives. For example: above two propositions can be used to make a compound proposition using any of the logical connectives. • 8 is an even number  AND  4 is a negative number. • False • 8 is an even number  OR 4 is a negative number. • True • For the first compound proposition to be true both the propositions have to be true as the connective is AND. As OR is the connective for the second one, if either of the propositions is true, the truth value of the compound proposition is true.

  40. logical Connectives • Conjunction: The compound proposition truth-value is true if and only if all the constituent propositions hold true. It is represented as " ^ ". Truth table for two individual propositions p and q with conjunction is given below.

  41. Disjunction: This is logical "or" read as either true value of the individual propositions. Truth table is given below.

  42. Negation: This is the logical "negation" and it is expressed by as  ¬p for "not p". Truth table is given below.

  43. Conditional: This is used to define as "a proposition holds true if another proposition is true" i.e. p  q is read as "if p, then q". Truth table is given below.

  44. Biconditional: A proposition (p  q) ^ (q  p) can be abbreviated using  biconditional conjunction as p  q and is read as "if p then q, and if q then p". • Tautology: A compound proposition, which is true in every case. E.g., p V ¬ p • Contradiction: This is the opposite of tautology, which is false in every case. E.g., p  ¬ p

  45. Identities • ¬ (P  Q)  (¬ P  ¬Q) ----- DeMorgan's Law • ¬ (P  Q)  (¬ P  ¬ Q) ----- DeMorgan's Law • (P  Q)  (¬ P  Q) ----- implication • [(P  Q)  R]  [P  (Q  R)] ----- exportation • (P  Q)  (¬ Q  ¬P) ----- contrapositive

  46. Implications • [(P  Q)  ¬Q]  P ----- modus tollens • [(P  Q)  (R  S)]  [(P  R)  (Q  S)] • [(P  Q)  (Q  R)]  (P  R)

  47. Predicate Logic • The propositional logic is not powerful enough to represent all types of assertions. For example, the statement: x is a non-zero integer, where x is a variable, is not a proposition because you can not tell whether it is true or false unless you know the value of x. Thus the propositional logic can not deal with such sentences. • The predicate logic is one of the extensions of propositional logic and it is fundamental to most other types of logic. Central to the predicate logic are the concepts of predicate and quantifier. • A predicate is a feature of language which you can use to make a statement about something, e.g. to attribute a property to that thing. If you say "Peter is tall", then you have applied to Peter the predicate "is tall". We also might say that you have predicated tallness of Peter or attributed tallness to Peter.

  48. A predicate is a template involving a verb that describes a property of objects, or a relationship among objects represented by the variables. For example, the sentences: • The flower is red. • The sweater is red. • The frame is red. • All these sentences come from the template "is red" by placing an appropriate noun/noun phrase in front of it. The phrase "is red" is a predicate and it describes the property of being red. Predicates are often given a name. • For example any of "is_red", "Red" or "R" can be used to represent the predicate "is red" among others. We can adopt Red as the name for the predicate “is_red". Sentences that assert an object is red can be represented as "Red(x)", where x represents an arbitrary object. Red(x) reads as "x is red".

  49. A predicate with variables, called atomic formula, can be made a proposition by applying one of the following two operations to each of its variables: • assign a value to the variable • quantify the variable using a quantifier • For example, x > 1 becomes 3 > 1 if 3 is assigned to x, and it becomes a true statement, and it becomes a proposition. • In general, a quantification is performed on formulas of predicate logic (called wff), such as x > 1 or P(x), by using quantifiers on variables.

  50. There are two types of quantifiers: • universal quantifier • existential quantifier • The universal quantifier turns, for example, the statement x > 1 to "for every object x in the universe, x > 1", which is expressed as " x x > 1". This new statement is true or false in the universe of discourse. Hence it is a proposition once the universe is specified. • Similarly the existential quantifier turns, for example, the statement x > 1 to "for some object x in the universe, x > 1", which is expressed as " x x > 1." Again, it is true or false in the universe of discourse, and hence it is a proposition once the universe is specified.

More Related