Logic in Computer Science (COMP118) Tutorial Problems 1

Similar documents
The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

a. See the textbook for examples of proving logical equivalence using truth tables. b. There is a real number x for which f (x) < 0. (x 1) 2 > 0.

THE LOGIC OF COMPOUND STATEMENTS

Mathematical Logic Propositional Logic - Tableaux*

CSC Discrete Math I, Spring Propositional Logic

Math 13, Spring 2013, Lecture B: Midterm

Section 1.1: Logical Form and Logical Equivalence

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

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

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

Introduction to Sets and Logic (MATH 1190)

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

Propositional Logic Truth-functionality Definitions Soundness Completeness Inferences. Modal Logic. Daniel Bonevac.

Homework assignment 1: Solutions

Completeness for FOL

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

Direct Proof and Proof by Contrapositive

Propositional Logic: Equivalence

WUCT121. Discrete Mathematics. Logic. Tutorial Exercises

Deductive reasoning is the process of reasoning from accepted facts to a conclusion. if a = b and c = d, c 0, then a/c = b/d

a. ~p : if p is T, then ~p is F, and vice versa

Equations and Solutions

Structural Induction

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

Logic Review Solutions

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

Approximations of Modal Logic K

It is not the case that ϕ. p = It is not the case that it is snowing = It is not. r = It is not the case that Mary will go to the party =

COMP2411 Lecture 6: Soundness and Completeness. Reading: Huth and Ryan, Sections 1.4

Your quiz in recitation on Tuesday will cover 3.1: Arguments and inference. Your also have an online quiz, covering 3.1, due by 11:59 p.m., Tuesday.

How to determine if a statement is true or false. Fuzzy logic deal with statements that are somewhat vague, such as: this paint is grey.

Propositional Logic: Bottom-Up Proofs

PROPOSITIONAL CALCULUS

Logic: Bottom-up & Top-down proof procedures

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

The following techniques for methods of proofs are discussed in our text: - Vacuous proof - Trivial proof

Recall that the expression x > 3 is not a proposition. Why?

Propositional natural deduction

TABLEAU SYSTEM FOR LOGIC OF CATEGORIAL PROPOSITIONS AND DECIDABILITY

Deductive Systems. Lecture - 3

1 Implication and induction

The Arithmetical Hierarchy

1.1 Language and Logic

FOUNDATION OF COMPUTER SCIENCE ETCS-203

Introduction to Metalogic

Packet #1: Logic & Proofs. Applied Discrete Mathematics

Discrete Mathematics(II)

LING 106. Knowledge of Meaning Lecture 3-1 Yimei Xiang Feb 6, Propositional logic

MAT246H1S - Concepts In Abstract Mathematics. Solutions to Term Test 1 - February 1, 2018

Formal Logic. Critical Thinking

10 Propositional logic

THE LOGIC OF COMPOUND STATEMENTS

For all For every For each For any There exists at least one There exists There is Some

Predicate Logic: Syntax

Introduction to Metalogic 1

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

Logical Structures in Natural Language: First order Logic (FoL)

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

1.1 Language and Logic

COMP232 - Mathematics for Computer Science

3 The language of proof

DESIGN AND IMPLEMENTATION OF ENCODERS AND DECODERS. To design and implement encoders and decoders using logic gates.

Propositional Logic Review

Conditional Statements

Logik für Informatiker Formal proofs for propositional logic

KE/Tableaux. What is it for?

Midterm Exam Solution

CS156: The Calculus of Computation

MAT 101 Exam 2 Logic (Part I) Fall Circle the correct answer on the following multiple-choice questions.

Overview. 1. Introduction to Propositional Logic. 2. Operations on Propositions. 3. Truth Tables. 4. Translating Sentences into Logical Expressions

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

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

cse541 LOGIC FOR COMPUTER SCIENCE

Logical Agents. September 14, 2004

Section 2.1: Introduction to the Logic of Quantified Statements

Number Theory and Graph Theory. Prime numbers and congruences.

Propositional Logic: Syntax

Artificial Intelligence

Artificial Intelligence Knowledge Representation I

Exercises. Exercise Sheet 1: Propositional Logic

CPSC 121 Midterm 1 Tuesday, October 11th, 2011

2 Conditional and Biconditional Propositions

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Chapter 2: Introduction to Propositional Logic

AMTH140 Lecture 8. Symbolic Logic

Truth Functions, 6.2 T T T T F F F F T F F F. Note that we need 4 lines to explore all the possibilities: When both are true (row 1),

02 Propositional Logic

Part 1: Propositional Logic

LOGIC CONNECTIVES. Students who have an ACT score of at least 30 OR a GPA of at least 3.5 can receive a college scholarship.

Writing proofs for MATH 61CM, 61DM Week 1: basic logic, proof by contradiction, proof by induction

Automated Solution of the Riddle of Dracula and Other Puzzles

Introduction to Logic in Computer Science: Autumn 2006

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

A Tableau Style Proof System for Two Paraconsistent Logics

Predicate Calculus. Lila Kari. University of Waterloo. Predicate Calculus CS245, Logic and Computation 1 / 59

2 Truth Tables, Equivalences and the Contrapositive

Section L.1- Introduction to Logic

(2) Generalize De Morgan s laws for n sets and prove the laws by induction. 1

CHAPTER 6 - THINKING ABOUT AND PRACTICING PROPOSITIONAL LOGIC

1. Propositions: Contrapositives and Converses

Transcription:

Logic in Computer Science (COMP118) Tutorial Problems 1 1. Let p 1 denote the proposition: Tom s house is red; p 2 denote the proposition: Jim s house is red; p 3 denote the proposition: Mary s house is red. Translate into propositional logic: Tom s house is red or Jim s house is red; If Jim s house is red, then Tom s house is red and Mary s house is red; Tom s house is not red; Jim s house is red if, and only if, Tom s house is not red; Neither Jim s nor Mary s house is red. Let P 1, P 2,..., P 5 be the translations into propositional logic of the five sentences above. For each P i, 1 i 5: give an interpretation I such that I(P i ) = 1 and give an interpretation J such that J(P i ) = 0. 2. Give a definition of satisfiable formulas. 3. Which of the following formulas are satisfiable? Check this (a) using truth tables and (b) using the tableau algorithm. ( p (p q)); ( ( p q) r); ((p q) (q p)); ((p q) (p q));

(( (p q) p) q). (Hint: We do not have tableau rules for. Thus, has to be replaced by its definition before the tableau rules can be applied.) 4. Call a propositional formula P positive if it does not contain the symbol. Give an inductive definition of positive formulas. Show that every positive formula is satisfiable. Solution for 1. P 1 = (p 1 p 2 ). Let I(p 1 ) = 1 and I(p 2 ) = 1. Then I(P 1 ) = 1. Let J(p 1 ) = 0 and J(p 2 ) = 0. Then J(P 1 ) = 0. P 2 = (p 2 (p 1 p 3 )). Let I(p 1 ) = 1 and I(p 2 ) = 1 and I(p 3 ) = 1. Then I(P 2 ) = 1. Let J(p 1 ) = 1 and J(p 2 ) = 0 and J(p 3 ) = 0. Then J(P 2 ) = 0. P 3 = p 1. Let I(p 1 ) = 0. Then I(P 3 ) = 1. Let J(p 1 ) = 1. Then J(P 3 ) = 0. P 4 = (p 2 p 1 ). Let I(p 2 ) = 1 and I(p 1 ) = 0. Then I(P 4 ) = 1. Let J(p 1 ) = 1 and J(p 2 ) = 1. Then J(P 4 ) = 0. P 5 = ( p 2 p 3 ). Let I(p 2 ) = 0 and I(p 3 ) = 0. Then I(P 5 ) = 1. Let J(p 2 ) = 1 and J(p 3 ) = 1. Then J(P 5 ) = 0. Solution for 3. For P 1 = ( p (p q)) we have the following truth table: p q p p (p q) (p q) P 1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 It follows that I(P 1 ) = 0 for all interpretations I. Hence P 1 is not satisfiable. Using the tableau algorithm, we set S 0 = {P 1 }.

S 1 = S 0 { p, (p q)} An application of = to S 1 gives S 2 = S 1 { p, q} S 2 contains the clash { p, p}. Since we obtained a tableau path with a clash and we only applied nonbranching rules, it follows that P 1 is not satisfiable. Note that we applied only non-branching rules. Nevertheless, there are of course more tableau paths starting with S 0 = {P 1 }. Namely, S 1 = S 0 { p, (p q)} An application of = to S 1 gives S 2 = S 1 {p} An application of = to S 2 gives S 3 = S 2 { p, q} S 3 contains a clash (actually two). Thus, again we obtain that P 1 is not satisfiable. This type of nondeterminism of the algorithm (caused by different orders in which the rules are applied) is called don t care non-determinism : it does not depend on which rule we apply first whether we obtain a clash or not. For P 2 = ( ( p q) r) we have the following truth table:

p q r p r ( p q) ( p q) P 2 1 1 1 1 0 1 0 0 1 1 0 1 1 1 0 0 1 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 0 1 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 It follows that I(P 2 ) = 1 for at least one interpretation I. Thus, P 2 is satisfiable. Using the tableau algorithm, we set S 0 = {P 2 }. S 1 = S 0 { ( p q), r} An application of = to S 1 gives S 2 = S 1 { p, q} An application of = to S 2 gives S 3 = S 2 {p} S 3 is complete and contains no clash. Thus, P 2 is satisfiable. First we unfold the abbreviation for and obtain P 3 = (( p q) ( q p)). We obtain the following truth table: p q p q ( p q) ( q p) ( q p) P 3 1 1 0 0 1 1 0 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 0

It follows that I(P 3 ) = 1 for at least one interpretation I. Hence P 3 is satisfiable. Using the tableau algorithm, we set S 0 = {P 3 }. S 1 = S 0 {( p q), ( q p)} An application of = to S 1 gives S 2 = S 1 { q, p} An application of = to S 2 gives S 3 = S 2 {q} No rule is applicable to S 3 = {P 3, ( p q), ( q p), q, p, q}. S 3 does not contain a clash. Thus, P 3 is satisfiable. First we unfold the abbreviation for and obtain P 4 = (( p q) ( p q)). We obtain the following truth table: p q p ( p q) ( p q) P 4 1 1 0 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 1 1 0 0 It follows that I(P 4 ) = 0 for all interpretations I. Hence P 4 is not satisfiable. Using the tableau algorithm, we set S 0 = {P 4 }. S 1 = S 0 {( p q), ( p q)} S 1 contains a clash. Thus, P 4 is not satisfiable. We set P 5 = (( (p q) p) q) and obtain the truth table:

p q (p q) (p q) ( (p q) p) P 4 1 1 1 0 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 0 0 1 0 0 It follows that I(P 5 ) = 0 for all interpretations I. Hence P 5 is not satisfiable. Using the tableau algorithm, we set S 0 = {P 5 }. S 1 = S 0 {( (p q) p), q} An application of = to S 1 gives S 2 = S 1 {( (p q), p} An appication of = to S 2 gives S 3 = S 2 { p} which contains the clash {p, p}. The other application of = to S 2 gives S 4 = S 3 { q} which contains the clash {q, q}. Thus, all complete tableaus starting with {P 5 } contain a clash. Hence P 5 is not satisfiable. Solution for 4. A definition of positive formulas is as follows: all atomic formulas are positive formulas; if P and Q are positive formulas, then (P Q) is a positive formula;

if P and Q are positive formulas, then (P Q) is a positive formula; Nothing else is a positive formula. Every positive formula is satisfiable: Let P be a positive formula. We set I(p) = 1 for every atomic formula p and show by induction over the construction of positive formulas Q that I(Q) = 1. For atomic formulas this follows from the definition. Assume Q = (Q 1 Q 2 ). By induction hypothesis, I(Q 1 ) = 1 and I(Q 2 ) = 1. Thus I(Q) = 1. Assume Q = (Q 1 Q 2 ). By induction hypothesis, I(Q 1 ) = 1 and I(Q 2 ) = 1. Thus I(Q) = 1.