@igorwhiletrue

Similar documents
Introduction to Turing Machines

Decidability: Church-Turing Thesis

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

Automata Theory. Definition. Computational Complexity Theory. Computability Theory

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

The decision problem (entscheidungsproblem), halting problem, & Turing machines. CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

Fundamentals of Computer Science

Lecture 19: Universality and Computability

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Universality and Computability

Modelling with cellular automata

COMPUTER SCIENCE. Computer Science. 15. Turing Machines. Computer Science. An Interdisciplinary Approach. Section 7.4.

Automata Theory (2A) Young Won Lim 5/31/18

Computability Theory. CS215, Lecture 6,

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

15-251: Great Theoretical Ideas in Computer Science Lecture 7. Turing s Legacy Continues

Turing Machines COMP1600 / COMP6260. Dirk Pattinson Australian National University. Semester 2, 2017

Computability, Undeciability and the Halting Problem

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 14 : Turing Machines

Cellular automata are idealized models of complex systems Large network of simple components Limited communication among components No central

Fundamental Questions. Universality. What is a general purpose computer? Computability. Are there problems that no machine can solve?

Turing Machine Recap

The Legacy of Hilbert, Gödel, Gentzen and Turing

Notes for Lecture Notes 2

Theory of Computation. Theory of Computation

Theory of Computation Turing Machine and Pushdown Automata

Universality and Computability

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Universality and Computability. 7.4 Turing Machines. Fundamental Questions. Turing Machine

Opleiding Informatica

Automata Theory CS S-FR2 Final Review

Summary. Reg Dodds Department of Computer Science University of the Western Cape 2016 Reg Dodds

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Equivalent Variations of Turing Machines

A Note on Turing Machine Design

Turing Machines (TM) The Turing machine is the ultimate model of computation.

Decidable Languages - relationship with other classes.

1 Computational Problems

CHAPTER 6. Copyright Cengage Learning. All rights reserved.

Universality and Computability. 7.4 Turing Machines. Fundamental Questions. Turing Machine

Decidability and Undecidability

Church s undecidability result

Most General computer?

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lecture 1 : Introduction

The roots of computability theory. September 5, 2016

Computational Models Lecture 8 1

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.

Cellular Automata. History. 1-Dimensional CA. 1-Dimensional CA. Ozalp Babaoglu

Introduction to Languages and Computation

Turing s original paper (1936)

Computational Models Lecture 8 1

Theory of Computation (IX) Yijia Chen Fudan University

CST Part IB. Computation Theory. Andrew Pitts

Automata Theory CS Complexity Theory I: Polynomial Time

Computational Models Lecture 8 1

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

! Princeton == center of universe. ! Hilbert, Gödel, Turing, Church, von Neumann.

11. Automata and languages, cellular automata, grammars, L-systems

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

TURING MAHINES

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Part I: Definitions and Properties

Computation. Some history...

Exam Computability and Complexity

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

CPSC 421: Tutorial #1

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Models. Models of Computation, Turing Machines, and the Limits of Turing Computation. Effective Calculability. Motivation for Models of Computation

CA320 - Computability & Complexity

Decision, Computation and Language

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Models of Computation. by Costas Busch, LSU

Turing machines and linear bounded automata

The Church-Turing Thesis. Chapter 18

Theory of Computation

Chapter 7 Turing Machines

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

CS4026 Formal Models of Computation

CSCE 551: Chin-Tser Huang. University of South Carolina

CSCI3390-Lecture 6: An Undecidable Problem

CS21 Decidability and Tractability

PROOFS IN PREDICATE LOGIC AND COMPLETENESS; WHAT DECIDABILITY MEANS HUTH AND RYAN 2.3, SUPPLEMENTARY NOTES 2

Turing s Legacy Continues

Complexity Theory. Ahto Buldas. Introduction September 10, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

CS20a: Turing Machines (Oct 29, 2002)

Cantor s Theorem. Theorem 7 The set of all subsets of N (2 N ) is infinite and not countable.

COMPUTER SCIENCE. 18. Turing Machines. Section

CSci 311, Models of Computation Chapter 9 Turing Machines

Turing Machines Decidability

Turing Machines. Lecture 8

The Unsolvability of the Halting Problem. Chapter 19

Institute for Applied Information Processing and Communications (IAIK) Secure & Correct Systems. Decidability

Lecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem. Michael Beeson

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

CP405 Theory of Computation

Time Magazine (1984)

Transcription:

Abstrakte Maschinen

@igorwhiletrue

Programming is hard

Why?

Link between our universe and computational universe Cellular automata are self-replicating abstract machines Humans are self-replicating biological machines (down to the cellular level) Or is the entire universe a single machine?

Abstract machine is a model of computation Cellular automata are abstract machines

Conway s Game of Life

if alive 2 or 3 neighbours to survive if dead exactly 3 neighbours to spawn else cell is dead

1 1 2 1 3 5 2 2 1 2 2 2 2 3 2 1

1 1 2 1 3 5 2 2 1 2 2 2 2 3 2 1

1 2 1 3 5 2 2 2 2 2 2 3 2 1

1 2 1 3 5 2 2 2 2 2 2 3 2 1

Still lifes Oscillators Spaceships Guns, puffers, breeders

Cellular automaton Metaphor for life Complexity, emergence & stuff

Other cellular automata Codd s automaton (8 states) Langton s loops (8 states) Wireworld (4 states)

Deterministic finite automaton

Endlicher automat Regular expressions Directed state transition graph

(refs fixes closes) #\d*

(refs fixes closes) #\d*

(refs fixes closes) #\d*

fixes #1234

ixes #1234

xes #1234

es #1234

s #1234

#1234

#1234

1234

234

34

4

M = (Q, Σ, δ, q0, F) Rule δ = (q i, a qi1) Can accept regular languages

Regular expressions Network protocols Game states Business rules Workflows Queues

$rules = [ 0 => ['c' => 1, 'f' => 7, 'r' => 9], 1 => ['l' => 2], 2 => ['o' => 3],... ];! $tokens = ['f', 'i', 'x', 'e', 's', ' ', '#', '1', '2', '3', '4', 'EOF'];! foreach ($tokens as $token) { if (!isset($rules[$state][$token])) { throw new NoTransitionException(); }! $state = $rules[$state][$token]; }! $accepted = in_array($state, $accept_states);

Nondeterministic finite automaton

baz

baz

az

z

Does not add computational power Can be compiled to a DFA Previous DFA example already showed this Basic quantum physics

Pushdown automaton

Kellerautomat Introduces a stack Can determine balanced parens

e ( ( ( ( ) ) ) ( ) )

( ( ( ) ) ) ( ) ) x e

( ( ) ) ) ( ) ) x x e

( ) ) ) ( ) ) x x x e

x ) ) ) ( ) ) x x x e

) ) ( ) ) x x x e

) ( ) ) x x e

( ) ) x e

) ) x x e

) x e

e

e

M = (Q, Σ, Γ, δ, q0, Zo, F) Rule δ = (q i, a, sj qi1, sj1) Can accept context-free languages

Validation Parsers Stack machines

Turing Machine

0 0 1 1

0 0 1 1

0 0 1 0

0 0 0 0

0 1 0 0

0 1 0 0

0 1 0 0

0 1 0 0

0 1 0 0

0 1 0 0

0 1 0 0

0 1 0 1

0 1 0 1

0 1 0 1

0 1 0 1

M = (Q, Σ, Γ, δ, q0, b, F) Rule δ = (q i, aj qi1, aj1, dk) Can accept recursively enumerable languages Or loop forever

while (!in_array($state, $accept_states)) { $read_val = isset($tape[$position])? $tape[$position] : '_';! if (!isset($rules[$state][$read_val])) { throw new NoTransitionException(); }! list($write_val, $move_dir, $new_state) = $rules[$state][$read_val];! $tape[$position] = $write_val;! if ('l' === $move_dir) { $position--; if ($position < 0) { $position++; array_unshift($tape, '_'); } } else if ('r' === $move_dir) { $position++; if ($position >= count($tape)) { array_push($tape, '_'); } }! $state = $new_state; }

This machine can run any algorithm

This machine can run any algorithm etsy.com/shop/sharpwriter

Universality

increment add one-third

increment add one-third increment add one-third

increment add one-third

U increment add one-third

U M

Stored-program computer (John von Neumann) Programs as data FPGA PHPPHP

Turing completeness

System capable of emulating a turing machine Unbounded storage Conditional branching Recursion

Universal Turing Machine λ-calculus (Alonzo Church) Game of Life Brainfuck PHP

If PHP can only do as much as a turing machine, why bother? Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy. Epigrams on Programming by Alan Perlis

Is our universe really turing complete? Or are the possible paths finite and predetermined? Do even stronger forces exist?

Self-reference

<?php $data = <<<'DATA' $program = <<<PROGRAM <?php \$data = <<<'DATA'\n$data\nDATA; $data! PROGRAM; echo $program; DATA; $program = <<<PROGRAM <?php \$data = <<<'DATA'\n$data\nDATA; $data! PROGRAM; echo $program;

Recursion

call_user_func( function ($x) { return $x($x); }, function ($x) { return $x($x); } );

while (true);

Russell s paradox

Let R be the set of all sets that do not contain themselves Does R contain itself? If yes, then R s definition is incorrect If no, R is not in the set, so it must contain itself

Liar paradox: This sentence is false. Type theory Hierarchy of types avoids self-reference

Entscheidungsproblem

David Hilbert asks for an algorithm that decides if a statement in first-order logic is universally valid Halting problem can be reduced to Entscheidungsproblem Machine that determines if another machine will halt

Halts?

Halts? Negate

Copy Halts? Negate

X { Copy Halts? Negate

X ( ) X

X Copy Halts? Negate

Copy X X Halts? Negate

Copy X X Halts? true Negate

Copy X X Halts? true Negate

Copy X X Halts? }X true X Negate

Copy X X Halts? false Negate

Copy X X Halts? false Negate halting now

Copy X X Halts? }X false X Negate halting now

Proof by contradiction Decision machine cannot exist We are screwed

Ways to cope

Use finite state machines in parts of your programs

Build restricted subsets of computing such as type systems that cannot loop forever

Conclusion

Programming is hard

Questions? github.com/igorw conway-php turing-php lambda-php @igorwhiletrue