David Evans University of Virginia cs1120 Fall 2009 Lecture 38: Modeling Computing.

Slides:



Advertisements
Similar presentations
Lecture Ref. handout page
Advertisements

David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 26: Proving Uncomputability Visualization.
Lecture 19. Reduction: More Undecidable problems
CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
David Evans CS200: Computer Science University of Virginia Computer Science Class 30: Models of Computation.
Class 39: Universality cs1120 Fall 2009 David Evans University of Virginia.
David Evans CS200: Computer Science University of Virginia Computer Science Class 27: Modeling Computation.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 39: Lambda Calculus.
Big Words, Busy Beavers, and The Cake of Computing David Evans flickr: mwichary TAPESTRY Workshop University of Virginia 15.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
Lecture 2 Page 1 CS 236, Spring 2008 Security Principles and Policies CS 236 On-Line MS Program Networks and Systems Security Peter Reiher Spring, 2008.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 29: Computability, Turing Machines, Can Computers Think?
Courtesy Costas Busch - RPI1 Reducibility. Courtesy Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.
Turing Machines CS 105: Introduction to Computer Science.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 2: Modeling Computers.
Class 19: Undecidability in Theory and Practice David Evans cs302: Theory of Computation University of Virginia Computer.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
David Evans CS200: Computer Science University of Virginia Computer Science Class 31: Universal Turing Machines.
Cs3102: Theory of Computation Class 17: Undecidable Languages Spring 2010 University of Virginia David Evans.
Complexity and Computability Theory I Lecture #13 Instructor: Rina Zviel-Girshin Lea Epstein Yael Moses.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
David Evans Turing Machines, Busy Beavers, and Big Questions about Computing.
Class 37: Uncomputability David Evans University of Virginia cs1120 Halting Problems Hockey Team.
Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011.
David Evans Curing Cancer with Your Cell Phone: Why all Sciences are Becoming Computing Sciences.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 27: Viruses and Object-Oriented Programming.
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
Cs3102: Theory of Computation Class 24: NP-Completeness Spring 2010 University of Virginia David Evans.
David Evans CS588: Security and Privacy University of Virginia Computer Science Lecture 15: Complexity Notes This is selected.
What Every Biologist, Chemist, and Poet Should Know about Computer Science David Evans UVaCompBio 25 April
David Evans CS150: Computer Science University of Virginia Computer Science Class 33: Computing with Photons From The.
Halting Problem Introduction to Computing Science and Programming I.
Cs3102: Theory of Computation Class 14: Turing Machines Spring 2010 University of Virginia David Evans.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 26: Proving Uncomputability.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 16: Universality and Undecidability.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 36: Modeling Computing.
Halting Problem and TSP Wednesday, Week 8. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have.
Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Fundamentals of Informatics Lecture 13 Reduction Bas Luttik.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
Recursively Enumerable and Recursive Languages
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
CompSci Today’s Topics Computer Science Noncomputability Upcoming Special Topic: Enabled by Computer -- Decoding the Human Genome Reading Great.
David Evans CS200: Computer Science University of Virginia Computer Science Class 26: Halting Problem It is plain at any.
Introduction to Computing Science and Programming I
Class 30: Models of Computation CS200: Computer Science
CSE 311 Foundations of Computing I
Lecture 37: A Universal Computer
Turing Machines, Busy Beavers, and Big Questions about Computing
Computable Problems.
Theory of Computation Turing Machines.
Lecture 25: Metalinguistics > (meval '((lambda (x) (* x x)) 4)
Recall last lecture and Nondeterministic TMs
Class 24: Computability Halting Problems Hockey Team Logo
Class 34: Models of Computation CS200: Computer Science
Class 26: Modeling Computing CS150: Computer Science
Lecture 23: Computability CS200: Computer Science
Presentation transcript:

David Evans University of Virginia cs1120 Fall Lecture 38: Modeling Computing

Menu Noncomputability of Malware Detection Modeling Computing – Turing’s Model – Universal Machines Remember to send me your requested site name by midnight tonight if you want your site hosted at name.cs.virginia.edu. Exam 2 and Final

Is-Malware Problem Input: A string, s, representing a program. Output: If s is malware, True; otherwise, False. Is “Is-Malware” computable?

From Paul Graham’s “Undergraduation”:Undergraduation My friend Robert learned a lot by writing network software when he was an undergrad. One of his projects was to connect Harvard to the Arpanet; it had been one of the original nodes, but by 1984 the connection had died. Not only was this work not for a class, but because he spent all his time on it and neglected his studies, he was kicked out of school for a year.... When Robert got kicked out of grad school for writing the Internet worm of 1988, I envied him enormously for finding a way out without the stigma of failure.... It all evened out in the end, and now he’s a professor at MIT. But you’ll probably be happier if you don’t go to that extreme; it caused him a lot of worry at the time. 3 years of probation, 400 hours of community service, $10,000+ fine

Morris Internet Worm (1988) p = fingerd – Program used to query user status – Worm also attacked other programs i = " nop 400 pushl $68732f pushl $6e69622f movl sp,r10 pushl $0 pushl $0 pushl r10 pushl $3 movl sp,ap chmk $3b " is_malware("p(i)") should evaluate to True Worm infected several thousand computers (~10% of Internet in 1988)

Uncomputability Proof Suppose we could define is_malware. Then we could define halts: def halts(s): return is_malware (remove_evil(s) + '''''' do_evil() '''''') Can we make remove_evil? Yes, just replace all externally visible actions (e.g., file writes) in s with shadow actions. Thus, is_malware is noncomputable.

Can Anti-Virus programs exist? “The Art of Computer Virus Research and Defense” Peter Szor, Symantec

“Solving” Noncomputable Problems Since the problem is noncomputable, there is no procedure that (1) always gives the correct answer, and (2) always finishes. Must give up one of these to “solve” undecidable problems – Giving up #2 is not acceptable in most cases – Must give up #1 Or change the problem: e.g., detect file infections during an execution

Actual is_malware Programs Sometimes give the wrong answer – “False positive”: say P is a virus when it isn’t – “False negative”: say P is safe when it is Database of known viruses: if P matches one of these, it is a virus Clever virus authors can make viruses that change each time they propagate – Emulate program for a limited number of steps; if it doesn’t do anything bad, assume it is safe

How convincing is our Halting Problem proof? This “proof” assumes Python exists and is means exactly what it should! Python is too complex to believe this: we need a simpler and more precise model of computation. def paradox(): if halts('paradox()'): while True: pass def paradox(): if halts('paradox()'): while True: pass 1. paradox leads to a contradiction. 2.If we have halts, an algorithm that solves the Halting Problem, we can define paradox. 3.Therefore, halts does not exist.

Should Python implementation convince us that Python exists? def make_huge(n): if n == 0: return [0] return make_huge(n-1) + make_huge(n-1) def make_huge(n): if n == 0: return [0] return make_huge(n-1) + make_huge(n-1) >>> len(make_huge(10)) 1024 >>> len(make_huge(100)) File "C:/Users/David Evans/cs1120/huge.py", line 3, in make_huge return make_huge(n-1) + make_huge(n-1) File "C:/Users/David Evans/cs1120/huge.py", line 3, in make_huge return make_huge(n-1) + make_huge(n-1)... File "C:/Users/David Evans/cs1120/huge.py", line 3, in make_huge return make_huge(n-1) + make_huge(n-1) MemoryError No real interpreter can correctly implement the full semantics of Python!

Solutions Option 1: Prove “Python” does exist – Show that some ideal interpreter could implement all the evaluation rules (but what is interpreting that ideal interpreter?) Option 2: Find a simpler computing model – Define it precisely – Show that the Halting paradox procedure can be defined in this model Note: our running time analyses also all depend on our computing model!

What makes a good model? Copernicus F = GM 1 M 2 / R 2 Newton Ptolomy

How should we model a Computer? Apollo Guidance Computer (1969) Colossus (1944) Cray-1 (1976) Palm Pre (2009) Flickr: louisvolant Apple II (1977) Honeywell Kitchen Computer (1969) Turing invented the model we’ll use today in What “computer” was he modeling?

“Computers” before WWII

Mechanical Computing

Modeling Computers Input – Without it, we can’t describe a problem Output – Without it, we can’t get an answer Processing – Need some way of getting from the input to the output Memory – Need to keep track of what we are doing

Modeling Input Engelbart’s mouse and keypad Punch Cards Altair BASIC Paper Tape, 1976

Turing’s Model “Computing is normally done by writing certain symbols on paper. We may suppose this paper is divided into squares like a child’s arithmetic book.” Alan Turing, On computable numbers, with an application to the Entscheidungsproblem, 1936

Modeling Pencil and Paper #CSSA723 How long should the tape be?... Infinitely long! We are modeling a computer, not building one. Our model should not have silly practical limitations (like a real computer does).

Modeling Output Blinking lights are cool, but hard to model Use the tape: output is what is written on the tape at the end Connection Machine CM-5, 1993

Modeling Processing (Brains) Look at the current state of the computation Follow simple rules about what to do next

Modeling Processing Evaluation Rules – Given an input on our tape, how do we evaluate to produce the output What do we need: – Read what is on the tape at the current square – Move the tape one square in either direction – Write into the current square Is that enough to model a computer?

Modeling Processing Read, write and move is not enough We also need to keep track of what we are doing: – How do we know whether to read, write or move at each step? – How do we know when we’re done? What do we need for this?

Finite State Machines 1 Start 2 HALT # 0

Hmmm…maybe we don’t need those infinite tapes after all? 1 Start 2 HALT ( not a paren ) # ) ERROR What if the next input symbol is ( in state 2?

How many states do we need? 1 Start 2 HALT ( not a paren ) # ) ERROR 3 not a paren ( ) 4 ( ) (

Finite State Machine There are lots of things we can’t compute with only a finite number of states Solutions: – “Infinite” State Machine Hard to define, draw, and reason about – Add an infinite tape to the Finite State Machine

Modeling Processing (Brains) Follow simple rules Remember what you are doing “For the present I shall only say that the justification lies in the fact that the human memory is necessarily limited.” Alan Turing

FSM + Infinite Tape Start: – FSM in Start State – Input on Infinite Tape – Pointer to start of input Step: – Read one input symbol from tape – Write symbol on tape, and move L or R one square – Follow transition rule from current state Finish: – Transition to halt state

Turing’s Model: Turing Machine 1 Start 2 Input: # Write: # Move:  # # Input: 1 Write: 0 Move:  Input: 1 Write: 1 Move:  Input: 0 Write: 0 Move:  3 Input: 0 Write: # Move: Halt Infinite Tape: Finite set of symbols, one in each square Can read/write one square each step Controller: Limited (finite) number of states Follow rules based on current state and read symbol Write one square each step, move left or right or halt, change state

Charge If you want us to host your site, remember to send me your site name before midnight tonight! Wednesday: – Busy Beavers – Alternate Computing Models