Administrative stuff On Thursday, we will start class at 11:10, and finish at 11:55 This means that each project will get a 10 minute presentation + 5.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Types and Programming Languages Lecture 7 Simon Gay Department of Computing Science University of Glasgow 2006/07.
Proofs and Programs Wei Hu 11/01/2007. Outline  Motivation  Theory  Lambda calculus  Curry-Howard Isomorphism  Dependent types  Practice  Coq Wei.
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
First Order Logic Resolution
Copyright © Cengage Learning. All rights reserved.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Advanced Formal Methods Lecture 6: Isabelle - HOL Mads Dam KTH/CSC Course 2D1453, Material from L. Paulson.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Plan for today Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search.
What’s left in the course. The course in a nutshell Logics Techniques Applications.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
The Model Evolution Calculus Peter Baumgartner, MPI Saarbruecken and U Koblenz Cesare Tinelli, U Iowa.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
1 Theorem proving Alexander Serebrenik. 2 TP for FM FM: proving properties of programs. Theorem proving: proving statements in first-order logics (FOL).
` ² Q E D I Nelson-Oppen review
So far we have learned about:
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Natural deduction  ` A  ` B  ` A Æ B  ` A  ` A Æ B  ` B  ` B  ` A ) B  ` A  ` A ) B  ` B  ` A ÆIÆI ÆE1ÆE1 ÆE2ÆE2 Assume )I)I.
Review: forward E { P } { P && E } TF { P && ! E } { P 1 } { P 2 } { P 1 || P 2 } x = E { P } { \exists … }
First Order Logic (chapter 2 of the book) Lecture 3: Sep 14.
Course announcement Software Reliability Methods –Spring 06, Tu Th 9:30am-11:00am –Instructors: Ingolf Krueger, Ranjit Jhala, Sorin Lerner Topics: –Model.
Review: forward E { P } { P && E } TF { P && ! E } { P 1 } { P 2 } { P 1 || P 2 } x = E { P } { \exists … }
Plan for the rest of the quarter TuesdayThursday Week 7ResolutionProof carrying code Week 8No class (Sorin in DC for workshop) Predicate abstraction (Mystery.
After today Week 9 –Tu: Pat Rondon –Th: Ravi/Nathan Week 10 –Tu: Nathan/Ravi –Th: Class canceled Finals week –Th: Zach, John.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2.1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Course eval results More applications Last question –Luging: 0.5 –Curling: 1.5 –Figure skating: 2 –Ice fishing: 6.5 –Foosball: 0.5.
1 Section 3.3 Mathematical Induction. 2 Technique used extensively to prove results about large variety of discrete objects Can only be used to prove.
Going back to techniques Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain.
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
17.5 Rule Learning Given the importance of rule-based systems and the human effort that is required to elicit good rules from experts, it is natural to.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Reading and Writing Mathematical Proofs
MATH 224 – Discrete Mathematics
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
CSE 311 Foundations of Computing I Lecture 8 Proofs and Set Theory Spring
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
Logic in Computer Science - Overview Sep 1, 2009 박성우.
CS6133 Software Specification and Verification
CSE 311 Foundations of Computing I Lecture 9 Proofs and Set Theory Autumn 2012 CSE
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
CMSC 330: Organization of Programming Languages Operational Semantics a.k.a. “WTF is Project 4, Part 3?”
Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of.
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
CMSC 330: Organization of Programming Languages Operational Semantics.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
Metalogic Soundness and Completeness. Two Notions of Logical Consequence Validity: If the premises are true, then the conclusion must be true. Provability:
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming.
Lecture 2: Proofs and Recursion. Lecture 2-1: Proof Techniques Proof methods : –Inductive reasoning Lecture 2-2 –Deductive reasoning Using counterexample.
Chapter 7. Propositional and Predicate Logic
Lifting Propositional Interpolants to the Word-Level
Elementary Metamathematics
CSE 311: Foundations of Computing
Chapter 7. Propositional and Predicate Logic
Search techniques.
This Lecture Substitution model
Copyright © Cengage Learning. All rights reserved.
Presentation transcript:

Administrative stuff On Thursday, we will start class at 11:10, and finish at 11:55 This means that each project will get a 10 minute presentation + 5 minutes of questions and answers

Pred. abstraction for software verification Won’t go into details of paper This work is interesting from the perspective of this class because it ties together two techniques we’ve already seen: –ESC/Java style checking –Predicate abstraction (BLAST lecture given by Ranjit)

Curry-Howard Isomorphism

But before: Type systems 101

Simply typed lambda calculus Consider the simply typed lambda calculus: e ::= n (integers) |x (variables) | x: . e (function definition) |e 1 e 2 (function application)  ::= int (integer type) |   !  2  (function type)

Typing rules Typing judgment:  ` e:  Is read as: in context , e has type  The context tells us what the type of the free variables in e are Example: x:int, f:int ! int ` (f x):int Typing rules: Judgment 1 Judgment 2

Rules for lambda terms  ` (f x):  2

Rules for lambda terms  ` ( x:  1. b):

What other rules do we need?

 ` x:  x:  2   ` n: int

Summary so far  x:  1 ` b:  2  ` ( x:  1. b):  1 !  2  ` f:  1 !  2  ` (f x):  2  ` x:  1  ` x:  x:  2   ` n: int

Adding pairs e ::= n | x | x: . e | e 1 e 2  ::= int |   !  2

Adding pairs e ::= n | x | x: . e | e 1 e 2 |(e 1,e 2 )(pair construction) | fst e(select first element of a pair) | snd e(select second element of a pair)  ::= int |   !  2  |  1 *  2 (pair type)

Rules for pairs  ` (x,y):   *  2

Rules for pairs  ` fst x:    ` snd x:  

Rules for pairs (summary)  ` x:  1  ` (x,y):   *  2  ` y:  2  ` x:   *  2  ` fst x:    ` x:   *  2  ` snd x:  

Adding unions e ::= n | x | x: . e | e 1 e 2 | (e 1,e 2 ) | fst e | snd e  ::= int |   !  2  |  1 *  2

Adding unions e ::= n | x | x: . e | e 1 e 2 | (e 1,e 2 ) | fst e | snd e | inl e(create a union of the left case) | inr e(create a union of the right case) | case e of inl x ) e 1 | inr y ) e 2 (perform case analysis on union)  ::= int |   !  2  |  1 *  2 |  1 +  2 (sum (aka union) type)

Rules for unions  ` inl  x:  1 +  2  ` inr  x:  1 +  2

Rules for unions  ` z:  1 +  2  ` ( case z of inl x ) b 1 | inr y ) b 2 ) : 

Rules for unions (summary)  ` x:  1  ` inl  x:  1 +  2  ` y:  2  ` inr  x:  1 +  2  ` z:  1 +  2  ` ( case z of inl x ) b 1 | inr y ) b 2 ) :   x:  1 ` b 1 :  y:  2 ` b 2 : 

Curry-Howard Isomorphism

Typing rules for lambda terms Where have we seen these rules before?  x:  1 ` b:  2  ` ( x:  1. b):  1 !  2  ` f:  1 !  2  ` (f x):  2  ` x:  1

Typing rules for lambda terms  x:  1 ` b:  2  ` ( x:  1. b):  1 !  2  ` f:  1 !  2  ` (f x):  2  ` x:  1  ` B  ` A ) B  ` A ) B  ` A  ` B )I)I )E)E  1 ` 2 1 ` 2  `  1 !  2  `  2  `  1 Erase terms Convert to logic

Typing rules for pairs  ` x:  1  ` (x,y):   *  2  ` y:  2  ` x:   *  2  ` fst x:    ` x:   *  2  ` snd x:   Where have we seen these rules before?

Typing rules for pairs  ` x:  1  ` (x,y):   *  2  ` y:  2  ` x:   *  2  ` fst x:    ` x:   *  2  ` snd x:   Erase terms  ` 1 ` 1  `   *  2  ` 2 ` 2  `   *  2  `    `   *  2  `    ` A  ` B  ` A Æ B  ` A  ` A Æ B  ` B ÆIÆI ÆE1ÆE1 ÆE2ÆE2 Convert to logic

Typing rules for unions  ` x:  1  ` inl  x:  1 +  2  ` y:  2  ` inr  x:  1 +  2 Where have we seen these rules before?

Typing rules for unions  ` x:  1  ` inl  x:  1 +  2  ` y:  2  ` inr  x:  1 +  2 Erase terms ` 1` 1  `  1 +  2 ` 2` 2 Convert to logic  ` A  ` A Ç B ÇI1ÇI1  ` B  ` A Ç B ÇI2ÇI2

Typing rules for unions (cont’d)  ` z:  1 +  2  ` ( case z of inl x ) b 1 | inr y ) b 2 ) :   x:  1 ` b 1 :  y:  2 ` b 2 :  Where have we seen this rule before?

Typing rules for unions (cont’d)  ` z:  1 +  2  ` ( case z of inl x ) b 1 | inr y ) b 2 ) :   x:  1 ` b 1 :  y:  2 ` b 2 :   `  1 +  2 ` `   1 `  1 `  2 `  2 `   ` A Ç B  ` C ÇEÇE  ` C  ` C Erase terms Convert to logic

Curry-Howard isomorphism Propositions-as-types :  ::= int |   !    |  1 *  2 |  1 +  2 A ::=p| A 1 ) A 2 | A 1 Æ A 2 | A 1 Ç A 2 If types are propositions, then what are lambda terms?

Typing rules using logic for types  x : A ` y : B  ` ( x : A. y) : A ) B  ` f : A ) B  ` (f x) : B  ` x : A )I)I )E)E  ` x : A  ` (x,y) : A Æ B  ` y : B  ` x : A Æ B  ` fst x : A  ` x : A Æ B  ` snd x : B ÆIÆI ÆE1ÆE1 ÆE2ÆE2  ` x : A  ` inl  x : A Ç B  ` y : B  ` inr  x : A Ç B ÇI1ÇI1 ÇI2ÇI2  ` z : A Ç B  ` ( case z of inl x ) e 1 | inr y ) e 2 ) : C  x : A ` e 1 : C  y: B ` e 2 : C ÇEÇE

Curry-Howard isomorphism If types are propositions, then what are lambda terms? Answer: terms are proofs Programs-as-proofs:  ` e:A means that under assumptions , A holds and has proof e

Example A proof of A ) B is a function that takes a parameter x of type A (that is to say, a proof of A), and returns something of type B (that is to say, a proof of B)  x : A ` y : B  ` ( x : A. y) : A ) B )I)I

Another example Suppose we have a proof of A ) B. This is a function f that, given a proof of A, returns a proof of B. Suppose also that we have a proof of A, call it x. Then applying f to x gives us a proof of B.  ` f : A ) B  ` (f x) : B  ` x : A )E)E

Another example A proof of A Æ B is just a pair containing the proof of A and the proof of B  ` x : A  ` (x,y) : A Æ B  ` y : B ÆIÆI

Another example Given a proof of A, a proof of A Ç B is a union in the left case, which records that we attained the disjunction through the left of the Ç There is a problem though…  ` x : A  ` inl  x : A Ç B ÇI1ÇI1

Another example Given a proof of A, a proof of A Ç B is a union in the left case, which records that we attained the disjunction through the left of the Ç Unfortunately, the proof does not record what the right type of the union is. –Given that x is a proof of A, what is inl  x a proof of? Ideally, we would like the proof (lambda term) to determine the formula (type). What’s the fix?  ` x : A  ` inl  x : A Ç B ÇI1ÇI1

The fix for Ç proofs (union terms) Ideally, we would like the proof (lambda term) to determine the formula (type). What’s the fix?  ` x : A  ` inl  x : A Ç B  ` y : B  ` inr  x : A Ç B ÇI1ÇI1 ÇI2ÇI2

The fix for Ç proofs (union terms) Ideally, we would like the proof (lambda term) to determine the formula (type). What’s the fix? We add the other type to the Ç proof (union term):  ` x : A  ` inl B  x : A Ç B  ` y : B  ` inr A  x : A Ç B ÇI1ÇI1 ÇI2ÇI2

Intuition for quantifiers A proof of 8 x: . P(x) is a function that, given a parameter x of type , returns a proof of P(x) A proof of 9 x: . P(x) is a function that computes a value of type  for which P(x) holds Note that 8 x: .P(x) and 9 x: . P(x) are formulas, and so they are types. But they also contain a type  inside of them.

Programs-as-proofs The programs-as-proofs paradigm is operational: to prove something, we have to provide a program This program, when run, produces a computational artifact that represents a proof of the formula –the program itself is also a representation of the proof, but so is the final result computed by the program

Curry-Howard breaking down Because of the operational nature of the programs-as-proofs paradigm, the paradigm only works for proofs that are constructive Consider the formula 9 x. P(x) –A constructive proof must show how to compute the x that makes the formula valid –A proof by contradiction would assume 8 x. : P(x), and then derive false. –But this does not give us a way to compute x, which means it doesn’t give us a “program-as-proofs” proof.

Curry-Howard breaking down Curry-Howard isomorphism only holds for constructive logics –Like classical logic, except that we do not allow proofs by contradiction The rule that you remove depends on the calculus you’re using –In our natural deduction calculus, remove the following rule:  ` : : A  ` A : E

Constructive logic In other calculii, it may be the following rule: Or it may be the law of the excluded middle:  :  A  ` F  ` A  ` A Ç : A

Constructive logic example Consider the task of constructing an algorithm that prints 0 if Riemann’s Hypothesis holds and prints 1 otherwise. –Riemann’s Hypothesis has not been proved or disproved (Fermat’s last theorem was previously used, until it was proven…) Does such an algorithm exists?

Constructive logic example Consider the task of constructing an algorithm that prints 0 if Riemann’s Hypothesis holds and prints 1 otherwise. –Riemann’s Hypothesis has not been proved or disproved (Fermat’s last theorem was previously used, until it was proven…) Does such an algorithm exists? –Classicists: yes –Constructivists: don’t know yet. Need to wait until Riemann’s Hypothesis is proven or disproven

Constructive logic It may seem that using constructive logic is like tying your hands behind your back before starting a proof. So why use it? Several arguments for it, including philosophical ones One of the concrete arguments in favor of constructive logic is the Curry-Howard isomorphism, which leads to the so-called specifications-as-programs paradigm.

Specifications as programs Suppose we want to program an algorithm that given a natural number x produces a natural number y so that a decidable condition P(x,y) is satisfied A proof of 8 x. 9 y. P(x,y) in constructive logic yields a program for computing y from x, which is a provably correct implementation of the specification. Programs and specifications are the same!

Specifications as programs This idea has been used in various contexts, including two widely know theorem provers –Coq –NuPRL One of the main challenges in these systems is extracting efficient programs from the proofs

Conclusion

The course in a nutshell Logics Techniques Applications

Logics Propositional, first-order, higher-order Expressiveness, level of automation, human friendliness Constructive logic

Techniques Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy E-graph Rewrite rules Communication between decision procedures and between prover and decision procedures DPLL Backtracking Incremental SAT Matching Natural deduction Sequents Tactics & Tacticals Resolution Applying induction based on recursive structures

Applications Rhodium ESC/Java Blast Proof Carrying Code

What have we learned?