Sie sind auf Seite 1von 48

Artificial Intelligence

Knowledge Representation Schemes Symbolic Logic

K Raghunathan
Chartered Engineer FIETE, MIE, MCSI, MISTE, MISTD, MIIMM Retd. Dy. Controller (R&D) [MoD]

Propositional Logic

What is Propositional Logic


a simplified logical language basic unit is a simple statement
Called a proposition considered as an indivisible unit represented by a single uppercase alphabet with or without a numerical subscript

complex statements are made by joining simple statements by means of truthfunctional connectors

Proposition Examples
A A2 P P1 Each of the above represents a simple english statement, like
Birds have wings Amitabh is tall

Connectors
Aka connectives or operators Negation or ~ (logical NOT) Conjunction or & (logical AND) Disjunction V (logical OR) Implication (conditional operator)
Unidirectional Bidirectional

if .then if and only if then

Complex Statement Examples


~A A&B PVQ

PQ
PQ (A V B) & (P V Q)

wff
Well-formed formula Pronounced woof properly constructed & grammatically correct statement May be simple or complex statement

wff Examples
Valid wffs A&B (Q v R) Invalid wffs A&BVC )Qv(&CP&

Some Definitions
Tautology
a wff that is true for all possible truth-value assignments to the statements in that wff

Contradiction
a wff that is false for all possible truth-value assignments to the statements in that wff

two wffs are consistent if it is true for at least one possible truth-value assignment to the statements in the 2 wffs two wffs are inconsistent if there is no truth-value assignment to the statements in the 2 wffs

Rules of Replacement (Rules of Equivalence)


Double negation

~~A A
A&BB&A AVB BVA

Commutativity

Associativity
(A & B) & C A & (B & C) (A V B) V C A V (B V C)

Tautology
AA&A AAVA

DeMorgans Laws
~(A & B) ~A V ~B ~(A V B) ~A & ~B

Transposition (aka contraposition)


P Q ~Q ~P P Q ~P V Q

Material Implication

Exportation
(P & Q) R P (Q R)

Distribution
P & (Q V R) P V (Q & R) (P & Q) V (P & R) (P V Q) & (P V R)

Material Equivalence
aka biconditional introduction/elimination
P Q (P Q) & (Q P) P Q (P & Q) V (P~ & Q~)

Inference Rules

Modus Ponens
aka Modus Ponendo Ponens
PQ P --------Q

Modus Tollens
Aka Modus Tollendo Tollens PQ ~Q ----------~P

Hypothetical Syllogism
aka Chain Rule P Q Q R -------------P R

Disjunctive Syllogism
aka modus tollendo ponens P V Q ~P -----------Q P V Q ~Q ------------P

Constructive Dilemma
(P Q) & (R S) PVR -----------------------------QVS

Destructive Dilemma
(P Q) & (R S) ~Q V ~S -----------------------------~P V ~R

Addition
P -------------PVQ

Conjunction
aka Logical Multiplication

P Q ----------P&Q

Simplification
P & Q --------------P P&Q -----------Q

Substitution
If s is a valid wff, we may be able to write another wff s having same structure as s but made up of different propositions For example: P V ~P is valid & true so, we can say Q V ~Q is also valid & true Should be careful in constructing the substitutions, else the substitution may not be valid or appropriate; so, many books omit this rule

Predicate Logic

What is Predicate Logic


Improvement over Propositional Logic Can represent more real-life situations than Propositional Logic Allows more than one letter to represent a statement Allows both uppercase & lowercase letters Allows use of arguments for the predicates Allows use of variables & functions Allows use of Quantifiers

A simple statement is called a Predicate Complex statements are made by combining predicates with connectors Predicate consists of 2 parts
Functor (predicate name or predicate symbol) One or more Arguments (placed in parentheses)

Arguments can be
Constants/Objects - words (strings), numbers & lowercase letters near the beginning of the alphabet (a,b,c etc) Variables - words (strings), lowercase letters near the end of the alphabet (w,x,y,z etc) Functions words (strings), lowercase letters in the middle of the alphabet (f,g,h etc)

Predicate Examples
man(john) haswings(bird) Father(Raghu, Ravi, Renuka) Vx bird(x) canfly(x) If there is only one argument, the functor denotes an attribute of the argument If 2 or more arguments, the functor denotes the relation of first argument with the remaining arguments

all rules of propositional logic are applicable in predicate logic also when values are assigned to each term in the wff, each possible combination of such assignment is an interpretation of the wff (like instance of a class in OOP) Each interpretation may independently evaluate to TRUE or FALSE

A wff is satisfiable, if it is true for at least one interpretation A wff is valid, if it is true for all possible interpretations A wff is a contradiction, if is false for all possible interpretations

Complex Form
If a wff contains quantifiers & implications, it is said to be a complex wff Example: x bird(x) canfly(x)

Normal Form
A wff that does not contain implications is said to be in normal form (it may contain quantifiers) Normalisation means removal of all implications If implications are removed (without affecting the semantics of the wff) it comes to normal form To normalise a wff, expressions containing implications must be replaced with equivalent expressions which do not contain implications For this, use the rules of replacement (rules of equivalence)

Examples of normal form x bird(x) & canfly(x) (P V Q) & (R V (S & T))


If all quantifiers occur at the front of the wff (at the start/beginning) it is said to be in prenex normal form

CNF & DNF Form


If a wff does not contain any quantifiers or implications and all its component expressions contain only disjunctions (or conjunctions) and the component expressions are connected only by conjunctions (or disjunctions), it is said to be in CNF (or DNF)

CNF: (P V Q) & (A V B V C) & (S V T) DNF: (P & Q) V (A & B) V (C & D & E) CNF = conjunctive normal form = product of sums form DNF = disjunctive normal form = sum of products form

Clausal Form
A wff consisting of predicates connected only by disjunctions is said to be in clausal form In such case, the wff itself is called a clause

Example: A V B V C

Converting a Complex wff to Clausal Form

Unification

Resolution

Das könnte Ihnen auch gefallen