16-Logical%20Programming - 16. Logical Programming Logic...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS 313 - Fundamentals of Programming Languages 1 16. Logical Programming Logic Programming ± Neither imperative nor functional ± Deals with relations, not functions ` Arguments and results are treated uniformly ` daughter(sue,john) ` lessthan(3,10) ± Separate logic from control ` Programmer declares what facts and relations are true ` System determines how to use facts to solve problems
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ICS 313 - Fundamentals of Programming Languages 2 Relations (Predicates) ± A table with n 0 columns and a possibly infinite set of rows ± A tuple (a 1 ,a 2 ,…,a n ) is in a relation if a i appears in column i, 1 i n ± Example: Relation append is a set of tuples of the form (X,Y,Z), where Z consists of the elements of X followed by the elements of Y ± Relations can be specified using Horn clauses (rules) Horn Clauses (Rules) ± A Horn clause: P if Q 1 and Q 2 and … and Q k , k 0 can be interpreted as: The consequent, P, is true if the antecedents Q 1 , Q 2 ,…, Q k , k 0 are all true
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

16-Logical%20Programming - 16. Logical Programming Logic...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online