HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

Convert FOL clauses to PROLOG

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
convertfolprologclauses

Problem

I am very new to PROLOG so it might be a very trivial question, but I absolutely have no idea how to solve it. There are 4 sentences I need to formulate into PROLOG code:



-
All hounds howl at night.

-
Anyone who has any cats will not have any mice.

-
Light sleepers do not have anything which howls at night.

-
John has either a cat or a hound.


I convert sentences to well-formed formula in first-order predicate calculus like that

- ∀x (HOUND(x) → HOWL(x))

- ∀x ∀y (HAVE(x,y) ∧ CAT (y) → ¬∃z (HAVE(x,z) ∧ MOUSE (z)))

- ∀x (Light_Sleeper(x) → ¬∃y (HAVE (x,y) ∧ HOWL(y)))

- ∃x (HAVE (John,x) ∧ (CAT(x) ∨ HOUND(x)))


Now I don't know how to write them in Prolog.
Also, how can I make query on them?

Solution

If you can convert them to Horn clauses, you can convert them to Prolog.

If you can't convert them to Horn clauses, I don't think you can convert them to Prolog.

So, convert them to Horn clauses first, and then see the answer to this question:

Horn clause to Prolog

Context

StackExchange Computer Science Q#102238, answer score: 2

Revisions (0)

No revisions yet.