Вы находитесь на странице: 1из 88

Propositional Logic-

Introduction
Outline
• Symbolic AI
• Some Applications of Propositional Logic
• Propositional Logic
• Syntax
• Semantic
• Truth Table
• Inference rules
• Limitations of Propositional Logic
Symbolic AI
• AI relies on the Physical Symbol System Hypothesis:
Intelligent activity is achieved through the use of
• symbol patterns to represent the problem
• operations on those patterns to generate potential solutions
• search to select a solution among the possibilities

An AI representation language must


 handle qualitative knowledge
 allow new knowledge to be inferred from facts & rules
 allow representation of general principles
 capture complex semantic meaning
 allow for meta-level reasoning

e.g., Predicate Calculus (also, the basis of Prolog)


Logic
• A tool for reasoning

• Provides basic concept used in many


computer science fields (Artificial Intelligence,
Information Retrieval, DataBases etc. )
A logic language consists of semantics and syntax

Semantics:What the sentences mean.

Syntax: How sentences can be assembled.


Formal Logic
• Step 1: Use certain symbols to express the abstract
form of certain statements

• Step 2: Use a certain procedure based on these


abstract symbolizations to figure out certain logical
properties of the original statements.
Truth Tables
• Slow
• Systematic
• Reveals consequence as well as non-
consequence
• Only works for truth-functional logic
Formal Proofs
• Pretty fast (with practice!)
• Not systematic
• Can only reveal consequence
• Can be made into systematic method (that can then
also check for non-consequence) but becomes
inefficient

• Can be used for predicate logic


Truth Trees
• Fast

• Systematic

• Can reveal consequence as well as non-


consequence

• Can be used for truth-functional as well as


predicate logic
Propositional Satisfiability
Find the truth assignment that satisfies logical sentence

Propositional Satisfiability Testing:


• 1990: 100 variables/200 clauses (constraints)
• 1998: 10,000-100,000 variables/10^6 clauses

Some Applications:

• Diagnosis, workflow analysis, planning, software/circuit


testing, machine learning, bioinformatics
Electronic Circuit
P
Q & 1

&

R
1
Formal Languages and Commitments
Language Ontological Epistemological
Commitment Commitment

Propositional Logic facts true, false, unknown

First-order Logic facts, objects, true, false, unknown


relations
Temporal Logic facts, objects, true, false, unknown
relations, times
Probability Theory facts degree of belief
∈ [0,1]
Fuzzy Logic facts with degree of known interval
truth ∈ [0,1] value
Motivation
• formal methods to perform reasoning are required when dealing
with knowledge
• propositional logic is a simple mechanism for basic reasoning tasks
– it allows the description of the world via sentences
• simple sentences can be combined into more complex ones
• new sentences can be generated by inference rules applied to existing
sentences
• predicate logic is more powerful, but also considerably more
complex
– it is very general, and can be used to model or emulate many other
methods
– although of high computational complexity, there is a subclass that can be
treated by computers reasonably well
Objectives
• know the important aspects of propositional and predicate logic
– syntax, semantics, models, inference rules, complexity
• understand the limitations of propositional and predicate logic
• apply simple reasoning techniques to specific tasks
• learn about the basic principles of predicate logic
• apply predicate logic to the specification of knowledge-based
systems
• use inference rules to deduce new knowledge from existing
knowledge bases
Evaluation Criteria

• check sentences for syntactical correctness

• check if a sentence is true or false

• formulate simple sentences for simple


problems
Concerns
• What does it mean to say a statement is true?
• What are sound rules for reasoning
• What can we represent in propositional logic?
• What is the efficiency?
• Can we guarantee to infer all true statements?
Propositional Logic
• a relatively simple framework for reasoning
• can be extended for more expressiveness at the cost of
computational overhead
• important aspects
– syntax
– semantics
– validity and inference
– models
– inference rules
– complexity
Semantics
• Model = possible world

• x+y = 4 is true in the world x=3, y=1.

• x+y = 4 is false in the world x=3, y = 1.

• Entailment S1,S2,..Sn |= S means in every world where


S1…Sn are true, S is true.

• Some cognitive scientists argue that this is the way people


reason.
Reasoning or Inference Systems

• Proof is a syntactic property.

• Rules for deriving new sentences from old ones.

• Sound: any derived sentence is true.

• Complete: any true sentence is derivable.

• NOTE: Logical Inference is monotonic.


Forms of Reasoning:
Deduction,
Abduction,
Induction
Theorem Proving,
Sherlock Holmes,
and All Swans are White...
Basic Types of Inferences: Induction
• Induction: Derive a general rule (axiom) from background
knowledge and observations.
• Example:

Socrates is a human (background knowledge)


Socrates is mortal (observation/ example)

Therefore, I hypothesize that all humans are mortal (generalization)

• Remarks:
– Induction means to infer generalized knowledge from example
observations: Induction is the inference mechanism for (machine)
learning.
Basic Types of Inferences: Abduction
• Abduction: From a known axiom (theory) and some
observation, derive a premise.

• Example:

All humans are mortal (theory)


Socrates is mortal (observation)

Therefore, Socrates must have been a human (diagnosis)

• Remarks:
– Abduction is typical for diagnostic and expert systems.
• If one has the flue, one has moderate fewer.
• Patient X has moderate fewer.
• Therefore, he has the flue.
– Strong relation to causation
Deduction
• Deductive inferences are also called theorem
proving or logical inference.
– Deduction is truth preserving: If the premises (axioms
and facts) are true, then the conclusion (theorem) is
true.
• To perform deductive inferences on a machine, a
calculus is needed:
– A calculus is a set of syntactical rewriting rules defined
for some (formal) language. These rules must be sound
and should be complete.
Proposition
• A proposition is a symbolic variables whose value must
be either True or False, and which stands for a natural
language statement which could be either true or false

Examples:
A = Smith has chest pain
B = Smith is depressed
C = it is raining
Propositional Logic
Representing simple facts

It is raining
RAINING
It is sunny
SUNNY
It is windy
WINDY
If it is raining, then it is not sunny
RAINING → ¬SUNNY
Propositional Logic
Vocabulary
A set of propositional symbols
P, Q, R, ….

A set of logical connectives


∧, ∨ , ¬ , ⇒, ⇔
∧ (and) ∨ (or) ¬(not) ⇒ (implication) ⇔ (equivalence)

Parenthesis (for grouping)


()

Logical constants
True, False
Propositional Logic
Each symbol P, Q, R etc is a (atomic) sentence
Both True and False are (atomic) sentences
A sentence enclosed in parentheses is a sentence

If α and β are sentences, then so are


α∧β conjunction
α∨β disjunction
¬α negation
α⇒β implication
α⇔β equivalence

The above are complex sentences


Precedence is ¬ , ∧ , ∨ , ⇒ , ⇔
BNF Grammar Propositional Logic
Sentence → AtomicSentence | ComplexSentence

AtomicSentence → True | False | P | Q | R | ...

ComplexSentence → (Sentence )

| Sentence Connective Sentence

| ¬ Sentence

Connective → ∧|∨|⇒|⇔

ambiguities are resolved through precedence ¬ ∧ ∨ ⇒ ⇔ or parentheses


e.g. ¬ P ∨ Q ∧ R ⇒ S is equivalent to (¬ P) ∨ (Q ∧ R)) ⇒ S
Truth Tables for Connectives

P Q ¬P P∧Q P∨Q P⇒Q P⇔Q


False False True False False True True
False True True False True True False
True False False False True False False
True True False True True True True
Sample Sentences

P (P ∧ ¬ Q) ⇒ R
True (P ∧ Q) ⇔ (Q ∧ P)
(P ∧ Q) (P ∨ R )

What do the sentences mean?

The meaning depends on user defined semantics. If P is defined as


“it is hot” and Q is defined as “it is raining”, then

P means it is hot
P∨Q means either is hot or it is raining (or both)
¬Q means that it is not raining
Well- Formed Formulas
• Formula
A term (string) in propositional logic.

• Well formed formula (WFF)


A term that is constructed correctly according to
propositional logic syntax rules.
WFF
• Constants: False, True

• Variables: P,Q,R
• If a and b are WFF, a ∧ b are WFF
• If a and b are WFF, a ∨ b are WFF
• If a and b are WFF, a →b are WFF
• If a and b are WFF, a ↔b are WFF

Any formula that cannot be constructed using these rules


are not WFF.
Semantics
• interpretation of the propositional symbols and constants
– symbols can stand for any arbitrary fact
 sentences consisting of only a propositional symbols are satisfiable, but not
valid
 the value of the symbol can be True or False
 must be explicitly stated in the model
– the constants True and False have a fixed interpretation
 True indicates that the world is as stated
 False indicates that the world is not as stated
• specification of the logical connectives
– frequently explicitly via truth tables
Semantics
• Interpretation
• Evaluation function of a formula
• Properties of wffs
– Valid / tautology
– Satisfiable
– Contradiction
– Equivalent formulas
Semantics
• A formula F is a logical consequence of a formula P
• A formula F is a logical consequence of a set of
formulas P1,…Pn
• Notation of logical consequence P1,…Pn ⇒F.
• Theorem. Formula F is a logical consequence of
a set of formulas P1,…Pn if the formula P1,…Pn →F is
valid.
• Theorem. Formula F is a logical consequence of a set
of formulas P1,…Pn if the formula P1∧… ∧ Pn ∧ ~F is a
contradiction.
Some terms: summary
• The meaning or semantics of a sentence determines
its interpretation.

• Given the truth values of all symbols in a sentence, it


can be “evaluated” to determine its truth value
(True or False).

• A model for a KB is a “possible world” (assignment


of truth values to propositional symbols) in which
each sentence in the KB is True.
More terms
• A valid sentence or tautology is a sentence that is True
under all interpretations, no matter what the world is actually
like or how the semantics are defined. Example: “It’s raining or
it’s not raining.”
• An inconsistent sentence or contradiction is a sentence
that is False under all interpretations. The world is never like
what it describes, as in “It’s raining and it’s not raining.”
• P entails Q, written P |= Q, means that whenever P is True,
so is Q. In other words, all models of P are also models of Q.

39
Models
• if there is an interpretation for a sentence such that
the sentence is true in a particular world, that world is
called a model
– refers to specific interpretations

• models can also be thought of as mathematical objects


– these mathematical models can be viewed as equivalence
classes for worlds that have the truth values indicated by
the mapping under that interpretation
– a model then is a mapping from proposition symbols to
True or False
Propositional Logic: Semantics
• A model M of a propositional language consists of
 a collection of atoms, say B = { bi : 0 < i }, where _|_ is
excluded from B, and
 a partial mapping M from
A = { ai : 0 < i } to B = { bi : 0 < i }.
 If M(ai) ε B, we say that ai is true in M.
 We write “ai is true in M” as M |= ai. (Read M satisfies ai).
 |= is referred to as the satisfaction relation.
Propositional Semantics
• Extend M, and therefore the satisfaction relation to
all propositions using the following inductive
definition:
– M |= X ^ Y iff M |= X and M |= Y.
– M |= X v Y iff M |= X or M |= Y.
– M |= X => Y if M |= X then M |= Y.
– M |= ¬ X, if it is not the case that M |= X.
Propositional Logic: Example
• B = { a1, a3} where M given as
M(a1) = a1 and M(a2) = a2 has the following properties.
M |= a1
M |= a1 ∧ a3
M |= ¬ a2
M |= a2 ⇒ a4

• M does not satisfy the following propositions.


M |= a4
M |= a1 ⇒ a4
Models and Entailment
• a sentence α is entailed by a knowledge base KB if the models of
the knowledge base KB are also models of the sentence α

KB |= α
• inference rules allow the construction of new sentences from
existing sentences

• an inference procedure generates new sentences on the basis of


inference rules
• if all the new sentences are entailed, the inference procedure is
called sound or truth-preserving
Tautology and Contradiction

• Tautology: proposition that is always true


Male V ~Male

• Contradiction: proposition that is always false.


Healthy Λ ~Healthy
An inference procedure for proposition logic

Suppose we want to prove ¬(P ∧ Q) ⇒ (P ∨ ¬Q)

Construct a truth table, if ¬(P ∧ Q) ⇒ (P ∨ ¬Q) is true for all


values of P and Q, then we have proved it.

For any sentence, no matter how complex, we can always


prove or disprove it this way. In other words, truth table
construction is complete.
Equivalence rules

Idempotent P∨P ≡ P P∧P ≡ P


Asociative (P ∨ Q) ∨ R ≡ P ∨ (Q ∨ R) (P ∧ Q) ∧ R ≡ P ∧ (Q ∧ R)
Comutative P∨Q ≡Q∨P P∧Q ≡Q∧P P↔Q≡Q↔P
Distributive P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ R) P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R)
De Morgan ~ (P ∨ Q) ≡ ~ P∧ ~ Q ~ (P ∧ Q) ≡ ~ P∨ ~ Q
Eliminate Implication P → Q ≡~ P ∨ Q
Eliminate double implication P ↔ Q ≡ (P → Q) ∧ (Q → P)
Inference Rules
Some patterns of reasoning are so common that instead of creating a truth table
each time we see them, we can just establish their truth once, then reuse the
pattern in any situation.
Irish ⇒ Hot, Irish |- Hot
If we know Irish implies hot is true, and know
Irish is true, we can infer Hot is true. Read as
Irish implies Hot, Irish, Therefore Hot

Irish ∧ Blue |- Blue


If we know Irish and Blue is true, we can infer
that Blue is true. Read as
Irish and Blue Therefore Blue

Irish, Red |- Irish ∧ Red


If we know Irish is true, and we know Red is true,
we can infer that Irish and Red is true. Read as
Irish , Red Therefore Irish and Red
Irish |- Irish ∨ Green
If we know Irish is true, then we know that Irish
or Green is true. Read as
Irish, Therefore Irish or Green

¬¬Irish
¬¬ |- Irish
If we know not not Irish is true, we can infer that
Irish is true. Read as
Not not Irish, Therefore Irish

Irish ∨ Red, ¬ Red ∨ Fast |- Irish ∨ Fast


If we know Irish or Red is true, and we know not Red or Fast is true, we
can infer that Irish or Fast must be true. Read as
Irish or Red, not Red or Fast, Therefore Irish or Fast
Suppose the knowledge base consists of the facts
S ∧ T ⇒ ¬(¬P ∧ R)
¬¬S
T
R
And we need to prove P is entailed. We can use the rules of
inference to do this..

S ∧ T ⇒ ¬(¬P ∧ R) , ¬¬S , T And-Introduction


S ∧ T ⇒ ¬(¬P ∧ R) , ¬¬ S ∧ T Double Negation Elimination
S ∧ T ⇒ ¬(¬P ∧ R) , (S ∧ T) Modus ponens
¬(¬P ∧ R) And-Elimination
¬¬P Double Negation Elimination
P

So the rules of inference allow us to (sometimes) bypass having to


build truth tables.
Logical Inference
• also referred to as deduction
– implements the entailment relation for sentences
• validity
– a sentence is valid if it is true under all possible interpretations in all possible
world states
• independent of its intended or assigned meaning
• independent of the state of affairs in the world under consideration
• valid sentences are also called tautologies

• satisfiability
– a sentence is satisfiable if there is some interpretation in some world state (a
model) such that the sentence is true
• a sentence is satisfiable iff its negation is not valid
• a sentence is valid iff its negation is not satisfiable
Computational Inference
• computers cannot reason informally (“common sense”)
– they don’t know the interpretation of the sentences
– they usually don’t have access to the state of the real world to
check the correspondence between sentences and facts
• computers can be used to check the validity of sentences
– “if the sentences in a knowledge base are true, then the
sentence under consideration must be true, regardless of its
possible interpretations”
– can be applied to rather complex sentences
Computational Approaches
to Inference
• model checking based on truth tables
– generate all possible models and check them for validity or satisfiability
– exponential complexity, NP-complete
• all combinations of truth values need to be considered

• search
– use inference rules as successor functions for a search algorithm
– also exponential, but only worst-case
• in practice, many problems have shorter proofs
• only relevant propositions need to be considered
Validity and Inference
• truth tables can be used to test sentences for
validity
– one row for each possible combination of truth
values for the symbols in the sentence
– the final value must be True for every sentence
– a variation of the model checking approach
– not very practical for large sentences
sometimes used with customized improvements in
specific domains, such as VLSI design
Validity and Computers
• the computer has no access to the real world, and can’t
check the truth value of individual sentences (facts)
– humans often can do that, which greatly decreases the
complexity of reasoning
– humans also have experience in considering only important
aspects, neglecting others
• if a conclusion can be drawn from premises, independent of
their truth values, then the sentence is valid
– usually too tedious for humans
– may exclude potentially interesting sentences
• some, but not all interpretations are true
Propositional Logic: Proofs

• What formulas hold in all models ?


• i.e. can we check if a given proposition is true
in all models without going through all
possible models?

• Need proofs to answer this question.

• We use Natural Deduction proofs.


Propositional Proofs: Examples
• Prove: ( A ∧ B ) ⇒ (A ∨ B)
• Notice:
– The outermost connective is ⇒. Hence, the last step of
the proof must be an implication introduction.
– That means, we must assume ( A ∧ B ) and prove
(A ∨ B), and then discharge the assumption by using ⇒
introduction rule.
– In order to prove (A ∨ B) from ( A ∧ B ), we must use
∨ –introduction, and hence must prove either A or B
from ( A ∧ B ).
– This plan forms a skeleton of a proof.
Prop. Proof: Example Continued
• Prove: ( A ∧ B ) ⇒ (A ∨ B)
(A ^ B)
A ^ elimination
AvB v introduction
( A ^ B ) => (A v B) => introduction

• Proofs are analyzed backwards, i.e. start unraveling the


logical structure of the conclusion and work backwards to
the assumptions.
Derived Rules
• These are rules derived from other rules.
• Example:
A^B
B ^A
• Here is the derivation:
A ^ B B ^A
B A ^ elimination
B^ A ^ introduction
Inference rules
• Logical inference is used to create new sentences that
logically follow from a given set of predicate calculus
sentences (KB).
• An inference rule is sound if every sentence X produced
by an inference rule operating on a KB logically follows
from the KB. (That is, the inference rule does not create
any contradictions)
• An inference rule is complete if it is able to produce
every expression that logically follows from (is entailed by)
the KB. (Note the analogy to complete search algorithms.)

61
Sound rules of inference
• Here are some examples of sound rules of inference
– A rule is sound if its conclusion is true whenever the premise is true
• Each can be shown to be sound using a truth table
RULE PREMISE CONCLUSION

Modus Ponens A, A → B B
And Introduction A, B A∧B
And Elimination A∧B A
Double Negation ¬¬A A
Unit Resolution A ∨ B, ¬B A
Resolution A ∨ B, ¬B ∨ C A∨C
62
Soundness of modus ponens

A B A→ B OK?
True True True

True False False

False True True

False False True

63
Soundness of the
resolution inference rule

64
Proving things
• A proof is a sequence of sentences, where each sentence is
either a premise or a sentence derived from earlier sentences
in the proof by one of the rules of inference.
• The last sentence is the theorem (also called goal or query)
that we want to prove.
• Example for the “weather problem” given above.
1 Humid Premise “It is humid”

2 Humid→Hot Premise “If it is humid, it is hot”

3 Hot Modus Ponens(1,2) “It is hot”

4 (Hot∧Humid)→Rain Premise “If it’s hot & humid, it’s raining”

5 Hot∧Humid And Introduction(1,2) “It is hot and humid”

6 Rain Modus Ponens(4,5) “It is raining”


Horn sentences
• A Horn sentence or Horn clause has the form:
P1 ∧ P2 ∧ P3 ... ∧ Pn → Q
or alternatively
(P → Q) = (¬P ∨ Q)
¬P1 ∨ ¬ P2 ∨ ¬ P3 ... ∨ ¬ Pn ∨ Q
where Ps and Q are non-negated atoms
• To get a proof for Horn sentences, apply Modus
Ponens repeatedly until nothing can be done
Entailment and derivation
• Entailment: KB |= Q
– Q is entailed by KB (a set of premises or assumptions)
if and only if there is no logically possible world in
which Q is false while all the premises in KB are true.
– Or, stated positively, Q is entailed by KB if and only if
the conclusion is true in every logically possible world
in which all the premises in KB are true.
• Derivation: KB |- Q
– We can derive Q from KB if there is a proof
consisting of a sequence of valid inference steps
starting from the premises in KB and resulting in Q

67
Two important properties for inference

Soundness: If KB |- Q then KB |= Q
– If Q is derived from a set of sentences KB using a
given set of rules of inference, then Q is entailed by
KB.
– Hence, inference produces only real entailments, or
any sentence that follows deductively from the
premises is valid.
Completeness: If KB |= Q then KB |- Q
– If Q is entailed by a set of sentences KB, then Q can
be derived from KB using the rules of inference.
– Hence, inference produces all entailments, or all valid
sentences can be proved from the premises.

68
Soundness and Completeness
• A rule A1 …… An is said to be sound if for every B

model in which all of A1 …… An are true, then so is B. i.e. if


M |= A1 , …… , M |= An, then M |= B.
• A collection of rules are sound if all rules in the collection is
sound.
• A collection of rules is complete if M |= A for all models M,
then A is provable. I.e. there is a proof of A using the given set of
rules. (Denoted |R-- A ) where R is the set of rules.
Complexity
• the truth-table method to inference is complete
– enumerate the 2n rows of a table involving n symbols
– computation time is exponential
• satisfiability for a set of sentences is NP-complete
– so most likely there is no polynomial-time algorithm
– in many practical cases, proofs can be found with moderate
effort
• there is a class of sentences with polynomial inference
procedures (Horn sentences or Horn clauses)
P1 ∧ P2 ∧ ... ∧ Pn ⇒ Q
We can represent facts in Propositional Logic, and we have a
sound and complete procedure for inference.
But Propositional Logic has some weaknesses...

• The size of the truth tables grows exponentially. So we may


run out of space and time before we can answer a question.

Suppose we want to encode the fact that all men are mammals,
we have no choice but to list that fact for each individual man in
the knowledge base
P means Paul is a mammal
Q means Quentin is a mammal
R means Robert is a mammal
S means Steve is a mammal
etc etc
What we really need is a compact way represent these kinds of
facts….
Validity != Provability
• Goldbach’s conjecture: Every even number (>2) is
the sum of 2 primes.
• This is either valid or not.
• It may not be provable.
• Godel: No axiomization of arithmetic will be
complete, i.e. always valid statements that are not
provable.
Limitation of Propositional logic
• Theorem proving is decidable
• The propositional calculus has its limitations
• cannot deal properly with general statements of the
form:-
All men are mortal.
• You cannot derive from the conjunction of this and “
Devindra is a man” that..
Devindra is mortal.
• Cannot represent objects and quantification
Limitations
• If all men are mortal =P
• Devindra is a man = Q
• Devindra is mortal =R
Then (P & Q) → R is not valid
To do this, you need to analyze propositions into
predicates and arguments and delay explicitly with
quantification.
Limitations of Propositional Logic
• number of propositions
– since everything has to be spelled out explicitly, the number of rules is
immense
• dealing with change (monotonicity)
– even in very simple worlds, there is change
– the agent’s position changes
– time-dependent propositions and rules can be used
• even more propositions and rules
• propositional logic has only one representational device, the
proposition
– difficult to represent objects and relations, properties, functions,
variables, ...
Implies =>
• If 2+2 = 5 then monkeys are cows. TRUE
• If 2+2 = 5 then cows are animals. TRUE
• Indicates a difference with natural reasoning. Single
incorrect or false belief will destroy reasoning. No
weight of evidence.
Inference
• Does s1,..sk entail s?
• Say variables (symbols) v1…vn.
• Check all 2^n possible worlds.
• In each world, check if s1..sk is true, that s is true.
• Approximately O(2^n).
• Complete: possible worlds finite for propositional
logic, unlike for arithmetic.
What can’t we say?
• Quantification: every student has a father.
• Relations: If X is married to Y, then Y is married to
X.
• Probability:There is an 80% chance of rain.
• Combine Evidence: This car is better than that
one because…
• Uncertainty: Maybe John is playing golf.
Propositional logic is a weak language
• Hard to identify “individuals” (e.g., Mary, 3)
• Can’t directly talk about properties of individuals or
relations between individuals (e.g., “Bill is tall”)
• Generalizations, patterns, regularities can’t easily be
represented (e.g., “all triangles have 3 sides”)
• First-Order Logic (abbreviated FOL or FOPC) is
expressive enough to concisely represent this kind of
information
FOL adds relations, variables, and quantifiers, e.g.,
•“Every elephant is gray”: ∀ x (elephant(x) → gray(x))
•“There is a white alligator”: ∃ x (alligator(X) ^ white(X))
79
Example
• Consider the problem of representing the
following information:
– Every person is mortal.
– Confucius is a person.
– Confucius is mortal.
• How can these sentences be represented so
that we can infer the third sentence from the
first two?

80
Example II
• In PL we have to create propositional symbols to stand for all or part
of each sentence. For example, we might have:
P = “person”; Q = “mortal”; R = “Confucius”
• so the above 3 sentences are represented as:
P → Q; R → P; R → Q
• Although the third sentence is entailed by the first two, we needed an
explicit symbol, R, to represent an individual, Confucius, who is a
member of the classes “person” and “mortal”
• To represent other individuals we must introduce separate symbols
for each one, with some way to represent the fact that all individuals
who are “people” are also “mortal”

81
Some Applications of
Propositional Logic
SUDOKU
1 2 3 4 5 6 7 8 9
1
2
3
4
5
6
7
8
9
Mathematical models
Dutch Soccer League
• if Eindhoven and Amsterdam play on the same day the TV income is
x
• If Eindhoven and Amsterdam play on two different days, the income
is 2x
• if a team plays on Wednesday champions league it doesn’t play on
Friday
• there are at most 3 plays on Friday
• ….. in sum several thousand constraints over LP and Boolean
variables

• League is modelled by the Barcelogic tool


Transition Systems
Example an Editor that can
highlight the semantic error
Summary
• The process of deriving new sentences from old one is called inference.
– Sound inference processes derives true conclusions given true premises
– Complete inference processes derive all true conclusions from a set of
premises
• A valid sentence is true in all worlds under all interpretations
• If an implication sentence can be shown to be valid, then—given its
premise—its consequent can be derived
• Different logics make different commitments about what the world is
made of and what kind of beliefs we can have regarding the facts
– Logics are useful for the commitments they do not make because lack of
commitment gives the knowledge base engineer more freedom
• Propositional logic commits only to the existence of facts that may or
may not be the case in the world being represented
– It has a simple syntax and simple semantics. It suffices to illustrate the process
of inference
– Propositional logic quickly becomes impractical, even for very small worlds

88

Вам также может понравиться