Aditya Engineering College (A)
LOGIC CONCEPTS
Logic helps in investigating and classifying the structure of statements and
arguments through the system of formal study of inference.
Logicisastudyofprinciplesusedto
–distinguishcorrectfromincorrectreasoning.
–Logical system should possesses properties such as consistency, soundness, and
completeness.
–Consistency implies that none of the theorems of the system should contradict each other.
–Soundness means that the inference rules shall never allow a false inference from true
premises.
Formally itdealswith
–thenotionoftruthinanabstractsenseandisconcerned withtheprinciplesofvalid
inferencing.
Propositional Calculus
Aditya Engineering College (A)
Propositional Calculus is a language of propositions basically
refers
–tosetofrulesusedtocombinethepropositionstoformcompound
propositionsusinglogicaloperatorsoftencalledconnectivessuchas
ordot,V,~,or(),
1.Well-FormedFormula
Well-formed formulaisdefinedas:
–Anatomisawell-formedformula.
–Ifisawell-formed formula,then~isawell-formed
formula.
–Ifandarewellformedformulae,then(),(V), (),
()arealsowell-formedformulae.
–Apropositional expressionis awell-formedformula
ifand onlyifitcanbeobtainedby usingaboveconditions.
Propositional Calculus
Aditya Engineering College (A)
Well-FormedFormulaExamples
R1-Anatomisawell-formedformula.
R2-IfisaWFF, then ~is a
well-formedformula.
R3-Ifandarewellformedformulae,then(),
(V), (),()arealsowell-formed
formulae.
Aditya Engineering College (A)
Propositional Calculus…
2.TruthTable
Truth table gives us operational definitions of
important logical operators.
–Byusingtruthtable,thetruthvaluesofwell-formed
formulaearecalculated.
●Truthtableelaboratesallpossibletruthvaluesofa
formula.
●Themeaningsofthelogicaloperatorsaregivenby
thefollowingtruthtable.
PQ ~PPQPVQPQ PQ
TT F T T T T
TF F F T F F
FT T F T T F
FF T F F T T
Q) Compute the TT: (AVB)∧(~B->A)
Negation ~
Conjunction^ or dot
Disjunction V
If-then(Implication) ->
iff(Biconditional) <->
Aditya Engineering College (A)
Propositional Logic
•Knowledge Representation can be done with
1)Propositional Logic 2)First Order Logic
•Propositional logic (PL) is the simplest form of logic where all the
statements are made by propositions.
•A proposition is a declarative statement which is either true or false.
It is a technique of knowledge representation in logical and
mathematical form.
•Propositional logic is also called Boolean logic as it works on 0 and
1.
•Machine In AI can be given input in terms of knowledge but machine cannot understand this
knowledge which is framed using English sentences.
•So this knowledge must be represented inaway understandable to machine , this is called
knowledge representation.
Aditya Engineering College (A)
Propositional Logic
•In propositional logic, we use symbolic variables to represent the logic, and we can
use any symbol for a representing a proposition, such A, B, C, P, Q, R, etc.
•Propositions can be either true or false, but it cannot be both.
•Propositional logic consists of an object, relations or function, and logical
connectives.
•These connectives are also called logical operators.
•The propositions and connectives are the basic elements of the propositional logic.
•Connectives can be said as a logical operator which connects two sentences.
•A proposition formula which is always true is called tautology, and it is also called a
valid sentence.
•ApropositionformulawhichisalwaysfalseiscalledContradiction.
•Apropositionformulawhichhasbothtrueandfalsevaluesiscalled.
•Statementswhicharequestions,commands,oropinionsarenotpropositions
suchas"Whereis","Howareyou","Whatisyourname",arenotpropositions.
Aditya Engineering College (A)
Propositional Logic
Syntax of propositional logic:
•The syntax of propositional logic defines the allowable sentences for the knowledge
representation. There are two types of Propositions:
Atomic Propositions:
Atomic Proposition: Atomic propositions are the simple propositions. It consists of a
single proposition symbol. These are the sentences which must be either true or false.
a)2+2is4,itisanatomicpropositionasitisatruefact.
b)"TheSuniscold"isalsoapropositionasitisafalsefact.
Compound propositions
•Compoundpropositionsareconstructedbycombiningsimpleroratomic
propositions,usingparenthesisandlogicalconnectives.
Example:
a)"Itisrainingtoday,andstreetiswet."
b)“Rajisadoctor,andhisclinicisinMumbai."
Aditya Engineering College (A)
Propositional Logic
LogicalConnectives
Negation ~
Conjunction^
Disjunction V
If-then(Implication) ->
iff(Biconditional) <->
Logical connectives are used to connect two simpler propositions or representing a sentence
logically. We can create compound propositions with the help of logical connectives.
Example:
X: It is cold
Y: It is sunny
Z:It is breezy
1.It is not cold ~X
2.It is cold and it is breezy X^Z
3.It is cold or it is breezy XvZ
4.If it is breezy then it is cold Z->X
5.If it is breezy and cold then it is not sunny Z^X -> ~Y
6.It will be cold iffit is breezy X <-> Z
Aditya Engineering College (A)
Propositional Logic
Examples:
Raj did not read book
~ read(Raj,book)
Raj watches Amazon or Netflix
Watches(Raj,Amazon) v Watches(Raj,Netflix)
If Raj buys mobile then color is black
Buys(Raj,Mobile) -> Color( Mobile,black)
Raj becomes happy if and only if Raj eats dairy milk.
becomes(Raj,happy) <-> eats( Raj,Dairymilk)
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Semantic Tableaux System…
Consistencyand Inconsistency: Satisfiability and Unsatisfiability
IfanatomPand~Pappearonasame pathofa
semantictableau,
–theninconsistencyisindicatedandsuchpathissaidto
becontradictoryorclosed(finished)path.
–Evenifonepathremainsnoncontradictoryor
unclosed(open),thentheformulaattherootofa
tableauisconsistent.
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Semantic Tableaux System…
Avaluationissaidtobeamodelof(or
satisfies)iff()=T.
Intableauxapproach,modelforaconsistent formulais
constructedasfollows:
–Onanopenpath,assigntruthvaluestoatoms (positiveor
negative)ofwhichisattherootofa tableausuchthatismade
tobetrue.
–ItisachievedbyassigningtruthvalueTtoeach atomicformula
(positiveornegative)onthat path.
Valuation
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Semantic Tableaux System…
Contradictorytableau(orfinishedtableau)isdefinedto
beatableauinwhichallthepathsarecontradictoryor
closed(finished).
ConsistentandInconsistent
Ifatableauforaformulaattherootisacontradictory
tableau,thenaformulaissaidtobeinconsistent.
Aformulaisconsistentifthereisatleastonopenpath
inatableauwithroot
ContradictoryTableau
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Semantic Tableaux System…
Example:Showthat
:(PQR)(~PS)Q~R~Sis
inconsistent(Unsatisfiable)usingtableauxmethod.
R)(~PS)Q~R~S{T-root}(PQ
{Applyrule1to1}
(1)
(2)
(3)
PQR
~PS
Q
~R
~S
S{Applyrule6to3} P
{Applyrule6to2)}~(PQ)
Closed:{S,~S}onthepath
R
Closed{R,~R}
~P ~Q
{P,~P}Closed Closed{~Q,Q}
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Semantic Tableaux System…
Problem:Showthat:(Q~R)(RP) is
consistent( satisfiable)andfinditsmodel.
Solution:
{T-root} (Q~R)(RP)
{Applyrule1to1}
(1)
(2)
(3)
(Q~R)
(RP)
{Applyrule1to2}Q
{Applyrule6to3}~R
~R P
open open
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
Resolutionrefutationisanothersimplemethod toprovea formulaby
contradiction.
–Herenegationofgoaltobeprovedisaddedtogivenset ofclauses.
–Itisshownthenthatthereisarefutationinnewsetusing resolutionprinciple.
Resolution:Duringthisprocessweneedto identify
–twoclauses,onewithpositiveatom(P)andotherwith negativeatom(~P)forthe
applicationofresolutionrule.
Resolutionisbasedonmodusponeninferencerule.
–Thismethodismostfavouredfordeveloping computerbasedtheorem
provers.
–Automatictheoremproversusingresolutionare simpleandefficientsystems.
Resolutionisperformedonspecialtypesof formulaecalledclauses.
–Clauseispropositionalformulaexpressedusing
•{V,~}operators.
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
Conjunctive and Disjunctive NormalForms
InDisjunctiveNormalForm(DNF),
–a formulaisrepresented intheform
–(L
11…..L
1n)V..…V(L
m1….. L
mk ), whereallL
ijare
literals.Itisadisjunctionofconjunction.
InConjunctive NormalForm(CNF),
–a formulaisrepresented intheform
–(L
11V…..VL
1n)……(L
p1V…..VL
pm),
L
ij
whereall areliterals.Itisa
conjunctionofdisjunction.
Aclauseisaspecialformulaexpressedasdisjunctionofliterals.If
aclausecontainsonlyoneliteral,thenitiscalledunitclause.
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
ConversionofaFormulato itsCNF
EachformulainPropositionalLogiccanbeeasily
transformedintoitsequivalentDNForCNFrepresentation
usingequivalencelaws.
–Eliminateandbyusingthefollowing
equivalencelaws.
PQ
PQ
~PVQ
(PQ)(QP)
–Eliminatedoublenegationsignsbyusing
~~P P
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
Cont…
UseDeMorgan’slawstopush~(negation)
immediatelybeforeatomic formula.
~(PQ)
~(PVQ)
~PV~Q
~P~Q
Usedistributivelaw togetCNF.
PV(QR) (PVQ)(PVR)
WenoticethatCNFrepresentationofaformulais
oftheform
–(C
1…..C
n),whereeachC
k,(1kn)is
aclausethatisdisjunctionofliterals.
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
ResolutionofClauses
ProfSarojKaushik,CSE,
IITD
IftwoclausesC
1andC
2containacomplementarypair
ofliterals{L,~L},then
–theseclausescanberesolvedtogetherbydeletingLfromC
1
and~LfromC
2andconstructinganewclausebythe
disjunctionoftheremainingliteralsinC
1andC
2.
Thenewclausethusgeneratediscalled
resolventofC
1andC
2.
–HereC
1andC
2arecalledparentsofresolvedclause.
–Iftheresolventcontainsoneormoresetof
iscomplementarypairofliterals,thenresolvent
alwaystrue.
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
ResolutionTree
Invertedbinarytreeisgeneratedwiththelastnodeof
thebinarytreetobearesolvent.
Thisalsocalledresolutiontree.
Example:Findresolventof:
C
1=PVQVR
C
2=~QV~W
C
3=~PV~W
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
Example-ResolutionTree
PVQVR ~QV~W
{Q,~Q}
PVRV~W
{P,~P}
~PV~W
R V~W
ThusResolvent(C
1,C
2,C
3)=RV~W
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
Example:“Marywillgetherdegreeifsheregistersasa
studentandpassherexam.Shehasregisteredherselfasa
student.Shehaspassedherexam”.Showthatshewillgeta
degree.
Solution:Symbolizeabovestatementsasfollows:R:Mary
isaregisteredstudent
P:MaryhaspassedherexamD:Mary
getsherdegree
Theformulaecorrespondingtoabovelistedsentencesareas
follows:
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
Marywillgetherdegreeifsheregistersasa
studentandpassherexam.
RPD(~RV~PVD)
Shehasregisteredherselfasastudent.
R
Shehaspassed herexam.
P
Conclude“Mary willgetadegree”.
D
Cont…
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
Setofclausesare:
–S={~RV~PVD,R,P}
Addnegationof"Marygetsherdegree(= D)"toS.
NewsetS'is:
–S'={~RV~PVD,R,P,~D}
Wecaneasilyseethatemptyclauseis deduced
fromaboveset.
Hencewecanconcludethat“Marygetsher degree”
Example–Cont…
Aditya Engineering College (A)
Artificial Intelligence Dr P Udayakumar
Resolution Refutation in PL
DerivingContradiction
~RV~PVD R
~PVD P
D ~D