A brief Introduction to Automated Theorem Proving

33
A brief Introduction to Automated Theorem Proving Theoretical Foundations, History and the Resolution Calculus for classical First-order Logic Uwe Keller

description

A brief Introduction to Automated Theorem Proving. Theoretical Foundations, History and the Resolution Calculus for classical First-order Logic Uwe Keller. Content. Intoduction Motivation & History Theorem Proving, ATP and Calculi Foundations FOL, Normalforms & Preprocessing, Metaresults - PowerPoint PPT Presentation

Transcript of A brief Introduction to Automated Theorem Proving

Page 1: A brief Introduction to Automated Theorem Proving

A brief Introduction to Automated Theorem Proving

Theoretical Foundations, History and the Resolution Calculus for classical First-order Logic

Uwe Keller

Page 2: A brief Introduction to Automated Theorem Proving

Content Intoduction

Motivation & History Theorem Proving, ATP and Calculi

Foundations FOL, Normalforms & Preprocessing, Metaresults

Resolution Basic calculus, Unification Refinements, Redundancy Decision procedures

Chain Resolution A Variant of Resolution for the Semantic Web

Demo

Page 3: A brief Introduction to Automated Theorem Proving

Part I:Introduction

Motivation & History Theorem Proving, ATP and Calculi

Page 4: A brief Introduction to Automated Theorem Proving

Modelling(automated)

Deduction

Logic and Theorem Proving

Real-world descriptionin natural language.Mathematical ProblemsProgram + Specification

Syntax (formal language).First-order Logic, Dynamic Logic, …

Valid Formulae

Provable Formulae

Formalization

Semantics(truth function)

Calculus(derivation / proof)

Correctness

Completeness

Page 5: A brief Introduction to Automated Theorem Proving

How did it start … Results from first-half of the 20th century in

mathematical logic showed … we can do logical reasoning with a limited set of simple

(computable) rules in restricted formal languages like First-order Logic (FOL)

That means computers can do reasoning!

Implementation of ATP First: Computers where needed :- ) AI as a prominent field: Reasoning as a basic skill! Mid 1950‘s first attempts to implement an ATP

Today (A)TP is no longer only a part of main stream AI Central shared problem: How to represent and search

extremely large search spaces!

Page 6: A brief Introduction to Automated Theorem Proving

A rough timeline in ATP … before 1950: Proof-theoretic Work by Skolem, Herbrand, Gentzen and Schütte 1954: First machine-generated Proof (Davis) 1955ff: Semantic Tableaus (Beth, Hinitkka) 1957: First machine-generated Proof in Logic Calculus (Newell & Simon) 1957: Lazy substitution by free (dummy) Vars (Kanger, Prawitz) 1958: First prover for Predicate Logic (Prawitz) 1959: More provers (Gilmore, Wang) 1960: Davis-Putnam Procedure (Davis, Putnam, Longman) 1963: Unification (J.A. Robinson) 1963ff: Resolution (J.A. Robinson); Inverse Method (Maslov) 1963ff: Modern Tableau Method (Smullyan, Lis) without Unification 1968: Modelelimination (Loveland), with Unification 1970ff: PROLOG (Colmerauer, Kowalski), Refinements of Resolution 1971: Connection Method (Bibel), Matings (Andrews) with Unification 1985: ATP in non-classical logics, Renaissance of Tableaux Methods 1987: Tableaus with Unification 1993ff: Renewed interest in Instance-based Methods: DPLL, Modelevolution …

Page 7: A brief Introduction to Automated Theorem Proving

Theorem Proving Given

a formal language (or logic) L a calculus C for this language (= set of rules) a conjecture S and a set of assumptions or axioms A in the

language L

Determine Can we construct a proof for S (from A) in calculus C?

Logic = Syntax + Semantics + Calculus TP = Proof-search in C (Huge search problem)

Correctness and completeness of Calculi essential properties

Calculus = Non-deterministic Algorithm Central problem in ATP: How to implement a non-deterministic

algorithm „efficiently“ on a deterministic machine :- )

Page 8: A brief Introduction to Automated Theorem Proving

Theorem Proving (II) Research areas

Interactive / tactic TP vs. Automated TP Classical Logic vs. Non-classical logics

Calculi for … ATP - General principle: Refutation

Resolution, Tableau, Inverse Method, Instance-based Methods ITP – General principle: Proof situation / context

Sequent Calculi others – General principle: Generation from Axioms

Hilbert-style Calculi Central difference:

What are the elements in a proof & what is a proof?

Page 9: A brief Introduction to Automated Theorem Proving

Main TP Applications Main Applications

Software & Hardware Verification Theorem proving in Mathematics Query answering in rich knowledge bases (Ontologies) Verification of cryptographic protocols Retrieval of Software Components Reasoning in non-classical Logics Program synthesis …

… many systems implemented ATP: Vampire, Otter, Spass, E-SETHEO, Darwin, Epilog,

SNARK, Gandalf … ITP: Isabelle/HOL, Coq, Theorema, KeY-Prover …

Page 10: A brief Introduction to Automated Theorem Proving

Why is FOL of special interest in the ATP community ? There are less & more expressive logics than FOL

Classical Propositional Logic, Modal Propositional Logic, Description Logics, Temporal Propositional Logic

Higher-order Predicate Logics, Dynamic Predicate Logics, Type Theory

Research in ATP mainly focused on FOL FOL is very expressive, many real-world problems can be

formalized in FOL FOL turned out to be the most expressive logic that one can

adequately approach with ATP techniques

Page 11: A brief Introduction to Automated Theorem Proving

Example … Theorem in (elementary) Calculus

Nullstellensatz: Every function which is continous over a closed interval I=[a,b] must take the value 0 somewhere in I if f(a) <= 0 and f(b) >= 0

Proof idea: Consider the Supremum l of set M = {x : f(x) <= 0, a<=x<=b} and show that f(l) = 0

Page 12: A brief Introduction to Automated Theorem Proving

Example (II) … Formalization

Compact (only LEQ) Redundancy-free Specific definitions

Continous functions Main idea of proof

is already encoded Use Supremum

Can be done by anATP system

… but without properFormalization ?!?

ATP better than humanprover? Robbins Problem in Algebra

Intelligent Proving vs.Combinatorical proving

Page 13: A brief Introduction to Automated Theorem Proving

Part II:Foundations

FOL, Normalforms & Preprocessing, Metaresults

Page 14: A brief Introduction to Automated Theorem Proving

Classical First-order Logic (FOL) Syntax

Signature § Function Symbols, Predicate Symbols, Arity, logical

Connectives, Quantors Terms (over §), Atomic Formulae (over §), Formluae (over §) Definition relative to the signature § of the predicate logic

Semantics First-order structure / interpretation S = (U,I)

Universe U + Signature-Interpretation I Constants I(c) = element of U Functionsymbols I(f) = total functions on U Relationsymbols I(R) = relation on U Logical connectives and quantors in the usual way

Definition relative to the signature § of the predicate logic

Page 15: A brief Introduction to Automated Theorem Proving

Classical FOL (II) Model of a statement

An interpretation S = (U,I) is called a model of a statement s iff valS(s) = t

What does it mean to infer a statement from given premisses? Informally: Whenever our premisses P hold it is the case that the

statement holds as well Formally: Logical Entailment

For every interpretation S which is a model of P it holds that S is a model of S as well

Special case: Validity – Set of premisses is empty Logical entailment in a logic L is the (semantic) relation that a

calculus C aims at formalizing syntactically (by means of a derivability relation)!

Logical entailment considers semantics (Interpretations) relative to a set of premisses or axioms!

Page 16: A brief Introduction to Automated Theorem Proving

Normal Forms What is a normal form? Why are they interesting?

Relation to ATP? Conversion of input to a specifc NF my be required by a calculus (e.g.

Resolution) ) Preprocessing step ATP in a sense can be seen as a conversion in a NF itself, borderline is

fuzzy in a sense

Normalforms in FOL Negation Normal Form Standard Form Prenex Normal Form Clause Normal Form (in a sense a „logic free“ form)

There are logics where certain NF do not exist, like CNF in a Dynamic First-order Logic Certain calculi then can not be applied in these logics!

Page 17: A brief Introduction to Automated Theorem Proving

Negation Normal Form A formula is in Negation NF (NNF) iff. it contains no implication and no

bi-implication symbols and all negation symbols occur only as part of a literal (directly in front of atomic formulae)

How to achieve this NF ? Replace implication and bi-implication by their definition (in terms of Æ and

Ç) Move negation symbols inside to atomic formulae

De Morgan laws Dualize quantifiers when moving negation symbols over a quantor Eliminate multiple negations

All these syntactical transformations generate semantically equivalent formulae

Example

Page 18: A brief Introduction to Automated Theorem Proving

Standard Form A formula A is in Standard Form if no variable x in A occurs

both bound and free and no bound variable is used as a quantor variable for multiple subformulae

How to generate this NF? Bounded renaming of quantor variables and the respective

occurrences Transformed formulae is semantically equivalent to original one

Example (8 x P(x) Æ Q(z)) ! (9 x R(x) Ç 9 z (P(z) Æ Q(z)))

Page 19: A brief Introduction to Automated Theorem Proving

Prenex Normal Form A formula A is in Prenex NF iff. it is of the form

A = Q1x1 … Qnxn B where Qk is a universal or existential quantor and B contains no quantors. B is called the Matrix of A

How to construct this NF? Transform A in NNF and Standard Form Move iteratively outermost quantor to the outside until it reaches

another quantor. Quantors may not cross quantors of different sort (in-scope relation between quantor occurrences may not be changed)

This transformation generates a formulae which is logically equivalent to the original one.

Example

Page 20: A brief Introduction to Automated Theorem Proving

Clause Normal Form A formula A is in Clause NF iff. it is in PNF, closed, the prefix only

contains universal quantors and the Matrix is on conjunctive normal form.

In other words: A = 8 x1 … 8 xn ( (L1,1 Ç … Ç L1,m1) Æ … Æ (Lk,1 Ç … Ç

Lk,mk)) where Li,j is a literal (negated or positive atomic formula)

How to construct this NF? Transform A in NNF and Standard Form Transform result in PNF Remove existential quantors by Skolemization (Function terms) Apply Distributivity laws to convert Matrix of the result in conjuntive normal

form (conjunction of discjunction of literals) This transformation results in a formula which is not logically equivalent, but

it is satisfiability-preserving (which is enough for the ATP methods later)

Example

Page 21: A brief Introduction to Automated Theorem Proving

Clause Normal Form (II) A formula A is in Clause NF can be written as A = 8 x1 … 8 xn ( (L1,1 Ç … Ç L1,m1

) Æ

… Æ (Lk,1 Ç … Ç Lk,mk)) where Li,j is a literal (negated or positive atomic formula)

Since every formula can be transformed into CNF, the CNF can be seen as „logic free“ representation of a formulae All quantors are universal, no free variables are allowed -> drop quantors Matrix is in CNF = Conjunction of Disjunction of Literals -> Model as a Set of Sets of

Literals Example

The sketched transformation to CNF is not optimal Exponential blowup possible (already for NNF) Syntactical structure of the original formula gets lost Skolemsymbols have unnecessarily many parameters Unnecessarily many new skolem systems are introduced

One can improve all these aspects of a transformation to CNF! Skolemization before PNF transformation, Definitorial CNF for Matrix, Reuse of Skolem

functions

Page 22: A brief Introduction to Automated Theorem Proving

Metaresults Metaresult = Property of a Logic L Here some metaresults for FOL which form the

theoretical foundation of ATP (carry over to many other logics as well)

Deduction Theorem If M [ s ² s‘ then M ² s‘ ! s Logical entailment can be reduced to validity

Proof by contradiction If M is a set of closed formulae then

M ² s iff. M [ {¬s} is unsatisfiable (i.e. has no model) Logical entailment can be reduced to unsatisfiability checking Refutation can be used as a universal principle for inference in FOL

Page 23: A brief Introduction to Automated Theorem Proving

Metaresults (II) Complexity of logical entailment, validity and

satisfiability

Propositional Logic Logical entailment (²-relation) is decidable, Satisfiability too Set of valid formulae is co-NP-complete Set of satisfiable formulae is NP-complete

First-order Predicate Logic Logical entailment / validity / satisfiability is undecidable Set of valid formulae is semi-decidable (recursively enumerable) Set of satisfiable formulae is not recursively enumerable

Page 24: A brief Introduction to Automated Theorem Proving

Metaresults (III) Term Interpretations and Herbrand Theorem

S = (U,I) is term-interpretation if U = Term0

Let Term0 be non-empty. An interpretation S = (U,I) is called

Herbrand-Interpretation if S is term-interpretation and I(f)(t1,…,t

) = f(t

,…,t

) for all n-ary function symbols f 2 and

ground terms t,…,t

Herbrand-Modell of s is Herbrand-Intp. I with I ² s

Herbrand-Interpretations are special because they have a simple universe (syntactical) and Terms are basically uninterpreted. Quantifiers then have ground terms as their range!

Computers can deal with such special (syntactical) interpretations, but not with interpretations in general!

Page 25: A brief Introduction to Automated Theorem Proving

Metaresults (IV) Term Interpretations and Herbrand Theorem

Let M be a set of closed formulae s in Prenex-Normalform that contain no existential quantors (for instance s in CNF)

Let T be a set of terms (over signature T(M) := set of T-instances of M, i.e. replace every occurence of a

(universal) variable in any formulae in M with any term in T

Herbrand Theorem Let Term0

be non-empty and M a set of formulae in Prenex-NF without existential quantors.

Then the following statements are equivalent M has a model M has a Herbrand-model Term0

(M) has a model The last set is a set of formulae in propositional logic

Page 26: A brief Introduction to Automated Theorem Proving

Metaresults (V) Compactness of FOL

A (possibly infinite) set M of formulae has a model iff every finite subset M‘ ½ M has a model (i.e. is satisfiable)

Combining Compactness with Herbrand‘s Theorem Let Term0

be non-empty and M a set of formulae in Prenex-NF without existential quantors.

Then M is unsatisfiable iff. T(M) is unsatisfiable for a finite set of ground terms T ½ Term0

Note that T is a finite set of ground terms over the signature of the formula set M

No „external“ functions symbols have to be considered! Allows for using guided substitutions (Unification!)

Page 27: A brief Introduction to Automated Theorem Proving

Metaresults (VI) That means: logical entailment / validity can be checked

by reduction to unsatisfiabiliy of a set of formulae M‘ which can done by finding suitable finite (counter)-

examples for the quantfied variables such that a contradiction arises

One can only use the Signature of the given set M‘ to find the counterexamples

Basically this is what all ATP procedures do: Find a finite set of counterexamples (objects) such that a the instance of the orginial set is determined as being

The theorem immediately gives an algorithm for ATP! Problem: How to construct / find T in the theorem in

a clever way?

Page 28: A brief Introduction to Automated Theorem Proving

Part III:The Resolution Calculus

Pre-resolution phase: Gilmore‘s Methods, Davis-Putnam Procedure

Unification Basic Resolution Calculus Refinements, Redundancy Decision procedures

Page 29: A brief Introduction to Automated Theorem Proving

Pre-Resolution period: Gilmore‘s Method

Page 30: A brief Introduction to Automated Theorem Proving

Pre-Resolution period:Davis-Putnam Procedure

Page 31: A brief Introduction to Automated Theorem Proving

A Revolution in ATP: Robinson‘s Resolution Principle

Page 32: A brief Introduction to Automated Theorem Proving

Part IV:Chain Resolution

A Variant of Resolution for the Semantic Web

Page 33: A brief Introduction to Automated Theorem Proving

Part IV:Demo

assisted by a Resolution-based ATP System: VAMPIRE