COMP Intro to Logic for Computer Scientists. Lecture 3

Similar documents
Logic and Proofs. Jan COT3100: Applications of Discrete Structures Jan 2007

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

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

CSC Discrete Math I, Spring Propositional Logic

Propositional Logic: Semantics

Definition 2. Conjunction of p and q

PUZZLE. You meet A, B, and C in the land of knights and knaves. A says Either B and I are both knights or we are both knaves.

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

Section 1.1: Logical Form and Logical Equivalence

Announcements CompSci 102 Discrete Math for Computer Science

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Chapter 4: Classical Propositional Semantics

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

MACM 101 Discrete Mathematics I. Exercises on Propositional Logic. Due: Tuesday, September 29th (at the beginning of the class)

COMP Intro to Logic for Computer Scientists. Lecture 11

The Logic of Compound Statements cont.

Propositional Language - Semantics

Math.3336: Discrete Mathematics. Applications of Propositional Logic

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

1) Let h = John is healthy, w = John is wealthy and s = John is wise Write the following statement is symbolic form

Limits of Computation. Antonina Kolokolova

Example. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives

COM S 330 Homework 02 Solutions. Type your answers to the following questions and submit a PDF file to Blackboard. One page per problem.

Homework assignment 1: Solutions

Artificial Intelligence: Knowledge Representation and Reasoning Week 2 Assessment 1 - Answers

PROPOSITIONAL CALCULUS

1.3 Propositional Equivalences

1.1 Language and Logic

Introduction to Sets and Logic (MATH 1190)

FUNDAMENTALS OF MATHEMATICS HANDOUT 1.3 DR. MCLOUGHLIN

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

Midterm: Sample 3. ECS20 (Fall 2017) 1) Using truth tables, establish for each of the two propositions below if it is a tautology, a contradiction

Chapter 3: Logic. Diana Pell. A statement is a declarative sentence that is either true or false, but not both.

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies

Discrete Mathematics and Its Applications

Recitation Week 3. Taylor Spangler. January 23, 2012

CISC-102 Winter 2016 Lecture 17

Mathematical Reasoning (Part I) 1

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

CSCI Homework Set 1 Due: September 11, 2018 at the beginning of class

Section 3.1 Statements, Negations, and Quantified Statements

CHAPTER 4 CLASSICAL PROPOSITIONAL SEMANTICS

Propositional Logic 1

5. Use a truth table to determine whether the two statements are equivalent. Let t be a tautology and c be a contradiction.

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

Knights, Knaves, and Logical Reasoning Mechanising the Laws of Thought

AMTH140 Lecture 8. Symbolic Logic

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

1.1 Language and Logic

PHIL12A Section answers, 16 February 2011

Propositional Equivalence

Propositional Calculus. Problems. Propositional Calculus 3&4. 1&2 Propositional Calculus. Johnson will leave the cabinet, and we ll lose the election.

The Foundations: Logic and Proofs. Part I

15414/614 Optional Lecture 1: Propositional Logic

software design & management Gachon University Chulyun Kim

Compound Propositions

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

Where are my glasses?

2/13/2012. Logic: Truth Tables. CS160 Rosen Chapter 1. Logic?

1 The Foundations. 1.1 Logic. A proposition is a declarative sentence that is either true or false, but not both.

Symbolic Logic Outline

Propositional Logic and Semantics

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

COMP Intro to Logic for Computer Scientists. Lecture 6

Propositional Logic: Equivalence

PL: Truth Trees. Handout Truth Trees: The Setup

CS 220: Discrete Structures and their Applications. Propositional Logic Sections in zybooks

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference

Tautologies, Contradictions, and Contingencies

Conditional Statements

Math.3336: Discrete Mathematics. Propositional Equivalences

THE LOGIC OF COMPOUND STATEMENTS

At least one of us is a knave. What are A and B?

ICS141: Discrete Mathematics for Computer Science I

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Intermediate Logic. Natural Deduction for TFL

A Little Deductive Logic

CSE 311: Foundations of Computing. Lecture 3: Digital Circuits & Equivalence

Homework 2: Solutions

Propositional Logic Logical Implication (4A) Young W. Lim 4/11/17

Introduction to Decision Sciences Lecture 2

Proving logical equivalencies (1.3)

Propositional Logic Review

Discrete Mathematics

CS250: Discrete Math for Computer Science. L6: CNF and Natural Deduction for PropCalc

A Little Deductive Logic

Reading: EC 1.3. Peter J. Haas. INFO 150 Fall Semester 2018

Logic. Part I: Propositional Logic. Max Schäfer. Formosan Summer School on Logic, Language, and Computation 2010

Chapter 2: The Logic of Compound Statements

Show Your Work! Point values are in square brackets. There are 35 points possible. Tables of tautologies and contradictions are on the last page.

Discrete Structures for Computer Science

CSE 20: Discrete Mathematics

Automated Solution of the Riddle of Dracula and Other Puzzles

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

Propositional Languages

Logical Structures in Natural Language: Propositional Logic II (Truth Tables and Reasoning

1 Tautologies, contradictions and contingencies

The statement calculus and logic

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Transcription:

COMP 1002 Intro to Logic for Computer Scientists Lecture 3 B 5 2 J

Admin stuff Make-up lecture next Monday, Jan 14 10am to 12pm in C 3033

Knights and knaves On a mystical island, there are two kinds of people: knights and knaves. Knights always tell the truth. Knaves always lie. Puzzle 1: You meet two people on the island, Arnold and Bob. Arnold says Either I am a knave, or Bob is a knight. Is Arnold a knight or a knave? What about Bob?

Knights and knaves Puzzle 1: You meet two people on the island, Arnold and Bob. Arnold says Either I am a knave, or Bob is a knight. Is Arnold a knight or a knave? What about Bob? A: Arnold is a knight B: Bob is a knight Formula: A B : Either Arnold is a knave, or Bob is a knight Want: scenarios where either both A is a knight and the formula is true, or A is a knave and the formula is false. Use if and only if notation: A B A. True if both formulas have same value A B A A B A B A True True False True True True False False False False False True True True False False False True True False

Special types of sentences A sentence that has a satisfying assignment is satisfiable. Some row in the truth table ends with True. Example: B A Sentence is a contradiction: All assignments are falsifying. All rows end with False. Example: A A A B B A True True True True False True False True False False False True A A A True False False False Sentence is a tautology: All assignments are satisfying All rows end with True. Example: B A B A B A B B A B True True True True True False True True False True True True False False False True

Determining formula type How long does it take to check if a formula is satisfiable? If somebody gives you a satisfying assignment, then in time roughly the size of the formula. On a m-symbol formula, take time O(m) = constant * m, for some constant depending on the computer/software. What if you don t know a satisfying assignment? How hard it is to find it? Using a truth table: in time O(m 2 n ) on a length m n- variable formula. Is it efficient?...

Complexity of computation Would you still consider a problem really solvable if it takes very long time? Say 10 n steps on an n-symbol string? At a billion (10 9 ) steps per second (~1GHz)? To process a string of length 100 will take 10 100 /10 9 seconds, or ~3x10 72 centuries. Age of the universe: about 1.38x10 10 years. Atoms in the observable universe: 10 78-10 82.

Complexity of computation What strings do we work with in real life? A DNA string has 3.2 10 9 base pairs A secure key in crypto: 128-256 bits Number of Walmart transactions per day: 10 6. URLs searched by Google in 2012: 3x10 12.

Determining formula type How long does it take to check if a formula is satisfiable? Using a truth table: in time O(m 2 n ) on a length m n-variable formula. Is it efficient? Not really! Formula with 100 variables is already too big! In software verification: millions of variables! Can we do better?

Logical equivalence Two formulas F and G are logically equivalent (F G or F G) if they have the same value for every row in the truth table on their variables. A A False (same as saying it is a contradiction) A B (A B ) A B A B B A is sometimes called the biconditional often pronounced as if and only if, or iff Useful fact: proving that F G can be done by proving that F G is a tautology

Double negation Negation cancels negation A A I do not disagree with you = I agree with you For a human brain, harder to parse a sentence with multiple negations: Alice says: I refuse to vote against repealing the ban on smoking in public. Does Alice like smoking in public or hate it?

De Morgan s Laws Simplifying negated formulas For AND: A B is equivalent to A B For OR: A B A B Example: ( A B) is A B, same as A B So, since A B is equivalent to A B, (A B) is equivalent to A B

De Morgan s laws: examples Let A be it s sunny and B it s cold. It s sunny and cold today! -- No, it s not! That could mean No, it s not sunny. No, it s not cold. No, it s neither sunny nor cold. In all of these scenarios, It s either not sunny or not cold is true. Let A be x < 2, B be x > 4. Either x < 2 or x > 4 No, it is not! Then 2 x 4 0 1 2 3 4 5 6

More examples Let A be I play and B I win. A B: If I play, then I win Equivalent to A B: Either I do not play, or I win. Negation: (A B): It is not so that if I play then I win. By de Morgan s law: A B A B By double negation: A B (A B) So negation of If I play then I win is I play and I don t win.

Longer example of negation Start with the outermost connective and keep applying de Morgan s laws and double negation. Stop when all negations are on variables. ( A B A C ) A B A C (negating ) A B A C (de Morgan) A B A C (removing )

Knights and knaves On a mystical island, there are two kinds of people: knights and knaves. Knights always tell the truth. Knaves always lie. Puzzle 2: You see three islanders talking to each other, Arnold, Bob and Charlie. You ask Arnold Are you a knight?, but can t hear what he answered. Bob pitches in: Arnold said that he is a knave! and Charlie interjects Don t believe Bob, he s lying. Out of Bob and Charlie, who is a knight/knave?