Automata Grammars and Languages Discourse 08 Rices Theorem

  • Slides: 11
Download presentation
Automata, Grammars and Languages Discourse 08 Rice’s Theorem C SC 473 Automata, Grammars and

Automata, Grammars and Languages Discourse 08 Rice’s Theorem C SC 473 Automata, Grammars and Languages

Predicates, Properties and Sets • predicate, n. 1. Logic. That which is predicated or

Predicates, Properties and Sets • predicate, n. 1. Logic. That which is predicated or said of the subject in a proposition; the second term of a proposition, which is affirmed or denied of the first term by means of the copula, as in ‘paper is white’, ‘ink is not white’. 2. a. Gram. The statement made about a subject, including the logical copula (`is’, `are’, etc. ). b. Math. An assertion or propositional function. c. Synonyms: `assertion’, `proposition’ • Mathematically: a function which returns a truth-value (true or false). If the function P returns `true’ for an argument x, this indicates the property holds for that x: • Predicates can be about objects of any universe: C SC 473 Automata, Grammars and Languages 2

Predicates, Properties and Sets • property: the quality or attribute that is asserted to

Predicates, Properties and Sets • property: the quality or attribute that is asserted to hold by a predicate, as in `whiteness (or white) is a property of paper’, `blackness (or black) is a property of ink’. Used synonymously with quality or attribute. • A property of Turing-recognizable sets is defined by a predicate on Turing-recognizable sets. n example: the property of “emptiness” for a language is defined by the predicate P (L ) [ L = ]. C SC 473 Automata, Grammars and Languages 3

Rice’s Theorem • A machine tool for proving problems undecidable • Any property of

Rice’s Theorem • A machine tool for proving problems undecidable • Any property of TMs that can be expressed as a property of languages [a machine independent property] is undecidable—except trivial properties. n n Trivial property: a property true for all Turing-recognizable sets, or for none. Michine independent properties: u “the language accepted by M is a regular set. ” u n Machine dependent properties u u C SC 473 Automata, Grammars and Languages 4

Rice’s Theorem (cont. ) • Theorem (Rice’s Theorem). The language is decidable iff P

Rice’s Theorem (cont. ) • Theorem (Rice’s Theorem). The language is decidable iff P is a trivial property. (Hence no non-trivial property of the Turing-recognizable sets can be decided. ) Proof: ( ). If P is true for all TMs M, then is decidable. If P is false for all TMs then is decidable. ( ). (contrapositive). Assume that P is non-trivial. Without loss of generality, we can assume that [ For if not, we can use the property and show that the complementary language is undecidable. ] C SC 473 Automata, Grammars and Languages 5

Rice’s Theorem (cont. ) • Since property P is non-trivial, there is some recognizable

Rice’s Theorem (cont. ) • Since property P is non-trivial, there is some recognizable language B with Our goal is to reduce to To prove we assume there is a decider for and from it plus a reduction function, construct a decider for. What is decider good at? Given an input it can tell whether M has property P or not. Our reduction function (“program translator”) will transform a pair to a program having “dual” behavior: if M accepts w then behaves like an acceptor for B; otherwise it behaves like an acceptor for . Since B has the property P while does not, the decider will say “yes” iff M accepts w. C SC 473 Automata, Grammars and Languages 6

Rice’s Theorem (cont. ) Construct from input a transformed program so that the following

Rice’s Theorem (cont. ) Construct from input a transformed program so that the following holds: Here is what the “translator” C constructs: yes start Note: if then : So (*) holds as desired. With this reduction function, we proceed to the reduction itself. C SC 473 Automata, Grammars and Languages 7

Rice’s Theorem (Cont. ) Reduction: Suppose there is a decider for yes no Since

Rice’s Theorem (Cont. ) Reduction: Suppose there is a decider for yes no Since the language be undecidable. � C SC 473 Automata, Grammars and Languages yes no is undecidable, so must 8

Rice’s Theorem (Cont. ) • Corollary: Given a TM M the following properties of

Rice’s Theorem (Cont. ) • Corollary: Given a TM M the following properties of the language L(M) are all undecidable: • Is L(M) empty? • Is L(M) finite? • Is L(M) regular? • Is L(M) a CFL? • Is the string foo L(M) ? • Does L(M) have more than 3 members? • Does L(M) have fewer than 10 members? • … C SC 473 Automata, Grammars and Languages 9

Machine-Dependent Problems • Not all problems about TM-recognizable sets can be settled by Rice’s

Machine-Dependent Problems • Not all problems about TM-recognizable sets can be settled by Rice’s Theorem • Rice’s Theorem only applies to properties of languages recognized • Properties of the TM itself might be decidable or undeciable—the approach has to be ad hoc. • Ex: Given a TM M, does it have an even number of states? Easily decidable • Ex: Given TM M, q. Is there any configuration with p q yielding a configuration with state q? Decidable. If there is a transition in of form (p, a) = (q, -, -), p q, then yes else no. (We do not require any of these configurations to be reachable from the initial configuration. ) C SC 473 Automata, Grammars and Languages 10

Machine-Dependent Problems • Ex: Undecidable Machine-Dependent Problem • Predicate: Given TM M with ={0,

Machine-Dependent Problems • Ex: Undecidable Machine-Dependent Problem • Predicate: Given TM M with ={0, 1, blank}, does it ever print 3 consequtive 1’s on its tape (for any input). • Reduction: reduction func. in 2 stages. • uses 01 for 0 and 10 for 1, making changes in the rules accordingly. When M has a 0 in cell j then has a 0 in cell 2 j and a 1 in cell 2 j+1 (never a 111 on tape) • modifies so that if accepts, prints 111 and halts in the accept state. • prints 111 accepts � C SC 473 Automata, Grammars and Languages 11