Lojban
The Logical Language
Log in
Username:
Password:
I forgot my password |
CapsLock is on.
Log in
History: Prolog for Lojbanists
View page
Source of version: 2
(current)
A Prolog program consists of a database of rules and facts. A rule is a bridi with the following restricted grammar: <rule> = <simple-bridi> .ijanai <simple-bridi> | <simple-bridi> .ijanai tu'e <conjunct> tu'u <conjunct> = <simple-bridi> | <simple-bridi> .ije <conjunct> <simple-bridi> = <simple-sumti>* <brivla> <simple-sumti>* <simple-sumti> = la <name> | <quantified-variable> | li <number> | lo <brivla> <be-beho>? <be-beho> = be <simple-sumti> (bei <simple-sumti)* be'o All variables are always quantified universally with a scope extending over the whole rule. Facts are degenerate rules with just a "<simple-bridi>", and are treated as unconditional rules. A fact or rule is said to be "ground" if there are no variables in it. Prolog interpreters accept queries, which are simple-bridi, and return all values of all variables in the simple-bridi which, when substituted for those variables, produce either facts in the database or facts deducible from the facts and rules in the database. Here is a trivial Prolog program in Lojban syntax: la djan. patfu la djordj. .i la djordj. patfu la fred. .i roda rode rodi zo'u: da patpatfu de .ijanai tu'e da patfu di .ije di patfu de tu'u .i ma patpatfu la fred. To which the Prolog system will reply "la fred." The system sees that "ma patpatfu la fred." matches the rule head "da patpatfu de" and then attempts to match the members of the conjunct against existing facts or rule heads. There are built-in brivla for which the system knows how to compute the answer rather than consulting its database: e.g. "li mu du lo sumji be li re bei li ci be'o" is always true. Typically the sumti of such predicates must be ground. See also: ((Prolog tools))
About
Introduction
What Others Say
FAQ
Learning
Books
Vocabulary
Lojbanic Software
Community
Web/Email Forums
IRC Chat
Links
News
Dictionary
Swag
Multimedia
Lojbanic Texts
Audio
Wiki
Recent Changes
Popular Pages
How To Edit
The LLG
Official Projects
Publications
Donate!
Contact Us
Search Lojban Resources