Propositional Logic Introduction and Syntax Alice Gao Lecture 2 - - PowerPoint PPT Presentation

propositional logic introduction and syntax
SMART_READER_LITE
LIVE PREVIEW

Propositional Logic Introduction and Syntax Alice Gao Lecture 2 - - PowerPoint PPT Presentation

Propositional Logic Introduction and Syntax Alice Gao Lecture 2 CS 245 Logic and Computation Fall 2019 Alice Gao 1 / 30 Outline Learning goals Propositions and Connectives Propositional Language Revisiting the learning goals CS 245


slide-1
SLIDE 1

Propositional Logic Introduction and Syntax

Alice Gao

Lecture 2

CS 245 Logic and Computation Fall 2019 Alice Gao 1 / 30

slide-2
SLIDE 2

Outline

Learning goals Propositions and Connectives Propositional Language Revisiting the learning goals

CS 245 Logic and Computation Fall 2019 Alice Gao 2 / 30

slide-3
SLIDE 3

Learning goals

By the end of the lecture, you should be able to

▶ Determine whether an English sentence is a proposition. ▶ Determine whether an English sentence is a simple or

compound proposition.

▶ Determine whether a propositional formula is atomic and/or

well-formed.

▶ Draw the parse tree of a well-formed propositional formula. ▶ Given a propositional formula with no parentheses, make it a

well-formed formula by adding parentheses according to the precedence rules.

CS 245 Logic and Computation Fall 2019 Alice Gao 3 / 30

slide-4
SLIDE 4

Outline

Learning goals Propositions and Connectives Propositional Language Revisiting the learning goals

CS 245 Logic and Computation Fall 2019 Alice Gao 4 / 30

slide-5
SLIDE 5

Propositions

A proposition is a statement that is either true or false. Meaningless statements, commands, and questions are not propositions.

CS 245 Logic and Computation Fall 2019 Alice Gao 5 / 30

slide-6
SLIDE 6

CQ on proposition

CS 245 Logic and Computation Fall 2019 Alice Gao 6 / 30

slide-7
SLIDE 7

Examples of propositions

▶ The sum of 3 and 5 is 8. ▶ The sum of 3 and 5 is 35. ▶ Goldbach’s conjecture: Every even number greater than 2 is

the sum of two prime numbers.

CS 245 Logic and Computation Fall 2019 Alice Gao 7 / 30

slide-8
SLIDE 8

Examples of non-propositions

▶ Question: Where shall we go to eat? ▶ Command: Please pass the salt. ▶ Sentence fragment: The dogs in the park ▶ Non-sensical: Green ideas sleep furiously. ▶ Paradox: This sentence is false.

CS 245 Logic and Computation Fall 2019 Alice Gao 8 / 30

slide-9
SLIDE 9

Compound and simple propositions

▶ A compound proposition is formed by means of logical

connectives. The commonly used logical connectives are “not”, “and”, “or”, “if, then”, and “ifg”.

▶ A simple proposition is not compound and cannot be further

divided.

CS 245 Logic and Computation Fall 2019 Alice Gao 9 / 30

slide-10
SLIDE 10

Interpreting a compound proposition

To interpret a compound proposition, we need to understand the meanings of the connectives. Let 𝐵 and 𝐶 be arbitrary propositions. We will use 1 and 0 to denote true and false respectively.

CS 245 Logic and Computation Fall 2019 Alice Gao 10 / 30

slide-11
SLIDE 11

Negation

“Not A” is true if and only if A is false. 𝐵 not 𝐵 1 1

CS 245 Logic and Computation Fall 2019 Alice Gao 11 / 30

slide-12
SLIDE 12

Conjunction

“A and B” is true if and only if both A and B are true. 𝐵 𝐶 𝐵 and 𝐶 1 1 1 1 1

CS 245 Logic and Computation Fall 2019 Alice Gao 12 / 30

slide-13
SLIDE 13

Disjunction

𝐵 𝐶 𝐵 or 𝐶 1 1 1 1 1 1 1 “Or” may be interpreted in two ways

▶ The inclusive sense of “A or B or both” ▶ The exclusive sense of “A or B but not both”

In mathematics, the inclusive sense of “or” is commonly used.

CS 245 Logic and Computation Fall 2019 Alice Gao 13 / 30

slide-14
SLIDE 14

Implication

𝐵 𝐶 if 𝐵 then 𝐶 1 1 1 1 1 1 1 The only circumstance in which “if A then B” is false is when A is true and B is false. Whenever A is false, “if A then B” is vacuously true.

CS 245 Logic and Computation Fall 2019 Alice Gao 14 / 30

slide-15
SLIDE 15

Equivalence

”A ifg B” is the same as ”if A then B, and if B then A”. ifg is pronounced as if and only if. 𝐵 𝐶 𝐵 ifg 𝐶 1 1 1 1 1 1

CS 245 Logic and Computation Fall 2019 Alice Gao 15 / 30

slide-16
SLIDE 16

CQ on compound or simple propositions

CS 245 Logic and Computation Fall 2019 Alice Gao 16 / 30

slide-17
SLIDE 17

Remarks on connectives

The arity of a connective:

▶ The negation is a unary connective. It only applies to one

proposition.

▶ All other connectives are binary connectives. They apply to

two propositions. Is a connective symmetric?

▶ And, Or, and Equivalence are symmetric. The order of the

two propositions does not afgect the truth value of the compound proposition.

▶ Implication is not symmetric. If A then B, and if B then A

have difgerent truth values.

CS 245 Logic and Computation Fall 2019 Alice Gao 17 / 30

slide-18
SLIDE 18

Outline

Learning goals Propositions and Connectives Propositional Language Revisiting the learning goals

CS 245 Logic and Computation Fall 2019 Alice Gao 18 / 30

slide-19
SLIDE 19

Propositional language 𝑀𝑞

The propositional language 𝑀𝑞 consists of three classes of symbols:

▶ Proposition symbols: 𝑞, 𝑟, 𝑠, … . ▶ Connective symbols: ¬, ∧, ∨, →, ↔.

Oral reading of logical connectives ¬ not negation ∧ and conjunction ∨

  • r

(inclusive) disjunction → if, then (imply) implication ↔ ifg (equivalent to) equivalence

▶ Punctuation symbols: ( and ).

CS 245 Logic and Computation Fall 2019 Alice Gao 19 / 30

slide-20
SLIDE 20

Expressions of 𝑀𝑞

▶ expressions are fjnite strings of symbols. Examples: 𝑞, 𝑞𝑟, (𝑠),

𝑞∧ → 𝑟 and ¬(𝑞 ∧ 𝑟).

▶ The length of an expression is the number of occurrences of

symbols in it.

▶ empty expression: an expression of length 0, denoted by 𝜇. ▶ two expressions 𝑣 and 𝑤 are equal if they are of the same

length and have the same symbols in the same order.

▶ an expression is read from left to right.

CS 245 Logic and Computation Fall 2019 Alice Gao 20 / 30

slide-21
SLIDE 21

Expression terminologies

▶ 𝑣𝑤 denotes the result of concatenating two expressions 𝑣, 𝑤 in

this order. Note that 𝜇𝑣 = 𝑣𝜇 = 𝑣.

▶ 𝑤 is a segment of 𝑣 if 𝑣 = 𝑥1𝑤𝑥2 where 𝑣, 𝑤, 𝑥1, 𝑥2 are

expressions. 𝑤 is a proper segment of 𝑣 if 𝑤 is non-empty and 𝑤 ≠ 𝑣. If 𝑣 = 𝑤𝑥, where 𝑣, 𝑤, 𝑥 are expressions, then 𝑤 is an initial segment (prefjx) of 𝑣. Similarly, 𝑥 is a terminal segment (suffjx) of 𝑣.

CS 245 Logic and Computation Fall 2019 Alice Gao 21 / 30

slide-22
SLIDE 22

Atomic formulas

Defjnition (𝐵𝑢𝑝𝑛(𝑀𝑞))

𝐵𝑢𝑝𝑛(𝑀𝑞) is the set of expressions of 𝑀𝑞 consisting of a proposition symbol only.

CS 245 Logic and Computation Fall 2019 Alice Gao 22 / 30

slide-23
SLIDE 23

Well-formed propositional formulas

Defjnition (𝐺𝑝𝑠𝑛(𝑀𝑞))

An expression of 𝑀𝑞 is a member of 𝐺𝑝𝑠𝑛(𝑀𝑞) if and only if its being so follows from (1) - (3):

  • 1. 𝐵𝑢𝑝𝑛(𝑀𝑞) ⊆ 𝐺𝑝𝑠𝑛(𝑀𝑞).
  • 2. If 𝐵 ∈ 𝐺𝑝𝑠𝑛(𝑀𝑞), then (¬𝐵) ∈ 𝐺𝑝𝑠𝑛(𝑀𝑞).
  • 3. If 𝐵, 𝐶 ∈ 𝐺𝑝𝑠𝑛(𝑀𝑞), then (𝐵 ∗ 𝐶) ∈ 𝐺𝑝𝑠𝑛(𝑀𝑞) where ∗ is
  • ne of the four binary connectives.

Note that 𝐺𝑝𝑠𝑛(𝑀𝑞) is the minimum set that satisfjes the three conditions above.

CS 245 Logic and Computation Fall 2019 Alice Gao 23 / 30

slide-24
SLIDE 24

CQ on the fjrst symbol in a well-formed formula

CS 245 Logic and Computation Fall 2019 Alice Gao 24 / 30

slide-25
SLIDE 25

CQ on well-formed propositional formulas

CS 245 Logic and Computation Fall 2019 Alice Gao 25 / 30

slide-26
SLIDE 26

Example: Generating Formulas

The following expression is a formula. ((𝑞 ∨ 𝑟) → ((¬𝑞) ↔ (𝑟 ∧ 𝑠))) How is it generated using the defjnition of well-formed propositional formulas? One can use parse trees to analyze formulas.

CS 245 Logic and Computation Fall 2019 Alice Gao 26 / 30

slide-27
SLIDE 27

Example: Parse Tree

Draw the parse tree for the following formula. ((𝑞 ∨ 𝑟) → ((¬𝑞) ↔ (𝑟 ∧ 𝑠))) Parse tree: ((𝑞 ∨ 𝑟) → ((¬𝑞) ↔ (𝑟 ∧ 𝑠))) (𝑞 ∨ 𝑟) 𝑞 𝑟 ((¬𝑞) ↔ (𝑟 ∧ 𝑠)) (¬𝑞) (𝑟 ∧ 𝑠) 𝑟 𝑠 𝑞

CS 245 Logic and Computation Fall 2019 Alice Gao 27 / 30

slide-28
SLIDE 28

Exercise: Parse Trees

Draw the parse tree for the following formula. (((¬𝑞) ∧ 𝑟) → (𝑞 ∧ (𝑟 ∨ (¬𝑠)))

CS 245 Logic and Computation Fall 2019 Alice Gao 28 / 30

slide-29
SLIDE 29

Precedence rules: for humans

Consider the following sequence of connectives: ¬, ∧, ∨, →, ↔ Each connective on the left has priority over those on the right. Examples: Add back the brackets based on the precedence rules.

▶ ¬𝑞 ∨ 𝑟 ▶ 𝑞 ∧ 𝑟 ∨ 𝑠 ▶ 𝑞 → 𝑟 ↔ 𝑞 ▶ ¬𝑞 → 𝑞 ∧ ¬𝑟 ∨ 𝑠 ↔ 𝑟

CS 245 Logic and Computation Fall 2019 Alice Gao 29 / 30

slide-30
SLIDE 30

Revisiting the learning goals

By the end of the lecture, you should be able to

▶ Determine whether an English sentence is a proposition. ▶ Determine whether an English sentence is a simple or

compound proposition.

▶ Determine whether a propositional formula is atomic and/or

well-formed.

▶ Draw the parse tree of a well-formed propositional formula. ▶ Given a propositional formula with no parentheses, make it a

well-formed formula by adding parentheses according to the precedence rules.

CS 245 Logic and Computation Fall 2019 Alice Gao 30 / 30