Learning Pilog -3: Unification and Proof Search

What is Unification?

: (? (equal John John))
-> T
: (? (equal John Susie))
-> NIL
(be house_elf (Dobby))
(be witch (Hermione))
(be witch (Rita_Skeeter))
(be wizard (Harry))
(be magic (@X)
(or
((house_elf @X))
((wizard @X))
((witch @X)) ) )
: (? (magic @X))
@X=Dobby
@X=Harry
@X=Hermione
@X=Rita_Skeeter
-> NIL
: (rules 'magic)
1 (be magic (@X) (or ((house_elf @X)) ((wizard @X)) ((witch @X))))
-> magic
: (? magic house_elf wizard witch (magic @X))
1 (magic @X)
1 (house_elf Dobby)
@X=Dobby
1 (wizard Harry)
@X=Harry
1 (witch Hermione)
@X=Hermione
2 (witch Rita_Skeeter)
@X=Rita_Skeeter

Example: Crossword Puzzle

(be word (astante a s t a n t e))
(be word (astoria a s t o r i a))
(be word (baratto b a r a t t o))
(be word (cobalto c o b a l t o))
(be word (pistola p i s t o l a))
(be word (statale s t a t a l e))
(be crossword (@V1 @V2 @V3 @H1 @H2 @H3)
(be crossword (@V1 @V2 @V3 @H1 @H2 @H3)
(word @H1 @ @H12V12 @ @H14V22 @ @H16V32 @)
(word @H2 @ @H22V14 @ @H24V24 @ @H26V34 @)
(word @H3 @ @H32V16 @ @H34V26 @ @H36V36 @)
(word @V1 @ @H12V12 @ @H22V14 @ @H32V16 @)
(word @V2 @ @H14V22 @ @H24V24 @ @H34V26 @)
(word @V3 @ @H16V32 @ @H26V34 @ @H36V36 @) )
: (? (crossword @V1 @V2 @V3 @H1 @H2 @H3))
@V1=astante @V2=baratto @V3=statale @H1=astante @H2=baratto @H3=statale
@V1=astoria @V2=baratto @V3=statale @H1=astante @H2=cobalto @H3=pistola
-> NIL

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mia Temma

Mia Temma

These are cross-posts from my blog https://picolisp-explored.com. I’m writing about PicoLisp for beginners. Welcome!