Professional Documents
Culture Documents
Neil D. Jones
DIKU 2005 Supplementary notes: see web page Some slides today based on Nils Andersens (from 2004)
ROLES OF LOGIC
Descriptive Propositional logic, e.g., circuits Predicate logic, e.g., theorems Temporal logic, e.g., protocols, systems Analysis Test freedom from errors, race conditions,. . . Test other well-behavedness, e.g., of code from WWW Test correctness with respect to specications Test equivalence, e.g., of circuits Synthesis Transformation: Specication Implementation Formal reasoning, proofs Values T, F or 0, 1 Values from a set, e.g., N Mainly control ow
LOGIC IN ANTIQUITY
The science of inferring correctly. Some conclusions only depend on the form of the argument and not on the actual contents. Doesnt deal with how humans think (psychology) or whether the statements actually agree with facts (theory of knowledge). Socrates (approx. 469399), Plato (427347), Aristotle (384322). All M are P All S are M All S are P Syllogisms Four kinds of statements: All/Some . . . are/are not . . . two premises, a conclusion (256 modes, 19 (15) valid ones).
5
LOGIC SYSTEMS
Formalism. A game with symbols The actual (or imagined) world
Logic Philosophy, Logic Mathematics. Circularity? Mathematics used in logic, but logic used in (or even founding?) mathematical reasoning. Desirable properties of a formal system: suciency (expressibility): Has formulas for the items that interest us. necessity : No superuous symbols or notions. consistency : Two contradictory statements never concluded. soundness : Only true statements concluded. completeness : All true statements concluded. decidability : Checkable if a statement is concluded or not.
6
computable!
Engineering
$ * & ' HH % HH H HH H $ HH H ' HH j H
'
model in the
-
sense of science %
model in the
sense of logic % |=
Left side: scientic experiments, measurements, what is out there? Purpose: analytic, to understand nature. Right side: specications to dene what is to be done! Purpose: synthetic, to construct systems.
8
Completeness: |= implies
Propositional logic: is equivalent to |=, but nontrivial (in spite of the simplicity of truth tables). Reason: SAT is NP-hard. Predicate logic: is equivalent to |=. However
and |= are undecidable. Further, G odel proved equivalence on universal models, but G odel also proved that is weaker than |= for arithmetic (the natural numbers)
Model checking via temporal logic: Weaker than Predicate logic (formulas have no variables) Stronger in another way (temporal operator like Finally)) There are several dierent temporal logics Designed so that equals |=
PROPOSITIONAL LOGIC
Judgements formed with propositional variables p, q, r, p1, . . ., and operators: Negation , , Disjunction Classically exclusive (lat. aut . . . aut . . . ), now always inclusive (lat. vel . . . vel . . . ), v , , + Conjunction & , , , Implication , < , , Absurdity, contradiction 0, F, , , (bottom) Priorities: binds tighter than {, }, We dont decide on a priority between and .) Other logical operators: Exclusive disjunction +, . Equivalence =, , , . Tautology 1, T, ,
11
NATURAL DEDUCTION
A sequent 1, . . . , n Gerhard Gentzen (190945) The rules for conjunction Example 1.4: p q, r Proof trees
pq e2 q q i
i
e2
qr
e1
(Later we shall see that the second rule can be derived from other rules.) Example 1.5: p, (q r ) p r qs
Example 1.6: (p q ) r, s t
13
IMPLICATION
Modus ponens (MP) p, p q, p (q r ) Introduce : . . Modus tollens (MT) Example 1.7: p (q r ), p, r q Example 1.8: p q, q p; p q, q
14
i e
MT
EXAMPLE 1.9
p q
1 2 3 4 5
Example 1.11:
(q r ) ((q p) (p r )) p (q r )
pr qr
15
DISJUNCTION
. . pq qp pq pr p (q r ) (p q ) (p r )
16
i1
i2
. .
e
Example 1.16: q r
NEGATION
Example 1.20: p q pq . . Example 1.21: p q, p q
i e
p; p p q q
17
DERIVED RULES
i
MT
Reductio ad absurdum is PBC, Proof By Contradiction: . . Tertium non datur (LEM, law of the excluded middle) Example 1.24: p q p q
18
LEM PBC
PROVABLE EQUIVALENCE
(p q ) (p q ) pq pq pq p pq r p q p q q p p q r r p (q r )
19
INTUITIONISTIC LOGIC
Luitzen Egbertus Jan Brouwer (18811966) Intuitionists claim PBC, LEM,
e
are invalid.
Theorem 1.26: There exist positive irrational numbers a and b such that ab is a rational number. Proof (not intuitionistically valid): Choose 2 1. a = b = 2, if 2 is rational, and 2 2. a = 2 , b = 2 otherwise.
20