/
Forward Chaining (propositional) Forward Chaining (propositional)

Forward Chaining (propositional) - PowerPoint Presentation

WheresMyPizza
WheresMyPizza . @WheresMyPizza
Follow
342 views
Uploaded On 2022-08-04

Forward Chaining (propositional) - PPT Presentation

Recursive stackbased version of Backchaining using Propositional Logic could be modified to handle variables using unification negation context fail if subgoal is repeated BackchainKBquery ID: 934961

goal stack cangettowork candrivetowork stack goal candrivetowork cangettowork return havemoney sunny rule havebike fact true rentcar query canbiketowork pop

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Forward Chaining (propositional)" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Slide2

Slide3

Forward Chaining (propositional)

Slide4

Recursive stack-based version of Back-chaining using Propositional Logic

could be modified to handle...

variables (using unification)

negation

context (fail if sub-goal is repeated)

Backchain(KB,query)

stack

{query} // initialize

return BC(KB,stack)

 

BC(KB,stack)

if stack empty, return True

goal

stack.pop()

if goal

KB, return BC(KB,stack) // a known fact

for each rule a

1

..a

n

goal in KB:

stack.push(a

1

..a

n

)

result

BC(KB,stack)

if result=True, return True

remove

a

1

..a

n

from stack

return False

Slide5

KB =

{CanBikeToWork

CanGetToWork

CanDriveToWork

CanGetToWork

CanWalkToWork

CanGetToWork

HaveBike

Sunny

CanBikeToWork

OwnCar

CanDriveToWork

HaveMoney

RentCar

CanDriveToWork

HaveMoney

TaxiAvailable

CanDriveToWork

Sunny 

CanWalkToWork

HaveUmbrella

CanWalkToWork

Rainy, // facts

HaveBike,

HaveMoney,

RentCar

}

query = CanGetToWork ?

Slide6

{CanGetToWork

}

// initialize goal stack with query

{

CanBikeToWork

}

// replace subgoal with rule

1

{

HaveBike,Sunny

} // push antecedents for rule

4

{Sunny

}

// HaveBike

is

fact, so pop it

backtrack

since Sunny in not a fact and can’t be proved

{

CanDriveToWork

}

// rule 2, another way CanGetToWork

{OwnCar

}

// try rule

5

backtrack

, not provable

{

HaveMoney,

RentCar

}

//

another way to prove CanDriveToWork

{RentCar

}

//

pop HaveMoney since known fact

{} //

success

! empty goal stack, return True

Slide7

Slide8

Slide9

Slide10

Slide11