Eclipse CLP Prolog with CHR Flashcards

Terms Definitions
What does prolog stand for?
PROgramming in LOGic
What does it mean for prolog to be a declarative language?
Rather than describing how to compute a solution, a program consists of a data base of facts and logical relationships (rules) which describe the relationships which hold for the given application. Rather then running a program to obtain a solution, the user asks a question. When asked a question, the run time system searches through the data base of facts and rules to determine (by logical deduction) the answer.
What are some of the features of prolog?
logical variables meaning that they behave like mathematical variables, a powerful patten-matching facility (unification), a backtracking strategy to search for proofs, uniform data structures, and input and output are interchangeable.
What happens if there are multiple solutions to a problem?
The run time system may backtrack to generate alternative solutions. Prolog is a weakly typesd language with dynamic type checking and static scope rules.
What does a prolog program consist of?
A prolog program consists of a database of facts and rules, and queries (questions).Fact: .Rule: :-Query: ?-Variables: must begin with an upper case letter.Constants: numbers, begin with lowercase letter, or enclosed in single quotes.
What is interesting to understand about a prolog program?
A prolog program consists of a data base of facts and rules. There is no structure imposed on a prolog program, there is no main procedure, and there is no nesting of definitions. All facts and rules are global in scope and the scope of a variable is the fact or rule in which it appears. The readability of a Prolog program is left up to the programmer.
How is a prolog program executed?
A prolog program is executed by asking a question. The question is called a query. Facts, rules, and queries are called clauses.
What is a fact is in prolog?
A fact is just what it appears to be --- a fact. A fact in everyday language is often a proposition like "It is sunny" or "It is summer." In Prolog such facts could be represented as follows:'It is sunny'.'It is summer'.
What is a query in prolog?
A query in prolog is the action of asking the program about information contained within its data base. Thus, queries usually occur in the interactive mode. After a program is loaded, you will receive the query prompt,?-at which time you can ask the run time system about information in the data base.
What is an example of asking a question in prolog?
?- 'It is sunny'.prolog will respond with:Yes?-
What does a yes and no to a query in prolog mean?
A yes means that the information in the data base is consistent with the subject of the query. Another way to express this is that the program is capable of proving the query true with the available information in the data base. If a fact is not deducible from the data base the system replys with a no, which indicates that based on the information available (the closed world assumption) the fact is not deducible.
What is an example of asking a question that would give a no?
If the data base does not contain sufficient information to answer a query, then it answers the query with a no.?- 'It is cold'.no?-
What are rules in prolog?
Rules extend the capabilities of a logic program. They are what give Prolog the ability to pursue its decision-making process.
What is an example prolog program illustrating rules?
'It is sunny'.'It is summer'.'It is hot' :- 'It is summer', 'It is sunny'.'It is cold' :- 'It is winter', 'It is snowing'.The rule reads as follows:"It is host if it is summer and it is sunny". The second rule is read as follows: "It is cold if it is winter and it is snowing".The query,?- 'It is hot'.Yes?-is answered in the affirmative since both 'It is summer' and 'It is sunny' are in the data base while a query ''?-'It is cole.'" will produce a negative response.This program is an example of propositional logic.
What is predicate logic in prolog?
Facts and rules may be parameterized to produce programs in predicate logic. The parameters may be variables, atoms, numbers, or terms. Parameterization permits the definition of more complex relationships.
What is an example of predicate logic in prolog?
female(amy).female(johnette).male(anthony).male(bruce).male(ogden).parentof(amy, johnette).parentof(amy, anthony).parentof(amy, bruce).parentof(ogden, johnette).parentof(ogden, anthony).parentof(ogden, bruce).The above program contains the three simple predicates: female; male; and parentof. They are parameterized with what are called atoms.
Using the predicate logic example, how would you alter/add to the program to find sibblings?
You first would ask, what does it mean to be a sibling? To be someone's sibling you must have the same parent. This last sentence can be written in Prolog as:siblingof(X,Y) :- parentof(Z,X), parentof(Z,Y).A translation of the above Prolog rule into English would be X is the sibling of Y provided that Z is a parent of X, and Z is a parent of Y. X, Y, and Z are variables. The rule however, also defines a child to be its own sibling. To correct this we must add that X and Y are not the same. The corrected version is:siblingof(X,Y) :- parentof(Z,X), parentof(Z,Y), X Y.The relation brotherof is similar but adds the condition that X must be a male.brotherof(X,Y) :- parentof(Z,X), male(X), parentof(Z,Y), X Y.
What can be learned from the sibbling prolog examples?
From these examples we see how to construct facts, rules, and queries and that strings are enclosed in single quotes, variables begin with a capital letter, constants are either enclosed in single quotes or begin with a small letter.
What are the types in prolog?
numbers, atoms, lists, tuples, and patterns.
What are the types of objects that can be passed as arguments?
Type Valuesboolean true, failinteger integersreal floating point numbersvariable variablesatom character sequences
What is important to understand about the type of objects that can be passed as arguments?
The boolean constants are not usually passed as parameters but are propositions. The constant fail is useful in forcing the generation of all solutions. Variables are character strings beginning with a capital letter. Atoms are either quoted character strings or unquoted strings beginning with a small letter.
What is a great book on constraing programming using eclipse?
What is a great link to a prolog tutorial?
How did prolog originate?
Prolog originated from attempts to use logic to express grammar rules and formalize the parsing process.
What are definite clause grammars?
DCG's are a generalization of context free grammars.
What is a meta program?
Meta programs treat other programs as data. They analyze, transform, and simulate other programs. Prolog clauses may be passed as arguments, added and deleted from the Prolog data base, and may be constructed and then executed by a Prolog program. Implementations may require that the functor and arity of the clause be previously declared to be a dynamic type.
What is arity?
The number of arguments a predicate taks.
What is the difference between a caluse and a predicate?
clause are the single things ending with a .predicate means all under the same name/arityex:foo(1).foo(2).foo(3).there are 3 clauses but one predicate foo/1
/ 28

Leave a Comment ({[ getComments().length ]})

Comments ({[ getComments().length ]})


{[ comment.comment ]}

View All {[ getComments().length ]} Comments
Ask a homework question - tutors are online