26
An Introduction to Computational Logic Introduction to Computational Logic 1

An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

  • Upload
    others

  • View
    14

  • Download
    1

Embed Size (px)

Citation preview

Page 1: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

An Introduction to Computational Logic

Introduction to Computational Logic 1

Page 2: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

History: Basic Ideas

FormalizationAristotle (†322 B.C.)

syllogismsSePPeQ

SeQ

CalculizationHerodot (†430 B.C.)

Egyptian stones, abacus

MechanizationHerodot (†430 B.C.)

mechanai

Introduction to Computational Logic 2

Page 3: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

History: Combining the Ideas (1)

Descartes (1596-1650)

geometry

Hobbes (1588-1679)

thinking=

calculating

Leibnitz (1646-1719)

lingua characteristicacalculus ratiocinator

universal encyclopedia

Lullus (1232-1315)

ars magna

Pascal (1623-1662) Leibnitz (1646-1719)

Introduction to Computational Logic 3

Page 4: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

History: Combining the Ideas (2)

DeMorgan (1806-1871)Boole (1815-1864)

propositional logic

Frege(1882)

first order logic“Begriffsschrift”

Whitehead, Russell (1910-1913)

Principia Mathematica

Javins(1869)

evaluatingboolean

expressions

Babbage (1792-1871)

analytical engine

Introduction to Computational Logic 4

Page 5: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

History: Combining the Ideas (3)

Skolem, Herbrand, Godel (1930)

completeness offirst order logic

“Beamten”-logic:F |= G iff G ∈ F

“Hohere Beamten”-logic:F |= G iff F = {G}

Turing (1936)

Turing machine

Zuse (1936-1941)

Z1, Z3

Introduction to Computational Logic 5

Page 6: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

History: Finally, Computers Arrive

von Neumann (1946)

computer

Zuse (1949)

Plankalkul

Turing (1950)

Turing test

Can machines think?

Introduction to Computational Logic 6

Page 7: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

History: Deduction Systems

I early 1950s: Davis: Preßburger arithmetic.

I 1955/6: Beth, Schutte, Hintikka: semantic tableaus.

I 1956: Simon, Newell: first heuristic theorem prover.

I late 1950s: Gilmore, Davis, Putnam:theorem prover based on Herbrand’s “Eigenschaft B Methode”.

I 1960: Prawitz: unification.

I 1965: J.A. Robinson: resolution principle.

I thereafter: improved resolution rules vs. intelligent heuristics.

I 1996: McCune’s OTTER proves Robbin’s conjecture.

I today: TPTP library, yearly CASC competition.

Introduction to Computational Logic 7

Page 8: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

History: Logic Programming

I 1971: A. Colmerauer: System Q Prolog.

brother-of (X, Y )← father-of (Z, X) ∧ father-of (Z, Y ) ∧ male(X).

I 1979: R.A. Kowalski: algorithm = logic + control.

I late-70s to mid-80s: theoretical foundations.

I 1977: D.H.D. Warren: first Prolog compiler.

I 1982: A. Colmerauer: Prolog II constraints.

. Constraint logic programming.

Introduction to Computational Logic 8

Page 9: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

Deduction

I A world without deduction would be a world without science, technology, laws, socialconventions and culture (Johnson–Laird, Byrne: 1991).

I Think about it!

Introduction to Computational Logic 9

Page 10: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

A Simple Example

I ‘Socrates is a human. All humans are mortal. Hence, Socrates is mortal.

Page 11: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

A Simple Example

I ‘Socrates is a human. All humans are mortal. Hence, Socrates is mortal.

human(socrates)(forall X) (if human(X) then mortal(X))mortal(socrates)

Page 12: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

A Simple Example

I ‘Socrates is a human. All humans are mortal. Hence, Socrates is mortal.

human(socrates)(forall X) (if human(X) then mortal(X))mortal(socrates)

h(s)(∀X) (h(X)→ m(X))m(s)

Page 13: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

A Simple Example

I ‘Socrates is a human. All humans are mortal. Hence, Socrates is mortal.

human(socrates)(forall X) (if human(X) then mortal(X))mortal(socrates)

h(s)(∀X) (h(X)→ m(X))m(s)

I 5 is a natural number. All natural numbers are integers. Hence, 5 is an integer.

Introduction to Computational Logic 10

Page 14: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

The Addition of Natural Numbers

I The sum of zero and the number Y is Y. The sum of the successor of the number Xand the number Y is the successor of the sum of X and Y.

. Are you willing to conclude from these statementsthat the sum of one and one is two?

Page 15: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

The Addition of Natural Numbers

I The sum of zero and the number Y is Y. The sum of the successor of the number Xand the number Y is the successor of the sum of X and Y.

. Are you willing to conclude from these statementsthat the sum of one and one is two?

0 + Y = Y

s(X) + Y = s(X + Y )s(0) + s(0) = s(s(0))

Page 16: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

The Addition of Natural Numbers

I The sum of zero and the number Y is Y. The sum of the successor of the number Xand the number Y is the successor of the sum of X and Y.

. Are you willing to conclude from these statementsthat the sum of one and one is two?

0 + Y = Y

s(X) + Y = s(X + Y )s(0) + s(0) = s(s(0))

. Are you willing to conclude that addition is commutative?

Page 17: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

The Addition of Natural Numbers

I The sum of zero and the number Y is Y. The sum of the successor of the number Xand the number Y is the successor of the sum of X and Y.

. Are you willing to conclude from these statementsthat the sum of one and one is two?

0 + Y = Y

s(X) + Y = s(X + Y )s(0) + s(0) = s(s(0))

. Are you willing to conclude that addition is commutative?

0 + Y = Y

s(X) + Y = s(X + Y )X + Y = Y + X

Page 18: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

The Addition of Natural Numbers

I The sum of zero and the number Y is Y. The sum of the successor of the number Xand the number Y is the successor of the sum of X and Y.

. Are you willing to conclude from these statementsthat the sum of one and one is two?

0 + Y = Y

s(X) + Y = s(X + Y )s(0) + s(0) = s(s(0))

. Are you willing to conclude that addition is commutative?

0 + Y = Y

s(X) + Y = s(X + Y )X + Y = Y + X

Introduction to Computational Logic 11

Page 19: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

Applications

I Functional equivalence of two chips.

I Verification of hard- and software.

I Year 2000 problem.

I Eliminating redundancies and proving properties of group communication systems.

I Designing the layout of yellow pages.

I Managing a tunnel project.

I Natural language processing.

I Cognitive Robotics.

I Semantic web (description logics).

I Law.

I Optimization Problems.Logic is Everywhere

Introduction to Computational Logic 12

Page 20: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

A Simple Description Logic – Concept Definitions

person(X) → sex(X) ≈ male ∨ sex(X) ≈ female

adult(X) → person(X)woman(X) ↔ person(X) ∧ sex(X) ≈ female

man(X) ↔ person(X) ∧ sex(X) ≈ male

parent(X) ↔ person(X) ∧ (∃Y ) (child(X, Y ) ∧ person(Y ))mother(X) ↔ parent(X) ∧ sex(X) ≈ female

grandparent(X) ↔ person(X) ∧ (∃Y ) (child(X, Y ) ∧ parent(Y ))grandmother(X) ↔ grandparent(X) ∧ sex(X) ≈ female

Page 21: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

A Simple Description Logic – Concept Definitions

person(X) → sex(X) ≈ male ∨ sex(X) ≈ female

adult(X) → person(X)woman(X) ↔ person(X) ∧ sex(X) ≈ female

man(X) ↔ person(X) ∧ sex(X) ≈ male

parent(X) ↔ person(X) ∧ (∃Y ) (child(X, Y ) ∧ person(Y ))mother(X) ↔ parent(X) ∧ sex(X) ≈ female

grandparent(X) ↔ person(X) ∧ (∃Y ) (child(X, Y ) ∧ parent(Y ))grandmother(X) ↔ grandparent(X) ∧ sex(X) ≈ female

person v sex : (male t female)adult v person

woman = person u sex : female

man = person u sex : male

parent = person u ∃child : person

mother = parent u sex : femalegrandparent = person u ∃child : parent

grandmother = grandparent u sex : female

Introduction to Computational Logic 13

Page 22: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

A Simple Description Logic – Assertions and Services

I Concept Definitions:

person(X) → sex(X) ≈ male ∨ sex(X) ≈ female

adult(X) → person(X)woman(X) ↔ person(X) ∧ sex(X) ≈ female

man(X) ↔ person(X) ∧ sex(X) ≈ male

parent(X) ↔ person(X) ∧ (∃Y ) (child(X, Y ) ∧ person(Y ))mother(X) ↔ parent(X) ∧ sex(X) ≈ female

grandparent(X) ↔ person(X) ∧ (∃Y ) (child(X, Y ) ∧ parent(Y ))grandmother(X) ↔ grandparent(X) ∧ sex(X) ≈ female

I Assertions:parent(carl), parent(conny), woman(conny)child(conny, joe), child(conny, carl)sex(joe) ≈ male, sex(carl) ≈ male

I Reasoning services provide answers to questions like:

. Is each grandparent a parent?

. Is Conny a grandmother?

Introduction to Computational Logic 14

Page 23: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

Solving Sudoku Puzzles

I Specify Sudoku puzzles as propositional satisfiability (SAT) problems.

I Read a Sudoku puzzle.

I Translate the puzzle into a SAT-problem.

I Transform the SAT-problem into conjunctive normal form.

I Select/Design/Modify a SAT-solver including preprocessing steps.

I Translate the answer generated by the SAT-solver into a “nice” form.

I Print the solution.

I There will be a lecture/practical course in the next summer term.

Introduction to Computational Logic 15

Page 24: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

Some Background Literature

I L. Chang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving.Academic Press, New York (1973).

I M. Fitting: First–Order Logic and Automated Theorem Proving.Springer Verlag. Berlin, second edition (1996).

I J. Gallier: Logic for Computer Science: Foundations of Automated Theorem Proving.Harper and Row. New York (1986).

I S. Holldobler: Logik und Logikprogrammierung.Synchron Publishers GmbH, Heidelberg (2001).

I D. Poole and A. Mackworth and R. Goebel:Computational Intelligence: A Logical Approach.Oxford University Press, New York, Oxford (1998).

I S. Russell and P. Norvig: Artificial Intelligence.Prentice Hall, Englewood Cliffs (1995).

I U. Schoning: Logik fur Informatiker.Spektrum Akademischer Verlag (1995).

Introduction to Computational Logic 16

Page 25: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

Module Foundations

I Two lectures:

. Logic

. Science of Computational Logic

I Logic is offered from now until the end of November.

I Science of Computational Logic is offered from beginning of Decemberuntil end of the lecturing period.

I Exact dates will be announced later.

I Common written exam in the examination period following the lecturing period.

Introduction to Computational Logic 17

Page 26: An Introduction to Computational LogicChang and R.C.T. Lee: Symbolic Logic and Mechanical Theorem Proving. Academic Press, New York (1973). IM. Fitting: First–Order Logic and Automated

Logic

I Agenda

. Introduction

. Propositional Logic

. First Order Logic

I Exercises

. Exercises are announced each week.

. 3 students may form a group.

. Solutions are to be turned in a week later.

. Solutions will be corrected.

. 10% of the final mark will be given based on performance in the exercises.

. In the tutorial students discuss their solutions to exercises.

I More details including the exercises can be found on our web pages.

I Ask questions as soon as they arise, anywhere and at anytime.

I Don’t except a situation, where you do not understand everything.

Introduction to Computational Logic 18