15-251 Great Theoretical Ideas in Computer Science.

Slides:



Advertisements
Similar presentations
Logic & Critical Reasoning
Advertisements

Axiomatic Systems & Logic
1 Introduction to Abstract Mathematics Valid AND Invalid Arguments 2.3 Instructor: Hayk Melikya
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Valid Arguments An argument is a sequence of propositions. All but the final proposition are called premises. The last statement is the conclusion. The.
CS128 – Discrete Mathematics for Computer Science
Today’s Topics n Review Logical Implication & Truth Table Tests for Validity n Truth Value Analysis n Short Form Validity Tests n Consistency and validity.
Logic: Connectives AND OR NOT P Q (P ^ Q) T F P Q (P v Q) T F P ~P T F
1 Math 306 Foundations of Mathematics I Math 306 Foundations of Mathematics I Goals of this class Introduction to important mathematical concepts Development.
Computability and Complexity 10-1 Computability and Complexity Andrei Bulatov Gödel’s Incompleteness Theorem.
Propositional Logic Lecture 2: Sep 9. Conditional Statement If p then q p is called the hypothesis; q is called the conclusion “If your GPA is 4.0, then.
Discussion #9 1/9 Discussion #9 Tautologies and Contradictions.
Propositional Logic 7/16/ Propositional Logic A proposition is a statement that is either true or false. We give propositions names such as p, q,
EE1J2 – Discrete Maths Lecture 4 Analysis of arguments Logical consequence Rules of deduction Rules of equivalence Formal proof of arguments See: Anderson,
Logic Truth Tables, Propositions, Implications. Statements Logic is the tool for reasoning about the truth or falsity of statements. –Propositional logic.
Propositional Logic.
CSci 2011 Discrete Mathematics Lecture 3 CSci 2011.
Intro to Discrete Structures
Course Outline Book: Discrete Mathematics by K. P. Bogart Topics:
MATH 224 – Discrete Mathematics
CSE 311: Foundations of Computing Fall 2013 Lecture 8: More Proofs.
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.
Math 240: Transition to Advanced Math Deductive reasoning: logic is used to draw conclusions based on statements accepted as true. Thus conclusions are.
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Pattern-directed inference systems
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity MATH Some Formal Logic (which is really.
Of 33 lecture 12: propositional logic – part I. of 33 propositions and connectives … two-valued logic – every sentence is either true or false some sentences.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Chapter 3: Introduction to Logic. Logic Main goal: use logic to analyze arguments (claims) to see if they are valid or invalid. This is useful for math.
Chapter 8 – Symbolic Logic Professor D’Ascoli. Symbolic Logic Because the appraisal of arguments is made difficult by the peculiarities of natural language,
Great Theoretical Ideas in Computer Science.
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
Great Theoretical Ideas in Computer Science.
How do I show that two compound propositions are logically equivalent?
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
Logical Form and Logical Equivalence M Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program.
CS6133 Software Specification and Verification
Mathematical Preliminaries
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
Computer Science CPSC 322 Lecture 22 Logical Consequences, Proof Procedures (Ch 5.2.2)
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 11 The Foundations: Logic and Proofs Rules of inference.
CSci 2011 Discrete Mathematics Lecture 4 CSci 2011.
CS104:Discrete Structures Chapter 2: Proof Techniques.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Outline Logic Propositional Logic Well formed formula Truth table
TRUTH TABLES Edited from the original by: Mimi Opkins CECS 100 Fall 2011 Thanks for the ppt.
CSE 311 Foundations of Computing I Lecture 8 Proofs Autumn 2012 CSE
Lecture 10 Methods of Proof CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Metalogic Soundness and Completeness. Two Notions of Logical Consequence Validity: If the premises are true, then the conclusion must be true. Provability:
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Propositional and predicate logic
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture–10: Soundness of Propositional Calculus 12 th August, 2010.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Sound Arguments and Derivations. Topics Sound Arguments Derivations Proofs –Inference rules –Deduction.
Chapter 1 Logic and proofs
CSE 311 Foundations of Computing I
Discrete Mathematics for Computer Science
Great Theoretical Ideas in Computer Science
Boolean logic Taken from notes by Dr. Neil Moore
CSE 311: Foundations of Computing
CS21 Decidability and Tractability
MA/CSSE 474 More Math Review Theory of Computation
Great Theoretical Ideas in Computer Science
Boolean logic Taken from notes by Dr. Neil Moore
This Lecture Substitution model
Presentation transcript:

Great Theoretical Ideas in Computer Science

Proofs and Logic Lecture 10 (September 23, 2010) P, P  Q Q

1+1 = 2 do we need a proof?

In mathematics, sometimes your intuition can be dead wrong. We know that 1  2 But here’s a theorem of Banach & Tarski: A solid ball in 3-dimensions can be cut up into a finite number of pieces, so that these pieces can be moved around and assembled into two identical copies of the original ball. Not possible in 1 or 2 dimensions, btw.

So it really pays off to: Formalize concepts, give precise definitions Make implicit assumptions explicit Write careful proofs, where every step can be checked carefully. Even “mechanically” using a “computing machine”, if you will

What is a proof?

3. Math. and Logic. A sequence of steps by which a theorem or other statement is derived from given premises. 1. a. Something that proves a statement; evidence or argument establishing a fact or the truth of anything, or belief in the certainty of something; an instance of this. Let’s ask the OED

What is a proof? Intuitively, a proof is a sequence of “statements”, each of which follows “logically” from some of the previous steps. What are “statements”? What does it mean for one to follow “logically” from another?

We’ll lay the groundwork for these questions in today’s lecture… But we will come back to these questions again later…

Propositions A proposition is a statement that is either true or false. snow is white 2+2 = 5 Socrates had six digits on his left hand the summer solstice occurs on June 21 st

Propositions A proposition is a statement that is either true or false. snow 2+2 is xadk keosign sziable?

Complex Statements If snow is white then the sun rises in the west Socrates was bald and Cicero ate a pie = 5 if and only if = 9 Snow is not white

Complex Statements snow is white  the sun rises in the west Socrates was bald  Cicero ate a pie = 5  = 9  (Snow is white)

Well-Formed Statements Every “simple” proposition is a well-formed propositional statement If A and B are well-formed so are (A  B), (A  B),  A, (A  B), (A  B) and or notif… thenif and only if

The “meaning” of these connectives (A  B) “A and B” (A  B) “A or B”  A“not A” true if both A and B are true true if at least one of A and B is true true if A is false ABAÆBAÆB TTT TFF FTF FFF AB A  B TTT TFT FTT FFF A AA TF FT

The “meaning” of these connectives (A  B)“if A then B” what are the rules for this? “A implies B”

The “meaning” of these connectives (A  B)“if A then B” (A  B)“A if and only if B” what are the rules for this? AB ABAB TTT TFF FTT FFT “A implies B” same as (A  B) and (B  A) AB ABAB TTT TFF FTF FFT

If snow is white then grass is green. Therefore, grass is green. Snow is white. Which of the following are true? Snow is white. If snow is white then grass is green. Therefore, grass is green.

Which of the following are true? The orchestra will not play both Bach and Haydn. The orchestra will not play Bach. Therefore, the orchestra will play Haydn.

Let’s abstract out the underlying mathematical structure…

Well-Formed Propositional Formulas If A and B are well-formed so are (A  B), (A  B),  A, (A  B), (A  B) p? Is  (p   q) well formed? The truth values T and F are well-formed All variables p, q, p 1, p 2, … are well-formed (p   (  q))? (p  q)  (  p  q)?

(Well-Formed) Propositional Formulas Each propositional formula B on n variables defines a function f B from {T,F} n to {T,F}. How is this function defined? Inductively.

Tautologies (a.k.a. Truths) A propositional formula B is a tautology if it is true for every setting of the variables T p p  q p   p p   p (  p  q)  (p  q) F (p  q)  (q  p) (p  q)  ((p  q)  (q  p))

Checking for Tautologies Evaluate the propositional formula B on every input in {T,F} n How?

E.g., B = (p Æ (p  q))  q pq p  qp Æ (p  q))(p Æ (p  q))  q TT TF FT FF

E.g., B = (p Æ (p  q))  q pq p  qp Æ (p  q))(p Æ (p  q))  q TTTTT TFFFT FTTFT FFTFT

Truth Table for formula B Create a table with 2 n rows p 1 =T, p 2 =T, p 3 =T…, p n =T p 1 =F, p 2 =T, p 3 =T…, p n =T p 1 =T, p 2 =F, p 3 =T…, p n =T p 1 =F, p 2 =F, p 3 =F…, p n =F... Evaluate the function for each setting B(T,T,T,…,T) B(F,T,T,…,T) B(T,F,T,…,T)... B(F,F,F,…,F) Takes at least 2 n time

Recursive Evaluation for B eval(formula B, setting M) { If (B == “T”) return T; if (B == “F”) return F; if (B == “B 1 Æ B 2 ”) return eval(B 1,M) Æ eval(B 2,M); … }

OK, quick recap propositional formulas a formula maps each possible “world” in {T,F} n into either T or F some formulas are “truths” (tautologies): they are true in all possible 2 n worlds can check if a formula is a tautology in ¼ 2 n time.

What is a proof? The truth table gives us a “proof” that a propositional formula is a tautology What are the pros of this proof technique? What are the cons?

( (p 1  p 2 )  (p 2  p 3 )  …  (p n-1  p n ) )  (p 1  p n ) Does not give much “intuition” Even simple things have very long proofs has truth-table of size 2 n Does not scale to non-Boolean proofs. Later we will want to prove things about all the naturals, then we’re in trouble with brute-force.

A “more natural” way to prove things… Let us start with a simple tautology we’ll call this an “axiom” And use one of these rules at each step: Whatever we can prove, we’ll call “theorems” A Ç (B Ç C) (A Ç B) Ç C A Ç A A A B Ç A (A Ç B), (  A Ç C) (B Ç C) (  A Ç A) we’ll call these “inference rules” associativity contraction expansion cut rule

Proof of commutativity rule A Ç B B Ç A A Ç B(hypothesis)  A Ç A(axiom) B Ç A(cut rule to 1,2) (1) (2)

Proof of new expansion rule A(hypothesis) B Ç A(expansion rule) A Ç B (commutativity) A A Ç B

Proof of “modus ponens” A, A  B B A(hypothesis) A  B (hypothesis)  A Ç B (def. of  ) A Ç B(apply expansion to 1) B Ç B(cut rule to 2,3) B(contraction) Since the logical system does not have “  ” we define it to be  A Ç B (1) (2) (3)

What is a proof? A sequence of statements, each of which is an axiom, or a hypothesis, or follows from previous statements using an inference rule

Another recap (well-formed) propositional formulas some formulas are tautologies (“truths”) p Ç  p (p Æ (p  q))  q some formulas are “theorems” p Ç  p (p Æ (p  q))  q can check by truth-table these are formulas for which we can give proofs

Are all theorems “true” (i.e., tautologies)? Are all tautologies theorems? Yes. (easy proof by induction) Yes. (much more involved proof) Yay! Our logical system is “sound”. We only prove truths. Double yay! Our logical system is “complete”. We can prove all the truths via inference rules. For this logical system and Boolean formulas

The high-level picture

A Logical System A “logic” consists of: 1)A collection S of well-formed sentences 2)Some sentences in S called “axioms” 3)A set of “rules of inference” A “truth concept” consists of: 1)A collection S of well-formed sentences 2)Some sentences in S called “truths”

A Logical System for Propositions Axiom: Inference Rules: A Ç (B Ç C) (A Ç B) Ç C A Ç A A A B Ç A (A Ç B), (  A Ç C) (B Ç C) (  A Ç A) associativity contraction expansion cut rule

This logical system is sound and complete for propositional truths (tautologies) “all theorems are true” “all truths are theorems”

Another (Toy) Example

Example: Balanced Parens Consider strings of parentheses Well-formed string: Has an equal number of “(”s and “)”s Truths: The parens are balanced. E.g., ))))((((, (), )()()()(, ² E.g., (((()))), (), ²

Example: Balanced Parens A Logical System: Axiom: ² Rules of inference: Theorems are those strings of parens that can obtained via this logical system A (A) A, B AB

Example: Balanced Parens Proof of theorem “(())()” ² (axiom) ()(rule 1) (())(rule 1 again) (())()(rule 2) A Logical System: Axiom: ² Rules of inference: A (A) A, B AB

Example: Balanced Parens Truth concept: The parens are balanced. The logical system with one axiom and two rules of inference In HW2, you showed this logical system is sound and complete for this truth concept! You also showed: another system was sound, but not complete!

Onwards and Upwards!

Propositional logic is fine in its place but it does not capture too much… Socrates is a human. All humans are crazy. Hence Socrates is crazy. E.g., Or 8 x, y ((x < y)  (x+1 < y+1) H(s) 8 x H(x)  C(x)  C(s)

First Order Logics Have variables, and usual logical operators But variables can range over more general structures Can have functions, relations and predicates and quantifiers 8 x  y P(x)  Q(y)

One concrete example Let’s say we want a language for arithmetic that captures statements like: 16 is even Every natural number is either even or odd “  natural x such that 2*x = 16” “  natural x ( (  natural y such that 2*y = x) Ç (  natural z such that 2*z+1 = x) ) Need quantifiers, “=”, “+”, (“–” ?), “*”, “<” and we need the naturals 0,1,2,… too!

Peano Arithmetic The Peano axioms formally define properties of the natural numbers

a) 0 is a natural number. d) For all natural numbers m and n, if S(m) = S(n), then m = n. b) For every natural number n, its “successor” S(n) is a natural number. c) For every natural number n, S(n) ≠ 0. Peano Arithmetic

h) If n is a natural number and n = m, then m is also a natural number. e) For every natural n, n = n f) For all naturals, if n = m, then m = n. g) For all naturals if k = m and m = n then k = n. Peano Arithmetic

Peano: Inductive Definition of +  = { 0, S0, SS0, SSS0,...} Inductive definition of addition (+): X, Y 2  ) X “+” 0 = X X “+” SY = S(X “+” Y)

S0 + S0 = SS0 (i.e., “1+1=2”) Proof: S0 + S0 = S(S0 + 0) = S(S0) = SS0

Peano: Inductive Definition of *  = { 0, S0, SS0, SSS0,...} Inductive definition of multiplication (*): X, Y 2  ) X “*” 0 = X X “*” SY = (X “*” Y) “+” X

Defining < for  : 8 x, y 2  “x > y” is TRUE  “y < x” is FALSE “x > y” is TRUE  “y > x” is FALSE “x+1 > 0” is TRUE “x+1 > y+1” is TRUE ) “x > y” is TRUE Peano: Defining “<”

Defining partial minus for  : 8 x,y 2  x – 0 = x x > y ) (x+1) – (y+1) = x-y Peano: Defining “minus”

Peano: and so on… You can build an edifice for arithmetic to conceivably prove all arithmetic truths and use this logical system Thm: the Peano system is sound for arithmetic Q: Is it complete?

We’ll be back…

Here’s What You Need to Know… Propositional Logic well-formed expressions truth tables tautologies Logical Systems truths theorems soundness and completeness First-order Logics quantifiers Peano’s axioms