• basic structure in logic programs is a term

  • term

    • is a constant, a variable, or a compound term
      • constants
        • denotes particular objects
        • which can be either an atom or a number
        • considered a functor of arity = 0
      • variables
        • denote a single but unspecified object
      • compound term
        • consists of
          • functor
          • a sequence of one or more terms called arguments
          • exp compound term: sentence(nphrase(john),vbphrase(verb(likes),nphrase(mary)))
    • ground v nonground terms/instance:
      • ground terms/instance - contains no variables
      • nonground terms/instance - contains variables
  • functor

    • is characterized by its: (name - which is an atom) and (arity - number of arguments)
    • unary functor - a functor with 1 argument
    • binary functor - a functor with 2 arguments
    • ternary functor - a functor with 3 arguments
  • logic program

    • is a finite set of clauses/rules
  • clause or rule

    • is a universally quantified logical sentence of the form
    • A ← B1, B2, …, Bk. for k≥0
    • where A and Bi are goals
    • read declaratively: “A is implied by the conjunction of the Bi”
    • read procedurally: “To answer query A, answer the conjunctive query: B1, B2, …, Bk”
    • A is called the clause’s head
    • Bi is called the clause’s body
    • fact or unit clause__ - if k=0, no Bs
    • iterative clause - if k=1, one B
  • query

    • query in conjunction form
    • A1, …, An? where n>0

Computation

  • computation of a logic program P finds an instance of a given query logically deducible from P. A goal G is deducible from a program P if there is an instance A of G where A ← B1, …, Bn, n≥0, is a ground instance of a clause in P, and the Bi are deducible from logic program P. Deduction of a goal G from an identical fact is a special case

Meaning

  • meaning of a program P is inductively defined using logical deduction. The set of ground instances of facts in logic program P are in the meaning. A ground goal G is in the meaning if there is a ground instance G ← B1, …, Bn of a rule in P such that B1, …, Bn are in the meaning. The meaning consists of the ground instances that are deducible from the program
  • an intended meaning M of a program is also a set of ground unit goals.
  • logic program P is:
    • correct with respect to an intended meaning M, if M(P) is a subset of M
    • complete with respect to an intended meaning M, if M is a subset of M(P)
    • correct and complete with respect to an intended meaning M, if M = M(P)
  • 3 basic statements
    • facts
    • rules
    • queries