Exam 2 Flashcards
What is logic programming?
A collection of facts and rules. Facts are logical statements assumed to be true (axioms), and rules are logical statements that derive new facts from existing facts that support the premise.
What is forward-chaining?
Start with the facts and work forwards towards the query (the goal).
What is backward-chaining?
Start with the query (the goal) and move backwards saving any facts that supports the goal
Data-Driven vs. Goal-Driven Search
Data-driven is best for automatic processing such as object recognition, routine decisions; may do lots of work that is irrelevant to the goal. Goal driven is more appropriate for problem solving such as where are my keys? How do I get into a PhD program? Goal driven is often used in expert systems that are designed for medical diagnosis or other types of diagnostic systems
What is first-order predicate logic?
Boolean logic assumes the world contains facts that are either true or false, predicate logic assumes the world contains objects and relationships.
What are some symbols in predicate calculus?
A constant, a variable, a function, or a predicate. Constants being with lowercase letters, variables being with an uppercase letter, the arity of a function is the number of arguments of the functor, and a predicate names a relationship between objects in the world.
Everyone likes ice cream.
There does not exist someone who doesn’t like icecream.
There exists a person that likes broccoli is the same as?
It is not true that no one likes broccoli
“If it doesn’t rain on Monday, Tom will go to the mountains.”
not(weather(rain, monday) → go(tom, mountains))
Emma is a Doberman pinscher and a good dog.
is_a(emma, doberman) good_dog(emma)
“All basketball players are tall.”
X (basketball_player(X) → tall(X))
“Nobody likes taxes.”
not( X likes(X, taxes))
What are prolog statements constructed from?
Terms. A term is a constant, a variable, or a structure. A constant is an atom or an integer. An an atom is a string of letters, digits, or underscores that begins with a lowercase letter.
What is a variable in ProLog?
A variable is any string of letters, digits, or underscores that begins with an uppercase letter or an underscore
Variables are not bound to types by declarations
The binding of a value to a variable (hence its type) is called an instantiation
Instantiation occurs as a result of resolution
Instantiations last only as long as it takes to satisfy one complete goal, which involves the proof or disproof of one proposition
What is a headless horn clause?
The headless Horn clause is an unconditional assertion (a fact, or a proposition that is assumed to be true). For example,
male(bill).
What is a headed horn clause?
Represents a rule, such that a conclusion can be drawn if a given set of conditions is satisfied
consequence :- antecedent_expression
i.e. ancestor(mary, shelley) :- mother(mary, shelley)
When are variables in prolog assumed to universally quantified vs existentially quantified?
Variables in the consequence are assumed to be universally quantified
Variables in the antecedent expressions are assumed to be existentially quantified
What is the syntax of a goal statement?
Headless Horn statement.
Prolog to append a list to another list to produce a third list:
append( [ ], B, B).
append( [H | T], A, [H | L] ) :- append(T,A,L).
What is the “is” operator in prolog?
It takes an arithmetic expression as its right operand and a variable as its left operand. X is 1+2.
X = 3.
Will 1+2 is 4-1 work?
No, because first argument 1+2 is already instantiated.
Will X is Y work?
No, Y must already be instantiated.
Will Y is 1+2, X is Y. work?
Yes, if y is instantiated by the time it is needed. Y =3, X =3
What is the prolog tracing model?
The prolog tracing model of execution has four events: - call (beginning of attempt to satisfy goal), Exit (when a goal has been satisfied), Fail (when goal fails), Redo (when backtracking occurs).