Mathematical Logic Part One

Similar documents
Mathematical Logic Part One

Mathematical Logic Part One

Mathematical Logic Part One

Mathematical Logic Part One

Mathematical Logic Part One

Mathematical Logic Part One

Mathematical Logic Part One

Mathematical Logic Part Two

Guide to Negating Formulas

Boolean Logic. CS 231 Dianna Xu

A statement is a sentence that is definitely either true or false but not both.

Proposition/Statement. Boolean Logic. Boolean variables. Logical operators: And. Logical operators: Not 9/3/13. Introduction to Logical Operators

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Compound Propositions

Discrete Mathematics and Its Applications

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

Propositional Logic. Fall () Propositional Logic Fall / 30

Propositional logic ( ): Review from Mat 1348

An Introduction to Logic 1.1 ~ 1.4 6/21/04 ~ 6/23/04

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

CSC Discrete Math I, Spring Propositional Logic

EECS 1028 M: Discrete Mathematics for Engineers

Introducing Proof 1. hsn.uk.net. Contents

Deduction by Daniel Bonevac. Chapter 3 Truth Trees

Unit 1. Propositional Logic Reading do all quick-checks Propositional Logic: Ch. 2.intro, 2.2, 2.3, 2.4. Review 2.9

MA103 STATEMENTS, PROOF, LOGIC

Section 1.1: Logical Form and Logical Equivalence

Supplementary Logic Notes CSE 321 Winter 2009

Stanford University CS103: Math for Computer Science Handout LN9 Luca Trevisan April 25, 2014

CS1800: Hex & Logic. Professor Kevin Gold

Topic 1: Propositional logic

HW1 graded review form? HW2 released CSE 20 DISCRETE MATH. Fall

A Little Deductive Logic

Logic. Propositional Logic: Syntax

THE LOGIC OF COMPOUND STATEMENTS

Mathematical Logic Part Three

PHIL12A Section answers, 16 February 2011

Definition 2. Conjunction of p and q

3 The Semantics of the Propositional Calculus

Lecture 02: Propositional Logic

Outline for Today. What is an Implication? Negations and their Applications. Proof by Contrapositive. Proof by Contradiction

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

1.1 Statements and Compound Statements

AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic

1 Propositional Logic

Manual of Logical Style (fresh version 2018)

A Little Deductive Logic

Predicates, Quantifiers and Nested Quantifiers

What is Logic? Introduction to Logic. Simple Statements. Which one is statement?

AMTH140 Lecture 8. Symbolic Logic

Manual of Logical Style

The statement calculus and logic

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Logic As Algebra COMP1600 / COMP6260. Dirk Pattinson Australian National University. Semester 2, 2017

Logic - recap. So far, we have seen that: Logic is a language which can be used to describe:

TRUTH TABLES LOGIC (CONTINUED) Philosophical Methods

Truth-Functional Logic

Outline for Today. What is an Implication? Negations and their Applications. Proof by Contrapositive. Proof by Contradiction

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

Ella failed to drop the class. Ella dropped the class.

Propositional Logic: Syntax

Propositional Logic. Spring Propositional Logic Spring / 32

cis32-ai lecture # 18 mon-3-apr-2006

Proseminar on Semantic Theory Fall 2013 Ling 720 Propositional Logic: Syntax and Natural Deduction 1

HANDOUT AND SET THEORY. Ariyadi Wijaya

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

Propositions. Frequently, we will use the word statement instead of proposition.

This chapter covers propositional logic and predicate logic at a basic level. Some deeper issues will be covered later.

The Inductive Proof Template

Discrete Mathematics and Applications COT3100

Logic and Proofs. (A brief summary)

Logic. Propositional Logic: Syntax. Wffs

UNIT-I: Propositional Logic

DISCRETE STRUCTURES WEEK5 LECTURE1

Propositional Language - Semantics

Propositional Logic and Semantics

Finite Automata Part Two

Mathematical Logic Part Three

Chapter 1: The Logic of Compound Statements. January 7, 2008

Symbolic Logic 3. For an inference to be deductively valid it is impossible for the conclusion to be false if the premises are true.

Logic, Sets, and Proofs

15414/614 Optional Lecture 1: Propositional Logic

Today s Topic: Propositional Logic

MAT2345 Discrete Math

Section 3.1 Statements, Negations, and Quantified Statements

Chapter 1 Elementary Logic

First Order Logic: Syntax and Semantics

- 1.2 Implication P. Danziger. Implication

Math 10850, fall 2017, University of Notre Dame

Sec$on Summary. Propositions Connectives. Truth Tables. Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional

Axiomatic systems. Revisiting the rules of inference. Example: A theorem and its proof in an abstract axiomatic system:

Alex s Guide to Word Problems and Linear Equations Following Glencoe Algebra 1

Proof: If (a, a, b) is a Pythagorean triple, 2a 2 = b 2 b / a = 2, which is impossible.

Connectives Name Symbol OR Disjunction And Conjunction If then Implication/ conditional If and only if Bi-implication / biconditional

Numbers that are divisible by 2 are even. The above statement could also be written in other logically equivalent ways, such as:

Chapter Summary. Propositional Logic. Predicate Logic. Proofs. The Language of Propositions (1.1) Applications (1.2) Logical Equivalences (1.

Proposition logic and argument. CISC2100, Spring 2017 X.Zhang

Where are my glasses?

Foundation of proofs. Jim Hefferon.

MATH 22 INFERENCE & QUANTIFICATION. Lecture F: 9/18/2003

Transcription:

Mathematical Logic Part One

Question: How do we formalize the defnitions and reasoning we use in our proofs?

Where We're Going Propositional Logic (Today) Basic logical connectives. Truth tables. Logical equivalences. First-Order Logic (Friday/Monday) Reasoning about properties of multiple objects.

Propositional Logic

A proposition is a statement that is, by itself, either true or false.

Some Sample Propositions Puppies are cuter than kittens. Kittens are cuter than puppies. Usain Bolt can outrun everyone in this room. CS103 is useful for cocktail parties. This is the last entry on this list.

Things That Aren't Propositions Commands Commands cannot cannot be be true true or or false. false.

Things That Aren't Propositions Questions Questions cannot cannot be be true true or or false. false.

Propositional Logic Propositional logic is a mathematical system for reasoning about propositions and how they relate to one another. Every statement in propositional logic consists of propositional variables combined via propositional connectives. Each variable represents some proposition, such as You liked it or You should have put a ring on it. Connectives encode how propositions are related, such as If you liked it, then you should have put a ring on it.

Propositional Variables Each proposition will be represented by a propositional variable. Propositional variables are usually represented as lower-case letters, such as p, q, r, s, etc. Each variable can take one one of two values: true or false.

Propositional Connectives Logical NOT: p Read not p p is true if and only if p is false. Also called logical negation. Logical AND: p q Read p and q. p q is true if and only if both p and q are true. Also called logical conjunction. Logical OR: p q Read p or q. p q is true if and only if at least one of p or q are true (inclusive OR) Also called logical disjunction.

Truth Tables A truth table is a table showing the truth value of a propositional logic formula as a function of its inputs. Useful for several reasons: They give a formal defnition of what a connective means. They give us a way to fgure out what a complex propositional formula says.

The Truth Table Tool

Summary of Important Points The connective is an inclusive or. It's true if at least one of the operands is true. Similar to the operator in C, C++, Java and the or operator in Python. If we need an exclusive or operator, we can build it out of what we already have.

Truth Table for XOR This This is is the the truth truth table table for for XOR. XOR. You You choose how how we we can can write write XOR XOR using using the the other other logical operators: p q p XOR q F F F F T T T F T T T F (A) (A) (p (p q) q) (p (p q) q) (B) (B) (p (p q) q) (p (p q) q) (C) (C) (p (p q) q) (p (p q) q) (D) (D) (p (p q) q) (p (p q) q) Answer Answer at at PollEv.com/cs103 PollEv.com/cs103 or or text text CS103 CS103 to to 22333 22333 once once to to join, join, then then A, A, B, B, or or C. C.

Mathematical Implication

Implication The connective is used to represent implications. Its technical name is the material conditional operator. What is its truth table? Pull out a sheet of paper, make a guess, and talk things over with your neighbors!

Truth Table for p q (implies) What What is is the the correct truth truth table table for for implication? Enter Enter your your guess guess as as a list list of of four four values to to fll fll in in the the rightmost column of of the the table. table. (ex: (ex: F, F, T, T,?,?, F) F) p q p q F F F T T F T T Answer Answer at at PollEv.com/cs103 PollEv.com/cs103 or or text text CS103 CS103 to to 22333 22333 once once to to join, join, then then your your response. response.

Truth Table for Implication p q p q F F T Bad bracket, don t get A F T T Bad bracket, get A T F F Perfect bracket, don t get A T T T Perfect bracket, get A

Why This Truth Table? The truth values of the are the way they are because they're defned that way. The intuition: Every propositional formula should be either true or false that s just a guiding design principle behind propositional logic. We want p q to be false only when p q is true. In other words, p q should be true whenever (p q) is true. What's the truth table for (p q)?

Truth Table for Implication p q p q F F T F T T F T F The The implication implication is is only only false false if if p p is is true true and and q q isn t. isn t. It s It s true true otherwise. otherwise. T T T You You will will need need to to commit commit this this table table to to memory. memory. We re We re going going to to be be using using it it a a lot lot over over the the rest rest of of the the week. week.

The Biconditional Connective

The Biconditional Connective The biconditional connective is used to represent a two-directional implication. Specifcally, p q means both that p q and that q p. Based on that, what should its truth table look like? Take a guess, and talk it over with your neighbor!

Biconditionals The biconditional connective p q is read p if and only if q. Here's its truth table: p q F F F T T F T T p q T F F T One One interpretation interpretation of of is is to to think think of of it it as as equality: equality: the the two two propositions propositions must must have have equal equal truth truth values. values.

True and False There are two more connectives to speak of: true and false. The symbol is a value that is always true. The symbol is value that is always false. These are often called connectives, though they don't connect anything. (Or rather, they connect zero things.)

Proof by Contradiction Suppose you want to prove p is true using a proof by contradiction. The setup looks like this: Assume p is false. Derive something that we know is false. Conclude that p is true. In propositional logic: ( p ) p

Operator Precedence How do we parse this statement? x y z x y z Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) ((y z) (x (y z))) Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence The main points to remember: binds to whatever immediately follows it. and bind more tightly than. We will commonly write expressions like p q r without adding parentheses. For more complex expressions, we'll try to add parentheses. Confused? Just ask!

The Big Table Connective Read As C++ Version Fancy Name not! Negation and && Conjunction or Disjunction implies see PS2! Implication if and only if see PS2! Biconditional true true Truth false false Falsity

Recap So Far A propositional variable is a variable that is either true or false. The propositional connectives are Negation: p Conjunction: p q Disjunction: p q Implication: p q Biconditional: p q True: False:

Translating into Propositional Logic

Some Sample Propositions a: I will be in the path of totality. b: I will see a total solar eclipse. I I won't won't see see a a total total solar solar eclipse eclipse if if I'm I'm not not in in the the path path of of totality. totality. a b

p if q translates to q p It does not translate to p q

Some Sample Propositions a: I will be in the path of totality. b: I will see a total solar eclipse. c: There is a total solar eclipse today. If If I will will be be in in the the path path of of totality, totality, but but there's there's no no solar solar eclipse eclipse today, today, I won't won't see see a a total total solar solar eclipse. eclipse. a c b

p, but q translates to p q

The Takeaway Point When translating into or out of propositional logic, be very careful not to get tripped up by nuances of the English language. In fact, this is one of the reasons we have a symbolic notation in the frst place! Many prepositional phrases lead to counterintuitive translations; make sure to double-check yourself!

Propositional Equivalences

Quick Question: What would I have to show you to convince you that the statement p q is false?

Quick Question: What would I have to show you to convince you that the statement p q is false?

De Morgan's Laws Using truth tables, we concluded that is equivalent to (p q) p q We also saw that (p q) is equivalent to p q These two equivalences are called De Morgan's Laws.

De Morgan's Laws in Code Pro tip: Don't write this: if (!(p() && q()) { /* */ } Write this instead: if (!p()!q()) { /* */ } (This even short-circuits correctly!)

Logical Equivalence Because (p q) and p q have the same truth tables, we say that they're equivalent to one another. We denote this by writing (p q) p q The symbol is not a connective. The statement (p q) ( p q) is a propositional formula. If you plug in diferent values of p and q, it will evaluate to a truth value. It just happens to evaluate to true every time. The statement (p q) p q means these two formulas have exactly the same truth table. In other words, the notation φ ψ means φ and ψ always have the same truth values, regardless of how the variables are assigned.

An Important Equivalence Earlier, we talked about the truth table for p q. We chose it so that p q (p q) Later on, this equivalence will be incredibly useful: (p q) p q

Another Important Equivalence Here's a useful equivalence. Start with p q (p q) By De Morgan's laws: p q (p q) p q p q p q p q Thus p q p q

Another Important Equivalence Here's a useful equivalence. Start with p q (p q) By De Morgan's laws: p q (p q) p q p q If p is false, then If p is false, then p q p q p p q q Thus p q p q is is true. true. If If p p is is true, true, then then q q has has to to be be true true for for the the whole whole expression expression to to be be true. true.

One Last Equivalence

The Contrapositive The contrapositive of the statement is the statement p q q p These are logically equivalent, which is why proof by contrapositive works: p q q p

Why All This Matters

Why All This Matters Suppose we want to prove the following statement: If x + y = 16, then x 8 or y 8

Why All This Matters Suppose we want to prove the following statement: If x + y = 16, then x 8 or y 8 x + y = 16 x 8 y 8

Why All This Matters Suppose we want to prove the following statement: If x + y = 16, then x 8 or y 8 x < 8 y < 8 x + y 16 If x < 8 and y < 8, then x + y 16

Theorem: If x + y = 16, then x 8 or y 8. Proof: By contrapositive. We will prove that if x < 8 and y < 8, then x + y 16. Let x and y be arbitrary numbers such that x < 8 and y < 8. Note that x + y < 8 + y < 8 + 8 = 16. This means that x + y < 16, so x + y 16, which is what we needed to show.

Why This Matters Propositional logic is a tool for reasoning about how various statements afect one another. To better understand how to prove a result, it often helps to translate what you're trying to prove into propositional logic frst. That said, propositional logic isn't expressive enough to capture all statements. For that, we need something more powerful.

Next Time First-Order Logic Reasoning about groups of objects. First-Order Translations Expressing yourself in symbolic math!