Aussagenlogik

Transcription

Aussagenlogik
Aussagenlogik
Schnelldurchlauf
Michael Leuschel
Softwaretechnik und Programmiersprachen
05/11/2012
Lecture 3
Teil 1:
Sprache (Syntax)
05/11/2012
Bestandteile
n 
Atomare Aussagen (atomic propositions)
n 
Entweder wahr oder falsch (Wahrheitswert, truth
value auf Englisch; true oder false)
n 
n 
zwei-wertig
Wahrheitswert einer komplexen Aussage:
n 
bestimmt von Wahrheitswerten der Bestandteile
it rains and it is cold
05/11/2012
it rains
(compositionality)
it is cold
Alphabet der Aussagenlogik
n 
Connectives
n 
n 
n 
n 
n 
n 
Atomare Aussagen
n 
n 
Und (Konjunktion): ∧
Oder (Disjunktion): ∨
Wenn (Implikation): →
Not (Negation):
¬
Äquivalenz ⟺, Exklusives Oder, . . .
Bezeichner:
p
q
(
)
Klammerung
n 
05/11/2012
Klammern
rains ...
Well Formed Formulas (wff’s)
n 
n 
Atomic propositions are wff’s
If α and β are wff’s then so are:
n 
n 
n 
n 
n 
n 
(¬ α)
(α ∧ β)
(α ∨ β)
(α → β)
No other expressions are wff’s
Note: α, β : meta-variables (outside of
propositional logic)
05/11/2012
Precedence
1. Negation ¬ binds highest
2. Then come ∧ and ∨
3. Finally comes →
Instead of
n 
(((¬ p) ∧ (¬ q)) → ((¬ p) ∨ (¬ q)))
we can write
n 
n 
05/11/2012
(¬ p ∧ ¬ q) → (¬ p ∨ ¬ q)
¬p∧¬q → ¬p∨¬q
Teil 2:
Semantik der Aussagenlogik
Interpretations, Models, Logical
Consequence
05/11/2012
Wahrheitswert einer Formel
n 
n 
Zuweisung: wff ↝ Wahrheitswert
Junktoren:
n 
n 
n 
n 
feste Bedeutung
Bsp: true ∧ false ergibt false
Wahrheitstabellen (truth tables)
Atomare Aussagen:
n 
n 
05/11/2012
egal (wahr oder falsch)
(we study form, not content !)
Wahrheitstabellen
α
β
¬α
α∧ β
α∨ β
α→ β α⇔ β
true
true
false
true
true
true
true
true
false
false
false
true
false
false
false
true
true
false
true
true
false
false
false
true
false
false
true
true
05/11/2012
Interpretations and Models
n 
An interpretation v is a mapping from atomic
propositions to {true,false}
Example: v(p) = true, v(q) = false
n 
Extension to wff’s by using truth tables
Example: v(p ∨ q) = ?
n  1. Determine v for subparts:
n 
n 
v(p) = true, v(q) = false
2. Apply truth table: true ∨ false = true
n 
v(p ∨ q) = true
For v’(p) = false, v’(q) = false: v’(p ∨ q) = false
n 
Interpretation v is a model for α iff v(α) = true
05/11/2012
Exercises:
n 
n 
v(p) = true,v(q) = false
v’(p) = false,v’(q) = false
n 
n 
n 
n 
n 
n 
n 
05/11/2012
v(p ∧ (q ∨ (¬p) )) =
v(p → (p → q )) =
v’(p → (p → q )) =
v(p ∨ (¬p)) =
v’(p ∨ (¬p)) =
v(p ∧ (¬p)) =
v’(p ∧ (¬p)) =
Exercises: Solutions
n 
n 
v(p) = true,v(q) = false
v’(p) = false,v’(q) = false
n 
n 
v(p ∧ (q ∨ (¬p) )) false
n 
n 
v(p)
v(q ∨ (¬p) )
true
n 
v(p ∧ (q ∨ (¬p) )) = false
v(p → (p → q )) = false
v’(p → (p → q )) = true
v(p ∨ (¬p)) = true
v’(p ∨ (¬p)) = true
false
v(q)
false
05/11/2012
v(¬p) false
n 
n 
v(p)
true
v(p ∧ (¬p)) = false
v’(p ∧ (¬p)) = false
Satisfaction, Tautology,
Contradiction
n 
A wff α is called
satisfiable (erfüllbar) iff it has a model
n  unsatisfiable or a contradiction
(unerfüllbar, Widerspruch) iff it has no model
n  a tautology iff all interpretations are models
n 
p ∧ (¬p)
p ∧ (q ∨ (¬p) )
p ∨ (¬p)
05/11/2012
Consequence and
Equivalence
n 
Two wff’s α and β are logically equivalent,
denoted by α ≡ β, iff they have the same
models (i.e., same truth table)
(p ∧ q) ≡ (q ∧ p)
(p → q) ≡ (¬p ∨ q)
n 
A wff α is called a logical consequence of β,
denoted by β ⇒ α, iff every model of β is also
a model of α
p ⇒ (q ∨ p)
05/11/2012
often
instead of ⇒
Consequence for Sets
n 
An interpretation v is a model for a set S of
wff’s iff it is a model for every element of S
v(p)=true,
n 
v is a model of {(p ∨ q), (¬p → ¬q)}
A set A of wff’s is called a logical
consequence of another set B,
denoted by B ⇒ A,
iff every model of B is also a model of Α
{p} ⇒ {(p ∨ q), (¬p → ¬q)}
05/11/2012
Beispiel
Ja
{p → q , ¬q} ⇒ {¬p}
?
auch Modell von {¬p} v(p)=true,
v(q)= true
v(p)=true,
v(q)=false
v(p)= false,
v(q)= true
4 mögliche Interpretationen
05/11/2012
v(p)= false,
v(q)= false
einziges Modell von
{p → q , ¬q}
Ein anderes Puzzle
Ein Zettel sagt die
Wahrheit der
andere nicht.
?
In dieser Zelle befindet
sich eine Prinzessin und
ein Tiger in der anderen
Zelle
05/11/2012
?
?
?
In einer der Zellen
befindet sich eine
Prinzessin und in der
anderen ein Tiger
Beware: Logic vs Language
n 
n 
Commutativity: p ∧ q ≡ q ∧ p
But:
He got scared and he killed the intruder.
n  He killed the intruder and he got scared.
(causal and temporal meaning attached to
and)
n 
n 
Implication
If 1 = 2 then I am Winnie the Poh.
05/11/2012
What (definitely) to know for
the exam:
n 
Language of Propositional Logic
n 
n 
wff’s
Semantics of Propositional Logic
n 
n 
n 
05/11/2012
Truth tables, Interpretations, Models,
Satisfiability,Tautology, Contradiction
Logical Equivalence and Consequence