Lecture 2: Propositional and First-Order Logic

Slides:



Advertisements
Similar presentations
With examples from Number Theory
Advertisements

PROOF BY CONTRADICTION
Prof. Shachar Lovett Clicker frequency: CA CSE 20 Discrete math Prof. Shachar Lovett
Proofs and Programs Wei Hu 11/01/2007. Outline  Motivation  Theory  Lambda calculus  Curry-Howard Isomorphism  Dependent types  Practice  Coq Wei.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 3 CS 1813 – Discrete Mathematics Truth Inference and the Logical Way.
Induction Sections 41. and 4.2 of Rosen Fall 2008 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions:
TR1413: Discrete Mathematics For Computer Science Lecture 3: Formal approach to propositional logic.
1 Chapter 7 Propositional and Predicate Logic. 2 Chapter 7 Contents (1) l What is Logic? l Logical Operators l Translating between English and Logic l.
TR1413: INTRO TO DISCRETE MATHEMATICS LECTURE 2: MATHEMATICAL INDUCTION.
So far we have learned about:
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.
Review: forward E { P } { P && E } TF { P && ! E } { P 1 } { P 2 } { P 1 || P 2 } x = E { P } { \exists … }
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2.1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Problems to Solve Involving Induction Proof by Induction Basis Step: Does it work for n=0?
EE1J2 – Discrete Maths Lecture 5 Analysis of arguments (continued) More example proofs Formalisation of arguments in natural language Proof by contradiction.
Mathematical Induction Readings on induction. (a) Weiss, Sec. 7.2, page 233 (b) Course slides for lecture and notes recitation. Every criticism from a.
Reading and Writing Mathematical Proofs
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
1 Math/CSE 1019C: Discrete Mathematics for Computer Science Fall 2011 Suprakash Datta Office: CSEB 3043 Phone: ext
Methods of Proof Lecture 3: Sep 9. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical.
2.3Logical Implication: Rules of Inference From the notion of a valid argument, we begin a formal study of what we shall mean by an argument and when such.
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.
Formal Verification Lecture 9. Formal Verification Formal verification relies on Descriptions of the properties or requirements Descriptions of systems.
9.4 Mathematical Induction
Mathematical Induction I Lecture 4: Sep 16. This Lecture Last time we have discussed different proof techniques. This time we will focus on probably the.
CSE-490 Logic in Computer Science The Coq Proof Assistant POSTECH Dec 15, 2006 박성우.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
Logic in Computer Science - Overview Sep 1, 2009 박성우.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CS6133 Software Specification and Verification
Module #15 – Inductive Proofs 12/6/2015(c) , Michael P. Frank1 Inductive Proofs: a brief introduction Rosen 5 th ed., §3.3 ~35 slides, ~1.5 lecture.
September 29, 2009Theory of Computation Lecture 7: Primitive Recursive Functions III 1 Some Primitive Recursive Functions Example 3: h(x) = x! Here are.
1 Propositional Logic: Fundamental Elements for Computer Scientists 0. Motivation for Computer Scientists 1. Propositions and Propositional Variables 2.
INDUCTION Slides of Ken Birman, Cornell University.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
Mathematical Induction I Lecture 5: Sep 20 (chapter of the textbook and chapter of the course notes)
Mathematical Induction
1 Interactive Computer Theorem Proving CS294-9 September 28, 2006 Adam Chlipala UC Berkeley Lecture 6: A Crash Course on Proof Automation.
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.
1 Interactive Computer Theorem Proving CS294-9 September 14, 2006 Adam Chlipala UC Berkeley Lecture 4: Inductively- Defined Predicates.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Thoughts on Programming with Proof Assistants Adam Chlipala University of California, Berkeley PLPV Workshop.
Lecture 2: Proofs and Recursion. Lecture 2-1: Proof Techniques Proof methods : –Inductive reasoning Lecture 2-2 –Deductive reasoning Using counterexample.
Lecture 11: Proof by Reflection
Chapter 7. Propositional and Predicate Logic
Section 3.3 The Product and Quotient Rule
COT 3100, Spring 2001 Applications of Discrete Structures
Section 2-3b The Product Rule
MATH 245 Spring 2009 This is mathematics for computer science
Revisiting Predicate Logic LN chapters 3,4
CSE 311: Foundations of Computing
Proof Techniques.
Explorations in Artificial Intelligence
Methods for Evaluating Validity
Chapter 10: Mathematical proofs
Lecture 11 CS 1813 – Discrete Mathematics
Propositional Logic.
Computer Security: Art and Science, 2nd Edition
Metatheorems Computational Logic Lecture 8
Chapter 7. Propositional and Predicate Logic
Search techniques.
6-1: Operations on Functions (+ – x ÷)
Primitive Recursive Predicates
CSE 311 Foundations of Computing I
Introduction to Proofs
Lesson: Derivative Techniques -1
Presentation transcript:

Lecture 2: Propositional and First-Order Logic Interactive Computer Theorem Proving Lecture 2: Propositional and First-Order Logic CS294-9 August 31, 2006 Adam Chlipala UC Berkeley

What is a Proof? Theorem: For all n, 2∑i 2 0..n i = n(n+1). Liberal use of natural language What is a Proof? Ad-hoc idea of which high-level argument techniques are valid Theorem: For all n, 2∑i 2 0..n i = n(n+1). Proof: By induction on n. Base case (n = 0): 2∑i 2 0..n i = 0 = 0(0+1) Inductive case (n = n' + 1): IH: 2∑i 2 0..n' i = n'(n'+1) 2∑i 2 0..n i = 2(n'+1) + 2 ∑i 2 0..n' i = 2(n'+1) + n'(n' + 1) = (n' + 1)(n' + 2) All sorts of zany notations “Obvious steps” whose obviousness is in the eye of the beholder

Getting Warmer....

Coq Version Fixpoint sum (n : nat) : nat := match n with | O => O | S n => S n + sum n end. Theorem sum_equals : forall n, 2 * sum n = n * (n + 1). induction n. trivial. defn sum. rewrite mult_plus_distr_l. rewrite IHn. ring_nat. Qed.

Under the Hood.... sum_equals = fun n : nat => nat_ind (fun n0 : nat => 2 * sum n0 = n0 * (n0 + 1)) (refl_equal (0 * (0 + 1))) (fun (n0 : nat) (IHn : 2 * sum n0 = n0 * (n0 + 1)) => eq_ind_r (fun n1 : nat => n1 = S n0 * (S n0 + 1)) (eq_ind_r (fun n1 : nat => 2 * S n0 + n1 = S n0 * (S n0 + 1)) (eq_ind (interp_cs plus mult 1 0 (Node_vm n0 (Empty_vm nat) (Empty_vm nat)) (Cons_monom 2 Nil_var (Cons_monom 3 (Cons_var End_idx Nil_var) (Cons_varlist (Cons_var End_idx (Cons_var End_idx Nil_var)) (Nil_monom nat))))) (fun n1 : nat => (1 + 1) * (1 + n0) + n0 * (n0 + 1) = n1) (sym_eq (spolynomial_simplify_ok nat plus mult 1 0 nateq (Node_vm n0 (Empty_vm nat) (Empty_vm nat)) NatTheory (SPplus (SPmult (SPplus (SPconst 1) (SPconst 1)) (SPplus (SPconst 1) (SPvar nat End_idx))) (SPmult (SPvar nat End_idx) (SPplus (SPvar nat End_idx) (SPconst 1)))))) ((1 + n0) * (1 + n0 + 1)) (SPmult (SPplus (SPconst 1) (SPvar nat End_idx)) (SPplus (SPplus (SPconst 1) (SPvar nat End_idx)) (SPconst 1))))) IHn) (mult_plus_distr_l 2 (S n0) (sum n0))) n

Propositional Logic p ::= > | ? | P | p ! p | p ^ p | p _ p | :p 1 P ^ Q ! P _ Q P Q 1 P P ! P OK, now let's check A ^ B ^ C ^ D ^ E ^ F ! D

Natural Deduction: “and” A ^ B A B ^I A ^ B A ^E1 B ^E2 Example Given: D B A B ^ A ^E2 ^E1 ^I D : A ^ B > >I Example > ^ > > >I ^I

Natural Deduction: “implies” A ! B A B !E x : A B A ! B !I On the board: (A ! B) ! (B ! C) ! (A ! C) Example Example (A ! B) ! A ! B A ! B x : A ! B y : A y x B !I !E x : A x A ! A !I

Natural Deduction: “or” A _ B A _I1 B _I2 Example A _ A ! A !I A _E x : A _ A y : A z : A x y z A _ B C x : A y : B _E On the board: (A ! C) ! (B ! C) ! A _ B ! C

Natural Deduction: “false” and “not” ? ? :A :I x : A :A A B :E On the board: :? On the board: ::> We can derive the “not” rules by defining: :A ´ A ! ?

And now in Coq... (natded.v)

First-Order Logic t ::= x | f(t, ..., t) p ::= > | ? | p ! p | p ^ p | p _ p | :p | P(t, ..., t) | t = t | 8x, p | 9x, p Examples 8x, P(x) ! 9y, Q(x, y) 8x, f(x) = g(x) ! x = c _ x = h(x, c) Bad news: We're dealing with infinite universes, so there is no clear analogue of truth tables. Good news: We can extend natural deduction to work for first-order logic.

Natural Deduction: “forall” 8x, A A{x := t} 8E y A{x := y} 8x, A 8I

Natural Deduction: “exists” A{x := t} 9x, A 9I y B 9E A{x := y} 9x, A

Natural Deduction: “equals” t = t =I A A{t1 := t2} =E t1 = t2

Conclusion All code is on the web site. HW1 is posted Propositional & first-order logic Due before the start of next lecture Next lecture: Data structures