Chapter 16 Flashcards
(35 cards)
Difference between Logical programming and procedural programming?
Logical = specify results
Procedural = show how to get to results
What is a proposition?
A logical statement that may or may not be true
What represents a object in proposition?
Constants or variables
What are the types of propositions?
Atomic + compound
What does a compound term consist of?
Functor and order list of parameters
Compound term in Prolog example
student(jon) student = functor, jon = argument
What are the 2 forms for propositions?
Facts ( assumed to be true) and queries (truth to be determined.
Fact = jon is a student.
query = is jon a student?
What is a compound proposition?
2+ atomic propositions
What are the 2 quantifiers?
Exists (backwards E) universal (upside down A)
Is resolution an inference principle?
Yes
What is the unification process?
Finds values for variables in propositions such that the matching process can move forward
What happens after instantiating a variable with a value and the matching fails?
Backtrack and instantiate variable with different value
What are the 2 types of Horn caluses?
Headed (single atomic proposition on the left
Headless ( father(bob, jake) )
Can all propositions be stated as Horn clauses?
No only most
What is meant by “ Logic programming is nonprocedural”?
Dont state how the result must be computed but rather the form of the result
What is a atom in Prolog?
String of letter, digits and underscores starting with lowercase
What is a variable in Prolog?
same as atom but starts with Uppercase letter
What are the 3 kinds of statements in Prolog?
Fact, Rule and Goal
Example of a fact statement in prolog:
female(shelly) aka headless Horn clauses
Example of atomic rule statement in prolog:
ancestor(mary,shelly) :- mother(mary,shelly) (headed horn clause)
Example of universal rule statement in prolog
(headed horn clause)
parent(X,Y) :- mother(X,Y).
parent(X,Y) :- father(X,Y).
grandparent(X,Z) :- parent(X,Y), parent(Y,Z) === x is a grand parent of Z if X is a parent of Y and Y is a parent of Z
How are goal used in prolog?
?- man(fred). aka is fred a man?
Conjunctive propositions:
?- father(X,mike). ( find all the X such that X is mikes father
What are the 2 different inferencing approaches?
Bottom-up resolution aka forward chaining ( begin with facts and go to goal)
Top-down aka backward chaining ( begin at goal and go to fact ( prolog uses this))
What happens if a goal has many sub goals?
Use BFS or DFS ( prolog uses dfs)
DFS = find complete proof for one before working on another