Download Discrete Mathematics

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Axiom wikipedia , lookup

Jesús Mosterín wikipedia , lookup

Fuzzy logic wikipedia , lookup

Willard Van Orman Quine wikipedia , lookup

Meaning (philosophy of language) wikipedia , lookup

Axiom of reducibility wikipedia , lookup

Inquiry wikipedia , lookup

Argument wikipedia , lookup

Tractatus Logico-Philosophicus wikipedia , lookup

History of logic wikipedia , lookup

Mathematical logic wikipedia , lookup

History of the function concept wikipedia , lookup

Modal logic wikipedia , lookup

Syllogism wikipedia , lookup

Foundations of mathematics wikipedia , lookup

Boolean satisfiability problem wikipedia , lookup

Bernard Bolzano wikipedia , lookup

Laws of Form wikipedia , lookup

Quantum logic wikipedia , lookup

Intuitionistic logic wikipedia , lookup

Analytic–synthetic distinction wikipedia , lookup

Catuṣkoṭi wikipedia , lookup

Propositional formula wikipedia , lookup

Law of thought wikipedia , lookup

Natural deduction wikipedia , lookup

Propositional calculus wikipedia , lookup

Principia Mathematica wikipedia , lookup

Truth-bearer wikipedia , lookup

Transcript
Discrete Mathematics
Jeremy Siek
Spring 2010
Jeremy Siek
Discrete Mathematics
1 / 12
Jeremy Siek
Discrete Mathematics
2 / 12
Outline of Lecture 2
1. Propositional Logic
2. Syntax and Meaning of Propositional Logic
Jeremy Siek
Discrete Mathematics
2 / 12
Logic
I
Logic defines the ground rules for establishing truths.
I
Mathematical logic spells out these rules in complete detail,
defining what constitutes a formal proof.
Learning mathematical logic is a good way to learn logic because
it puts you on a firm foundation.
Writing formal proofs in mathematical logic is a lot like computer
programming. The rules of the game are clearly defined.
I
I
Jeremy Siek
Discrete Mathematics
3 / 12
Propositional Logic
I
Propositional logic is a language that abstracts away from content
and focuses on the logical connectives.
I
Uppercase letters like P and Q are meta-variables that are
placeholders for propositions.
The following rules define what is a proposition.
I
Jeremy Siek
Discrete Mathematics
4 / 12
Propositional Logic
I
Propositional logic is a language that abstracts away from content
and focuses on the logical connectives.
I
Uppercase letters like P and Q are meta-variables that are
placeholders for propositions.
The following rules define what is a proposition.
I
I
A propositional variable (lowercase letters p, q, r) is a
proposition. These variables model true/false statements.
Jeremy Siek
Discrete Mathematics
4 / 12
Propositional Logic
I
Propositional logic is a language that abstracts away from content
and focuses on the logical connectives.
I
Uppercase letters like P and Q are meta-variables that are
placeholders for propositions.
The following rules define what is a proposition.
I
I
I
A propositional variable (lowercase letters p, q, r) is a
proposition. These variables model true/false statements.
The negation of a proposition P, written ¬ P, is a proposition.
Jeremy Siek
Discrete Mathematics
4 / 12
Propositional Logic
I
Propositional logic is a language that abstracts away from content
and focuses on the logical connectives.
I
Uppercase letters like P and Q are meta-variables that are
placeholders for propositions.
The following rules define what is a proposition.
I
I
I
I
A propositional variable (lowercase letters p, q, r) is a
proposition. These variables model true/false statements.
The negation of a proposition P, written ¬ P, is a proposition.
The conjunction (and) of two propositions, written P ∧ Q, is a
proposition.
Jeremy Siek
Discrete Mathematics
4 / 12
Propositional Logic
I
Propositional logic is a language that abstracts away from content
and focuses on the logical connectives.
I
Uppercase letters like P and Q are meta-variables that are
placeholders for propositions.
The following rules define what is a proposition.
I
I
I
I
I
A propositional variable (lowercase letters p, q, r) is a
proposition. These variables model true/false statements.
The negation of a proposition P, written ¬ P, is a proposition.
The conjunction (and) of two propositions, written P ∧ Q, is a
proposition.
The disjunction (or) of two propositions, written P ∨ Q, is a
proposition.
Jeremy Siek
Discrete Mathematics
4 / 12
Propositional Logic
I
Propositional logic is a language that abstracts away from content
and focuses on the logical connectives.
I
Uppercase letters like P and Q are meta-variables that are
placeholders for propositions.
The following rules define what is a proposition.
I
I
I
I
I
I
A propositional variable (lowercase letters p, q, r) is a
proposition. These variables model true/false statements.
The negation of a proposition P, written ¬ P, is a proposition.
The conjunction (and) of two propositions, written P ∧ Q, is a
proposition.
The disjunction (or) of two propositions, written P ∨ Q, is a
proposition.
The conditional statement (implies), written P −→ Q, is a
proposition.
Jeremy Siek
Discrete Mathematics
4 / 12
Propositional Logic
I
Propositional logic is a language that abstracts away from content
and focuses on the logical connectives.
I
Uppercase letters like P and Q are meta-variables that are
placeholders for propositions.
The following rules define what is a proposition.
I
I
I
I
I
I
I
A propositional variable (lowercase letters p, q, r) is a
proposition. These variables model true/false statements.
The negation of a proposition P, written ¬ P, is a proposition.
The conjunction (and) of two propositions, written P ∧ Q, is a
proposition.
The disjunction (or) of two propositions, written P ∨ Q, is a
proposition.
The conditional statement (implies), written P −→ Q, is a
proposition.
The Boolean values True and False are propositions.
Jeremy Siek
Discrete Mathematics
4 / 12
Propositional Logic
I
I
I
Different authors include different logical connectives in their
definitions of Propositional Logic. However, these differences are
not important.
In each case, the missing connectives can be defined in terms of
the connectives that are present.
For example, I left out exclusive or, P ⊕ Q, but
P ⊕ Q = (P ∧ ¬ Q) ∨ ¬ P ∧ Q
Jeremy Siek
Discrete Mathematics
5 / 12
Propositional Logic
I
I
How expressive is Propositional Logic?
Can you write down the rules for Sudoku in Propositional Logic?
Jeremy Siek
Discrete Mathematics
6 / 12
Propositional Logic
I
I
How expressive is Propositional Logic?
Can you write down the rules for Sudoku in Propositional Logic?
I
It’s rather difficult if not impossible to express the rules of Sudoku
in Propositional Logic.
I
But Propositional Logic is a good first step towards more powerful
logics.
Jeremy Siek
Discrete Mathematics
6 / 12
Meaning of Propositions
I
A truth assignment maps propositional variables to True or False.
The following is an example:
A ≡ {p 7→ True, q 7→ False, r 7→ True}
A(p) = True
I
A(q) = False
A(r) = True
The meaning of a proposition is a function from truth
assignments to True or False. We use the notation JP K for the
meaning of proposition P .
JpK(A) = A(p)
(
True
if JP K(A) = False
J¬P K(A) =
False otherwise
Jeremy Siek
Discrete Mathematics
7 / 12
Meaning of Propositions, cont’d
(
True
JP ∧ QK(A) =
False
(
False
JP ∨ QK(A) =
True
(
False
JP −→ QK(A) =
True
if JP K(A) = True, JQK(A) = True
otherwise
if JP K(A) = False, JQK(A) = False
otherwise
if JP K(A) = True, JQK(A) = False
otherwise
Jeremy Siek
Discrete Mathematics
8 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
JpK(A) = True
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
I
JpK(A) = True
JqK(A) = False
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
I
I
JpK(A) = True
JqK(A) = False
Jp ∧ pK(A) = True
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
I
I
I
JpK(A) = True
JqK(A) = False
Jp ∧ pK(A) = True
Jp ∧ qK(A) = False
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
I
I
I
I
JpK(A) = True
JqK(A) = False
Jp ∧ pK(A) = True
Jp ∧ qK(A) = False
Jp ∨ qK(A) = True
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
I
I
I
I
I
JpK(A) = True
JqK(A) = False
Jp ∧ pK(A) = True
Jp ∧ qK(A) = False
Jp ∨ qK(A) = True
Jp −→ pK(A) = True
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
I
I
I
I
I
I
JpK(A) = True
JqK(A) = False
Jp ∧ pK(A) = True
Jp ∧ qK(A) = False
Jp ∨ qK(A) = True
Jp −→ pK(A) = True
Jq −→ pK(A) = True
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
I
I
I
I
I
I
I
JpK(A) = True
JqK(A) = False
Jp ∧ pK(A) = True
Jp ∧ qK(A) = False
Jp ∨ qK(A) = True
Jp −→ pK(A) = True
Jq −→ pK(A) = True
Jp −→ qK(A) = False
Jeremy Siek
Discrete Mathematics
9 / 12
Example Propositions
Suppose A = {p 7→ True, q 7→ False}.
I
I
I
I
I
I
I
I
I
JpK(A) = True
JqK(A) = False
Jp ∧ pK(A) = True
Jp ∧ qK(A) = False
Jp ∨ qK(A) = True
Jp −→ pK(A) = True
Jq −→ pK(A) = True
Jp −→ qK(A) = False
J(p ∨ q) −→ qK(A) = False
Jeremy Siek
Discrete Mathematics
9 / 12
Tautologies
Definition
A tautology is a proposition that is true in any truth assignment.
Examples:
I
p −→ p
q ∨ ¬q
I
(p ∧ q) −→ (p ∨ q)
I
There are two ways to show that a proposition is a tautology:
1. Check the meaning of the proposition for every possible truth
assignment. This is called model checking.
2. Contruct a proof that the proposition is a tautology.
Jeremy Siek
Discrete Mathematics
10 / 12
Model Checking
I
One way to simplify the checking is to only consider truth
assignments that include the variables that matter. For example,
to check p −→ p, we only need to consider two truth assignments.
1. A1 = {p 7→ True}, Jp −→ pK(A1 ) = True
2. A2 = {p 7→ False}Jp −→ pK(A2 ) = True
I
I
However, in real systems there are many variables, and the
number of possible truth assignments grows quickly: it is 2n for n
variables.
There are many researchers dedicated to discovering algorithms
that speed up model checking.
Jeremy Siek
Discrete Mathematics
11 / 12
Stuff to Rememeber
Propositional Logic:
I
The kinds of propositions.
The meaning of propositions.
I
How to check that a proposition is a tautology.
I
Jeremy Siek
Discrete Mathematics
12 / 12