Tải bản đầy đủ (.pdf) (77 trang)

Chapter 1a Propositional Logic I Discrete Mathematics II BK TPHCM

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (642.69 KB, 77 trang )

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Chapter 1a
Propositional Logic I
Discrete Mathematics II

Contents
Introduction
Declarative Sentences
Natural Deduction
Sequents
Rules for natural deduction

(Materials drawn from Chapter 1 in:

Basic and Derived Rules
Intuitionistic Logic

“Michael Huth and Mark Ryan. Logic in Computer Science: Modelling and
Reasoning about Systems, 2nd Ed., Cambridge University Press, 2006.”)

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form



Nguyen An Khuong, Huynh Tuong Nguyen
Faculty of Computer Science and Engineering
University of Technology, VNU-HCM

Homeworks and Next
Week Plan?

1a.1


Contents

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

1 Propositional Calculus: Declarative Sentences
2 Propositional Calculus: Natural Deduction

Sequents
Rules for natural deduction
Basic and Derived Rules
Excursion: Intuitionistic Logic

Contents
Introduction
Declarative Sentences
Natural Deduction
Sequents

Rules for natural deduction

3 Propositional Logic as a Formal Language

Basic and Derived Rules
Intuitionistic Logic

Formal Language

4 Semantics of Propositional Logic

Meaning of Logical Connectives
Preview: Soundness and Completeness

Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form

5 Conjunctive Normal Form

Homeworks and Next
Week Plan?

1a.2



Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

1 Propositional Calculus: Declarative Sentences
2 Propositional Calculus: Natural Deduction
Contents
Introduction

3 Propositional Logic as a Formal Language

Declarative Sentences
Natural Deduction

4 Semantics of Propositional Logic

Sequents
Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

5 Conjunctive Normal Form

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness


Normal Form
Homeworks and Next
Week Plan?

1a.3


Propositional Calculus

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Study of atomic propositions

Propositions are built from sentences whose internal structure is
not of concern.
Contents

Building propositions

Boolean operators are used to construct propositions out of
simpler propositions.

Introduction
Declarative Sentences
Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules


Example for Propositional Calculus

Intuitionistic Logic

Formal Language

• Atomic proposition: One plus one equals two.
• Atomic proposition: The earth revolves around the sun.
• Combined proposition: One plus one equals two and the

earth revolves around the sun.

Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.4


Goals and Main Result of Propositional Calculus

Propositional Logic I
Nguyen An Khuong,

Huynh Tuong Nguyen

Meaning of formula

Associate meaning to a set of formulas by assigning a value true or
false to every formula in the set.

Contents
Introduction
Declarative Sentences

Proofs

Symbol sequence that formally establishes whether a formula is
always true.

Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

Formal Language

Soundness and completeness

The set of provable formulas is the same as the set of formulas
which are always true.

Semantics

Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.5


Uses of Propositional Calculus

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Hardware design

The production of logic circuits uses propositional calculus at all
phases; specification, design, testing.

Contents
Introduction
Declarative Sentences

Verification

Verification of hardware and software makes extensive use of

propositional calculus.

Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

Formal Language

Problem solving

Decision problems (scheduling, timetabling, etc) can be expressed
as satisfiability problems in propositional calculus.

Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.6


Predicate Calculus: Central ideas


Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Richer language

Instead of dealing with atomic propositions, predicate calculus
provides the formulation of statements involving sets, functions
and relations on these sets.

Contents
Introduction
Declarative Sentences

Quantifiers

Natural Deduction
Sequents

Predicate calculus provides statements that all or some elements
of a set have specified properties.

Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

Formal Language

Compositionality


Similar to propositional calculus, formulas can be built from
composites using logical connectives.

Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.7


The uses of Predicate Calculus

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Progamming Language Semantics
The meaning of programs such as
ifx >= 0theny := sqrt(x)elsey := abs(x)
can be captured with formulas of predicate calculus:

∀x∀y(x = x ∧ (x ≥ 0 → y = x) ∧ (¬(x ≥ 0) → y = |x|))

Contents

Introduction
Declarative Sentences
Natural Deduction
Sequents
Rules for natural deduction

Other Uses of Predicate Calculus
• Specification: Formally specify the purpose of a program in order to
serve as input for software design,

• Verification: Prove the correctness of a program with respect to its
specification.

Basic and Derived Rules
Intuitionistic Logic

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.8



An Example for Specification

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Let P be a program of the form
while a <> b do
if a > b then a := a - b else a:= b - a;
The specification of the program is given by the formula

Contents
Introduction
Declarative Sentences
Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules

{a ≥ 0 ∧ b ≥ 0} P {a = gcd(a, b)}

Intuitionistic Logic

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness


Normal Form
Homeworks and Next
Week Plan?

1a.9


Logic in Theorem Proving, Logic Programming, and Other
Systems of Logic

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Theorem proving

Formal logic has been used to design programs that can
automatically prove mathematical theorems.
Logic programming

Research in theorem proving has led to an efficient way of proving
formulas in predicate calculus, called resolution, which forms the
basis for logic programming.

Contents
Introduction
Declarative Sentences
Natural Deduction
Sequents
Rules for natural deduction

Basic and Derived Rules

Some Other Systems of Logic

Intuitionistic Logic

Formal Language

• Three-valued logic: A third truth value (denoting “don’t

know” or “undetermined”) is often useful.
• Intuitionistic logic: A mathematical object is accepted only

if a finite construction can be given for it.
• Temporal logic: Integrates time-dependent constructs such

Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

as (“always” and “eventually”) explicitly into a logic
framework; useful for reasoning about real-time systems.
1a.10



Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

1 Propositional Calculus: Declarative Sentences
2 Propositional Calculus: Natural Deduction
Contents
Introduction

3 Propositional Logic as a Formal Language

Declarative Sentences
Natural Deduction

4 Semantics of Propositional Logic

Sequents
Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

5 Conjunctive Normal Form

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness


Normal Form
Homeworks and Next
Week Plan?

1a.11


Declarative Sentences
The language of propositional logic is based on propositions or
declarative sentences.

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Declarative Sentences

Sentences which one can—in principle—argue as being true or
false.
Contents

Examples

Introduction
Declarative Sentences

1

The sum of the numbers 3 and 5 equals 8.


2

Jane reacted violently to Jack’s accusations.

3

Every natural number > 2 is the sum of two prime numbers.
All Martians like pepperoni on their pizza.

Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules

4

Intuitionistic Logic

Formal Language
Semantics
Meaning of Logical
Connectives

Not Examples

Preview: Soundness and
Completeness

Normal Form


• Could you please pass me the salt?

Homeworks and Next
Week Plan?

• Ready, steady, go!
• May fortune come your way.
1a.12


Putting Propositions Together
Example 1.1

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

If the train arrives late and
there are no taxis at the station then
John is late for his meeting.
John is not late for his meeting.

Contents
Introduction

The train did arrive late.

Declarative Sentences
Natural Deduction


Therefore, there were taxis at the station.

Sequents
Rules for natural deduction
Basic and Derived Rules

Example 1.2

If it is raining and
Jane does not have her umbrella with her then
she will get wet.
Jane is not wet.

Intuitionistic Logic

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

It is raining.
Therefore, Jane has her umbrella with her.
1a.13



Focus on Structure
We are primarily concerned about the structure of arguments in
this class, not the validity of statements in a particular domain.

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

We therefore simply abbreviate sentences by letters such as p, q, r,
p1 , p2 etc.
From Concrete Propositions to Letters - Example 1.1

If the train arrives late and
there are no taxis at the station then
John is late for his meeting.

Contents
Introduction
Declarative Sentences
Natural Deduction
Sequents
Rules for natural deduction

John is not late for his meeting.

Basic and Derived Rules
Intuitionistic Logic


Formal Language

The train did arrive late.

Semantics
Meaning of Logical
Connectives

Therefore, there were taxis at the station.

Preview: Soundness and
Completeness

Normal Form

becomes

Homeworks and Next
Week Plan?

Letter version

If p and not q, then r. Not r. p. Therefore, q.
1a.14


Focus on Structure

Propositional Logic I
Nguyen An Khuong,

Huynh Tuong Nguyen

From Concrete Propositions to Letters - Example 1.2

If it is raining and
Jane does not have her umbrella with her then
she will get wet.
Jane is not wet.

Contents
Introduction
Declarative Sentences
Natural Deduction
Sequents

It is raining.

Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

Therefore, Jane has her umbrella with her.

Formal Language
Semantics

has
the same letter version

If p and not q, then r. Not r. p. Therefore, q.


Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.15


Logical Connectives

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Notations/Symbols

Sentences like “If p and not q, then r.” occur frequently. Instead
of English words such as “if...then”, “and”, “not”, it is more
convenient to use symbols such as →, ∧, ¬.

Contents
Introduction
Declarative Sentences

¬: negation of p is denoted by ¬p.

∨: disjunction of p and r is denoted by p ∨ r, meaning at least
one of the two statements is true.
∧: conjunction of p and r is denoted by p ∧ r, meaning both are
true.
→: implication between p and r is denoted by p → r, meaning
that r is a logical consequence of p. p is called the
antecedent, and r the consequent.

Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.16


Example 1.1 Revisited


Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

From Example 1.1

If the train arrives late and
there are no taxis at the station then
John is late for his meeting.

Contents
Introduction
Declarative Sentences

Symbolic Propositions

We replaced “the train arrives late” by p, etc.

Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules

The statement becomes: If p and not q, then r.

Intuitionistic Logic

Formal Language
Semantics


Symbolic Connectives

With symbolic connectives, the statement becomes:

Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form

p ∧ ¬q → r

Homeworks and Next
Week Plan?

1a.17


Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

1 Propositional Calculus: Declarative Sentences
2 Propositional Calculus: Natural Deduction

Sequents
Rules for natural deduction
Basic and Derived Rules
Excursion: Intuitionistic Logic


Contents
Introduction
Declarative Sentences
Natural Deduction
Sequents

3 Propositional Logic as a Formal Language

Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

4 Semantics of Propositional Logic

Formal Language
Semantics
Meaning of Logical
Connectives

5 Conjunctive Normal Form

Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.18



Introduction

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Objective

We would like to develop a calculus for reasoning about
propositions, so that we can establish the validity of statements
such as Example 1.1.

Contents
Introduction
Declarative Sentences

Idea

We introduce proof rules that allow us to derive a formula ψ from
a number of other formulas φ1 , φ2 , . . . φn .

Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

Formal Language


Notation

We write a sequent φ1 , φ2 , . . . , φn ψ
to denote that we can derive ψ from φ1 , φ2 , . . . , φn .

Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.19


Propositional Logic I

Example 1.1 Revisited

Nguyen An Khuong,
Huynh Tuong Nguyen

English

If the train arrives late and
there are no taxis at the station then

John is late for his meeting.
Contents

John is not late for his meeting.

Introduction
Declarative Sentences

The train did arrive late.

Natural Deduction
Sequents

Therefore, there were taxis at the station.

Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

Sequent

Formal Language
Semantics

p ∧ ¬q → r, ¬r, p

q

Meaning of Logical
Connectives

Preview: Soundness and
Completeness

Normal Form

Remaining task

Homeworks and Next
Week Plan?

Develop a set of proof rules that allows us to establish such
sequents.
1a.20


Propositional Logic I

Rules for Conjunction

Nguyen An Khuong,
Huynh Tuong Nguyen

Introduction of Conjunction

φ

ψ
Contents

[∧i]


Introduction

φ∧ψ

Declarative Sentences
Natural Deduction
Sequents
Rules for natural deduction
Basic and Derived Rules

Elimination of Conjunction

Intuitionistic Logic

Formal Language
Semantics

φ∧ψ

φ∧ψ
[∧e1 ]

φ

Meaning of Logical
Connectives

[∧e2 ]
ψ


Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.21


Propositional Logic I

Example of Proof

Nguyen An Khuong,
Huynh Tuong Nguyen

To show
p ∧ q, r

q ∧ r.

How to start?
Contents

p∧q

r,


Introduction
Declarative Sentences
Natural Deduction

q ∧ r.

Sequents
Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

Proof Step-by-Step
1

p ∧ q (premise)

2

r (premise)

3

q (by using Rule ∧e2 and Item 1)

4

q ∧ r (by using Rule ∧i and Items 3 and 2)

Formal Language
Semantics

Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.22


Propositional Logic I

Graphical Representation of Proof

Nguyen An Khuong,
Huynh Tuong Nguyen

Contents

p∧q

Introduction

[∧e2 ]

Declarative Sentences

r


Natural Deduction

q

Sequents
Rules for natural deduction

[∧i]
q∧r

Basic and Derived Rules
Intuitionistic Logic

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.23


Where are we heading with this?


Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

• We would like to prove sequents of the form

φ1 , φ2 , . . . , φn

ψ

• We introduce rules that allow us to form “legal” proofs
• Then any proof of any formula ψ using the premises

φ1 , φ2 , . . . , φn is considered “correct”.

Contents
Introduction
Declarative Sentences
Natural Deduction
Sequents

• Can we say that sequents with a correct proof are somehow

“valid”, or “meaningful”?
• What does it mean to be meaningful?
• Can we say that any meaningful sequent has a valid proof?
• ...but first back to the proof rules...

Rules for natural deduction
Basic and Derived Rules

Intuitionistic Logic

Formal Language
Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness

Normal Form
Homeworks and Next
Week Plan?

1a.24


Rules of Double Negation and Eliminating Implication

Propositional Logic I
Nguyen An Khuong,
Huynh Tuong Nguyen

Double Negation

¬¬φ

φ
[¬¬e]

[¬¬i]

¬¬φ

φ

Contents
Introduction
Declarative Sentences
Natural Deduction

Eliminating Implication

Sequents
Rules for natural deduction
Basic and Derived Rules
Intuitionistic Logic

φ

φ→ψ

Formal Language

[→ e]
ψ

Semantics
Meaning of Logical
Connectives
Preview: Soundness and
Completeness


Normal Form

Example

Homeworks and Next
Week Plan?

p:= “It rained,” and p → q:= “If it rained, then the street is wet.”
We can conclude from these two that the street is indeed wet.
1a.25


×