Shared Flashcard Set

Details

Chapter 16
Logic Programming Languages
79
Computer Science
Graduate
05/08/2019

Additional Computer Science Flashcards

 


 

Cards

Term
Express programs in a form of symbolic logic
Use a logical inferencing process to produce results
Declarative rather than procedural
Definition
Logic (declarative) programming language
Term
Logic programming languages are _____ rather than _____. Only specification of _____ are stated. Not detailed _____ for producing them.
Definition
declarative, procedural, results, procedures
Term
a logical statement that may or may not be true
Definition
proposition
Term
A proposition consists of _____ and _____ of objects to each other
Definition
objects, relationships
Term
Used for the basic needs of formal logic. Express propositions, express relationships between propositions, describe how new propositions can be inferred from other propositions
Definition
symbolic logic
Term
Particular form of symbolic logic used for logic programming. Use quantified variables over non-logical objects, allow the use of sentences that contain variables
Definition
(first-order) predicate calculus
Term
This is an example of _____ _____.
For all x, if x is a man then x is mortal.
Definition
predicate calculus
Term
Objects in propositions are represented by simple terms: either _____ or _____ _____
Definition
constants, quantified variables
Term
A symbol that represents an object
Definition
constant
Term
E.g.: likes(bob, steak); likes, bob, steak are _____
Definition
constants
Term
a symbol that can represent different objects at different times
Definition
quantified variable
Term
E.g.: ∀ X. P (For all X, P is true), where X is a _____ _____; ∀ is a _____ _____
Definition
quantified variable, universal quantifier
Term
Simplest proposition
Consist of compound terms
Definition
atomic propositions
Term
Compound terms composed of two parts
_____: function symbol that names the relationship. E.g.: student, like
Ordered list of parameters (_____)
Definition
Functor, tuple
Term
student(jon)
like(seth, OSX)
like(nick, windows)
like(jim, linux)
These are examples of _____ _____
Definition
atomic propositions
Term
Propositions can be stated in two forms:
-_____: proposition is assumed to be true
-_____: truth of proposition is to be determined
Definition
Fact, Query
Term
-Have two or more atomic propositions
-Propositions are connected by logical operators
Definition
compound proposition
Term
¬a
Definition
not a
Term
a∩b
Definition
a and b
Term
a∪b
Definition
a or b
Term
a≡b
Definition
a is equivalent to b
Term
a⸧b
Definition
a implies b
Term
a⸦b
Definition
b implies a
Term
∀X.P
Definition
For all X, P is true
Term
∃X.P
Definition
There exists a value of X such that P is true
Term
Standard form for propositions
Definition
clausal form
Term
B1 ∪ B2 ∪ … ∪ Bn ⸦ A1 ∩ A2 ∩ ... ∩ Am
Definition
If all the As are true, then at least one B is true
Term

B1 ∪ B2 ∪ … ∪ Bn ⸦ A1 ∩ A2 ∩ ... ∩ Am

What is the antecedent and consequent?

Definition

Antecedent: right side (i.e., Ai ... Am)

Consequent: left side (i.e., B1 … Bn)

Term

-Process of inferring a proposition from given propositions

-Allows inferred propositions to be computed from given propositions

Definition
resolution
Term

Infer a proposition given the following propositions:

older(joanne, jake) ⸦ mother(joanne, jake)

wiser(joanne, jake) ⸦ older(joanne, jake)

Definition
wiser(joanne, jake) ⸦ mother(joanne, jake)
Term
Finding values for variables in propositions that allow matching process to succeed
Definition
unification
Term
Assigning temporary values to variables to allow unification to succeed
Definition
instantiation
Term
After instantiating a variable with a value, if matching fails, may need to _____ and instantiate with a different value
Definition
backtrack
Term
When propositions are used for resolution, only _____ form can be used
Definition
restricted
Term
What are the 2 forms of a Horn clause?
Definition
headed, headless
Term
Single atomic proposition on left side. E.g.: likes(bob, trout) ⸦ likes(bob, fish) ∩ fish(trout)
Definition
headed
Term
Empty left side (used to state facts). E.g.: father(bob, jake)
Definition
headless
Term
Most propositions can be stated as _____ _____
Definition
Horn clauses
Term
Logic programming is _____
Definition
nonprocedural
Term
Logic programs do not state _____ a result is to be computed, but rather the _____ of the result
Definition
how, form
Term
  • sorted(list) ⸦ ∀j such that 1 ≤ j < n, list(j) ≤ list(j + 1)
  • sort(old_list, new_list) ⸦ permute(old_list, new_list) ∩ sorted(new_list)
  1. permute is a predicate returned true if its _____ parameter is a permutation of its _____ parameter
  2. sort the items in _____ and put them into _____
Definition
2nd, 1st, old_list, new_list
Term

Prolog

An atom or an integer

Definition
constant
Term

Symbolic value of Prolog, consists of either:

  • a string of letters, digits, and underscores beginning with a lowercase letter
  • a string of printable ASCII characters delimited by apostrophes
Definition
atom
Term

Prolog

any string of letters, digits, and underscores beginning with an uppercase letter

Definition
variable
Term

Prolog

  • binding of a variable to a value
  • Lasts as long as it takes to satisfy one complete goal
Definition
instantiation
Term
Represents atomic proposition. E.g.: functor(parameter list)
Definition
structure
Term
  • Used for the hypotheses
  • Headless Horn clauses.

female(shelley).

male(bill).

father(bill, jake).

Definition
fact statements
Term
Prolog statement is terminated by a _____
Definition
period
Term
  • Used for the hypotheses
  • Headed Horn clause
Definition
rule statements
Term
Right side: antecedent (_____ part)
Definition
if
Term

Prolog

May be single term OR conjunction

Definition
antecedent
Term
Left side: consequent (_____ part)
Definition
then
Term

Prolog

Must be single term

Definition
consequent
Term
Multiple terms separated by logical AND operations (implied)
Definition
conjunction
Term
  • For theorem proving, theorem is in form of proposition that we want system to _____ or _____
  • In Prolog, these propositions are called goals (statements) or _____; same format as _____ Horn clause
  • _____ propositions are propositions with _____ also legal goals
Definition
prove, disprove, queries, headless, Conjunctive, variables
Term

father(X, mike)

System will then attempt, through _____, to find an instantiation of X that results in a true value

Definition
unification
Term

Prolog: Inferencing Process

If a goal is a compound proposition, each of the facts is a _____

Definition
subgoal
Term
To prove a goal is true, must find a _____ of inference rules and/or facts
Definition
chain
Term
Process of proving a subgoal called matching, satisfying, or _____
Definition
resolution
Term

_____-_____ resolution, _____ chaining

  • Begin with facts and rules of database and attempt to find sequence that leads to goal
  • Works well with a large set of possibly correct answers
Definition
bottom-up, forward
Term

_____-_____ resolution, _____ chaining

  • Begin with goal and attempt to find sequence that leads to set of facts in database
  • Works well with a small set of possibly correct answers
Definition
top-down, backward
Term
Prolog implementations use _____ chaining
Definition
backward
Term
When goal has more than one subgoal, can use either _____-first search or _____-first search
Definition
depth, breadth
Term
Find a complete proof for the first subgoal before working on others
Definition
depth-first search
Term
Work on all subgoals in parallel
Definition
breadth-first search
Term
Prolog uses _____-first search. Can be done with fewer computer resources
Definition
depth
Term
  • With a goal with multiple subgoals, if fail to show truth of one of subgoals, reconsider previous subgoal to find an alternative solution
  • Begin search where previous search left off
  • Can take lots of time and space because may find all possible proofs to every subgoal
Definition
backtracking
Term
Built-in structure that displays instantiations at each step
Definition
trace
Term

Tracing model of execution- 4 events:

  • _____ (beginning of attempt to satisfy goal)
  • _____ (when a goal has been satisfied)
  • _____ (when backtrack occurs)
  • _____ (when goal fails)
Definition
call, exit, redo, fail
Term
Prolog supports _____ variables and _____ arithmetic
Definition
integer, integer
Term
_____ operator: takes an arithmetic expression as right operand and variable as left operand
Definition
is
Term
The following is _____: Sum is Sum + Number.
Definition
illegal
Term

speed(ford, 100).

speed(chevy, 105).

speed(dodge, 95).

speed(volvo, 80).

time(ford, 20).

time(chevy, 21).

time(dodge, 24).

time(volvo, 24).

distance(X, Y) :- speed(X, Speed), time(X, Time), Y is Speed * Time.

Solve is query: distance(chevy, Chevy_Distance).

Definition
2205
Term
A sequence of any number of elements
Definition
list
Term
Can be atoms, atomic propositions, or other terms (including other lists)
Definition
elements
Term

Prolog: List Structures

[apple, prune, grape, kumquat]

[]

[X | Y] /* head _____, tail _____; head: _____, tail: _____ */

[X | Y] = [a, b, c] /* x = _____; y = _____ */

Definition
X, Y, CAR, CDR, a, [b, c]
Term

What is the result of Family?

append([], List, List).

append([Head | List_1], List_2, [Head | List_3]) :- append(List_1, List_2, List_3).

append([bob, jo], [jake, darcie], Family).

Definition
Family = [bob, jo, jake, darcie]
Term
The underscore character (_) means an _____ variable - it means we do not care what instantiation it might get from unification
Definition
anonymous
Term

Deficiencies of Prolog

  • Resolution order control: In a pure logic programming environment, the order of attempted matches is _____ and all matches would be attempted _____
  • The closed-world assumption: The only knowledge is what is in the _____
  • The negation problem: Anything not stated in the database is assumed to be _____
  • Essential limitations: It is easy to state a sort process in _____, but difficult to actually _____ - it doesn't know how to sort
Definition
nondeterministic, concurrently, database, false, logic, do
Supporting users have an ad free experience!