Documente Academic
Documente Profesional
Documente Cultură
Chapter 9 Introduction
Logic
Predicate Logic
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Ren Witte Proof Procedures in
Predicate Logic
Department of Computer Science Automated Reasoning
Introduction
Logic
Propositional Logic
Introduction
Predicate Logic
5 Conclusions
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
6 Notes and Further Reading Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Informal, Semi-Formal, and
Formal
Propositional Logic
Introduction
Syntax
Semantics
Logical Equivalences
Tautologies and
Contradictions
Derivation Rules
Predicate Logic
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Copyright 2009 by John Wiley & Sons Ltd, [vL09] Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Logic as a Tool Problems with Natural
Language Specifications
Paradoxes
Boolean circuits: foundation of modern digital design Different Logics
Informal, Semi-Formal, and
Combinatorial explosion: logic served as a tool to formalize the theory of Formal
Propositional Logic
NP-completeness capturing the notion of combinatorial explosion Introduction
Syntax
SQL (Structured Query Language) in databases is essentially a syntactic Semantics
Design validation and verification: the famous Intel bug of 1995, involving faulty Predicates
Quantifiers
floating point divisions, caused a cost of US$ 500 million Translating NL into
Predicate Logic
Proof Procedures
Security: trust of algorithms; do guarantees exist? Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Propositional Logic
ambiguous Introduction
Syntax
Remember the train control example with and/or causing different Tautologies and
Contradictions
Predicate Logic
Full braking shall be activated by any train that receives an outdated Motivation
acceleration command or that enters a station block at speed higher than X Predicates
Quantifiers
m.p.h. and for which the preceding train is closer than Y yards. Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Another problem: Paradoxes Informal, Semi-Formal, and
Formal
A student is sued for his tuition by the school that educated him. He argues that Logical Equivalences
Tautologies and
he must win, since, if he loses, the school didnt educate him well enough, and Contradictions
Derivation Rules
doesnt deserve the money. The school argues that he must lose, since if he Predicate Logic
wins, he was educated well enough and therefore should pay it. Motivation
Predicates
All these problems led to the effort to formulate logic in a symbolic language.
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Types of Logics Informal, Semi-Formal, and
Formal
Various logics have been proposed: Propositional Logic
Predicate Logic
Semantics
Logical Equivalences
Tautologies and
Temporal Logics Contradictions
Derivation Rules
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Informal Specifications Logic
Problems with Natural
Predicate Logic
Motivation
Predicates
Formal Specifications Quantifiers
Translating NL into
Formal syntax and semantics. Predicate Logic
Negation
Better support for automatic requirements validation and verification. Predicate Logic
Automated Reasoning
Conclusions
1 Introduction Introduction
Logic
Problems with Natural
Derivation Rules
Tautologies and
Contradictions
Derivation Rules
Predicate Logic
Proof Procedures
Proof Procedures in
5 Conclusions Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Propositional Logic (0th-Order Logic) Informal, Semi-Formal, and
Formal
Propositional logic is a simple and well known language for representing knowledge Propositional Logic
Introduction
Syntax
Parts Semantics
Logical Equivalences
Predicate Logic
Proof procedures: (inference mechanisms) how to automatically create or prove Motivation
Predicates
new propositions Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Definition Different Logics
Informal, Semi-Formal, and
A statement (also known as a proposition) is a declarative sentence that is either Formal
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Propositional Logic
Name Symbol Introduction
Syntax
and (conjunction) Semantics
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Rules Different Logics
Syntax of propositional logic can be recursively defined by two rules: Informal, Semi-Formal, and
Formal
Propositional Logic
| (<statement> <statement>)
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Example Text Language Specifications
Paradoxes
Translate into propositional logic: Different Logics
Informal, Semi-Formal, and
Propositional Logic
If I will pass then I am clever, Introduction
Predicate Logic
Motivation
Translation Predicates
Conclusions
Introduction
Interpretation Logic
Problems with Natural
Semantic Rules define how to evaluate the meaning of a statement. Language Specifications
Paradoxes
a truth table)
Formal
Propositional Logic
Truth Value: The meaning valI (p) of a statement p under a given interpretation I Introduction
Syntax
Semantics
Logical Equivalences
Predicate Logic
trainMoving doorsClosed Motivation
Predicates
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
p p Paradoxes
Different Logics
F T Propositional Logic
Introduction
Syntax
Semantics
Logical Equivalences
Tautologies and
p q pq p q pq Contradictions
Derivation Rules
T T T T T T Predicate Logic
T F F T F T Motivation
Predicates
F T F F T T Quantifiers
Translating NL into
F F F F F F Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Informal, Semi-Formal, and
Formal
p q pq p q pq Propositional Logic
Introduction
T T T T T T Syntax
T F F T F F
Semantics
Logical Equivalences
F T F F T T Tautologies and
Contradictions
F F T F F T Derivation Rules
Predicate Logic
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Informal, Semi-Formal, and
Formal
Propositional Logic
Introduction
Definition Syntax
Two statements are logically equivalent if they have the same T/F values for all
Semantics
Logical Equivalences
cases, that is, if they have the same truth tables. Tautologies and
Contradictions
Derivation Rules
Predicate Logic
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Contrapositive Introduction
p q is logically equivalent to q p: Logic
Problems with Natural
Language Specifications
p q pq
Paradoxes
q p q p Different Logics
T F F T F F Propositional Logic
F T T F T T
Introduction
Syntax
F F T T T T Semantics
Logical Equivalences
Tautologies and
Contradictions
Derivation Rules
F T F T Proof Procedures in
Predicate Logic
F F T T Automated Reasoning
Conclusions
Introduction
Logic
p q pq (p q) p Formal
Propositional Logic
T T T T Introduction
T F F T Syntax
Semantics
F T F T Logical Equivalences
Tautologies and
F F F T Contradictions
Derivation Rules
Predicate Logic
Motivation
Definition Predicates
Quantifiers
A statement that is true under any interpretation I is called a tautology. Notation: Translating NL into
Predicate Logic
Negation
|= (p q) p Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Prove Language Specifications
Paradoxes
Different Logics
q Formal
pq Propositional Logic
Introduction
Syntax
Semantics
Predicate Logic
T T T T T Motivation
T F F F T Predicates
Quantifiers
F T T F T Translating NL into
Predicate Logic
F F T F T Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Informal, Semi-Formal, and
Formal
p p p p Logical Equivalences
Tautologies and
T F F Contradictions
Derivation Rules
F T F Predicate Logic
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
pq qp Predicate Logic
Motivation
p (q r ) (p q) (p r ) distributivity Predicates
p (q r ) (p q) (p r ) Quantifiers
Translating NL into
p (q r ) (p q) r associativity
Predicate Logic
Negation
p (q r ) (p q) r Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
p Tautologies and
Contradictions
q modus ponens
pq Derivation Rules
Predicate Logic
q Motivation
p modus tollens
p q Predicates
Quantifiers
pq Translating NL into
qr Negation
Proof Procedures
pq
qr resolution Proof Procedures in
p r
Propositional Logic
Proof Procedures in
Predicate Logic
pq p simplification Automated Reasoning
p pq addition Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Propositional Logic
valI (p) = T . The satisfying interpretation I is called a model of p, written I |= p Introduction
Syntax
Semantics
Validity Logical Equivalences
Tautologies and
A formula p is valid, written |= p, if it is true (T ) in all interpretations (i.e., p is a Contradictions
Derivation Rules
tautology). Predicate Logic
Motivation
Unsatisfiability Predicates
Quantifiers
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
1 Introduction Introduction
Logic
Problems with Natural
Language Specifications
2 Propositional Logic Paradoxes
Different Logics
Informal, Semi-Formal, and
Formal
Motivation Introduction
Syntax
Predicates Semantics
Logical Equivalences
Quantifiers Tautologies and
Contradictions
Translating NL into Predicate Logic Derivation Rules
Proof Procedures
5 Conclusions Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Good enough for RE? Paradoxes
Different Logics
Some limitations of propositional logic Informal, Semi-Formal, and
Formal
It rained on Sunday
Semantics
Logical Equivalences
Tautologies and
Can we access parts of the sentence? Contradictions
Derivation Rules
Can we find out from P Q that both propositions refer to the same day? Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Informal, Semi-Formal, and
Predicates Formal
Now we can formally find out that sunday is mentioned in both formulas. Predicates
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
A predicate is a declarative sentence whose T/F value depends on one or more Paradoxes
Different Logics
variables. In other words, a predicate is a declarative sentence with variables, and Informal, Semi-Formal, and
Formal
after those variables have been given specific values, the sentence becomes a Propositional Logic
statement. Introduction
Syntax
Semantics
Example
Logical Equivalences
Tautologies and
Contradictions
Derivation Rules
Predicate Logic
are predicates. The statement P(8) is true, while the statement Q(feather, brick) is Proof Procedures
false. Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
A quantifier modifies a predicate by describing whether some or all elements of the Language Specifications
Paradoxes
Existential quantifier:
Introduction
Syntax
Semantics
says that P(x) is true for all x in the domain. Predicate Logic
Motivation
Predicates
The statement
Quantifiers
Translating NL into
Predicate Logic
( x)P(x) Negation
Proof Procedures
says that there exists an element x of the domain such that P(x) is true; in other Proof Procedures in
Propositional Logic
words, P(x) is true for some x in the domain. Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Informal, Semi-Formal, and
Note Formal
Predicate Logic
Motivation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Two common constructions Paradoxes
Different Logics
Propositional Logic
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
With Paradoxes
Different Logics
Informal, Semi-Formal, and
For all cars x, if x is large, then x does not get good mileage. Derivation Rules
Predicate Logic
or Motivation
Predicates
or Negation
Proof Procedures
There arent any large cars that get good mileage. Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Different Logics
Informal, Semi-Formal, and
Formal
Propositional Logic
Predicate Logic
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Propositional Logic
Introduction
Negate the statement All large cars get bad mileage. Syntax
Semantics
Logical Equivalences
Conclusions
Introduction
1 Introduction Logic
Problems with Natural
Language Specifications
Paradoxes
2 Propositional Logic Different Logics
Informal, Semi-Formal, and
Formal
Propositional Logic
3 Predicate Logic Introduction
Syntax
Semantics
4 Proof Procedures
Logical Equivalences
Tautologies and
Proof Procedures
Proof Procedures in
Conclusions
Introduction
Examples Semantics
Logical Equivalences
Tautologies and
Direct Proof: We have the facts F1 , F2 , . . . , Fn and want to show that G is a logical Contradictions
Derivation Rules
consequence. Prove by showing that (F1 F2 . . . Fn ) G is a Predicate Logic
tautology: Motivation
Predicates
Quantifiers
Refutation Proof: Prove by showing that adding the negation of G to the facts: Proof Procedures
Proof Procedures in
(F1 F2 . . . Fn G) leads to an inconsistency Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Inference Rule: formal way of generating new expressions from (a set of) existing
Logic
Problems with Natural
and if we can generate all expressions that logically follow from a set S, it is
Semantics
Logical Equivalences
Predicate Logic
Notation Motivation
S `r Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
This is also called the turnstyle symbol. It is a syntactic operation. Mind the Predicate Logic
Automated Reasoning
difference to the semantic operation |=. Conclusions
Introduction
Truth Table Logic
Problems with Natural
exhaustive proof method Language Specifications
Paradoxes
Propositional Logic
NP-Complete (Boolean Satisfiability problem) Introduction
Syntax
Semantics
until you arrive at the empty clause (showing a contradiction and thus the validity of Negation
Proof Procedures
the original goal). Proof Procedures in
or you cannot apply any more axioms (i.e. goal cannot be proven from the Propositional Logic
Proof Procedures in
statements) Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Example: Modus Ponens Different Logics
Informal, Semi-Formal, and
Modus ponens is a sound (but not complete!) inference rule for predicate calculus: Formal
Propositional Logic
If we have P and P Q, then we can infer (add to our knowledge base) Q Introduction
Syntax
Example: Semantics
Logical Equivalences
Rule: All men are mortal: X (man(X ) mortal(X )). Derivation Rules
Predicate Logic
We can now deduce: mortal(socrates) Motivation
Predicates
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Mathematical foundation: Gdels completeness theorem (1930-31) Language Specifications
Paradoxes
Different Logics
For first-order logic: any sentence that logically follows from another set of Informal, Semi-Formal, and
Formal
sentences can be proved from that set Propositional Logic
if KB |= , then KB `R Semantics
Logical Equivalences
But he only showed that R must exist he did not provide it Tautologies and
Contradictions
Derivation Rules
This was done by Robinson (1965): resolution algorithm Predicate Logic
Note: the theorem says that if it follows, then it can be proved. But we dont Motivation
Predicates
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Applications of Automated Theorem Proving Different Logics
Informal, Semi-Formal, and
Automated Reasoning (Automated Theorem Proving) is an important foundation for Formal
Predicate Logic
Requirements Verification & Validation Motivation
Predicates
Formal Software Verification Quantifiers
Translating NL into
Semantic Web Predicate Logic
Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Propositional Logic
Introduction
Predicate Logic
5 Conclusions
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
6 Notes and Further Reading Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
General Idea Language Specifications
Paradoxes
Test for assertions: e.g., does a given invariant such as doorsOpen trainStopped Predicate Logic
Conclusions
Introduction
Logic
Problems with Natural
Soundness something can be inferred only if it is entailed by the knowledge base Predicate Logic
Motivation
(KB) Predicates
Quantifiers
Conclusions
Propositional Logic
Introduction
Logic
simple (not very expressive) Problems with Natural
Language Specifications
sound, complete, decidable Paradoxes
Different Logics
Informal, Semi-Formal, and
Formal
Subsets of predicate logic with efficient decidability procedures for automated Propositional Logic
Proof Procedures in
Introduction
Logic
Propositional Logic
Introduction
Predicate Logic
5 Conclusions
Motivation
Predicates
Quantifiers
Translating NL into
Predicate Logic
6 Notes and Further Reading Negation
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Logic
Problems with Natural
Language Specifications
Paradoxes
Required Different Logics
Informal, Semi-Formal, and
Formal
[vL09, Chapters 4.44.4.1, 4.4.7, 4.5]
Propositional Logic
Introduction
Syntax
Supplemental Semantics
Logical Equivalences
Tautologies and
[Mey85] Contradictions
Derivation Rules
Predicate Logic
Motivation
Further Reading Predicates
Quantifiers
Proof Procedures
Proof Procedures in
Propositional Logic
Proof Procedures in
Predicate Logic
Automated Reasoning
Conclusions
Introduction
Introduction to Logic.
Language Specifications
Paradoxes
Propositional Logic
http://www.morganclaypool.com/doi/abs/10.2200/ Introduction
S00518ED2V01Y201306CSL006. Syntax
Semantics
Logical Equivalences
[Mey85] Bertrand Meyer. Tautologies and
Contradictions
On Formalism in Specifications. Derivation Rules
http://se.ethz.ch/~meyer/publications/computer/formalism.pdf.
Motivation
Predicates
Quantifiers
Proof Procedures
Software Specifications. Proof Procedures in
Conclusions