Notions of Computability Many notions of computability have been proposed, e.g. – (Type 0 a.k.a. Unrestricted or context sensitive) Grammars – Partial.

Slides:



Advertisements
Similar presentations
Grammar types There are 4 types of grammars according to the types of rules: – General grammars – Context Sensitive grammars – Context Free grammars –
Advertisements

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
Primitive Recursive Functions (Chapter 3)
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Simplifying CFGs There are several ways in which context-free grammars can be simplified. One natural way is to eliminate useless symbols those that cannot.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
1 Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible.
Markov Algorithms An Alternative Model of Computation.
Chapter 4 Normal Forms for CFGs Chomsky Normal Form n Defn A CFG G = (V, , P, S) is in chomsky normal form if each rule in G has one of.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Decidable languages Sipser 4.1 (pages ). CS 311 Mount Holyoke College 2 Hierarchy of languages All languages Turing-recognizable Turing-decidable.
Mu-Recursive Functions
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
1 Other Models of Computation. 2 Models of computation: Turing Machines Recursive Functions Post Systems Rewriting Systems.
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Context-Free Grammars Chapter 3. 2 Context-Free Grammars and Languages n Defn A context-free grammar is a quadruple (V, , P, S), where  V is.
Chapter 9 Turing Machine (TMs).
Chapter 4 Context-Free Languages Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Formal Grammars Denning, Sections 3.3 to 3.6. Formal Grammar, Defined A formal grammar G is a four-tuple G = (N,T,P,  ), where N is a finite nonempty.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
111 Computability, etc. Recap. Present homework. Grammar and machine equivalences. Turing history Homework: Equivalence assignments. Presentation proposals,
BİL 744 Derleyici Gerçekleştirimi (Compiler Design)1 Syntax Analyzer Syntax Analyzer creates the syntactic structure of the given source program. This.
::ICS 804:: Theory of Computation - Ibrahim Otieno SCI/ICT Building Rm. G15.
1 Theory of Digital Computation Course material for undergraduate students on IT Department of Computer Science University of Veszprem Veszprem, Hungary.
Pushdown Automata (PDA) Intro
CSE S. Tanimoto Lambda Calculus 1 Lambda Calculus What is the simplest functional language that is still Turing complete? Where do functional languages.
Normal Forms for Context-Free Grammars Definition: A symbol X in V  T is useless in a CFG G=(V, T, P, S) if there does not exist a derivation of the form.
TM Design Universal TM MA/CSSE 474 Theory of Computation.
1 Section 14.2 A Hierarchy of Languages Context-Sensitive Languages A context-sensitive grammar has productions of the form xAz  xyz, where A is a nonterminal.
111 Discrete Mathematics Computability Brief introduction to computable functions, recursive functions, etc. Jeanine Meyer.
Context Free Grammars. Context Free Languages (CFL) The pumping lemma showed there are languages that are not regular –There are many classes “larger”
MA/CSSE 474 Theory of Computation Enumerability Reduction.
Phrase-structure grammar A phrase-structure grammar is a quadruple G = (V, T, P, S) where V is a finite set of symbols called nonterminals, T is a set.
Turing Machines Chapter 17. Languages and Machines SD D Context-Free Languages Regular Languages reg exps FSMs cfgs PDAs unrestricted grammars Turing.
Turing Machines. Intro to Turing Machines A Turing Machine (TM) has finite-state control (like PDA), and an infinite read-write tape. The tape serves.
1 Section 13.2 The Church-Turing Thesis The Church-Turing Thesis: Anything that is intuitively computable can be be computed by a Turing machine. It is.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
1 Simplification of Context-Free Grammars Some useful substitution rules. Removing useless productions. Removing -productions. Removing unit-productions.
Chapter 10 Computable Functions Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
Homework 4 due 11/25.
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
CS 3813: Introduction to Formal Languages and Automata Chapter 13 Other Models of Computation These class notes are based on material from our textbook,
1 Other Models of Computation Costas Busch - LSU.
Formal Languages and Grammars
Discrete Structures ICS252 Chapter 5 Lecture 2. Languages and Grammars prepared By sabiha begum.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
Unrestricted Grammars
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
CS 154 Formal Languages and Computability May 5 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
MA/CSSE 474 Theory of Computation Universal Turing Machine Church-Turing Thesis (Winter 2016, these slides were also used for Day 33)
20 G M aaba acba aaba.. What is it about? Models of Language Generation Models of Language Recognition.
Context-Free Languages & Grammars (CFLs & CFGs) (part 2)
Properties of Context-Free Languages
Syntax Specification and Analysis
Complexity and Computability Theory I
CSCE 355 Foundations of Computation
Turing Machines Chapter 17.
CSE 2001: Introduction to Theory of Computation Fall 2013
Other Models of Computation
Turing Machines Chapter 17.
CSE S. Tanimoto Lambda Calculus
Presentation transcript:

Notions of Computability Many notions of computability have been proposed, e.g. – (Type 0 a.k.a. Unrestricted or context sensitive) Grammars – Partial Recursive Functions – Lambda calculus – Markov Algorithms – Post Algorithms – Post Canonical Systems, All have been shown equivalent to Turing machines by simulation proofs

Systems we’ll study Context Sensitive Grammars Primitive Recursive Functions Partial recursive functions

Context Sensitive Grammars We can extend the notion of context-free grammars to a more general mechanism An (unrestricted) grammar G = (V,Σ,R,S) is just like a CFG except that rules in R can take the more general form α→β where α,β are arbitrary strings of terminals and variables. α must contain at least one variable (or nontermial). If α→β then uαv ⇒ uβv (“yields”) in one step Define ⇒ * (“derives”) as reflexive transitive closure of ⇒.

Classical not-context free language { a n b n c n | n ≥ 0 } S -> aSBC S -> aBC CB -> HB HB -> HC aB -> ab bB -> bb bC -> bc cC -> cc

Example: {a 2^n, n ≥ 0} Hereʼs a set of grammar rules 1. S → a 2. S→ ACaB 3.Ca → aaC 4.CB → DB 5.CB → E 6.aD → Da 7.AD →AC 8.aE → Ea 9. AE →  Try generating 2 3 a’s S ACaB AaaCB AaaDB AaDaB ADaaB ACaaB AaaCaB AaaaaCB AaaaaDB

(Unrestricted) Grammars and Turing machines have equivalent power For any grammar G we can find a TM M such that L(M) = L(G). For any TM M, we can find a grammar G such that L(G) = L(M).

Computation using Numerical Functions Weʼre used to thinking about computation as something we do with numbers (e.g. on the natural numbers) What kinds of functions from numbers to numbers can we actually compute? To study this, we make a very careful selection of building blocks

Primitive Recursive Functions The primitive recursive functions from ℕ x ℕ x... x ℕ → ℕ are those built from these primitives: – zero(x) = 0 – succ(x) = x+1 – π k,j (x1,x2,...,xk) = xj for 0 < j ≤ k using these mechanisms: – Function composition, and – Primitive recursion

Function Composition Define a new function f in terms of functions h and g 1, g 2,..., g m as follows: f(x 1,...x n ) = h( g 1 (x 1,...,x n ),...,g m (x 1,...,x n ) ) Note that f and g i have arity n but that h has arity m Example: f(x) = x + 3 can be expressed using two compositions as f (x) = succ(succ(succ(x)))

Primitive Recursion Primitive recursion defines a new function f in terms of functions h and g as follows: f(0,x1,..., xk) = h(x1,...,xk) f(Succ(n),x1,..., xk)= g(n, f(n,x1,...,xk), x1,...,xk) Note that the order of arguments here differs slightly from the order in the Hein book (page 832). Here we place the number being analyzed first rather than last. Many ordinary functions can be defined using primitive recursion, e.g. add(0,x) = π1,1(x) add(Succ(y),x) = succ(π3,3(y, add(y,x),x))

More P.R. Functions For simplicity, we omit projection functions and write 0 for zero(_) and 1 for succ(0) add(x,0) = x add(x,succ(y)) = succ(add(x,y)) mult(x,0) = 0 mult(x,succ(y)) = add(x,mult(x,y)) factorial(0) = 1 factorial(succ(n)) = mult(succ(n),factorial(n)) exp(n,0) = 1 exp(n, succ(n)) = mult(n,exp(n,m)) pred(0) = 0 pred(succ(n)) = n Essentially all practically useful arithmetic functions are primitive recursive, but...

Ackermannʼs Function is not Primitive Recursive A famous example of a function that is clearly well-defined but not primitive recursive A(m, n)= if m0 then n+1 else if n=0 then A(m–1, 1) else A(m–1, A(m,n–1))

This function grows extremely fast!

A is not primitive recursive Ackermannʼs function grows faster than any primitive recursive function, that is: for any primitive recursive function f, there is an n such that A(n, x) > f x So A canʼt be primitive recursive

An Algebra of PR functions A grammar for well formed term PR terms Term  Z | S | P N nth projection | C Term [ Term 1, …,Term n ] composition | PR Term Term primitive recursion N  1 | 2 | 3 | 4 | …

Example 1 Equations f(x) = succ(succ(succ(x))) Algebra F = C S [C S [S]] Term  Z | S | P N nth projection | C Term [ Term 1, …,Term n ] composition | PR Term Term primitive recursion

Example 2 Equations add(0,x) = x add(succ(y),x) = succ(add(y,x)) Algebra add = PR (P 1) (C S [P 2]) Term  Z | S | P N nth projection | C Term [ Term 1, …,Term n ] composition | PR Term Term primitive recursion f(0,x1,..., xk) = h(x1,...,xk) f(Succ(n),x1,..., xk)= g(n, f(n,x1,...,xk), x1,...,xk)

Example 3 Equations pred Zero = Zero pred (Succ n) = n Algebra pred = PR Z (P 1) Term  Z | S | P N nth projection | C Term [ Term 1, …,Term n ] composition | PR Term Term primitive recursion f(0,x1,..., xk) = h(x1,...,xk) f(Succ(n),x1,..., xk)= g(n, f(n,x1,...,xk), x1,...,xk)

Example 4 Equations monus Zero x = x monus (Succ n) x = pred(monus n x) minus x y = monus y x Algebra minus = C (PR (P 1) (C pred [P 2])) [P 2, P 1] f(0,x1,..., xk) = h(x1,...,xk) f(Succ(n),x1,..., xk)= g(n, f(n,x1,...,xk), x1,...,xk) Term  Z | S | P N | C Term [ Term 1, …,Term n ] | PR Term Term

Summary The algebra denotes functions by combining other functions. The simplest functions: Z, S, P n are trivial Yet by using – Composition - C Term [ Term 1, …,Term n ] – Primitive recursion - PR Term Term Many other functions can be built Almost every function we use can be built this way

Sanity Check We can check if a term in the algebra is a function of n arguments check Z _ = True check S 1 = True check (P n) m = n <= m check (C f gs) n = check f (length gs) && (all (\g -> check g n) gs) check (PR g h) n = check g (n-1) && check h (n+1)

Partial Recursive Functions A belongs to class of partial recursive functions, a superset of the primitive recursive functions. Can be built from primitive recursive operators & new minimization operator – Let g be a (k+1)-argument function. – Define f(x1,...,xk) as the smallest m such that g(x1,...,xk,m) = 0 (if such an m exists) – Otherwise, f(x1,...,xn) is undefined – We write f(x1,...,xk) = μm.[g(x1,...,xk,m) = 0] – Example: μm.[mult(n,m) = 0] = zero(_)

Turing-computable functions To formalize the connection between partial recursive functions and Turing machines, mathematicians have described how to use TMʼs to compute functions on ℕ. We say a function f : ℕ x ℕ x... x ℕ → ℕ is Turing- computable if there exists a TM that, when started in configuration q 0 1 n1 ⊔ 1 n2 ⊔... ⊔ 1 nk, halts with just 1 f(n1,n2,...nk) on the tape. Fact: f is Turing-computable iff it is partial recursive.