Professional Documents
Culture Documents
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
What is a Logic?
A logic is a formal language for representing information such
that conclusions can be drawn.
Logic = syntax + semantics (+ inference)
When defining a logic we have to define:
Syntax: the valid formulas in the language
Semantics: the meaning of formulas (i.e. when a formula
is true)
Inference algorithms allows to extract conclusions about the
satisfiability of formulas and about the relationship between
formulas.
Lots of different logics, but here only propositional logic
Other logics: first-order, temporal, fuzzy, ...
Departament de Llenguatges i Sistemes Informatics
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
p
(( p q) (r q))
( p q)
...
( p q)
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
Example
Consider formula ( p q) (r q)
Interpretation I = {p := 0, q := 1, r := 0}
... is NOT a model of the formula.
Excercise:
Consider formula ( p q) ( p q)
Find a satisfying and a non-satisfying interpretation
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
Removing parenthesis
From most to least priority:
All connectives are left-associative
EXAMPLES:
F1 F2 F3 F4 is
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
Removing parenthesis
From most to least priority:
All connectives are left-associative
EXAMPLES:
F1 F2 F3 F4 is
( ( ( ( F1 ) F2 ) F3 ) (F4 ) )
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
Removing parenthesis
From most to least priority:
All connectives are left-associative
EXAMPLES:
F1 F2 F3 F4 is
( ( ( ( F1 ) F2 ) F3 ) (F4 ) )
F1 F2 F3 F4 F5 is
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
Removing parenthesis
From most to least priority:
All connectives are left-associative
EXAMPLES:
F1 F2 F3 F4 is
( ( ( ( F1 ) F2 ) F3 ) (F4 ) )
F1 F2 F3 F4 F5 is
( ( ( (F1 F2 ) F3 ) (F4 ) ) F5 )
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
Example
EXAMPLE
We have 3 pigeons and 2 holes. If each hole can hold at most
one pigeon, is it possible to place all pigeons in the holes?
Vocabulary: pi, j means i-th pigeon is in j-th hole
Each pigeon is placed in at least one hole:
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
Usual Queries
Let F and G be arbitrary formulas. Then:
F is satisfiable (also consistent) if it has at least one model
F is unsatisfiable (also a contradiction) if it has no model
F is a tautology if every interpretation is a model of F
G is a logical consequence of F (F entails G), denoted F |= G,
if every model of F is a model of G
F and G are logically equivalent, denoted F G, if F and G
have the same models
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
Logical Equivalences
F F
F F
F G
F G
F
(F G) H
(F G) H
F (G H )
F (G H )
F
(F G) F G
F
(F G) F G
GF
If F is a tautology then
GF
F G
G
F
F G
F
F (G H )
If F is unsatisfiable then
F (G H )
F G
F
(F G) (F H )
F G
G
(F G) (F H )
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA
UPC
UNIVERSITAT POLITECNICA
DE CATALUNYA