1 Interactive Computer Theorem Proving CS294-9 September 14, 2006 Adam Chlipala UC Berkeley Lecture 4: Inductively- Defined Predicates.

Slides:



Advertisements
Similar presentations
Proofs and Programs Wei Hu 11/01/2007. Outline  Motivation  Theory  Lambda calculus  Curry-Howard Isomorphism  Dependent types  Practice  Coq Wei.
Advertisements

LING 388: Language and Computers Sandiway Fong Lecture 5: 9/5.
LING 388: Language and Computers Sandiway Fong Lecture 5: 9/8.
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.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Model Checking Lecture 5. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Computability and Complexity 19-1 Computability and Complexity Andrei Bulatov Non-Deterministic Space.
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
Self-Reference - Induction Cmput Lecture 7 Department of Computing Science University of Alberta ©Duane Szafron 1999 Some code in this lecture is.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Rules have form String of variables and terminals String of variables and terminals.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
Linear Bounded Automata LBAs
Homework #9 Solutions.
1 Decidability continued. 2 Undecidable Problems Halting Problem: Does machine halt on input ? State-entry Problem: Does machine enter state halt on input.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
Model Checking Lecture 5. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.
TM Design Universal TM MA/CSSE 474 Theory of Computation.
MA/CSSE 474 Theory of Computation Decision Problems DFSMs.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
Chapter 5: Sequences, Mathematical Induction, and Recursion 5.5 Application: Correctness of Algorithms 1 [P]rogramming reliability – must be an activity.
CS4026 Formal Models of Computation Part II The Logic Model Lecture 2 – Prolog: History and Introduction.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Lecture 1 Overview Topics 1. Proof techniques: induction, contradiction Proof techniques June 1, 2015 CSCE 355 Foundations of Computation.
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
September 29, 2009Theory of Computation Lecture 7: Primitive Recursive Functions III 1 Some Primitive Recursive Functions Example 3: h(x) = x! Here are.
This Week Lecture on relational semantics Exercises on logic and relations Labs on using Isabelle to do proofs.
Loop Invariants and Binary Search Chapter 4.4, 5.1.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Consider problems with answer YES or NO Examples: Does Machine have three states ? Is string a binary.
1 Proving Properties of Recursive List Functions CS 270 Math Foundations of CS Jeremy Johnson.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
1 Interactive Computer Theorem Proving CS294-9 September 28, 2006 Adam Chlipala UC Berkeley Lecture 6: A Crash Course on Proof Automation.
Cooperative Integration of an Interactive Proof Assistant and an Automated Prover Adam Chlipala and George C. Necula University of California, Berkeley.
1 Interactive Computer Theorem Proving CS294-9 October 5, 2006 Adam Chlipala UC Berkeley Lecture 7: Programming with Proofs.
1 Interactive Computer Theorem Proving CS294-9 November 30, 2006 Adam Chlipala UC Berkeley Lecture 14: Twelf.
1 Interactive Computer Theorem Proving CS294-9 October 19, 2006 Adam Chlipala UC Berkeley Lecture 9: Beyond Primitive Recursion.
1 Interactive Computer Theorem Proving CS294-9 September 7, 2006 Adam Chlipala UC Berkeley Lecture 3: Data structures and Induction.
Thoughts on Programming with Proof Assistants Adam Chlipala University of California, Berkeley PLPV Workshop.
Lecture 2: Propositional and First-Order Logic
Lecture 11: Proof by Reflection
CSCE 355 Foundations of Computation
Automata, Grammars and Languages
MATH 245 Spring 2009 This is mathematics for computer science
Linear Bounded Automata LBAs
Reductions.
Undecidable Problems Costas Busch - LSU.
Theory of Computation Lecture 14: A Universal Program V
CSCE 355 Foundations of Computation
Proving Properties of Recursive List Functions
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSE 311 Foundations of Computing I
Decidable Languages Costas Busch - LSU.
CS21 Decidability and Tractability
Instructor: Aaron Roth
CSE 311: Foundations of Computing
Decidability continued….
More Undecidable Problems
Recapitulation of Lecture 13
Presentation transcript:

1 Interactive Computer Theorem Proving CS294-9 September 14, 2006 Adam Chlipala UC Berkeley Lecture 4: Inductively- Defined Predicates

2 Administrivia ● The course registration database has been updated so that you can change your units for this class to 1. – Stay at 3 units if you plan to do a class project for credit. – Otherwise, reduce to 1 unit. ● Resource links added to web site. ● Created Majordomo mailing list for the class (details to follow by ) ● You can check HW1 yourself, so not being “handed back.” :-)

3 What Is “less than or equal to”? Fixpoint le_f (n m : nat) {struct n} : Prop := match n with | O => True | S n' => match m with | O => False | S m' => le_f n' m' end end. le_f 1 3 le_f 0 2 True le_f 3 1 le_f 2 0 False

4 Proving Transitivity ● Theorem: le_f n1 n2 -> le_f n2 n3 -> le_f n1 n3 ● Proof: By induction on n1. ● Case: n1 = 0. – le_f n1 n3 follows by computation. ● Case: n1 = S n1'. – By computation, n2 = S n2' with le_f n1' n2'. – From le_f (S n2') n3, we have n3 = S n3' with le_f n2' n3'. – By the IH, le_f n1' n3'. – By computation, le_f (S n1') (S n3').

5 Pros and Cons ● Pros – We used the same recursive function mechanism that's worked before. ● Cons – That was a fairly acrobatic proof for such a simple theorem! – How could we use this same approach to define what it means for a Turing machine to halt with a particular configuration?

6 Another “less than or equal to” n · nn · n le_n n · S mn · S m n · mn · m le_S 4 · 4 le_n 1 · 3 le_S 1 · 2 le_S 1 · 1 le_n 3 · 1 ? ?

7 Transitivity Again If P : n1 · n2 and Q : n2 · n3, then there exists R : n1 · n3. Proof: Induction on the structure of Q. Case: P : n1 · n2; Q = n2 · n2 le_n (n3 = n2) Answer: R = P Case: P : n1 · n2; Q = n2 · S n3' le_S Q' : n2 · n3' (n3 = S n3') IH: For any P' : n1 · n2, there exists R' : n1 · n3'. n1 · S n3' le_S R' (with P' := P) Answer: R =

8 A Comparison ● Computation proves many theorems atomically. ● Proofs follow the structure of the data type. ● The natural formulation only works for a limited subset of the computable functions. ● Explicit “logic programming” needed in all cases. ● Proofs follow the structure of your custom proof rules. ● Natural formulations work for expressing very uncomputable notions. FixpointInductive

9 Example: Turing Machines Let F be the set of final states. Let ) 1 be a binary relation expressing a single step. We want to define ), the state reachability relation. C ) CC ) C C ) C'' C ) 1 C' C' ) C'' 9 C', C' 2 F ^ C ) C' How do we express “a machine starting in configuration C terminates”? How is it that we got around the undecidability of this problem? Fixpoint run (n : nat) (C : config) {struct n} : Prop := match n with | O => F C | S n' => F C \/ run n' (s1 C) end. run 2 C F C \/ F (s1 C) \/ F (s1 (s1 C)) 9 n, run n C

10 Example: Sorted Lists sorted [] sorted [n] sorted (n :: m :: ls) sorted (m :: ls) n · mn · m We want to define what it means for a list nat to be sorted.

11 Sublists sublist [] [] sublist (n :: ls) (n :: ls') sublist ls ls' sublist (n :: ls) ls' sublist ls ls' We want to define what it means for one list to be a sublist of another. Example: [1], [1, 4], and [2, 3] are some sublists of [1, 2, 3, 4]. [3, 2] is not a sublist of [1, 2, 3, 4], because order matters.

12 A Theorem sorted [] sorted [n] sorted (n :: m :: ls) sorted (m :: ls) n · mn · m sublist [] [] sublist (n :: ls) (n :: ls') sublist ls ls' sublist (n :: ls) ls' sublist ls ls' If sorted ls and sublist ls ls' then sorted ls'.

13 Example: A Programming Language Interpreter n ::= O | S n b ::= true | false x ::= [variable] e ::= n | b | x | e + e | e = e c ::= skip | x := e | c; c | if e then c else c | while e do c

14 Conclusion ● Sample HW2 solution will be on the web site. ● HW3 is posted – Inductively-defined predicates involving lists ● Next lecture: Proofs as programs – Given by George, since I'll be out of town at the Workshop on Mechanizing Metatheory 1 – 1 That means using computers to write proofs about programming languages.