* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Logic Logical Concepts Deduction Concepts Resolution
Jesús Mosterín wikipedia , lookup
Model theory wikipedia , lookup
List of first-order theories wikipedia , lookup
Axiom of reducibility wikipedia , lookup
Truth-bearer wikipedia , lookup
Abductive reasoning wikipedia , lookup
Quantum logic wikipedia , lookup
Modal logic wikipedia , lookup
History of logic wikipedia , lookup
Unification (computer science) wikipedia , lookup
History of the function concept wikipedia , lookup
Sequent calculus wikipedia , lookup
Natural deduction wikipedia , lookup
Propositional formula wikipedia , lookup
Mathematical logic wikipedia , lookup
Curry–Howard correspondence wikipedia , lookup
Structure (mathematical logic) wikipedia , lookup
Law of thought wikipedia , lookup
Propositional calculus wikipedia , lookup
Principia Mathematica wikipedia , lookup
Intuitionistic logic wikipedia , lookup
Logical Concepts Logic If a formula ϕ is true under a given interpretation M , one says that that M satisfies ϕ, M |= ϕ Representation and Reasoning A formula is satisfiable if there is some interpretation under which it is true Otherwise, it is unsatisfiable (inconsistent) A formula is valid (a tautology), denoted by |= ϕ, if it is true in every interpretation for all M : M |= ϕ A formula ϕ is entailed (or is a logical consequence) by a set of formulae Γ, denoted by Γ |= ϕ, if for all M : M |= Γ then M |= ϕ K & R werkcollege – p. 2/20 K & R werkcollege – p. 1/20 Deduction Concepts Resolution A deductive system S is a set of axioms and rules of inference for deriving theorems A formula ϕ can be deduced by a set of formulae Γ if ϕ can be proven using a deduction system S , written as Γ ⊢S ϕ A deductive system S is sound if Automated reasoning: proving logic theorems by means of a computer program Γ ⊢? ϕ Proving unsatisfiability is enough, because: Γ |= ϕ ⇔ Γ ∪ {¬ϕ} |= ⊥ Γ ⊢S ϕ ⇒ Γ |= ϕ Resolution (J.A. Robinson, 1965): A deductive system S is complete if C ∨ {L}, C ′ ∨ {¬L} D Γ |= ϕ ⇒ Γ ⊢S ϕ A deductive system S is refutation-complete if where D is equal to C ∨ C ′ without the double literals Resolution is a refutation-complete inference rule Γ |= ⊥ ⇒ Γ ⊢S ⊥ K & R werkcollege – p. 3/20 K & R werkcollege – p. 4/20 Logic Programming Motivation for Resolution In first-order logic: Logic programming: based on logic for programming If S is inconsistent, then resolution will terminate within finite time: S ⊢R 2 Provides a computational interpretation of resolution Fundamentally, we cannot do much better than that Suppose P = {r ← p. q ← p. s ← q, r. p.} Basically: it searches for a resolution proof (recall tracing) Call: (7) s ? creep Call: (8) q ? creep Call: (9) p ? creep Exit: (9) p ? creep Exit: (8) q ? creep Call: (8) r ? creep Call: (9) p ? creep Exercise: Proof s from P using resolution. Compare your answer. Many applications: Mathematics: Robbins’ conjecture Proving that medical procedures are correct Programming! K & R werkcollege – p. 5/20 K & R werkcollege – p. 6/20 Logic Programming Concepts SLD Resolution Horn clause: clause with maximally one positive literal ¬A1 ∨ · · · ∨ ¬Am ∨ B , also denoted by B ← A1 , . . . , Am Fact: expressing relations between objects (literals) p ← (= p) SLD resolution (for Horn clauses): Rule: defines relations in terms of other relations (clauses) p ← q, ¬r, s ← B1 , . . . , Bn , Bi ← A1 , . . . , Am ← B1 , . . . , Bi−1 , A1 , . . . , Am , Bi+1 , . . . , Bn Query/Goal: negated fact SLD derivation: a sequence G0 , G1 , . . . and C1 , C2 , . . . ← p (= ¬p) Exercise: Negations have a special meaning: logic not part of the course K & R werkcollege – p. 7/20 S = {R ← T, T, P ← R} Derive P from S using SLD resolution. K & R werkcollege – p. 8/20 First-order logic First-order logic - syntax Allow the representation of entities and their properties, and relations among such entities Constant symbol - names exaclty one entity: a, b, . . . More expressive than propositional logic Functions - any given object is related to exactly one other object by the relation: Cos, Father-of, Plus, . . . Distinguished from propositional logic by its use of quantifiers Each interpretation of first-order logic includes a domain of discourse over which the quantifiers range Variable - refers to generic entities: x, y, z . . . Predicates - resemble a function that returns either true or false: Brother-of, Bigger-than, Has-color, . . . Additionally, it covers predicates Used to represent either a property or a relation between entities Quantifiers - allow the representation of properties that hold for a collection fo objects. Consider a variable x, Existential: ∃x, "there is an x" Universal: ∀x, "for all x" Sufficient for building knowledge-based systems Logical connectives and auxiliary symbols K & R werkcollege – p. 9/20 First-order logic - semantics K & R werkcollege – p. 10/20 First-order logic - semantics A domain of discourse D is defined An interpretation assigns a denotation to elements in the language Each term is assigned an object that it represents, and each sentence is assigned a truth value The domain of discourse D is a nonempty set of entities (of some kind) For instance, one can take D to be the set of integer numbers K & R werkcollege – p. 11/20 The interpretation of a function symbol is a function If D consists of integers, a function symbol f /2 can be interpreted as "+" The interpretation of a constant symbol can be simply identified with an object in D An interpretation may assign the value I(c) = 5 Given an interpretation, a predicate symbol, and n elements of D, one can tell whether the predicate is true according to the given interpretation K & R werkcollege – p. 12/20 Semantics - example Resolution in first-order logic Let D be the domain of natural numbers. Consider the formula ∀x∃yP (x, y) In order to evaluate if this formula is true or false, we need to give the predicate symbol P an interpretation Suppose we interpret P as the < relation, i.e., P (x, y) means "x is less than y" Under this interpretation, the formula above is clearly true Note, however, that this would not be the case if we had, for instance, interpreted P as "greater than" Intuitively, this is how resolution works in first-order logic, All Humans are Mortals Socrates is Human Therefore, Socrates is Mortal More generally, ∀xH(x) → M (x) H(Socrates) Therefore, M (Socrates) To recast the reasoning using the resolution technique, first the clauses must be converted to conjunctive normal form K & R werkcollege – p. 13/20 Clausal form K & R werkcollege – p. 14/20 Skolemisation A clause is a formula of the form When transforming a set of formulae into a set of clauses, existentially quantified variables are replaced by Skolem functions ∀x1 . . . ∀xs (L1 ∨ . . . ∨ Lm ) where each Li is a literal, Li 6= Lj , and x’s are variables occurring in those literals. In this form, all quantification becomes implicit Existentially quantified variables are replaced by the so-called Skolem functions The simplest form of Skolemisation is for existentially quantified variables which are not inside the scope of a universal quantifier. These can simply be replaced by creating new constants E.g., ∃xP (x) can be changed to P (c), where c is a new constant After replacement of all existentially quantified variables, any remaining variables are (implicitly) universally quantified K & R werkcollege – p. 15/20 K & R werkcollege – p. 16/20 Skolemisation (cont.) Skolemisation (cont.) More generally, Skolemisation is performed by replacing every existentially quantified variable y with a term f (x1 , . . . , xn ) whose function symbol f is new What you have is that, ∀x g(x) ∨ ∃yR(x, y) ⇐⇒ ∀x g(x) ∨ R(x, f (x)) x1 , . . . , xn are the variables that are universally quantified and whose quantifiers precede that of y where f (x) is a function that maps x to y . The function f introduced in this process is called a Skolem function "For every x there is a y s.t. R(x, y)" is converted into "There is a function f mapping every x into a y s.t. for every x R(x, f (x)) holds" ∀x1 . . . ∀xn ∃yR(x1 , . . . , xn , y) is satisfied by a model M iff For each possible value for x1 , . . . , xn there is a value for y that makes R(x1 , . . . , xn , y) true By the axiom of choice, there exists a function f s.t. y = f (x1 , . . . , xn ) The formula obtained by this transformation is satisfiable iff the original formula is K & R werkcollege – p. 18/20 K & R werkcollege – p. 17/20 Resolution method in first-order logic Unification Unification algorithm computes, if possible, the substitution which is needed in order to make the given expressions syntatically identical A substitution is a finite set {t1 /x1 , . . . , tn /xn } where each xi is a variable, being xi 6= xj , and each ti is a term not equal to xi Remember: a term is a constant, a variable, or f (t1 , . . . , tn ) (where f is a n-arity function symbol and t1 , . . . , tn are terms) K & R werkcollege – p. 19/20 In summary, this is what occurs, Find two clauses containing the same predicate, where such predicate is negated in one clause but not in the other Perform a unification on the two complementary predicates If the unification fails, you might have made a bad choice of predicates Go back to the previous step and try again Discard the unified predicates, and combine the remaining ones from the two clauses into a new clause, also joined by the or-operator K & R werkcollege – p. 20/20