Download Logic as a Tool 3mm Chapter 1: Understanding Propositional Logic

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
no text concepts found
Transcript
Logic as a Tool
Chapter 1: Understanding Propositional Logic
1.1 Propositions and logical connectives.
Truth tables and tautologies
Valentin Goranko
Stockholm University
September 2016
Goranko
Propositions
Proposition: statement which can be assigned a (unique) truth value:
true or false.
Some examples of propositions:
• “The Sun is hot.”
• The Moon is made of cheese.
• “Two plus two equals twenty two.”
• “The 1001st decimal digit of the number π is 7.”
Some non-examples:
• “Are you bored?”
• “Please, don’t go away!”
• “She loves me.”
• “x is an integer.”
• “This sentence is false.”
Goranko
Propositional logical connectives
• not, called negation, denoted by ¬;
• and, called conjunction, denoted by ∧ (or, sometimes by &);
• or, called disjunction, denoted by ∨;
• if . . . then . . . , called implication, or conditional, denoted by →;
• . . . if and only if . . . ,
called equivalence, or biconditional, denoted by ↔.
Goranko
Building composite propositions
Using the propositions
“Two plus two equals five” and “The sun is hot”
and the propositional connectives, we can produce:
• “It is not the case that two plus two equals five”
• “Two plus two equals five and the sun is hot”
• “Two plus two equals five or the sun is hot”
• “If two plus two equals five then the sun is hot”
• “Two plus two equals five if and only if the sun is hot”
Likewise, using the propositions
“Logic is fun”, “Logic is boring”, “Logic is easy”
we can produce the composite proposition:
“Logic is not fun or, if Logic is easy then Logic is fun and Logic
is not boring.”
Goranko
The propositional connectives as truth value functions
Each propositional connective acts on the truth values of the component
propositions in a precise way:
• ¬A is true if and only if A is false.
• A ∧ B is true if and only if both A and B are true.
• A ∨ B is true if and only if either of A or B (possibly both) is true.
• A → B is true if and only if the truth of A implies the truth of B,
i.e., iff A is false or B is true.
• A ↔ B is true if and only if A and B have the same truth-values.
Goranko
Truth tables
These rules can be summarized in the following truth tables, where T
stands for ‘true’ and stands for ’false’:
p ¬p
T F
F T
p
T
T
F
F
q p∧q p∨q p →q p ↔q
T
T
T
T
T
F
F
T
F
F
T
F
T
T
F
F
F
F
T
T
Goranko
Applying the truth tables
Given that
‘Two plus two equals five’ is false and ‘The Sun is hot’ is true,
using the truth-tables we obtain that:
“It is not the case that two plus two equals five” is true;
“Two plus two equals five and the Sun is hot” is false;
“Two plus two equals five or the Sun is hot” is true;
“If two plus two equals five, then the Sun is hot” is true.
“If two plus two equals five if and only if the Sun is hot” is true.
Goranko
Some comments on the truth tables
• Conjunction is commutative: A ∧ B is equally true as B ∧ A.
But, these do not always mean the same!
Compare “Bill pulled the trigger and Jack dropped dead”
with “Jack dropped dead and Bill pulled the trigger ”.
• Disjunction is non-exclusive: “I shall win or I shall die” is still true if
I both win and die. Compare also with “I shall win unless I die”.
• Implication is the most confusing of all.
Why should “False imply true” and “False imply false” be true?
Because there is no good reason to declare them false!
The implication A → B claims the truth of B only if A is true, else
no claim is made.
Thus, the implication A → B is false in only one case:
when A is true and yet B is false.
Goranko
Some equivalent forms of the implication
The implication is the most important and versatile propositional
connective. It can appear in variety of phrases:
• If A then B
• A implies B
• A only if B
• B whenever A
• B if A
• A is sufficient for B
• B is necessary for A
Goranko
Computing the truth value of a proposition
Suppose that
“Logic is fun.”: T;
“Logic is boring.”: F;
“Logic is easy.”: T;
To compute the truth value of the composite proposition:
“Logic is not fun or, if Logic is easy then Logic is fun and Logic is not
boring.”
we first write it in a symbolic form.
For that, we first analyse and clarify it syntax, by placing auxiliary
parentheses to indicate the order of applying the logical connectives:
“(Logic is not fun) or (if Logic is easy then (Logic is fun and
Logic is not boring)).”
Goranko
Computing the truth value of a proposition, cont’d
We now introduce symbolic names for the atomic propositions occurring
in it, e.g:
A : “Logic is fun.” B : “Logic is boring.” C : “Logic is easy.”
Then, the proposition can be written symbolically as:
(¬A) ∨ (C → (A ∧ ¬B))
Now, we compute its truth value step by step, applying the truth-tables
of the respective logical connectives:
(¬T) ∨ (T → (T ∧ ¬F))
= F ∨ (T → (T ∧ T))
= F ∨ (T → T)
=F∨T
= T.
Goranko
Propositional formulae
Propositional constants: > which represents a true proposition, and ⊥
which represents a false proposition.
Propositional variables: variables that range over propositions. Usually
denoted by p, q, r , possibly with indices.
Inductive definition of propositional formulae:
1. Every propositional constant and every propositional variable is a
propositional formula.
2. If A is a propositional formula then ¬A is a propositional formula.
3. If A, B are propositional formulae then (A ∨ B), (A ∧ B) , (A → B),
(A ↔ B) are propositional formulae.
Examples:
>, ¬>, p, ¬p, ¬¬p, ¬q, (p ∨ ¬q), ¬(p1 ∧ ¬(p2 → ¬p1 )), . . .
Outermost pairs of parentheses will often be omitted.
Goranko
Construction trees, subformulae, main connectives
Construction tree: a tree with nodes labelled with propositional
constants, variables, and propositional connectives, such that:
1. Every leaf is labelled by a propositional constant or variable.
2. Propositional constants and variables label only leaves.
3. Every node labelled with ¬ has exactly one successor node.
4. Every node labelled with any of ∧, ∨, →, ↔ has exactly two
successor nodes - left and right successor.
Every construction tree defines a formula C , built starting from the
leaves and going towards the root, by applying at every node the formula
construction rule corresponding to the label at that node.
Goranko
Construction tree of a formula
Leaves: propositional variables or constants
unary connective ( ¬ )
binary connective ( ∨, ∧, →, ↔)
the main connective
The formulae constructed in the process are the subformulae of C .
The connective labelling the root of the construction tree of a formula
C is the main connective of C .
Goranko
Construction tree: example
Formula:
(p ∨ ¬(q ∧ ¬r )) → ¬¬r
Construction tree
r
q
¬
∧
p
¬
r
¬
¬
∨
→
V Goranko
Parsing tree of a formula
The parsing tree of a formula looks the same as the construction tree,
but is produced in inverse order, starting from the main connective (of
any), drawing edges to all main components, and then recursively
producing the parsing trees for each of them.
Leaves: propositional variables or constants
unary connective ( ¬ )
binary connective ( ∨, ∧, →, ↔)
the main connective
Goranko
Parsing tree: example
Formula:
(p ∨ ¬(q ∧ ¬r )) → ¬¬r
Parsing tree
r
q
¬
∧
p
¬
r
¬
¬
∨
→
V Goranko
Truth tables of propositional formulae
Example:
(p ∨ ¬(q ∧ ¬r )) → ¬¬r
p
T
T
T
T
F
F
F
F
q
T
T
F
F
T
T
F
F
r
T
F
T
F
T
F
T
F
¬r
F
T
F
T
F
T
¬¬r
T
F
T
F
T
F
q ∧ ¬r
F
T
F
F
F
T
¬(q ∧ ¬r )
T
F
T
T
T
F
p ∨ ¬(q ∧ ¬r )
T
T
T
T
T
F
(p ∨ ¬(q ∧ ¬r )) → ¬¬r
T
F
T
F
T
T
Goranko
Simplified truth tables
p
T
T
T
T
F
F
F
F
q
T
T
F
F
T
T
F
F
r (p ∨
T T T
F T T
T T T
F T T
T F T
F F F
T
F
¬ (q ∧
T T F
F T T
T F F
T F F
T T F
F T T
¬
F
T
F
T
F
T
r ))
T
F
T
F
T
F
→
T
F
T
F
T
T
¬
T
F
T
F
T
F
¬
F
T
F
T
F
T
r
T
F
T
F
T
F
Goranko
Tautologies
Tautology (or, propositionally valid formula): a formula that obtains
truth value T for every assignment of truth values to the occurring
variables. Notation: |= A.
Examples:
|= p ∨ ¬p,
|= ¬(p ∧ ¬p),
|= ((p ∧ (p → q)) → q)
Testing tautologies with truth-tables:
p
T
T
F
F
q p → q p ∧ (p → q) (p ∧ (p
T
T
T
F
F
F
T
T
F
F
T
F
→ q)) → q
T
T
T
T
Goranko
Contradictions, satisfiable formulae
Contradiction is a formula that always takes truth value F.
Examples: p ∧ ¬p, ¬((p ∧ q) → p)
Thus, the negation of a tautology is a contradiction and the negation of
a contradiction is a tautology.
A formula is satisfiable if it is not a contradiction.
Example: p, p ∧ ¬q, etc.
Goranko
Related documents