0% found this document useful (0 votes)
5 views48 pages

Knowledge Representation

The document provides an overview of propositional logic, detailing its syntax, semantics, and deduction processes. It explains the concepts of propositions, connectives, and how to evaluate their validity through truth tables, including tautologies, contradictions, and contingencies. Additionally, it discusses argument structures, proof methods like modus ponens and modus tollens, and introduces the concept of entailment in logical reasoning.

Uploaded by

Nida -E-Rub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views48 pages

Knowledge Representation

The document provides an overview of propositional logic, detailing its syntax, semantics, and deduction processes. It explains the concepts of propositions, connectives, and how to evaluate their validity through truth tables, including tautologies, contradictions, and contingencies. Additionally, it discusses argument structures, proof methods like modus ponens and modus tollens, and introduces the concept of entailment in logical reasoning.

Uploaded by

Nida -E-Rub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 48

Knowledge Representation

Propositional Logic-1

By
Dr. Syed Noman Hasany &
Muhammad Ubaid Zaman
What is logic?
• Logic determines whether it is justified to reason
from given assumptions to a conclusion

– note: a logician cannot determine whether it rains

– he can conclude it rains from the assumptions if I hear


drips on the roof, then it rains and I hear drips on the roof

• There exist many logics


– First, we will discuss propositional logic…
A Formal Approach
• Any logic comes in three parts:
• syntax: what are the well-formed formulae (wffs)?
• semantics: what do formulae mean, how do we
interpret them?

• deduction: how to mechanically formulate formulae,


giving us for instance, the valid ones? Or is concerned
with manipulating formulae according to certain
rules (Also called the proof theory)
Propositional Logic

• The syntax of propositional logic is made up of


propositions and connectives.
Proposition
• A statement in some language that can be evaluated to either
true or false (but it cannot be both).
Example propositions:
• It is raining.
• 5 + 5 = 10.
• Turkey is in Asia.
• Riyadh is the capital of KSA.

Not propositions:
• Where are you?
• Oh no!
• Liverpool is not.
Checking Propositions’ Validity
• Valid propositions can be evaluated to either true or
false.

• e.g. It is true that it is raining


• e.g. It is false that Turkey is in Asia.

• An easy way to determine whether or not a


statement is a proposition is to see if you can prefix it
with “it is true that” or “it is false that”; and if it
subsequently still makes sense.
Representing Propositions
• we represent propositions using the
propositional variables p, q, r etc.

• The previous examples of propositions are all


atomic. We can combine these atomic
propositions to form compound propositions…
Connectives
• Propositions are combined through connectives. The
main connectives of propositional logic are:

• Conjunction (and): Λ
• Disjunction (or): v
• Negation (not): ¬
• Implication (if..then): →
• Equivalence / Bi-implication(if and only if): ↔
Implication
Example:
Using the implication Truth Table
connective we can express
that if “you give me your p q p→q
mobile phone” then “I will
be your best friend”, as:
p → q---- (q :- p) T T T
where p represents the T F F
proposition “you give me F T T
your mobile phone” and q
represents the proposition F F T
“I will be your best friend”.
Implication
• We need to be careful with → as it may not quite
capture our intuitions about implication.
• In particular (taking the previous example), p
→ q is true in the following situations:
– I study hard and I get rich; or
– I don't study hard and I get rich; or
– I don't study hard and I don't get rich.
• Note the last two situations, where the implication is
true regardless of the truth of p.
• The one thing we can say is that if I've studied hard
but failed to become rich then the proposition is
clearly false.
Equivalence OR Bi-implication
Example:
Using the equivalence Truth Table
connective we can express p q p↔q
that “Asim will get a first class
degree” iff “his average is
higher than 70%”, as: T T T
p↔q T F F
where p represents the F T F
proposition “Asim will get a
first class degree” and q F F T
represents the proposition
“his average is higher than
70%”.
Compound Statements
• Connectives can be combined to form
compound statements or formulae.
• e.g.: ¬(p Λ ¬ q)
pΛq↔r
Example
The truth table for ¬(p Λ ¬q) is as follows:

p q ¬q (p Λ ¬q) ¬(p Λ ¬q)


T T F F T
T F T T F
F T
F F T
F F
T F T
Precedence of PL connectives
• () High
• ¬
• Λ
• V
• , ↔ (from left to right) Low

– E.g: p V q Λ r is same as p V (q Λ r)
Example
The truth table for: p Λ q ↔ r as shown below.

p q r pΛq pΛq↔r
T T T T T
T T F T F
T F T F F
T F F F T
F T T F F
F T F F T
F F T F F
F F F F T
Example
Tautologies, Contradictions and
Contingencies
• For the truth tables of some formulae we find only Ts in the
last column. Such formulae are called “tautologies” (or valid
formulae).

• Conversely, the truth tables of other formulae contain only Fs


in the last column. Such formulae are called “contradictions”
(or unsatisfiable formulae).

• Negation of a tautology is a contradiction, and vice versa.

• A formula that is neither a tautology nor a contradiction (i.e.


contains both Fs and Ts in the last column) is known as a
“contingency” (or a satisfiable formula).
Tautology Example
The truth table for: p → (p V q), is a
tautology, as shown below.
p q (p V q) p → (p V q)
T T T T
T F T T
F T T T
F F F T
Contradiction Example

The truth table for: (p V q) Λ (¬p Λ ¬q), is a


contradiction, as shown below.
p q (p V q) ¬p ¬q ¬p Λ ¬q (p V q) Λ (¬p Λ ¬q)
T T T F F F F
T F T F T F F
F T
T T F F F
F F F T T T F
Contingency Example

The truth table for: (p Λ q) → ¬p , is a


contingency, as shown below.
p q (p Λ q) ¬p (p Λ q) → ¬p
T T T F F
T F F F T
F T F T
T
F F F T T
Equivalences
• It is worth noting that there are a number of equivalences
between the logical connectives.

Thus:
p  q is equivalent to ¬p V q
p Λ q is equivalent to ¬(¬p V ¬q)
p V q is equivalent to ¬p  q

• The symbol we use to denote equivalence is: ≡

e.g. p  q ≡ ¬p V q
etc.
Equivalences
p q p→q
•We can check
T T T
to see if these T F F
statements are equivalent
F T T
by examining
F F T
the appropriate
truth tables
p q ¬p ¬p V q
T T F T
T F F F
F T T T
F F T T
Equivalence Laws-1
• There are a number of laws that state equivalence relations.
The following are a few of the most popular ones:

• Associative laws:
(p V q) V r ≡ p V (q V r)
(p Λ q) Λ r ≡ p Λ (q Λ r)

• Commutative laws:
pVq ≡ qVp
pΛq ≡ qΛp

• Involution law:
¬¬p ≡ p
Equivalence Laws-1
• Distributive laws:
p V (q Λ r) ≡ (p V q) Λ (p V r)
p Λ (q V r) ≡ (p Λ q) V (p Λ r)

• DeMorgan’s laws:
¬(p V q) ≡ ¬p Λ ¬q
¬(p Λ q) ≡ ¬p V ¬q

• All these laws can be verified by checking the


appropriate truth tables to see that the statements
are equivalent.
Assign_1: Q.1
• Verify the equivalence of the formulae given
on the last 2 slides using truth table.
A BNF grammar of sentences in
propositional logic
S := <Sentence> ;
<Sentence> := <AtomicSentence> |
<ComplexSentence> ;
<AtomicSentence> := "TRUE" | "FALSE" |
"P" | "Q" | "S" ;
<ComplexSentence> := "(" <Sentence> ")" |
<Sentence> <Connective> <Sentence>
|"NOT" <Sentence> ;
<Connective> := "AND" | "OR" | "IMPLIES"
| "EQUIVALENT" ;
Grammar (in short)
S := <S> ;
<S> := <A_S> | <C_S> ;
<A_S> := “T”|”F”|P|Q|R|S ;
<C_S> :=(<S>)|<S> <C> <S> | ¬ <S>;

<C> := | V |→| ↔;
Processing grammar: Example 1
• Process the sentence for syntax check:
• PvQ
– S := <S>
– := <C_S>
– := <S> <C> <S>
– := <A_S> <C> <S>
– := P v <S>
– := P v <A_S>
– := P v Q
Processing grammar: Example 2
• Process the sentence for syntax check:
• P → (⌐Q )
– S := <S>
– := <C_S>
– := <S> <C> <S>
– := <A_S> <C> <S>
– := P → <S>
– := P → (<S>)
– := P → (<C_S>)
– := P → (⌐ <S>)
– := P → (⌐ <A_S>)
– := P → (⌐ Q)
Assign_1: Q.2
Syntax. Say whether each of the following is a sentence of Propositional Logic. Process
grammar to show the validity of sentences for (b) and (c) only.
Assign_1: Q.3
Validity, Satisfiability, Unsatisfiability. For each of the following sentences,
Indicate whether it is valid, satisfiable, or unsatisfiable. (c), (g) and (i)
“The beginning of knowledge is the
discovery of something that we do
not understand.”
– Frank Herbert
Knowledge base system

• Knowledge base = set of sentences in a formal language


Syntax semantics
Assignments and Models
• Each line of a truth table represents a different
possibility for the truth value combinations of the
propositions. Each is an assignment of the truth
values to the propositions.

• An assignment which makes the expression true is


said to be a model for the expression.

• An assignment which makes the expression false is


said to be a counter-example.

35
Argument and Proof in Propositional Logic

• An argument is a relationship between a set of propositions


called premises and another proposition called the conclusion.

• Proof is intended to show deductively that an argument is


sound (or valid).
– An argument is sound iff it cannot be the case that its premises are true
and its conclusion is false.

• The symbol (called the ‘turnstile’) we use in logic to denote


proof is:

i.e. Premises ├ Conclusion


36
Proof Example
• The following argument is sound:
p → q, p ├ q

• An argument that is not sound is called a fallacy

• In addition to using truth tables, other forms of proof can be


used, such as derivation rules (or proof rules).

• There are a number of such derivation rules which enable us


to prove that an argument is sound.

37
Modus Ponens
• One particularly important derivation rule is modus
ponens, as shown on the previous slide.

• This takes the following form:


p → q, p ├ q

• Essentially, this argument states that given the


premise p → q, and the premise p then we must
conclude q.

38
Modus Ponens Example
• An example argument of the form modus ponens:

Premises:
- If it is raining then ground is wet (p → q),
- It is raining (p),

Conclusion:
- Therefore, the ground is wet (q).

39
Modus Tollens
• Another important derivation rule is modus tollens (which is
also known as the contraposition) and it takes the following
form:
p → q, ¬q ├ ¬p

• Example:

Premises:
- If it is raining then the ground is wet (p → q),
- The ground is not wet (¬q)

Conclusion:
- Therefore, it is not raining (¬p).
40
Entailment
• The notation we use to show that the truth of a given
formula follows from the truth of some other
formula, is known as the entailment relation:

Example: {¬q, p  q} ╞ ¬p

means that proposition ¬p is true, iff both


proposition ¬q and p  q is true. Thus, the premises
entail the conclusion.

41
Entailment
Example: {¬q, p  q} ╞ ¬p

means that ¬p is true, iff Truth Table


both ¬q and p  q are true.
Thus, the premises entail
the conclusion (or the p q ¬p ¬q (p  q)
argument is sound).
T T F F T
Answer: T F F T F
The above argument is sound F T T F T
because in row#4 of TT both
premises ¬q and p  q are F F T T T
true and at the same time
conclusion ¬p is also true.
Entailment
• We can see in the previous table that there are some
assignments that make the formula true and some
assignments that make the formula false.

• Lines 1, 2 and 3 all have false truth assignments so we


disregard them.

• This means that we are left with one assignment, from the
last line of the table, and on examination we can see that all
assignments for the formula are true.
– i.e. ¬q is true, p  q is true and ¬p is true.

• Therefore, ¬p is entailed by {¬q, p  q} , or more formally:


{¬q, p  q} ╞ ¬p

43
Modus Ponens Argument Soundness
• Is modus ponens argument sound?
– p → q, p ╞ q

p q (p  q)
T T T
T F F
F T T
F F T
Entailment and Proof
• To clarify the difference between entailment and proof:

• Entailment: if we have a set of formulae which are true, then


as a logical consequence of this, some particular formula must
also be true.

• Proof: a formula is provable (derivable) in some logical system


if there are rules of inference that allow the formula to be
derived by performing some operations on the formulae.

• Entailment is concerned with the semantics of formulae,


proof is concerned with syntax only.

45
Soundness and Completeness
• Two important properties to consider in inference systems are
soundness and completeness.

• A logic is said to be sound, with respect to its semantics, if


only true formulae are derivable under the inference rules,
from premises which themselves are all true. (i.e. the
inference rules are correct)

• In a sound system inference rules are truth-preserving:


applying a rule to true premises yields a true conclusion.

• A logic is said to be complete if all the true formulae are


provable from the rules of the logic. (i.e. no other rules are
required)

46
Modus Tollens Exercise
• Is the below argument
entailed?
– {¬p, p  q} ╞ ¬q ?
• Answer: p q ¬p ¬q pq
– The above argument is T T F F T
NOT sound because in
row#3&4 of TT both
T F F T F
premises ¬p and p  q F T T F T
are true but the F F T T T
conclusion ¬q is false.
Assign_1: Q.4
• Is the below argument entailed?
– {q, p  q} ╞ p ?

You might also like