Propositional Logic: Structural Induction Alice Gao Lecture 3 CS - - PowerPoint PPT Presentation

β–Ά
propositional logic structural induction
SMART_READER_LITE
LIVE PREVIEW

Propositional Logic: Structural Induction Alice Gao Lecture 3 CS - - PowerPoint PPT Presentation

Propositional Logic: Structural Induction Alice Gao Lecture 3 CS 245 Logic and Computation Fall 2019 Alice Gao 1 / 25 Outline Learning goals Propositional language Structure of formulas Inductively defjned sets Revisiting the learning


slide-1
SLIDE 1

Propositional Logic: Structural Induction

Alice Gao

Lecture 3

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

slide-2
SLIDE 2

Outline

Learning goals Propositional language Structure of formulas Inductively defjned sets Revisiting the learning goals

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

slide-3
SLIDE 3

Learning goals

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

β–Ά Prove properties of well-formed propositional formulas using

structural induction.

β–Ά Prove properties of a recursively defjned concept using

structural induction.

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

slide-4
SLIDE 4

Propositional language π‘€π‘ž

The propositional language π‘€π‘ž consists of three classes of symbols:

β–Ά Propositional symbols: π‘ž, π‘Ÿ, 𝑠, … . β–Ά Connective symbols: Β¬, ∧, ∨, β†’, ↔. β–Ά Punctuation symbols: ( and ).

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

slide-5
SLIDE 5

Well-formed propositional formulas

Defjnition (𝐺𝑝𝑠𝑛(π‘€π‘ž))

An expression of π‘€π‘ž is a member of 𝐺𝑝𝑠𝑛(π‘€π‘ž) ifg its being so follows from (1) - (3):

  • 1. 𝐡𝑒𝑝𝑛(π‘€π‘ž) βŠ† 𝐺𝑝𝑠𝑛(π‘€π‘ž).
  • 2. If 𝐡 ∈ 𝐺𝑝𝑠𝑛(π‘€π‘ž), then (¬𝐡) ∈ 𝐺𝑝𝑠𝑛(π‘€π‘ž).
  • 3. If 𝐡, 𝐢 ∈ 𝐺𝑝𝑠𝑛(π‘€π‘ž), then (𝐡 βˆ— 𝐢) ∈ 𝐺𝑝𝑠𝑛(π‘€π‘ž).

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

slide-6
SLIDE 6

Outline

Learning goals Propositional language Structure of formulas Inductively defjned sets Revisiting the learning goals

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

slide-7
SLIDE 7

Unique readability of well-formed formulas

Does every well-formed formula have a unique meaning? Yes. Theorem: There is a unique way to construct each well-formed formula.

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

slide-8
SLIDE 8

Properties of well-formed formulas

We may want to prove other properties of well-formed formulas.

β–Ά Every well-formed formula has at least one propositional

variable.

β–Ά Every well-formed formula has an equal number of opening

and closing brackets.

β–Ά Every proper prefjx of a well-formed formula has more opening

brackets than closing brackets.

β–Ά There is a unique way to construct every well-formed formula.

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

slide-9
SLIDE 9

Why should you care?

Learning goals on structural induction:

β–Ά Prove properties of well-formed propositional formulas using

structural induction.

β–Ά Prove properties of a recursively defjned concept using

structural induction. Learning goals for future courses:

β–Ά Prove the space and time effjciency of recursive algorithms

using induction.

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

slide-10
SLIDE 10

Properties of well-formed formulas

Theorem: For every well-formed propositional formula πœ’, 𝑄(πœ’) is true.

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

slide-11
SLIDE 11

Recursive structure in well-formed formulas

Defjnition (𝐺𝑝𝑠𝑛(π‘€π‘ž))

An expression of π‘€π‘ž is a member of 𝐺𝑝𝑠𝑛(π‘€π‘ž) ifg its being so follows from (1) - (3):

  • 1. 𝐡𝑒𝑝𝑛(π‘€π‘ž) βŠ† 𝐺𝑝𝑠𝑛(π‘€π‘ž). (Base case)
  • 2. If 𝐡 ∈ 𝐺𝑝𝑠𝑛(π‘€π‘ž), then (¬𝐡) ∈ 𝐺𝑝𝑠𝑛(π‘€π‘ž). (Inductive case)
  • 3. If 𝐡, 𝐢 ∈ 𝐺𝑝𝑠𝑛(π‘€π‘ž), then (𝐡 βˆ— 𝐢) ∈ 𝐺𝑝𝑠𝑛(π‘€π‘ž). (Inductive

case)

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

slide-12
SLIDE 12

A structural induction template for well-formed formulas

Theorem: For every well-formed formula πœ’, 𝑄(πœ’) holds. Proof by structural induction: Base case: πœ’ is a propositional symbol π‘Ÿ. Prove that 𝑄(π‘Ÿ) holds. Induction step:

Case 1: πœ’ is (¬𝑏), where 𝑏 is well-formed. Induction hypothesis: Assume that 𝑄(𝑏) holds. We need to prove that 𝑄((¬𝑏)) holds. Case 2: πœ’ is (𝑏 βˆ— 𝑐) where 𝑏 and 𝑐 are well-formed and βˆ— is a binary connective. Induction hypothesis: Assume that 𝑄(𝑏) and 𝑄(𝑐) hold. We need to prove that 𝑄((𝑏 βˆ— 𝑐)) holds.

By the principle of structural induction, 𝑄(πœ’) holds for every well-formed formula πœ’. QED

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

slide-13
SLIDE 13

Review questions about the structural induction template

  • 1. Why is the defjnition of a well-formed formula recursive?
  • 2. To prove a property of well-formed formulas using structural

induction, how many base cases and inductive cases are there in the proof?

  • 3. In the base case, how do we prove the theorem? Does the

proof rely on any additional assumption about the formula?

  • 4. In an inductive case, how do we prove the theorem? Does the

proof rely on any additional assumption about the formula?

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

slide-14
SLIDE 14

Structural induction problems

Problem 1: Every well-formed formula has at least one propositional variable. Problem 2: Every well-formed formula has an equal number of

  • pening and closing brackets.

Problem 3: Every proper prefjx of a well-formed formula has more

  • pening brackets than closing brackets.

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

slide-15
SLIDE 15

Outline

Learning goals Propositional language Structure of formulas Inductively defjned sets Revisiting the learning goals

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

slide-16
SLIDE 16

Structural induction for other problems

Structural induction is an important concept and it does not only apply to well-formed propositional formulas. Let’s look at some structural induction examples.

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

slide-17
SLIDE 17

Ways of defjning a set

β–Ά List all the elements in the set. Example: 𝐡 = {1, 2, 3, 4}. β–Ά Characterize the set by some property of all the elements in

the set. Example: the set of even integers.

β–Ά Defjne a set inductively.

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

slide-18
SLIDE 18

Inductively defjned sets

An inductively defjnition of a set consists of three components:

β–Ά A domain set π‘Œ β–Ά A core set 𝐷 β–Ά A set of operations 𝑄

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

slide-19
SLIDE 19

Closed and minimal set

A set Y is closed under a set of operations P ifg applying any

  • peration in P to elements in Y will always give us back an

element in Y. A set Y is a minimal set with respect to a property R if

β–Ά Y has property R, and β–Ά For every set Z that has property R, 𝑍 βŠ† π‘Ž.

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

slide-20
SLIDE 20

Defjning a set inductively

Given a domain set π‘Œ, a core set 𝐷 and a set of operations 𝑄, 𝐽(π‘Œ, 𝐷, 𝑄) is the minimal subset of π‘Œ that

β–Ά contains 𝐷, and β–Ά is closed under 𝑄.

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

slide-21
SLIDE 21

Example 1: Inductively defjned sets

Consider the domain set, the core set, and the set of operations defjned below.

β–Ά The domain set X = ℝ (the set of real numbers) β–Ά The core set C = {0}. β–Ά The set of operations P = {𝑔(𝑦) = 𝑦 + 1}

CQ: What set does this defjne? (A) The set of natural numbers {0, 1, 2, ...}. (B) The set of even natural numbers {0, 2, ...}. (C) The set of integers {..., βˆ’2, βˆ’1, 0, 1, 2, ...}. (D) The set of even integers {..., βˆ’2, 0, 2, ...}. (E) The set of real numbers.

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

slide-22
SLIDE 22

Example 2: Inductively defjned sets

Consider the domain set, the core set, and the set of operations defjned below.

β–Ά The domain set X = ℝ (the set of real numbers) β–Ά The core set C = {0, 2}. β–Ά The set of operations P =

{𝑔1(𝑦, 𝑧) = 𝑦 + 𝑧, 𝑔2(𝑦, 𝑧) = 𝑦 βˆ’ 𝑧} CQ: What set does this defjne? (A) The set of natural numbers {0, 1, 2, ...}. (B) The set of even natural numbers {0, 2, ...}. (C) The set of integers {..., βˆ’2, βˆ’1, 0, 1, 2, ...}. (D) The set of even integers {..., βˆ’2, 0, 2, ...}. (E) The set of real numbers.

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

slide-23
SLIDE 23

Well-formed propositional formulas

Defjne the set of well-formed propositional formulas inductively.

β–Ά π‘Œ = the set of fjnite sequences of symbols in π‘€π‘ž. β–Ά 𝐷 = the set of propositional variables. β–Ά 𝑄 = {𝑔1(𝑦) = (¬𝑦), 𝑔2(𝑦, 𝑧) = (𝑦 βˆ— 𝑧)}

where βˆ— is one of ∧, ∨, β†’, ↔.

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

slide-24
SLIDE 24

Structural induction on 𝐽(π‘Œ, 𝐷, 𝑄)

Claim: Every element of the set 𝐽(π‘Œ, 𝐷, 𝑄) has the property 𝑆. Proof:

β–Ά Base case: Prove that 𝑆 holds for every element in the core

set 𝐷.

β–Ά Inductive case: Prove that for every operation 𝑔 ∈ 𝑄 of arity

𝑙 and any 𝑧1, ..., 𝑧𝑙 ∈ 𝐽(π‘Œ, 𝐷, 𝑄) such that 𝑆(𝑧1), ..., 𝑆(𝑧𝑙), 𝑆(𝑔(𝑧1, ..., 𝑧𝑙)) holds.

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

slide-25
SLIDE 25

Revisiting the learning goals

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

β–Ά Prove properties of well-formed propositional formulas using

structural induction.

β–Ά Prove properties of a recursively defjned concept using

structural induction.

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