1/43
Forty-four vocabulary flashcards covering core concepts in Prolog and logic programming.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Axioms (Facts and Rules)
Facts and rules that form the knowledge base or theory of a logic program; axioms are assumed truths, rules are implications between facts.
Facts
Statements assumed true that represent basic knowledge.
Rules
Logical implications or relationships that define how new information can be inferred.
Goal Statements
Queries the programmer wants to prove or satisfy; the desired outcomes.
Axioms as a Theory
The collection of facts and rules that forms the knowledge base or theory of the logic program.
Goal Statements as Theorems
Theorems or propositions that the programmer aims to prove or derive from the axioms.
Computation as Deduction
Computation involves deducing new information from the axioms to prove the goal statements.
Interpreter
The component that finds a set of axioms and inference steps that lead to the proof of the goal statements.
Inference
The process of deducing conclusions by applying logical rules to facts.
Proof
The successful determination of a collection of axioms and inference steps that imply the goal statements.
Predicate
A relation (a tuple) that defines a logical connection between its arguments.
Relational Programming
Prolog programming paradigm where relations (predicates) express connections rather than functions.
N-ary Relations
Predicates that involve more than two entities; arity can be greater than 2.
parent/2
A simple relation/fact where parent(tom, bob) defines a parent-child relation; the /2 denotes arity two.
Directionality in Parameters
In Prolog, parameters are not strictly inputs or outputs; their roles can vary by context.
In parameters
Inputs in traditional languages; Prolog does not fix in/out—variables can be used as inputs.
Out parameters
Outputs; variables become bound to produce results when queried.
Knowledge Base
The initial set of facts and rules for a logic program.
Conjunction
Expressed with a comma; all goals separated by the comma must be satisfied.
Disjunction
Expressed with a semicolon; at least one of the goals must be true.
Implication
The ':-' symbol in Horn clauses reads as 'if' or 'is implied by'.
Negation
Negation (not) expresses that a goal should not be true; often used as not(P) in Prolog.
Variables
Unknown values or placeholders; usually start with a capital letter or underscore.
Don’t-Care Variable
The underscore '_' denotes a placeholder where the value is irrelevant.
Comments in Prolog
Actual code comments: single-line using % and multi-line using /* … */.
Atoms
Constants representing names or identifiers; start with a lowercase letter or be quoted.
Numbers
Integers and floating-point numbers, including scientific notation.
Arity
The number of arguments a predicate takes; e.g., loves/2 vs loves/3.
Predicate Name
The name of a predicate; typically starts with a lowercase letter.
Arguments
The terms inside a predicate; can be constants, variables, or complex terms.
Arity distinction
Predicates with different arities are distinct (e.g., loves/2 vs loves/3).
Horn Clauses
A rule form H:-B1,B2,…,Bn (or a fact if there is no body).
Head and Body
In a Horn clause, the head is the relation; the body contains the conditions.
Rule vs Fact
A fact has no body; a rule has a head and a body.
Principle of Resolution
A reasoning principle: resolve clauses to derive a goal from facts and rules.
Unification
Binding variables to make two terms identical; central to Prolog execution.
Backtracking
Exploring alternative paths when a particular search path fails.
Unification: Constant
A constant unifies only with itself.
Unification: Variable
A variable can unify with anything (constants, variables, or structures).
Unification extends recursively
Unification applies not just to top-level terms but to subterms inside compounds.
Equality operator =
In Prolog, equality is implemented via unification using the = operator.
Conjunctive query
A query with multiple goals joined by a comma; all must be true.
Disjunctive query
A query with multiple goals joined by a semicolon; at least one must be true.
Lists
A fundamental data structure for representing sequences of elements in Prolog.