860 likes | 1.05k Vues
CSCI 4325 / 6339 Theory of Computation Chapter One. Zhixiang Chen Department of Computer Science University of Texas-Pan American. Background. Experience in at least one high-level programming language Data structures Discrete math Others …. Topics. What is computation?
E N D
CSCI 4325 / 6339Theory of ComputationChapter One Zhixiang Chen Department of Computer Science University of Texas-Pan American
Background • Experience in at least one high-level programming language • Data structures • Discrete math • Others …
Topics • What is computation? • Or what is an algorithm? • Formal languagesand computing devices? • Computation vs. Formal language understanding? • What can be computed? • Or what cannot be computed? • What can be efficiently computed? • Or what cannot be efficiently computed?
Reading Materials • Chapter 0, Introduction
The World of Theoretical Foundations of Computation … PARTIALLY COMPUTABLE COMPUTABLE PSPACE NEXP EXP NP P
Automata, Computability, and Complexity • Want to know • What are the fundamental capabilities and limitations of computers?
Complexity • What makes some problem computationally hard and others easy? • How to classify problems according to their computational difficulties? • How to understand the computational difficulties in the worst case, randomized, or approximate settings? • How to harness the computational difficulties for applications like cryptography?
Computability • What are limitations of Computers? • Want to know what problems are solvable by computers, and what are not? • Note: In complexity, we are interested in “solvable” problem, but want to know how difficult to solve.
Automata • Automata theory deals with the definitions of properties of mathematical models of computation. These models play a role in several applied areas of computer science. • Finite automata = regular expression: for text processing • Context-free grammar: for programming language design and implementation, AI, natural language processing • Context-sensitive grammar: for natural language processing
Sets • What is a Set? • A set is a collection of objects • Ex’s? • Notes: • We use capital letters to denote sets • An object contained in a set is called a set element. We use lower-case letters to denote set elements. • Notations • Given a set A and an object x, if x is an element of A, we write • Otherwise we write
Finite Sets and Infinite Sets • A set is finite if it has a finite number of elements • Ex’s? • A set is infinite if it has an infinite number of elements • Ex’s?
Set Cardinality • Given a set A, the cardinality of A, denoted by |A|, is the number of elements in A. • Ex’s?
Empty set • The empty set is a set without elements. • The empty is denoted as Ø.
Set Representation • By enumeration: • List all elements. Only good for finite sets • Ex’s. • A = {1, 2, 3, 4, 5}, B = {a, b, c, d, e} • C = { Joe, Jose, Chen_1, Chen_ 2} • D = { Black_Cat, White_Cat} • By Property: • Give property for set elements. Good for infinite sets (and finite sets as well) • Ex’s. • A = {x: x is an integer} • B = {y: y is a student at UTPA} • C = {z: z is a student in the CS department} • D = {w: and w is even}
Set Operations • Union • A U B is a set of elements in either A or B • A U B = {x: } • Intersection • is a set of elements in both A and B. • Difference • A – B is a set of elements in A but not in B.
Set Operations • Subset • if any implies • Proper Subset • if and • Equivalence • A = B if • Want example’s?
Properties of Set Operation • Idempotency • A U A = A • Commutativity • Associativity
Properties of Set Operation • Distributivity • Absorption • DeMorgan’s Law
Disjoint Sets and Power Sets • Disjoint Sets • A and B are disjoint if • Power Sets • Given a set A, the power set of A, denoted by is the collection of all subsets of A. • Ex’s. • A = {1, 2, 3} • = {, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}
Two Notations • Let S be a set such that any element in S is also a set, define • Ex’s • What is ? • What is ?
Set Partition • Given a nonempty set A, we say is a partition of A if • Any two elements of are disjoint.
Set Partition Examples • Ex’s • Let S = {a, b, c, d} • What partition of S has the fewest members? The most members? • List all partitions of S with exactly two members?
Relations and Functions- Ordered Pairs • Given any two objects a, b, let (a, b) denote the ordered pair of a and b. • The ordered pair of a and b tells that a and b is related under some relationship • The differences between (a, b) and {a, b}: • (a, b) (b, a), while {a, b} = {b, a} • (a, a) is a good ordered pair, while {a, a} is not. • The equivalence • (a, b) = (c, d) if and only if a = c, b = d.
Ordered Tuples • Given any n objects • is an n-ary ordered tuple. • Note: • The objects may not be distinct. • Ordered tuple examples?
Cartesian Products • Given two sets A and B, the Cartesian Product of A and B is • Given n sets , the n-fold Cartesian Product of these sets is • Ex’s?
Relations • A binary relation is defined as • A n-ary relation is defined as
Functions • A function is a binary relation on A and B such that • there is exactly one such that • A is called the domain of f. • For any , we denote y as f(x). f(x) is called the image (or value) of x. • The range of f is defined as • f [A] = { y: y = f(x) for some }
Function Mapping f A B
One-to-One, Onto, Bijection • One-to-One • A function is one-to-one if for any two distinct elements • Onto • A function is onto B, if • Bijection • A function is a bijection if f is one-to-one and onto
Inverse • The inverse of a binary relation is • The inverse of a function may not be a function any more. • Why? • If a function is bijection then its inverse is still a function. • Why?
Composition • Let Q and R to be two relations • Then RQ is also a relation Q R C A B
Composition Examples • Let R = {(a, b), (a, c), (c, d), (a, a), (b, a)}, • What is RR? • What is ? • Is R, RR or a function?
Graph Representation of a Binary Relation • Given a binary relation for each • draw a node to represent a, • draw another node to represent b, • draw an edge from a to b. • Then, we obtain a directed graph for R.
An Graph Representation Example • Let R = {(a, b), (b, a), (a, d), (d, c), (c, c), (c, a)}. • The Graph is b a c d
Reflexive • A relation R: A→A is reflexive, • if for any • For a reflexive relation R, the directed graph for R has a self-circle for each node • Graph example? • Other examples? • The less-than-or-equal-to relation over integers
Symmetric • A relation R: A→A is symmetric • if for any • In the directed graph of a symmetric relation, if there is an edge from node a to node b, then there must be another edge from node b to node a. • Graph examples? • Other Examples? • The friend relation over a group of people.
Antisymmetric • A relation R: A A is antisymmetric • if for any • In the direct graph of a antisymmetric relation, if there is an edge from a to b, then there must be no edge from b to a. • Some graph examples? • Other examples? • The parent relation over a group of people.
Transitive • A relation R:A A is transitive if (a, b) and (a, c) are in R, then (a, c) is also in R. • In the directed graph of a transitive relation, if there a path from a to b, then there is an edge from a to b. • Some graph examples? • Other examples? • The ancestor relation over a group of people. • The less-than relation over integers.
Equivalence Relation • A relation R: A A is equivalent if R is reflexive, symmetric and transitive. • Let R be an equivalence relation, for any a in A, we define the equivalence class containing the element a as • [a] = {x: (a, x) in R} • That is, [a] is the set of all elements related to a. • Examples? • The same-family relation • The x=y (mod p) relation for the given p.
A Equivalence Relation Theorem • Theorem. Let R: A→A to be an equivalence relation, then the equivalence classes of R is a partition of A. That is {[a]: a in A} is a partition of A. • Proof.
Partial Order • A relation R: A→A is a partial order if R is reflexive, antisymmetric, and transitive. • Ex’s • Some graph examples? • The boss-employee relation, assuming any person is the boss of him/herself. • Minimal elements ofa partial order R: A→A • An element a in A is minimal if for any b in A, • (b, a) in R implies b = a. • Ex’s
Total Order, Path, Length, Cycles • Total Order • A relation R: A A is a total order, if R is a partial order, and for any a, b in A, either (a, b) in R or (b, a) in R. • Path, Length, Cycles • Easy to see from the directed graph of a relation R. • Examples?
Countable and Uncountable Sets • Countable • A set S is countable if one of the following is true • S is finite • S is infinite but there is a bijection f: SN, where N is the set of natural numbers. • In other words, S is countable, if elements in S are enumerable. • Countable set examples? • Uncountable • Sets that are not countable
Unions of Countable Sets • The union of a finite collection of countable sets is countable • Proof. By dovetailing • The Union of a countably infinite collection of countable sets is countable • Proof. By dovetailing
There Are Uncountable Sets • Proof. By diagonalization. • Will give a proof later.
Definitions • Definitions describe the objects and notions that we use. A definition may be simple, or complex. Precision is essential to any mathematical definition. When defining some object we must make clear what constitutes that object and what does not.
Theorems • A theorem is a mathematical statement proved true. Generally a theorem is used to refer to a mathematical statement of special interest. Sometimes we prove statements that are interesting only because they assist in the proof of another, more significant statement. Such statements are called lemmas. Occasionally a theorem or its proof may allow us to conclude easily that other, related statements are true. These statements are called corollaries of the theorem.
Proofs • A proof is a convincing logical argument that a statement is true. In mathematics an argument must be airtight, that is, convincing in an absolute sense. This is rather different from the notion of proof that we use in everyday life or in the law. A mathematician demands proof beyond any doubt.