29.08.2013 Views

Logic in Computer Science - Liacs

Logic in Computer Science - Liacs

Logic in Computer Science - Liacs

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ϕ ⇒ φ<br />

ϕ<br />

φ<br />

<strong>Logic</strong> <strong>in</strong> <strong>Computer</strong> <strong>Science</strong><br />

Introduction<br />

Marcello Bonsangue<br />

Spr<strong>in</strong>g 2013


What is <strong>Logic</strong>?<br />

<strong>Logic</strong> from the Greek λογικη<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 2<br />

If it was so, it might be,<br />

and if it were so, it would be;<br />

but as it isn’t, it a<strong>in</strong>’t.<br />

That’s logic!<br />

Lewis Carol – via Tweedledee <strong>in</strong><br />

Through the look<strong>in</strong>g glass<br />

The tool for dist<strong>in</strong>guish<strong>in</strong>g between the true and the false (Averroes).<br />

The science of the most general laws of truth (Gottlob Frege)<br />

The study of the formal pr<strong>in</strong>ciples of reason<strong>in</strong>g (Webster dictionary)<br />

The analysis and appraisal of arguments (Wikipedia)<br />

1/22/2013<br />

2


Trivium (three ways)<br />

Preparatory study at medieval university<br />

Grammar, the art of comb<strong>in</strong><strong>in</strong>g symbols to express thought<br />

<strong>Logic</strong>, the art of th<strong>in</strong>k<strong>in</strong>g<br />

Rhetoric, the art of communicat<strong>in</strong>g thought<br />

to be studied before quadrivium<br />

Arithmetic, geometry, music, and astronomy<br />

Simpler, thus … trivial !<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 3<br />

1/22/2013<br />

3


The four ages of <strong>Logic</strong><br />

Symbolic logic (500 b.C. – 19 th century)<br />

Algebraic logic (mid – late 19 th century)<br />

Mathematical logic (late 19 th – mid 20 th century)<br />

<strong>Logic</strong> <strong>in</strong> computer science (late 20 th century – )<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 4<br />

1/22/2013<br />

4


The orig<strong>in</strong> of logic<br />

Plato: what is that can properly<br />

be called true or false?<br />

In formal debate sophists used<br />

rules to determ<strong>in</strong>es who had<br />

won an argument<br />

<strong>Logic</strong> dealt with arguments <strong>in</strong> natural language used<br />

by humans<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 5<br />

1/22/2013<br />

5


Ambiguities and paradoxes<br />

All or one?<br />

Eric does not believe that Mary can pass any test.<br />

Different mean<strong>in</strong>gs<br />

Students hate annoy<strong>in</strong>g professors<br />

Paradox<br />

This sentence is a lie<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 6<br />

1/22/2013<br />

6


Symbolic logic<br />

Aristotele’s syllogism (350 b.C.)<br />

Major premise: All men are mortal.<br />

M<strong>in</strong>or premise: Socrates is a man.<br />

Conclusion: Socrates is mortal.<br />

Bacon (17 th century)<br />

Not deduction, but <strong>in</strong>duction should be used for draw<strong>in</strong>g<br />

generalized conclusions from axioms or observations<br />

Kant (18 th century)<br />

<strong>Logic</strong> is the one completed science, and Aristotelian logic<br />

<strong>in</strong>cluded everyth<strong>in</strong>g about logic there is to know.<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 7<br />

1/22/2013<br />

7


The four ages of <strong>Logic</strong><br />

Symbolic logic (500 b.C. – 19 th century)<br />

Algebraic logic (mid – late 19 th century)<br />

Mathematical logic (late 19 th – mid 20 th century)<br />

<strong>Logic</strong> <strong>in</strong> computer science (late 20 th century – )<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 8<br />

1/22/2013<br />

8


Algebraic <strong>Logic</strong><br />

Leibniz's dream (1680): comb<strong>in</strong><strong>in</strong>g symbolic logic,<br />

mathematics and philosophy.<br />

Formulate logic us<strong>in</strong>g a mathematical language<br />

Ideas are composed from very few simple ones us<strong>in</strong>g few<br />

comb<strong>in</strong>ators like conjunction, negation, …<br />

Boole and De Morgan (end 17 th century)<br />

Study of properties of conjunction, negation … of symbols<br />

<strong>in</strong> analogy to multiplication, subtraction of numbers<br />

a(b + c) = (ab) + (ac) a∩ (b ∪ c) = (a ∩ b) ∪ (a ∩ c)<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 9<br />

1/22/2013<br />

9


Algebraic <strong>Logic</strong><br />

Dodgson (Lewis Carol) (1860)<br />

Venn’s diagrams as a visualization of sets<br />

Schröder's “The algebra of <strong>Logic</strong>” (1890)<br />

<strong>Logic</strong> is calculat<strong>in</strong>g discipl<strong>in</strong>e, a scientific universal<br />

language that looks more like a sign language than like a<br />

sound language.<br />

<strong>Logic</strong> become a useful tool to resolve many serious<br />

problems <strong>in</strong> mathematics<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 10<br />

1/22/2013<br />

10


The four ages of <strong>Logic</strong><br />

Symbolic logic (500 b.C. – 19 th century)<br />

Algebraic logic (mid – late 19 th century)<br />

Mathematical logic (late 19 th – mid 20 th century)<br />

<strong>Logic</strong> <strong>in</strong> computer science (late 20 th century – )<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 11<br />

1/22/2013<br />

11


Mathematical logic<br />

Mathematics become complex … and ambiguous<br />

Cauchy (1820): <strong>in</strong>f<strong>in</strong>ite sum of cont<strong>in</strong>uous function is<br />

cont<strong>in</strong>uous<br />

Abel (1826): counterexample!<br />

Frege (1879) proposes a new logic with quantifiers as<br />

a language for mathematics to resolve ambiguities<br />

more powerful than Aristotelian (propositional) logic<br />

Weierstrasse (ε,δ) def<strong>in</strong>ition of limits and cont<strong>in</strong>uity<br />

Peano axiomatization of natural numbers<br />

Hilbert axiomatization of geomtery<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 12<br />

1/22/2013<br />

12


The golden age<br />

Cantor set theory, <strong>in</strong>f<strong>in</strong>ity of <strong>in</strong>f<strong>in</strong>ities, transf<strong>in</strong>ite numbers<br />

Mathematics is apart from physical phenomena<br />

The absolute <strong>in</strong>f<strong>in</strong>ity nature of God is challenged<br />

Hilbert’s program (1920)<br />

F<strong>in</strong>itary logic is the language of mathematics<br />

Completeness: all true mathematical statements should be<br />

proved <strong>in</strong> this logic<br />

Consistency: no contradiction can be obta<strong>in</strong>ed <strong>in</strong> this logic<br />

Decidability: there should be an algorithm for decid<strong>in</strong>g<br />

theorems.<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 13<br />

1/22/2013<br />

13


The Russell paradox<br />

Cantor set theory is <strong>in</strong>consistent (1901)<br />

If T = { x | x ∉ x } then x ∈ x ⇔ x ∉ x<br />

Russel and Whitehead Pr<strong>in</strong>cipia Mathematica (1919):<br />

Solution by us<strong>in</strong>g a hierarchy of sets (type theory)<br />

Sets of a given type can conta<strong>in</strong> sets of preced<strong>in</strong>g types (those<br />

lower <strong>in</strong> the hierarchy), thus prevent<strong>in</strong>g loops.<br />

Zermelo-Fraenkel axiomatic set theory (1922)<br />

Set theory as foundation of mathematics<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 14<br />

1/22/2013<br />

14


Mathematics is more than sets<br />

Cont<strong>in</strong>uum Hypothesis (CH)<br />

There is no set between the Integers and the Reals<br />

Axiom of choice (AC)<br />

It is always possible to select an element from each non- nonempty<br />

set of an <strong>in</strong>f<strong>in</strong>ite collection of sets.<br />

Goedel (1930) and Cohen (1960)<br />

Assum<strong>in</strong>g or not either CH or AC does not give a<br />

contradiction <strong>in</strong> ZF set theory<br />

There are mathematical statements that are <strong>in</strong>dependent<br />

from set theory<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 15<br />

1/22/2013<br />

15


The end of Hilbert’s program<br />

Goedel (1931)<br />

If a logic is strong enough to form statement about itself,<br />

then it cannot be complete<br />

It is impossible to prove consistency of arithmetic with<strong>in</strong> any<br />

formal theory of arithmetic<br />

Church (1936), Tur<strong>in</strong>g (1937), Post (1946)<br />

There are problems that no algorithm<br />

could ever solve<br />

<strong>Logic</strong> is not the ultimate foundation of mathematics,<br />

simply another branch of it<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 16<br />

1/22/2013<br />

16


The four ages of <strong>Logic</strong><br />

Symbolic logic (500 b.C. – 19 th century)<br />

Algebraic logic (mid – late 19 th century)<br />

Mathematical logic (late 19 th – mid 20 th century)<br />

<strong>Logic</strong> <strong>in</strong> computer science (late 20 th century – )<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 17<br />

1/22/2013<br />

17


<strong>Computer</strong> <strong>Science</strong> started as <strong>Logic</strong><br />

Outcome of Hilbert’s program<br />

Formalization of algorithm (Church, Tur<strong>in</strong>g)<br />

Stored-program computers (Tur<strong>in</strong>g mach<strong>in</strong>e, von Neumann)<br />

Functional programm<strong>in</strong>g (Church λ-calculus)<br />

Type theory (Russell, Whitehead, Church)<br />

Recursive function theory (Goedel, Church, Tur<strong>in</strong>g, Kleene,<br />

Post)<br />

Automata theory<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 18<br />

1/22/2013<br />

18


<strong>Computer</strong> <strong>Science</strong> and <strong>Logic</strong><br />

<strong>Computer</strong> <strong>Science</strong> = design and study of<br />

computational systems via formal languages<br />

<strong>Logic</strong> = formal language to study properties of<br />

mathematical structures<br />

<strong>Logic</strong> is the calculus of computer science<br />

<strong>Logic</strong> has been more effective <strong>in</strong> computer science<br />

than it has been <strong>in</strong> mathematics<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 19<br />

1/22/2013<br />

19


<strong>Logic</strong> and system verification<br />

Model check<strong>in</strong>g<br />

Spec<br />

Model<br />

Program verification<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 20<br />

Spec<br />

System<br />

Model checker<br />

Yes!<br />

No<br />

Yes!<br />

No: counterexample<br />

1/22/2013<br />

20


<strong>Logic</strong> and programm<strong>in</strong>g languages<br />

Type theory<br />

Program semantics<br />

Rewrit<strong>in</strong>g systems<br />

Functional programm<strong>in</strong>g<br />

<strong>Logic</strong> and constra<strong>in</strong>t programm<strong>in</strong>g<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 21<br />

1/22/2013<br />

21


<strong>Logic</strong> and databases<br />

Query languages (SQL)<br />

Based on first-order logic<br />

Query evaluation<br />

Based on relational algebra<br />

XML Data Type Def<strong>in</strong>ition<br />

Based on tree automata<br />

XML queries<br />

Based on tree transducers<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 22<br />

1/22/2013<br />

22


<strong>Logic</strong> and ….<br />

Artificial <strong>in</strong>telligence<br />

Computational complexity<br />

Hardware circuits<br />

Security<br />

…<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 23<br />

1/22/2013<br />

23


<strong>Logic</strong> from computer science<br />

<strong>Logic</strong>s on f<strong>in</strong>ite structures<br />

Fixpo<strong>in</strong>t logics, modal and temporal logics<br />

Description logics, non-monotonic logic<br />

Connections between logic and automata<br />

Co<strong>in</strong>duction, coalgebra, bisimulation<br />

<strong>Logic</strong> a - Spr<strong>in</strong>g 2011<br />

Slide 24<br />

1/22/2013<br />

24


Reference<br />

Moshe Vardi A Brief History of <strong>Logic</strong>, 2003.<br />

PenC - Spr<strong>in</strong>g 2006<br />

Slide 25<br />

1/22/2013<br />

25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!