Title: Department of Computer Science
1Department of Computer Science Engineering
University of California, San DiegoCSE-291
Ontologies in Data IntegrationSpring 2004
- Bertram Ludäscher
- LUDAESCH_at_SDSC.EDU
2Introduction to Reasoning inFirst-order
Predicate Logicand Description Logic(s)
- Introduction to FO (aka PL)
- Syntax, Semantics
- Two decidable fragments
- propositional logic
- description logic(s)
- Reasoning w/ Tableaux
- Description Logic Reasoning
-
- Discussion of Topics / Assignments
3Syntax vs Semantics
- Syntax
- a.k.a. formation rules grammar
- prescribes what a well-formed formula is
(syntactically) - Semantics
- the meaning of well-formed formulas
- defined via a mapping called interpretation
4Propositional Logic Syntax
propositional logic ltlogicgt (or "propositional
calculus") A system of symbolic logic using
symbols to stand for whole propositions and
logical connectives. Propositional logic only
considers whether a proposition is true or false.
In contrast to predicate logic, it does not
consider the internal structure of propositions.
http//wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?propo
sitionallogic
- Logical symbols
- conjunction ?, disjunction ?, negation ?,
- implication ?, equivalence ?, parentheses ? ?
- Non-logical symbols
- propositional variables p, q, r, ...
- signature set of propositional variables ? p,
q, r, ... - Formation rules for well-formed formulas (wff)
- an atomic formula (propositional variable) is a
formula - if F, G are formulas, so are
- F?G, F ? G, ? F, F?G , F?G, ? F ?
5Propositional Logic Semantics
- Propositions can be assigned a truth-value
- either true or false (classical 2-valued logic
tertium non datur) - other propositional logics exist 3-valued,
4-valued, temporal, (modal logics), , fuzzy
logic - An interpretation I over a signature ? is a
mapping - I ? ? true, false , associating a truth
value to every propositional variable - Truth tables describe how to extend I from atomic
to composite formulas (Boolean Algebra) - F?G, F ? G, ? F, F?G , F?G
6Boolean Algebra, Truth Tables
http//wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?two-v
aluedlogic
7Different Logical Bases
- Often
- ?, ? , ?
- Alternatively
- ?, ?
- ? , ?
- NAND
- NOR
- XOR
- What about ite(A,B,C) if A then B else C ?
8Reasoning in Propositional Logic
- A formula F is
- valid if it is true for all interpretations I
- satisfiable if it is true for some interpretation
I - unsatisfiable if it is true for no interpretation
I - Try these
- p ? q
- p ? ?p
- p ? ?p
- p ? p
- p ? ?p
- ? p ? p
9Reasoning in Propositional Logic
- Def. models relationship
- If a formula F evaluates to true for an
interpretation I then I is called a model of F
written I F - I is a model of F1,, Fk, written I F1,,
Fk,if I is a model of each Fj - Automated deduction setting
- Show that A1,,, An (axioms) imply T (theorem),
that is, every model of the axioms is also a
model of the theorem - That is if I A1,,, An then I T
- Short A1,,, An T
- Often Show that A1 ? ? An ? ?T is
unsatisfiable - We need a procedure / reasoning algorithm
- Predicate Calculus (in fact calculi resolution,
tableaux, )
10Example
- p, p ? q q
- Truth table
- Resolution
- Tableaux
11Example Reasoning with Binary Decision
Trees(see also Binary Decision Diagrams, or
BDDs)
? B
A ? B
A
A
A
A
if-false
if-true
0
1
0
1
B
0
B
false
true
0
1
0
1
? A
? B
A ? B
A
A
A
if-false
if-true
1
0
0
1
B
B
1
false
true
0
1
0
1
12Syntax of First-Order Logic (FO)
- Logical symbols
- ?, ?, ?, ?, ?, ? ?, ? (for all), ?
(exists), ... - Non-logical symbols A FO signature ? consists of
- constant symbols a,b,c, ...
- function symbols f, g, ...
- predicate (relation) symbols p,q,r, ....
- function and predicate symbols have an associated
arity - we can write, e.g., p/3, f/2 to denote the
ternary predicate p and the function f with two
arguments - First-order variables x, y, ...
- Formation rules for terms
- constants and variables are terms
- if t1,,tk are terms and f is a k-ary function
symbols then f(t1,...,tk) is a term
13Syntax of First-Order Logic (FO)
- Formation rules for formulas
- if t1,, tk are terms and p/k is a predicate
symbol (of arity k) then p(t1, , tk) is an
atomic formula (short atom) - all variable occurrences in p(t1, , tk) are free
- if F,G are formulas and x is a variable, then
the following are formulas - F?G, F ? G, ? F, F?G , F?G, ? F ?,
- ?x F (for all x F(x,...) is true)
- ?x F (there exists x such that F(x,...) is
true) - the occurrences of a variable x within the scope
of a quantifier are called bound occurrences.
14Examples
- ?x man(x) ? person(x).
- man(bill).
- child(marriage(bill,hillary),chelsea).
- Variable x
- Constants (0-ary function symbols) bill/0,
hillary/0, chelsea/0 - Function symbols marriage/2
- Predicate symbols man/1, person/1, child/2
15Semantics of Predicate Logic
- Let D be a non-empty domain (a.k.a. universe of
discourse). A structure is a pair I (D,I), with
an interpretation I that maps ... - each constant symbols c to an element I(c)? D
- each predicate symbol p/k to a k-ary relation
I(p) ? Dk, - each function symbol f/k to a k-ary function
I(f) Dk?D - Let I be a structure, ? Vars ? D a variable
assignment. A valuation valI,? maps Term? to D
and Fml? to true, false - valI,? (x) ? (x) for x ? Vars
- valI,? (f(t1,...,tk)) I(f)( valI,? (t1),...,
valI,? (tk) ) for f(t1,...,tk) ?
Term? - valI,? (p(t1,...,tk)) I(p)( valI,? (t1),...,
valI,? (tk) ) for p(t1,...,tk) ? At? - valI,? (F ? G) valI,? (F) and valI,? (G) are
true for F,G ?Fml? - valI,? (F ? G) valI,? (F) or valI,? (G) is
true for F,G ?Fml? - valI,? (? F) true (false) if valI,? (F) is
false (true) for F?Fml? - valI,? (? x F) valI,?x/t (F) is true for some
t ? D for F?Fml? - valI,? (? x F) valI,?x/t (F) is true for all
t ? D for F?Fml?
16Example
- Formula F ?x man(x) ? person(x).
- Domain D b, h, c, d, e
- Lets pick an interpretation I
- I(bill) b, I(hillary) h, I(chelsea) c
- I(person) b, h, c
- I(man) b
- Under this I, the formula F evaluates to true.
- If we choose I like I but I(man) b,d, then
F evaluates to false - Thus, I is a model of F, while I is not
- I F I / F
17FO Semantics (contd)
- F entails G (G is a logical consequence of F) if
every model of F is also a model of G F
G - F is consistent or satisfiable if it has at least
one model - F is valid or a tautology if every interpretation
of F is a model - Proof Theory
- Let F,G, ... be FO sentences (no free variables).
- Then the following are equivalent
- F_1, ..., F_k G
- F_1 ? ... ? F_k ? G is valid
- F_1 ? ... ? F_k ? ? G is unsatisfiable
(inconsistent)
18Proof Theory
- A calculus is formal proof system to establish
- F1,, Fk T
- via formal (syntactic) derivations
- F1,, Fk ... T, where the denotes
allowed proof steps - Examples
- Hilbert Calculus, Gentzen Calculus, Tableaux
Calculus, Natural Deduction, Resolution, ... - First-order logic is semi-decidable
- the set of valid sentences is recursively
enumerable, but not recursive (decidable) - Some inference engines
- http//www.semanticweb.org/inference.html
19Querying vs. Reasoning
- Querying
- given a DB instance I ( logic interpretation),
evaluate a query expression (e.g. SQL, FO
formula, Prolog program, ...) - boolean query check if I ? (i.e.,
if I is a model of ?) - (ternary) query (X, Y, Z) I ?
(X,Y,Z) - gt check happyFathers in a given database
- Reasoning
- check if I ? implies I ? for all
databases I, - i.e., if ? gt ?
- undecidable for FO, F-logic, etc.
- Descriptions Logics are decidable fragments
- concept subsumption, concept hierarchy,
classification - semantic tableaux, resolution, specialized
algorithms
20Reasoning Example
- (1) p(0)
- (2) ?x p(x) ? p(s(x))
- (3) p(s(s(0))).
- We want to show that (1) ... (2) implies (3)
- Approach assume negation of (3) and show that it
leads to a contradiction with (1), (2) - Question Why is this sound?
21Types of Formulas
(?) rule for F A ? B (and other disjunctions)
(?) rule for F A ? B (and other conjunctions)
(?) rule for F ?x A(X,...) substitute a
?-variable X with an arbitrary term t
(?) rules for F ?x A(X,...) substitute a
?-variable X with a new constant c
22(Semantic) Tableaux Rules
- (?) rule for F A ? B
- (?) rule for F A ? B
- (?) rule for F ?x A(X,...)
- substitute a ?-variable X with an arbitrary term
t - (?) rules for F ?x A(X,...)
- substitute a ?-variable X with a new constant c
- A branch is closed if it contains complementary
formulas - A tableaux is closed if every branch is closed
23FO Tableaux Calculus
- Theorem (Soundness, Completeness of Tableaux
calculus) - Let A1,..., Ak and F be first-order logic
sentences. - (Recall a sentence is a closed formula, i.e.,
has no free variables) - Then the following are equivalent
- A1, ..., Ak F
- A1 ? ... ? Ak ? F is unsatisfiable (inconsistent)
- There is a closed tableaux for A1, ..., Ak , ?
F
24Reasoning with DLs(Shawn Bowers)