Prolog

LA home
Computing
Logic
 Prolog
  Intro.
  Examples
  Syntax
  Interp.

Also see
  λ-calculus
Prolog (Programming in Logic) is a programming language based on Predicate Logic. It uses the restricted syntax of Horn Clauses:
Predicates, e.g., floats(), etc.
Operators <=, and, not
Logical variables X, GP, etc.
Constants 7, girl, etc.
Function names f, left(), ...
Facts female(girl).
rules burns(X) <= wooden(X).
queries witch(girl).
Quantification of logical variables is implicit -- universal for facts and rules, existential for queries.
 
The introduction will get you going and there are more examples. The interpreter shows how Prolog works.
 



This prototype javascript implementation of Prolog; (21/1/'18) will eventually> spread to other pages.
 
<= (also :- ) can be read as if, or as is implied by.
planet(P)<=orbits(P,sun)  can be read as ∀ P, P is a planet if P orbits the sun. (That is not to say that the definition cannot be tightened.)
?satellite(S) can be read as does there exist an S such that S is a satellite?
And the answer, here, is yes, if S is earth's moon, or a moon of another planet.
www:


© L. Allison   http://www.allisons.org/ll/   (or as otherwise indicated),
Created with "vi (Linux or Solaris)",  charset=iso-8859-1,  fetched Friday, 23-Feb-2018 03:49:07 EST.

free: Linux, Ubuntu operating-sys, OpenOffice office-suite, The GIMP ~photoshop,
Firefox web-browser, FlashBlock flash on/off.