230 likes | 335 Views
Lecture 2 Theory of Computation. Yasir Imtiaz Khan. Graphs . Set of points with the lines connecting some of the points (also called simple graph). The points are called nodes or vertices and the lines are called edges.
E N D
Lecture 2Theory of Computation Yasir Imtiaz Khan
Graphs • Set of points with the lines connecting some of the points (also called simple graph). • The points are called nodes or vertices and the lines are called edges. Numbers of edges at a particular node is the degree of that node. G = (V, E)
Graphs Continue….. • Path: in a graph is a sequence of nodes connected by edges. • Simple Path: is a path that does not repeat nodes. • Connected Graph: if every two nodes have a path between them. • Cycle: A path is a cycle if it starts and ends with same node. • Simple Cycle: contains at least three nodes and repeats only the first and last nodes
Graphs Continue…. • Tree: if it is connected and has no simple cycles • Directed Graph: If it has arrows instead of lines • Strongly Connected: if a directed path connects every two nodes.
Language: a set of strings String:a sequence of symbols from some alphabet Example: Strings: cat, dog, house Language: {cat, dog, house} Alphabet:
Languages are used to describe computation problems Alphabet:
Alphabets and Strings An alphabet is a set of symbols Example Alphabet: A string is a sequence of symbols from the alphabet String variables Example Strings
Decimal numbers alphabet Binary numbers alphabet
String Operations Concatenation
String Length Length: Examples:
Proofs • Theorem • Mathematical statements proved true. • Lemmas • Assist in other proof so we proof • Corollaries • Related statements are true (Conclude other things)
Proof by Contradiction • In a proof by contradiction we assume, along with the hypotheses, the logical negation of the result we wish to prove and then reach some kind of contradiction. • That is, if we want to prove "If P, Then Q", we assume P and Not Q.
Example (Proof by Contradiction) • Theorem. There are infinitely many prime numbers. • Proof. Assume to the contrary that there are only finitely many prime numbers, and all of them are listed as follows: p1, p2 ..., pn. • Consider the number q = p1p2... pn + 1. The number q is either prime or composite. If we divided any of the listed primes pi into q, there would result a remainder of 1 for each i = 1, 2, ..., n. Thus, q cannot be composite. We conclude that q is a prime number, not among the primes listed above, contradicting our assumption that all primes are in the list p1, p2 ..., pn.
Proof by Induction • Mathematical induction: is a method of mathematical proof typically used to establish that a given statement is true of all natural numbers. • Base Case • Inductive Step
Theorem: For all n>=1. Proof #1: (by induction on n) Basis: n = 1 1 = 1
Inductive hypothesis: Suppose that for some k>=1. Inductive step: We will show that by the inductive hypothesis It follows that for all n>=1.
Automata theory • Deals with the properties of computation models. • Abstract Model of digital computer so it should have features like • Memory • Control Unit • ALU • Input • Output