0% found this document useful (0 votes)
20 views

summary-kr-vu-slides-and-practice-exam

The document discusses knowledge representation in artificial intelligence, focusing on propositional logic and its applications in problem-solving. It outlines the strengths and weaknesses of symbolic versus statistical AI, the formulation of knowledge bases, and the process of satisfiability testing for solving complex problems. Additionally, it covers advanced topics such as clause learning, reasoning tasks, and the challenges of hard satisfiability problems.

Uploaded by

aleks.caph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

summary-kr-vu-slides-and-practice-exam

The document discusses knowledge representation in artificial intelligence, focusing on propositional logic and its applications in problem-solving. It outlines the strengths and weaknesses of symbolic versus statistical AI, the formulation of knowledge bases, and the process of satisfiability testing for solving complex problems. Additionally, it covers advanced topics such as clause learning, reasoning tasks, and the challenges of hard satisfiability problems.

Uploaded by

aleks.caph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 143

Summary

Knowledge Representation

1. Knowledge Representation and Propositional Logics


2. DPLL+Logical reasoning for Sudokus
3. Logic, Hardness, GSAT, MaxSat
4. Clause Learning, Planning and Applications
5. Propositional Logic, MaxSat + Exam Preparation
6. Probabilistic Graphical Models 1
7. Probabilistic Graphical Models 2
8. Probabilistic Graphical Models 3
9. Probabilistic Graphical Models 4
10. Ontologies, and Ontology Languages
11. Description Logics
12. Description Logic Reasoning
13. Knowledge Engineering

Knowledge Representation and Propositional Logics

“Definition of intelligence”

• carry out complex reasoning (solve physics problems, prove


• draw plausible inferences (diagnose cars, solve a murder
• use natural language (read stories and answer questions about them, carry out extended
conversation)
• solving novel complex problems (generating plans, designing
• social activities that require a theory of mind

Two main lines of development in AI

•symbolic representations
•statistical representation

Statistical vs. symbolic AI:


very different types of applications

statistical:
– pattern recognition (images, sound, shapes)
– motor skills (robots)
– speech generation (sound)
– search engines
symbolic:
– planning (autonomous space missions)
– reasoning (diagnosis, design, decision support)
– language generation (conversations)
– search engines

1
Strengths & Weaknesses
Symbolic Connectionist
Construction Human effort Data hunger
Scaleable +/- (worse with more data) +/- (worse with less data)
Explainable + -
Generalisable Performance cliff Performance cliff

The goal of logic in KR

• To state statements which are known to be true (the knowledge base


• Some statements that describe the current state of the world (the premises
• To state statements for which we want to check if they are true (the conclusions ”)
• To see if the conclusions can be derived from the knowledge base + the premises through
logical reasoning
• A variety of related tasks

The ingredients of a logic in KR

• How to formulate the statements (Syntax)


• Assign meaning to the statements (Semantics)
• Assign what can be derived (Calculus)

And all of this differs from application domain to application domain and even application to
application.

3) PROPOSITIONAL LOGIC

The knowledge base: simple statements

• In propositional logic, a knowledge base can have simple statements , and complex
statements.
• A simple statement states one fact about the world :
– Examples: it is hot , it is raining , it is humid
– In our examples we often just use a single letter for a a simple statement:
– Examples: P, Q, R.

The knowledge base: complex statements


• Complex statements are made by combining other statements . If S and T are statements
(simple or complex), then the following are also complex statements:
These can be any combination

2
The meaning of simple statements

• In propositional logic, the meaning of a statement is either true or false.


• We call this the “ interpretation function ” I :
it maps any statement p to true or false: I(p)=0 or I(p)=1 (0 means false, 1 means
• Example:
– I(it is hot)=1 means that it is hot today
– I(it is hot)=0 means that it is not hot today
– I(Q)=1 means that Q is true

The meaning of complex statements


• The meaning of complex statements is calculated from the meaning of the parts:

3
Special statements: tautologies

4
Special statements: inconsistencies

There are also statements which are always false.


They are false for any of the possible combinations of truth values of their parts, in other
words, they are false in every world we can possibly imagine.
Such statements are called inconsistent (or: invalid).
The statements which are not a tautology and also not inconsistent (in other words: they are
true for some combination of truth values and false for others) are called satisfiable

Some terms

• The meaning or semantics of a sentence is determined by its interpretation .


• Given the truth values of all symbols in a sentence, it can be “evaluated” to determine
its truth value (True or False).
• A model for a KB is a “possible world” (assignment of truth values to propositional
symbols) in which each sentence in the KB is True.

More terms

• A satisfiable sentence is a sentence that can be made true in at least one world ( i.e. is not
inconsistent)
• P entails Q , written P |= Q, means that whenever P is True, so is Q. In other words, all
models of P are also models of Q
In Propositional Logics (and in other Logics) those notions can often be reduced to each
other.
• E.g. P is satisfiable iff ¬ P is not valid
• Or P |= Q iff P & ¬Q is unsatisfiable

So why are we doing all this?

1. We now have language in which we can make simple and complex statements about
the world ( “propositional
2. We can formulate problems that we need to solve as complex statements in
propositional logic
3. We have a formal and unambiguous semantics to define if a statement can be satisfied
4. We have a method (e.g. Truth Tables) to determine which valuations for propositions
satisfies the problem statements (a calculus)
5. Such a “satisfying truth assignment” is then the solution to our problem.

Practice Problem

5
6
Problem solving by Satisfiability testing

1. We have to answer a question


2. We formulate question as a complex statement S in propositional logic
3. We try to find a “satisfying assignment” of truth values (in other words: a combination of
truth values that makes S true)
4. That combination of truth values gives us the solution to the original problem.
Problem : if S contains n symbols, we need to check 2 n combinations of truth values.
Suppose we want to solve Sudoko with 721 variables.

DPLL+Logical reasoning for Sudokus

Propositional Logic

The meaning of propositional logic (Semantics) 1

• Propositions P and Q are interpreted to be either false or true (truth assignment, e.g.
I(P)=True or I(P)=1)
• Complex Sentences S can be calculated to be true or false according to an assignment
e.g. I(Rains --> Wet) is True iff I(Rains)=False (0) or I(Wet)=True (1)

The meaning of propositional logic (Semantics) 2

• Inconsistent sentence S: always false (boring) I(S)=0 for all assignment functions I
• Valid sentences S (tautology): always true (boring) I(S)=0 for all assignment functions I
• Satisfiable sentence S: interesting!
There is an assignment I such that I(S)=1. This is also called a model .
This is the task of SAT solving: finding a “model”

SAT solving for Problem Solving

• Represent your problem in Propositional Logic


• Is a problem solvable? = is the sentence satisfiable?

7
• Finding a solution = finding a model (= find a truth assignment I that makes the sentence S
true, i.e. I(S)=1 )

• Truth assignment is the solution to the problem

A calculus for propositional logic: aka How to find a satisfying model?

•Truth table method


•But: size of the table is 2N(N = number of variables)
•2729=10219….

And the problem can be even worse!


Luckily there are more efficient algorithms …

Clause Normal Form

8
9
Davis Putnam (DPLL)

• SAT is NP Complete (proved by Cook in 1971, as the first NP complete problem)


• This means that any fast SAT solver could also be used to solve lots of other exponential
problems
• This is widely believed to be impossible: nobody believes NP=P (but still an open problem)
• So should we give up all hope?
• Remarkably, even though they are exponential in the worst case (Cook was right in
1971….), modern SAT solver are very fast most of the time

Davis Putnam algorithm

• It was not developed by Davis & Putnam, but by Davis, Logemann & Loveland
• The original algorithm by Davis & Putnam used potentially exponential space
• The improved algorithm by DLL is now known as DP…
• It dates from the ‘60s, is (of course ) exponential in the worst case, but performs remarkably
well (if we add a few heuristics)

10
11
12
13
14
15
16
Heuristics for splitting

How to split

17
Sudokus in propositional logic

Checking for (in)consistency can be used to solve problems:


Many problems can be formulated as a set of constraints on the solution
These constraints can be stated in PL
Finding a solution
= asking if the set of constraints is satisfiable
= finding a satisfying truth assignment
Thus: Solving the problem = finding satisfying truth assignment
(that satisfies all the constraints

18
19
20
Logic, Hardness, GSAT, MaxSat

Knowledge Representation as Logic Engineering

• Previously , you might have learned that Logics exist , how they are defined , what their
theoretical properties are, etc.
• Knowledge Representation is
• The field of using the right logic for the right AI task
• Evaluating logics w.r.t. a task or in general
• Analytically (e.g. soundess , completeness , decidability , complexity , etc
• Empirically (practical complexity , practical completeness
• Adapt existing logics for a task (we do that in the course)
• Develop new logics if needed

Reasoning Tasks and Properties of Logics

Propositional Logic (reminder)

21
•Syntax
•Propositions P, Q
•SentencesS1, S2, … basedo n complex operators v, -
•Semantics
•Assignments I
•I(P) = True or False
•Assignment
•I(S1 v S2)=True iff I(S1)=True or I(S2)=True
•I(-S)=True iff I(S)=False
•Calculus and their properties
•Check with Truth Tables
•Check with DPLL

22
23
24
Propositionalizing

Propositional logic is a weak language

• Propositional letters only describe complete “states” of the world, we cannot talk about
“individuals” (e.g., Mary, 3)
• Can’t directly talk about properties of individuals or relations between individuals (e.g.,
“Bill is tall”)
• Generalizations, patterns, regularities can’t easily be represented (e.g., “all triangles have 3
sides”)
• First Order Logic (abbreviated FOL or FOPC) is expressive enough to concisely represent
this kind of information
FOL adds relations, variables, and quantifiers, e.g.,
•“Every elephant is  x (elephant(x) gray(x))
•“There is a white  x (alligator(X) ^ white(X))

Problem solving with Propositionalisation

In order to solve a problem using Propositionalisation


1. formulate problem as a complex formula F in first order logic
2. propositionalise F to get a Propositional statement S
3. find a “satisfying assignment” of truth values (in other words: a model of S)
4. This model gives us the solution to the original problem.

Remember:
if S contains n symbols, we need to check ~1,681 n nodes
Complexity: if S is the result of propositionalising a FOL sentence, then n is exponential in
the number of individuals i in the domain
--> DPLL may have to check doubly exponentially many nodes: 1,6812𝑛
n=10 gives a truth table of size size10230

25
Hard Satisfiability Problems

Structured vs. Random Problems

• So far, we’ve been dealing with SAT problems that encode other problems
• Most not as hard as # of variables & clauses suggests
• Small crossword grid + medium sized dictionary may turn into a big formula … but still a
small puzzle at some level
• Unit propagation does a lot of work for you
• Clause learning picks up on the structure of the encoding
• But some random SAT problems really are hard!
• Fix the length (often 3)
• Vary the ratio between number of clauses l and number of variables n

The magic ratio 4.26

Complexity peak is very stable …


across problem sizes
across solver types
systematic (last lecture)
stochastic (this lecture)

That’s called a “phase transition”

• Problems < 0˚C are like ice; > 0˚C are like water
• Similar “phase transitions” for other NP hard problems
• job shop scheduling
• traveling salesperson
• exam timetables
• Boolean circuit synthesis
• Latin squares (alias sports scheduling)

26
Incomplete SAT methods (GSAT)

Local search for SAT

• Make a guess (smart or dumb) about values of the variables


• Test how you are doing
• Try flipping a variable to make things better
• Algorithms differ on which variable to flip

• Flip a randomly chosen variable?


• No, blundering around blindly takes exponential time
• Ought to pick a variable that improves …
• Increase the # of satisfied clauses as much as possible
• Break ties randomly
• Note: Flipping a var will repair some clauses and break others
• This is the “GSAT” (Greedy SAT) algorithm (almost)

27
Decidability? Completeness?

• What does that mean for decidability?


• What does that mean for completeness?
• Remember: Completeness means that all correct solutions are found
• Soundness: If our algorithm returns a variable assignment with input KB, this variable
assignment is a model of KB
• Completeness: If an assignment is a model, then our algorithm will find it.

Who cares about decidability?

• Decidability ≈ completeness guarantee to find an answer, or tell you it doesn’t exist, given
enough run time & memory
• Sources of incompleteness
• incompleteness of the input data
• insufficient run time to wait for the answer
 Completeness is unachievable in practice anyway, regardless of the completeness of the
algorithm

28
Who cares about undecidability?

• Undecidability ≠ always guaranteed not to find an answer


• Undecidability = not always guaranteed to find an answer
• Undecidability may be harmless in many cases; in all cases that matter

Clause Learning, Planning and Applications

Clause Learning and Dependency directed backtracking

Chronological Backtracking
 Backtracking to the highest decision level that has not been tried with both values
 Originally proposed in the DLL paper in 1962
 OK for randomly generated instances, bad for instances generated in practical applications
 We can do better than that

29
Summarizing

We have now gained two advantages:

1. We have “learned” a new clause that “ summarizes ” a potential conflict. Adding this
clause to the clause base will help us to avoid making the same mistake in other parts
of the search space.
2. We can make a bigger “jump back” in the search tree, replacing chronological
backtracking (= just undoing the most recent choice), with dependency directed
backtracking (= undoing the most recent choice that was involved in the conflict, ie
the most recent choice that mattered).

Chapter 7: Propositional Satisfiability Techniques

l Propositional satisfiability: given a boolean formula


30
» e.g., (P ∨ Q) ∧ (¬Q ∨ R ∨ S) ∧ (¬R ∨ ¬P),
does there exist a model
» i.e., an assignment of truth values to the propositions
that makes the formula true?
l approach:
Try translating classical planning problems into satisfiability problems, and solving
them that way

State Transition System

Σ = (S,A,γ)
l states S = {…, si,…}
l actions A = {…, ai,…}
l State-transition function
γ: S x A → 2S
u S = {s0, …, s5}
u A = {move1, move2, put, take, load, unload}
u γ: see the arrows

Planning Problem
P = (Σ, s0, sG)
• Description of Σ
• Initial state or set of states
Initial state = s0
• Objective
Goal state, set of goal states, set of tasks, “trajectory” of states, objective function, …
Goal state = s5

Plans
u Classical plan: a sequence of actions
π = 〈a0, a1, …, an–1〉
〈take, move1, load, move2〉
Policy: partial function from S into A
{(s0, take),
(s1, move1),
(s3, load),
(s4, move2)}
Solution length = 4

Overall Approach

l A bounded planning problem is a pair (P,n):


u P is a planning problem; n is a positive integer
u Any solution for P of length n is a solution for (P,n)
l Planning algorithm: Do iterative deepening
u for n = 0, 1, 2, …,
» encode (P,n) as a satisfiability problem Φ
» if Φ is satisfiable, then
31
• From the set of truth values that satisfies Φ, a solution plan can
be constructed, so return it and exit

Notation

l For satisfiability problems we use propositional logic


l Need to encode ground atoms into propositions
» Atom: at(r1,loc1)
» Proposition: at-r1-loc1
u But we won’t bother to do a syntactic rewrite
Just use at(r1,loc1) itself as the proposition
l Also, we’ll write plans starting at a0
u π = 〈a0, a1, …, an–1〉

Fluents

l If π = 〈a0, a1, …, an–1〉 is a solution for (P,n), it generates these states:


s0, s1 = γ (s0,a0), s2 = γ (s1,a1) , …, sn = γ (sn–1, an–1)
l Fluent: proposition saying a particular atom is true in a particular state
u at(r1,loc1,i) is a fluent that’s true iff at(r1,loc1) is in si
u We’ll use li to denote the fluent for literal l in state si
» e.g., if l = at(r1,loc1)
then li = at(r1,loc1,i)
u ai is a fluent saying that a is the i’th step of π
» e.g., if a = move(r1,loc2,loc1)
then ai = move(r1,loc2,loc1,i)

Encoding Planning Problems


l Encode (P,n) as a formula Φ such that
π = 〈a0, a1, …, an–1〉 is a solution for (P,n) if and only if
Φ can be satisfied in a way that makes the fluents a0, …, an–1 true
l Let
u A = {all actions in the planning domain}
u S = {all states in the planning domain}
u L = {all literals in the language}
l Φ is the conjunction of many formulas …

Formulas in Φ

l Formula describing the initial state:


/\{l0 | l ∈ s0} ∧ /\{¬l0 | l ∈ L – s0 }
l Formula describing the goal:
/\{ln | l ∈ g+} ∧ /\{¬ln | l ∈ g–}
l For every action a in A, formulas describing what changes a would make if it were the
i’th step of the plan:
u ai ⇒ /\{pi | p ∈ Precond(a)} ∧ /\ {ei+1 | e ∈ Effects(a)}
l Complete exclusion axiom:
32
u For all actions a and b, formulas saying they can’t occur at the same time
¬ ai ∨ ¬ bi
u this guarantees there can be only one action at a time
l Is this enough?

Frame Axioms

l Frame axioms:
u Formulas describing what doesn’t change
between steps i and i+1
l Several ways to write these
l One way: explanatory frame axioms
u One axiom for every literal l
u Says that if l changes between si and si+1,
then the action at step i must be responsible:
(¬li ∧ li+1 ⇒ Va in A{ai | l ∈ effects+(a)})
∧ (li ∧ ¬li+1 ⇒ Va in A{ai | l ∈ effects–(a)})

Example

l Planning domain:
u one robot r1
u two adjacent locations l1, l2
u one operator (move the robot)
l Encode (P,n) where n = 1
u Initial state: {at(r1,l1)}
Encoding: at(r1,l1,0) ∧ ¬at(r1,l2,0)
u Goal: {at(r1,l2)}
Encoding: at(r1,l2,1) ∧ ¬at(r1,l1,1)
u Operator: see next slide

l Operator: move(r,l,l’)
precond: at(r,l)
effects: at(r,l’), ¬at(r,l)
Encoding:
move(r1,l1,l2,0) ⇒ at(r1,l1,0) ∧ at(r1,l2,1) ∧ ¬at(r1,l1,1)
move(r1,l2,l1,0) ⇒ at(r1,l2,0) ∧ at(r1,l1,1) ∧ ¬at(r1,l2,1)
move(r1,l1,l1,0) ⇒ at(r1,l1,0) ∧ at(r1,l1,1) ∧ ¬at(r1,l1,1){contradictions-
move(r1,l2,l2,0) ⇒ at(r1,l2,0) ∧ at(r1,l2,1) ∧ ¬at(r1,l2,1){easy to detect}
move(l1,r1,l2,0) ⇒ …{
move(l2,l1,r1,0) ⇒ … non-essential
move(l1,l2,r1,0) ⇒ …
move(l2,l1,r1,0) ⇒ … }
l How to avoid generating the last four actions?
u Assign data types to the constant symbols: order-sorted logic

l Locations: l1, l2
l Robots: r1
33
l Operator: move(r : robot, l : location, l’ : location)
precond: at(r,l)
effects: at(r,l’), ¬at(r,l)
Encoding:
move(r1,l1,l2,0) ⇒ at(r1,l1,0) ∧ at(r1,l2,1) ∧ ¬at(r1,l1,1)
move(r1,l2,l1,0) ⇒ at(r1,l2,0) ∧ at(r1,l1,1) ∧ ¬at(r1,l2,1)

l Complete-exclusion axiom:
¬move(r1,l1,l2,0) ∨ ¬move(r1,l2,l1,0)

l Explanatory frame axioms:


¬at(r1,l1,0) ∧ at(r1,l1,1) ⇒ move(r1,l2,l1,0)
¬at(r1,l2,0) ∧ at(r1,l2,1) ⇒ move(r1,l1,l2,0)
at(r1,l1,0) ∧ ¬at(r1,l1,1) ⇒ move(r1,l1,l2,0)
at(r1,l2,0) ∧ ¬at(r1,l2,1) ⇒ move(r1,l2,l1,0)

Extracting a Plan

l Suppose we find an assignment of truth values that satisfies Φ.


u This means P has a solution of length n (as used in the encoding)
l For i=1,…,n, there will be exactly one action a such that ai = true
u This is the i’th action of the plan.
l Example (from the previous slides):
u Φ can be satisfied with move(r1,l1,l2,0) = true
u Thus 〈move(r1,l1,l2,0)〉 is a solution for (P,0)
» It’s the only solution - no other way to satisfy Φ
Planning
l How to find an assignment of truth values that satisfies Φ?
u Use a satisfiability algorithm:
u Davis-Putname
u Local Search
u GSAT
u …
Discussion
l Recall the overall approach:
u for n = 0, 1, 2, …,
» encode (P,n) as a satisfiability problem Φ
» if Φ is satisfiable, then
• From the set of truth values that satisfies Φ, extract a solution
plan and return it
• How well does this work?
u By itself, not very practical (takes too much memory and time)
u But it can be combined with other techniques
» e.g., planning graphs
SatPlan

l SatPlan combines planning-graph expansion and satisfiability checking, roughly as


follows:
34
u for k = 0, 1, 2, …
» Create a planning graph that contains k levels
» Encode the planning graph as a satisfiability problem
» Try to solve it using a SAT solver
• If the SAT solver finds a solution within some time limit,
- Remove some unnecessary actions
- Return the solution
- Memory requirement still is combinatorially large
u but less than what’s needed by a direct translation into satisfiability
l BlackBox (predecessor to SatPlan) was one of the best planners in the 1998 planning
competition
l SatPlan was one of the best planners in the 2004 and 2006 planning competitions

Exponential Complexity Growth: The Challenge of Complex Domains

SAT Encoding (automatically generated from problem specification)

Applications of SAT (1)


Model Checking (hardware/software verification)
– Bounded model checking (BMC)
– Enhancement techniques: Abstraction and refinement
– Major groups at Intel, IBM, Microsoft, and universities such as CMU, Cornell, and
Princeton
– SAT has become a dominant back-end technology

Key questions:
– Safety property: can system ever reach state S?
– Liveness property: will system always reach T after it gets to S?

Main idea:
– Encode “reachability” in a finite transition graph
– CNF encoding: in simple terms, “similar” to planning

Classical Planning
– Parallel step optimal plans
– E.g., SATPLAN-06 fastest in this
category at IPC-06 planning competition
Main idea:
– Create planning graph, unfolded up to T steps
– Encode legal transitions as CNF
• Variables: action vars, fact vars for each time step t
• Clauses encode action preconditions, effects, mutual exclusion, etc.
e.g., (actionA_(t+1) preA1_t AND preA2_t AND preA3_t),
(NOT actionA_t OR NOT actionB_t), …

Combinatorial Design
– Complex mathematical structures with desirable properties
• Latin squares
35
• Quasi groups
• Ramsey numbers
• Steiner systems
•…
– Highly useful for
• design of experiments
• coding theory, cryptography
• drug design and testing
• crop rotation schedules

Has been applied to solve sub-problems in many domains!


– Test pattern generation
– Scheduling
– Optimal Control
– Protocol Design (e.g., for networks)
– Multi-agent systems
– E-Commerce (E-auctions and electronic trading agents), etc.

Propositional Logic, MaxSat + Exam Preparation

The MAXSAT Problem

• The well-known SAT problem is to determine if a boolean formula in Conjunctive Normal


Form (CNF) has a satisfying truth assignment
• A CNF formula is a conjunction of clauses
• A clause is a disjunction of literals (variables or their negations)
• 2 denotes the empty clause (falsified by every truth assignment)
• A satisfying assignment assigns true to at least one literal of every clause.
• MAXSAT is an optimization extension of SAT that asks what is the maximum number of
clauses that can be simultaneously satisfied

Example
F = (¬x)1(x 2y)1(¬y)1(z 2w)
F is unsatisfiable, so no truth assignment can satisfy all 4 clauses.
Truth assignment u = {x,¬y, z,¬w} satisfies all clauses except (¬x). )
U(pie) is a solution to the MAXSAT problem F.

Some clauses may be more important to satisfy than others


• This can be modeled by associating a positive cost with each clause C that will be incurred
if C is falsified
If it is mandatory to satisfy C, its cost is / and C is called hard
• Otherwise, C is called soft
Example
F = (¬x,/(infinity))1(x 2y, 4)1(¬y, 1)1(z 2w,/(infinity))
In F, (¬x,/) is a hard clause, and (x 2y, 4) is soft with cost 4.

A truth assignment u has cost equal to the sum of the


costs of the clauses it falsifies
36
• Goal: find an optimal feasible truth assignment, i.e., a truth assignment of minimum finite
cost mincost(F)
Example
F = (¬x,/(infinity))1(x 2y, 4)1(¬y, 1)1(z 2w,/(infinity))
u = {¬x, y, z,¬w} satisfies all clauses except (¬y, 1)
u is optimal: mincost(F)=cost(u)=1.

We use cost(C) to denote the cost of clause C.


• A solution must satisfy all hard clauses (else its cost will be infinite).
• A solution also satisfies a maximum total cost of soft clauses.
• Casting as minimization problem more closely corresponds to how most MAXSAT solvers
work.
• Many solutions might exist—typically we are only interested in finding one, sometimes
only interested in finding out the cost of a solution.

MAXSAT (ms) (standard MAXSAT): no hard clauses and all


clause have weight 1.
• Solution maximizes the number of satisfied clauses.
• Weighted MAXSAT (wms): no hard clauses.
• Partial MAXSAT (pms): have hard clauses but all soft clauses have weight 1.
• Weighted Partial MAXSAT (wpms): the version we have defined here (subsumes all other
versions).
• Standard MAXSAT is most interesting for theory: it already has sufficient structure for
theoretical insights.
• Other versions mostly an artifact of the limitations of earlier MAXSAT solvers.

Exam Preparation (I tried to answer them, emphasis on tried...)

1)

In a proof by contradiction, such as DPLL, I can prove that a formula F is entailed by a


knowledge base KB by showing that

A the knowledge base KB and the formula F are together unsatisfiable.

B the knowledge base is unsatisfiable, which implies that the formula F must be entailed.

C the knowledge base KB and the negation of the formula are unsatisfiable.

D the formula F is unsatisfiable, which implies that it must be entailed by the KB.

2)

Logic Engineering

Consider a language L defined as follows


•Syntax
37
{A,B,C} L
If F1, F2, F3 L then "(F1*F2*F3)" L

•Semantics: let I be an interpretation


I(A)=1, I(B)=2, l(C)=3
I(F1*F2*F3) = I(F3).I(F1).I(F2)

What is I(A*B*(C*A*B))?

3)

Semantics: the meaning of expressions

Fill in the truth value of the following formulas under the assumption that A,B,C and D are
all false. Fill in the truth values of the formulas (use the words "True, False").

(A & B) v -C v -D is : True
Conjunction, or, disjunction
__________
(A & B) v (-C & D) is True
Conjunction, or, conjunction
__________
(A ->B) v (C ->D) is True
Implies, or, implies _________
(-A ->B) v (-C ->D) is False
_________

4)

Semantics 2

Which of the following is true? The propositional statement


(PvQ ) --> (P&Q)
To be either false or true (truth assignment)
฀ contingency: neither a tautology (true and valid) nor a contradiction (false)

A is satisfiable, but not valid

B is valid

C is a contradiction

D neither valid, satisfiable nor a contradiction

5)

Automated Reasoning as Search


38
Automated reasoning can often be seen as search procedure, that tries to find an order of rules
to formulas in a knowledge base.

Which of the following statements about the DPLL (Davis Putnam Logemann Loveland)
Algorithm and Search is correct?

A DPLL recursively searches through all possible variable assignments for a model, i.e. an
interpretation that satisfies all the clauses.

B DPLL iteratively searches through the set of all clauses for one that is satisfied by a given
interpretation.

C DPLL exhaustively applies a set of transformation rules to produce a contradiction

D DPLL cannot be seen as a search procedure, it only randomly assigns values to


propositions until it finds an assignment that satisfies all the clauses

6)

DPLL

Consider the following knowledge base (set of clauses):

Definition 2.1.1. A tautology is a proposition that is always true.


Example 2.1.1. p ∨ ¬p

Definition 2.1.2. A contradiction is a proposition that is always false.


Example 2.1.2. p ∧ ¬p

Definition 2.1.3. A contingency is a proposition that is neither a tautology nor a contradiction.


Example 2.1.3. p ∨ q → ¬r

1: ¬ p v q v r
2: p v ¬ q v ¬ r
3: ¬ p v ¬ q v ¬ r
4: p v q
5: p v r
6: ¬ p v ¬ q v r

and show whether the knowledge base is satisfiable or not using DPLL. Use the following
order: unit, pure, split alphabetic with a positive value.

Assign p =true
2: p v ¬ q v ¬ r
4: p v q
5: p v r
39
Assign q=true
1: ¬ p v q v r
4: p v q

Find unit clause 6: ¬ p v ¬ q v r, so r = true


3: ¬ p v ¬ q v ¬ r

7)

Properties of GSAT

GSAT is complete w.r.t Propositional Logic satisfiability. True or false?

GSAT: Local greedy search/algorithm of picking the next variable to flip which increases the
number of satisfied clauses the most (ties are broken randomly, note that flips will break also
some clauses).

A True

B False

Probabilistic Graphical Models 1

Foundations

Introduction

Probabilistic Graphical Models is a major field in AI at the crossroads of KR, Statistics and
Learning.
• It has vast amount of applications:
• Decision Making
• Image Segmentation
• Medical Diagnoses
• Speech Recognition
• Natural Language Processing

40
41
42
43
Belief Dynamics

44
45
46
47
48
Independence

Conditional Independence

49
50
Bayes’ Rule

51
52
Exercise: False Positive

53
2nd Solution: Constructing the Belief State

Because we have only two events of interest, T and D, leading to only four worlds, this
solution is feasible.

54
Probabilistic Graphical Models 2

Introduction

55
Representing an expert knowledge in some domain, one needs to ensure some
correspondence between the independencies held by the distribution and those believed by
the expert.

Ex: Pr(Earthquake | Burglary) = Pr(Earthquake) or Pr(Aids | Covid-19) = Pr(Aids).

The Bayesian network (BN) is a modelling tool to specify probability distribution which can,
in principle, address these challenges. A BN relies on the basic insight that independence
forms a significant aspect of beliefs and that it can be elicited relatively easily using the
language of graphs.

A Graphical Tool for capturing Independence

56
First introducing some notions:
Given a DAG G, and a variable V in G,

57
Then, each DAG G corresponds to a compact representation of the following independence
statements:

58
Bayesian Networks

Parameterising the Independence Structure

Suppose, we would like to construct a probability distribution Pr that captures state of our
belief in a given domain.

1st step: Construct a DAG


To construct a DAG G whose independence structure is consistent with our belief state about
that domain.

This, indeed, constrains the possible choices, yet does not uniquely defines it.

2nd step: Add conditional probability tables


For every variable X in the DAG, and its parents U, For every value x of variable X, and
every instantiation u of U, define Pr(x | u).

The second step corresponds to constructing conditional probability table (CPT). This ensures
that Pr is unique.

59
Conditional Probability Tables

Bayesian Networks

Finally, we can formally define a Bayesian network [Pearl, 1985]:

60
61
Properties of Probabilistic Independence

In principle, a Bayesian network G might imply more independence statement than the ones
in Markov(G).

62
Properties of Probabilistic Independence: Symmetry

The first and the simplest property of probabilistic independence we consider is symmetry:

63
Decomposition

64
Another application:
Decomposition can simplify the initial chain rule.

65
Weak Union

66
Contraction

d-Separation

We have seen that deriving new independencies from Markov(G) is a non-trivial task.

Good news is that there is an easy graphical test called d-seperation which captures the
inferential power of graphoid axioms.

This means dsepG(X, Z, Y) (which reads X and Y is d-seperated by Z) implies IPr(X, Z, Y)


for every probability distribution Pr induced by G.

The intuition is similar to a water flow along a pipe (a path in the network) controlled by a set
of valves:
Two variables are independent if all the paths between them are blocked by a closed valve (to
be defined).

67
68
69
70
71
Pruning Method

Paths between sets of nodes can be exponentially many. The following method guarantees it
can be decided in linear time/space in the size of the graph.

72
73
Probabilistic Graphical Models 3

Variable Elimination:
A tool for Inference in Bayesian Networks

The Idea of Variable Elimination

74
Factors

75
We will have two key operations on factors:
summing-out and multiplication.

76
77
The Process of Elimination

78
79
Computing Prior Marginals

Choosing An Elimination Order

Computing Prior Marginals


Remember: All the crucial work is on Line 3 and 4.

80
Choosing an Order of Elimination

Observe: A straightforward idea is to track the degrees of each order.

81
Interaction Graphs

It is simpler to visualize such width with interaction graphs which expresses the interactions
between CPTs of a BN.

The interaction graph G of the given factors , is an undirected graph constructed as follows:
f1,…, fn

• The nodes of G are the variables that appear in factors . f1,…, fn

• Edges connect the variables which appear in the same factor.

82
A simple heuristic: Always choose the node with the smallest degree.

83
Another heuristic: Always choose the node whose elimination adds smallest number of edges.

Computing Posterior Marginals

Now assume that given a BN , N, a set of variables Q, and an instantiation e, we want to


compute the posterior marginal Pr(Q|e) for variables Q.

Remark: Note that prior marginal is a special case of posterior marginal where e is empty.
84
Goal: Computing Pr(Q, e) and normalizing by e.

85
Example: Consider G4 once again.

Suppose Q = {C}, e : A=true,


Goal: Pr(Q, e) by eliminating A first, B second.

Example (cont’d): Consider G4 once again.


Suppose Q = {C}, e : A=true,
Goal: Pr(Q | e) by eliminating A first, B second.

86
All we explained so far (except normalisation by e):

Canvas Quiz with Answers

1.

LAS8 In a proof by contradiction, such as DPLL or tableau, I can prove that a formula F
is entailed by a knowledge base KB by showing that

A: the knowledge base KB and the negation of the formula are unsatisfiable.

the formula F is unsatisfiable, which implies that it must be entailed by the KB.

the knowledge base is unsatisfiable, which implies that the formula F must be entailed.

the knowledge base KB and the formula F are together unsatisfiable

2.
LAS5 A calculus is called complete w.r.t. the semantics of a logic if, and only, if

all the formulas it proves are semantically entailed.


A: it can prove all the semantically entailed formulas.
it proves all the correct formulas in finite time.
all the formulas it proves are tautologies.

3.
LAS4 A formula is in clause normal form if it is a A: conjunction of A: disjunctions of A:
literals

CNF
87
4.
AS6 The semantics (meaning) of a formula in Propositional Logic is determined as:

multiple choice
a numeric value
set membership
A: a truth value

5.
Consider the sentence
((- A v -B) -> (A -> -B)) & (A v B)
Which of the following statements are true?
The sentence is neither valid, nor satisfiable, nor a contradiction
A: The sentence is satisfiable, but not valid
The sentence is valid, but not satisfiable
The sentence is not valid, and thus also not satisfiable
The sentence is not valid, and thus a contradiction

6.
LAC2 In the following truth table X1, X2 and X3 stand for possible truth values:
A B B->A A -> (B -> A)

True True X1(T) T


True False T X2 (T)
False True F X3 (T)
False False T T

Which of the following statements is correct (multiple answers possible):

A -> (B -> A) is valid because there is a model that interprets it as true


X1 =True
X1 = False
A -> (B -> A) is not valid but satisfiable
A -> (B -> A) is valid because all possible models interpret it as true

88
X2 = True
X2 = False

7.
LAC1 Match formulas that are logically equivalent.

A -> (B & C)

A: (-A v B) & (-A v C)

A v (B & C)

A: (A v B) & (A v C)

A -> -(B & C)

A: -A v -B v -C

A & - (B & C)

A: A & (-B v -C)

A & (B -> C)

A: (A & -B) v (A & C)

A -> (B & C) is equivalent to -A v (B & C) by definition of ->, which is equivalent to (-A v


B) & (-A v C) by rule 2 of slide 23
A v (B & C) is (AvB) &(AvC) by rule 2 on slide 23.
A-> -(B&C) is equivalent to -A v -(B&C) by definition of ->. -(B&C) is equivalent to -B v
-C by rule 1.
A v -(B&C) applies rule 1 again.

8.

Weighted partial MAXSAT formulas


฀ both hard and soft clauses are allowed. Subsumes all previously mentioned
variations.
Consider the following statements about geese

1. all geese are white ฀ X


2. geese often have two legs ฀ Y
3. It is very likely that a goose is either white or has two legs or both ฀ (X v Y) v
(X^Y)
89
4. if a goose does not have wings, it cannot fly. ฀ (-W฀Z)

and the following variables:


W stands for goose has wings
X stands for goose is white
Y stands for goose has two legs
Z stands for goose can not fly
Which of the following statements is a faithful representation of the knowledge
described above?

F= (X,-∞) & (X v Y, 0.4) & (Y,-5) & (Z v W,-∞)


F= (X,∞) & (-(X v Y), 0.4) & (Y,5) & (-(Z v W),∞)
A: F= (-X,∞) & (X v Y, 0.4) & (-Y,5) & (Z v W,∞)
F= X & (X v Y, 0.4) & (-Y,5) & (Z v W)

9.

Use DPLL procedure to prove or disprove satisfiability of the formula


(X v Y v Z) & ( X v -Y) & (Y v -Z) & (Z v -X) & (-X v -Y v -Z)
Label each step which part of the algorithm you have used

1. Simplification
Tautology: remove tautologies like P v -P from knowledge base (once in the beginning)

(X v Y v Z)

2. Split
3. pick a predicate and assume a truth value
4. – Heuristics of which literal to pick next can improve the efficiency of DPLL a lot
5. – DLCS (Dynamic Largest Combined Sum): Pick v with the largest count of positive and negative
6. occurrences: CP(v) + CN(v). If CP(v) > CN(v), choose v = 1, else v = 0
7. – DLIS (Dynamic Largest Individual Sum): Pick v with either largest CP or CN. Same truth
8. assignment as for DLCS.
9. – Jeroslow-Wang: weight of literal depends on the length of clauses it occurs in. Thereby, we
10. prefer small clauses. The score of a literal is J(v) =
11. P
12. c2Cv
13. 2฀jcj, and we pick the highest value.
14. One-sided JW looks at v and :v independently, whereas the two-sided approach looks at sum
15. of v and :v, and just picks the truth value based on J(v) J(:v) ) v = 1, else v = 0.
16. – MOMs (Maximum Occurrences in Clauses of Minimum Size): similar to JW, but we only look at
90
17. the smallest clauses in the knowledge base. The number of occurrences in those is indicates by
18. the function f. We choose the literal that maximizes [f(v) + f(:v)] 2k + f(v) f(:v). k is
19. a tuning parameter for the trade-off between the balanced distribution of v and :v and their

20. individual ones.

– Pure literals: set predicates that solely occur in their positive or negative form to the corresponding
truth value
– Unit clauses: set literals for which the knowledge base contain a unit clause to true (or the

predicate to false respectively)

10.
Give a pseudocode description of GSAT

Note that this algorithm tends to get stuck in local minimum (flipping a single variable does not increase
score). Thus, we perform random restarts to start new. That’s also why GSAT spends most time on
plateaus where score is not improved

11.
What are advantages of a short restart and a long restart?
More than 1 answer might be correct.
Advantage long restart: if we’ve randomly jumped to a part of the search space without
solutions, we will waste too much time on local walks

Advantage short restart: if we’ve randomly jumped to a part of the search space close
to a solution, we might still miss it because we didn’t do enough local exploration

A: Advantage short restart: if we’ve randomly jumped to a part of the search space
without solutions, we won’t waste to much time on local walks

A: Advantage long restart:if we’ve randomly jumped to a part of the search space close
to a solution, we are likely to actually find the solution because we’ll do enough local
exploration
91
12.
In Description Logics, a model is an interpretation function that assigns a value true or
false to each concept name.
- ontologies
-
True or false?
True
False

13.
In Description Logics a concept is called unsatisfiable if there is no model.
True or false?
True
False

14.

Description Logics are truly more expressive than Propositional Logics (i.e. everything
that can be said in PL can be said in all Description Logics).
True or false?
True
False

15.
Suppose that the concept names to use are Kid and Ice-Cream, and the role name is
likes.
Translate the following sentence from DL ALC to English

● ∃ (Links to an external site.) likes.Ice-Cream ⊑ Kid

A: Everybody who likes ice-cream is a kid


there is a kid that likes ice-cream
every kid likes ice-cream
everybody who only likes ice-cream is a kid

16.
Use a tableau to prove whether (∀r.A ⊓ ∀r.B) ⊑ ∀r.(A⊓B)
Explain the individual steps.

92
17.

1. Every Bayesian network implicitly represents a unique probability


distributions.
2. True or false?
A: True
False

18.
Given a Bayesian Network G, if two random variables X and Y are independent (w.r.t. to
the probability distribution induced by G) given a third random variable Z, then it follows
that X and Y are d-separated by Z.
True or false?
True
A: False

19.
A divergent valve (←W→) is closed iff neither variable W nor any of its descendants
appears in Z.
True or false?
True
False

20.

93
Group of answer choices
A: c) false
a) true
c) true
b) false
A: b) true
A: d) true
A: a) false
d) false

21.

94
IPr(D,emptyset,C) is True
A: IPr(C,{B,E},A) is False
A: IPr(E,{A},B) is False
IPr(E,{A},B) is True
A: IPr(D,emptyset,C) is False
IPr(C,{B,E},A) is True
IPr({BD},{A,c},E) is False
A: IPr({BD},{A,C},E) is True

95
22.

A: 0.0096

23.

96
A: 0.681
Probabilistic Graphical Models 4

97
Probabilistic Graphical Models 4

In this lecture, we will take a look at the problem of finding variable instantiations that have
maximal probability under some given evidence.

Consider the following examplary scenario:

• A society (S) that is 55% male and 45% female.


• Members of this population can suffer from a medical condition (C) that is more likely in
males.
• Two diagnostic tests are available for detecting this condition, T1 and T2.
• T2 is more effective on females while both tests are equally effective on males.

Example Scenario:

• A society (S) that is 55% male and 45% female.


• Members of this population can suffer from a medical condition (C) that is more likely in
males.
• Two diagnostic tests are available for detecting this condition, T1 and T2.
• T2 is more effective on females while both tests are equally effective on males.

98
One can partition this population into four different groups:

whether they are male or female,


and whether having the condition or not.

• Suppose that all we know is a person took both tests and the test results agree (i.e., A =
true).
Then we may ask: What is the most likely group that this person belong to?

Network Pruning

A Tool of Simplification: Network Pruning

Bayesian Network Simplification: Network Pruning

Network structure has a major impact on the performance of variable elimination (and also on
the performance of most algorithms).

Intuition: The complexity of inference can be very much affected by the number and location
of query and evidence variables within the network structure.

Network Pruning is done in two parts: Node Pruning and Edge Pruning.

Node Pruning

Idea: Given a BN N and a query (Q, e), one can remove any leaf node (with its CPT) from the
network as long as it does not belong to variables Q ∪ E.

This does not affect the ability of the network to answer the query correctly, thanks to the
following result.

Theorem: Let N be a Bayesian network and let (Q, e) be a corresponding query. If N’ =


pruneNodes(N, Q ∪ E), then Pr(Q, e) = Pr(Q, e) where Pr and Pr’ are the probability
distributions induced by networks N and N’ , respectively.

Remark that this can be done iteratively, possibly leading to further simplifications.

99
Edge Pruning
Idea: Given a Bayesian network N and a query (Q, e), one can eliminate some of the network
edges and reduce some of its CPTs without affecting its ability to compute the joint marginal
Pr(Q, e) correctly.

Procedure: For each edge U → X that originates from a node U in E

Theorem: Let N be a BN network and let e be an instantiation. If Nʹ = pruneEdges(N, e), then


Pr(Q, e) = Prʹ(Q, e) where Pr and Prʹ are the probability distributions induced by networks N
and N , respectively

Example: Pruning the network G w.r.t. evidence C=false

The two edges originating from node C were deleted and CPTs and were modified. ΘD|B,C ΘE|C
G

Remark the pruned network is only good for answering queries of the form Pr(q, C = false)
Otherwise pruned network and the original network may disagree.

100
Network Pruning: Example

Example: Pruning the network given the query Q = {D} and e : A=true, C = false Pruning
leads to removing node E and the edges originating from nodes A and C, and modifying the
CPTs, , and . ΘB|A ΘC|A ΘD|BC

Most Likely Instantiations

MAP Queries

One can partition this society into four different groups:

Whether they are male or female,


and having the condition or not.

Suppose that all we know is:


101
A person took both tests and the test results agree (i.e., A = yes).

Then we may ask things like:

What is the most likely group that this person belong to?
=
What are the most likely instantiation of variables S and C given evidence A=yes

102
To calculate that, we can simply compute the posterior marginal (previous lecture) over MAP
variables and then select the instantiation that has a maximum one.

A Special Case: MPE Queries

Remark:
Although likely to be different, sometimes this technique is used to approximate MAP
instances.

103
MAP & MPE Queries

Formal DefinitionGiven a Bayesian network with variables M/Q and evidence e,


MAP/MPE queries (values and instantiations)are defined as follows:

Computing MPE & MAP (by Variable Elimination)


Lets assume no evidence whatsoever, then
MPE instantiation:

We can calculate this by variable elimination:


Idea: Instead of summing-out, we maximise-out.
Example: To maximise S out from the factor, f(S,C, T1, T2, A) we construct a factor on the
remaining variables : C, T1, T2, A

104
105
Extended Factors

We can compute MPE instantiations in addition to its probability:

Idea: The extended factors which assign to each instantiation both a number and an
instantiation

MPE Algorithm

106
Computing MPE

Example:Assume, we want to compute MPE instantiation given evidence J=true and O =


false.

Pruning edges and simplifying (omitting rows that are assigned with 0) gives the following.

107
108
109
Ontologies

11. Ontologies: a way of organizing knowledge that is useful for people

What Is an ontology?
•“An ontology is a formal, explicit specification of a shared conceptualization.

Ontology/ Knowledge Graph

110
Definition(s) of an ontology

"An ontology defines the terms used to describe and represent an area of knowledge" -Jeff
Heflin

"An ontology
-defines the basic terms and relations
-that form the vocabulary of a topic area
-as well as the rules for combining terms and relations
-to infer extensions to the vocabulary" -Neches ('91)

The goal of an Ontology = Knowledge Sharing and Reuse


•Communication between people
•Interoperability between software agent

Ontology Elements

Class (concept,type)
-a name and a set of properties that describe a certain set of individuals in the domain
Example: person + name, birthdate, ID-nr, …

Instances
-the members of the sets defined by classes
Example: person45, name=Frank, birthdate=01-01-1960, ID-nr=12345

Property (relation)
-assert facts about the instances
Example: person45 is–father-of person256

111
An example of ontology

A Film Ontology

112
Real life examples

handcrafted
•music: Music ontology , MusicMoz(1073/7)
•biomedical: SNOMED(300k), Gene Ontology GO(43k terms)Emtree(45k+190kSystems
biology
•ranging from lightweight
•UNSPC, Open directory (400k) to heavyweight (Cyc (300k))
•ranging from small (METAR) to large (UNSPC)

METAR is the most common format in the world for the transmission of observational
weather data

A METAR weather report is predominantly used by aircraft pilots, and by meteorologists,


who use aggregated METAR information to assist in weather forecasting.

UNSPC Product and services

113
The United Nations Standard Products and Services Code(UNSPSC) is a taxonomyof
products and services for use in eCommerce. It is a four-level hierarchy coded as an
eight-digit number, with an optional fifth level adding two more digits.

By classifying their products & services, businesses can assist their customers with:
Finding and Purchasing
Product discovery
Facilitates expenditure analysis.
Control and uniformity across the company

UNSPC Product and services

114
SNOMED: used in healthcare

115
Biomedical ontologies (a few..)
•Mesh
•Medical Subject Headings, National Library of Medicine
•22.000 descriptions
•EMTREE
•Commercial Elsevier, Drugs and diseases
•45.000 terms, 190.000 synonyms
•UMLS
•Integrates 100 different vocabularies
•SNOMED
•300.000 concepts, College of American Pathologists
•Gene Ontology
•15.000 terms in molecular biology
•NCBI Cancer Ontology:
•17,000 classes (about 1M definitions),
Gene Ontology

The Gene Ontology (GO) is a major bioinformatics initiative to unify the representation of
gene and gene product attributes across all species

Three domains:
cellular component
molecular function
biological process
116
Gene product: Actin… UniProtKB:P68032
GO term: heartcontraction; GO:0060047 (biologicalprocess)
Evidencecode: InferredfromMutant Phenotype(IMP)
Reference: PMID 17611253
Assignedby: UniProtKB, June6, 2008

117
Bio-medical ontologies in Bio-portal at Stanford

118
A logic for Ontologies

A taskforLogic Engineering (KR)


•Whatlogic do we need forUMS PC?

Whatlogic do we needforMesh?

•WhataboutGO?
F–PsychiatryandPsychologyF01–behavior and behavior mechanisms
F02–psychological phenomena and processes
F03–mental disorders

What’s inside an ontology?

Classes + class-hierarchy
instances
slots/values
inheritance
•restrictions on slots (type, cardinality)
•properties of slots (symm., trans., …)
•relations between classes (disjoint, covers)
•reasoning tasks: classification, subsumption

Operators for ontologies?


Ontology/ Knowledge Graph

119
Class Axioms -Equivalence and Complement

Equivalent Classes contain the same individuals, and have the same definition

The complement of a class contains all individuals that are not in the class

120
Class Axioms -Disjointness

Disjoint Classes do not contain the same individuals

The complement and disjointness allow us to infer that individuals are different.

Class Axioms -Union and Disjoint Union


The Union Contains all individuals that belong to the classes of the union

121
A disjoint union is a union of mutually disjoint classes

Class Axioms -Intersection and Enumeration


The Intersection contains individuals that each belong to both classes

122
You can enumerate all members of a class

Class Restrictions-Some/all(existential, universal)

All members of a class have at least somevalue from the specified class
"NobelPrizeWinnersis the class of Personswho have wona NobelPrize"

All members of a class have only values from one specified class

A NobelPrizeis theclass of Prizesthatonlyhave been won byNobelPrizeWinners

That is not the same as: Every NobelPrizeWinneronly won NobelPrizes

Necessary and Sufficient Conditions

All members of a class must also be members of anotherClass (it is necessary for a
NobelPrizeWinnertohave been nominated for Nobel Price).
"NobelPrizeWinnersis exactly the class of all Personswho have wona NobelPrize"

The class is precisely specified by some other class (it is a necessary and sufficient
condition).
"NobelPrizeWinnersis the subset of all Personswho were nominatedFora NobelPrize"

Property Types -Symmetric Property

Used to specify that a property always holds in both directions

if type(p,SymmetricProperty) and p(x,y)

then p(y,x)

123
Property Types -Asymmetric Property

Used to specify that a property neverholds in both directions

if type(p,AsymmetricProperty) andp(x,y)

then p(y,x) is inconsistent

Property Types -Transitive Property


Used to specify that a property propagatesover itself

if type(p,TransitiveProperty) andp(x,y) andp(y,z)

then p(x,z)

124
Property Types -Functional Property
Used to specify that a property has only onevalue for any particular instance

if type(p,FunctionalProperty) andp(x,y) andp(x,z)

then y=z

Property Types -Inverse Functional Property


Used to specify that a value for the property uniquely identifiesan instance

if type(p,InverseFunctionalProperty) andp(x,y) andp(z,y)


then x=z

125
Property Types -Reflexive Property
Used to specify that every individualis alwaysrelated to itselfby that property

if type(p,ReflexiveProperty)

then ∀x p(x,x)

126
Property Axioms -Inverse Property

Used to specify that one property is alwaysthe inverse of another property

Summary & what comes now?

•We have seen

•Ontologies: a hierarchical representation of types (“classes”),with


instances(“individuals”) that belong to classes,and properties between the individuals.
•A number of realistic examples of ontologies in use
•These ontologies are easy to read by people

•Now:But can we also make a logics for ontologies,so that computers can reason
automatically?

127
Description logic= logic for ontologies

Description Logics are a family of knowledge representation formalisms


that represent knowledge about an application domain as a hierarchy of concepts and a
description of the properties of the objects (Description Logic Handbook)

We will only look at the simplest member of this family of formalisms

What do we need for our logic?

1.A language(“syntax”),so that we can write down expressions

2.A definition of the meaning of expressions (“semantics”)

3.Inference(“deduction”)so that we can derive new conclusions

Logic of Ontologies

Description logics are a formal language to describe such ontologies (if interpreted
sets-theoretically)
•Simple expressions are: Concepts (sets of objects) and roles (properties), and
Individuals(objects)
128
•Terminology/vocabulary (TBox)
•Complex expressions are 𝐶⊓𝐷,𝐶⊔𝐷,¬𝐶,∀𝑟.𝐶,∃𝑟.𝐶
•Knowledge Bases: C ⊑D, C = D,
•Assertions/Facts (ABox)
•Knowledge Bases: a: C , (a,b):r
•Semantics and Inference allows us to calculate hierarchies, consistently, instance relations,

etc….

Syntax (Concepts)

How to find the classes & properties(= concepts & roles)

1.Any artwork is created by an artist


2.A sculpture is an artwork
3.A painting is an artwork that is not a sculpture
4.A painter is someone who painted a painting
5.A sculptor is someone who sculptured an artwork and only create sculptures
6.If an artwork is created by an artist, he has either painted it or sculpted it

Concepts (= classes,types): Artwork, Artist, Sculptor, Painter, Painting, Sculpture


Roles (= properties): created, created_by, painted, sculptured

129
How to define complex concepts & roles?

Concepts: Artwork, Artist, Sculptor, Painter, Painting, Sculpture


Roles: created, created_by, painted, sculptured

•An artwork that is not a sculpture


•Someone who painted a painting
•Someone who sculptured an artwork and only created sculptures

Concept names: classes, types


Role names: properties

What is the intended meaning?

¬𝐵𝑜𝑦𝑠 (not boys),including tables,chairs,countries,etc.Better: 𝐻𝑢𝑚𝑎𝑛𝑠⊓¬𝐵𝑜𝑦𝑠


𝐶ℎ𝑖𝑛𝑒𝑠𝑒⊓¬𝐵𝑜𝑦𝑠, including Chinese cars, Chinese cups,etc.Better:
𝐻𝑢𝑚𝑎𝑛𝑠⊓𝐶ℎ𝑖𝑛𝑒𝑠𝑒⊓¬𝐵𝑜𝑦𝑠Or: 𝐶ℎ𝑖𝑛𝑒𝑠𝑒_𝑝𝑒𝑜𝑝𝑙𝑒⊓¬𝐵𝑜𝑦𝑠
130
What is wrong with 𝐵𝑜𝑦𝑠⊓∀𝑙𝑜𝑣𝑒𝑠.𝐶𝑎𝑟⊓𝐺𝑖𝑟𝑙𝑠(“boys that love only cars and girls”)

Girls that love only cars (and nothing else)


𝐺𝑖𝑟𝑙𝑠⊓∀𝑙𝑜𝑣𝑒𝑠.𝐶𝑎𝑟
Boys that love cars (but maybe also other things)
𝐺𝑖𝑟𝑙𝑠⊓∃𝑙𝑜𝑣𝑒𝑠.𝐶𝑎𝑟
Boys that don’t love cars
𝐵𝑜𝑦𝑠⊓¬∀𝑙𝑜𝑣𝑒𝑠.𝐶𝑎𝑟or𝐵𝑜𝑦𝑠⊓∀𝑙𝑜𝑣𝑒𝑠.¬𝐶𝑎𝑟) ??
1st= Boys that don’t love only cars
2nd= Boys that don’t love any cars

131
132
Syntax (Knowledge Base)

133
134
A DL Knowledge Base for Art

Semantics (Concepts)

DL Semantics

Mathematical meaning (“interpretation”)of concepts and roles


Interpretation of a concept (class, type) C𝐶𝐼= all individuals X that belong to C
Example: 𝑃𝑎𝑖𝑛𝑡𝑒𝑟𝐼={𝑟𝑒𝑚𝑏𝑟𝑎𝑛𝑑𝑡,𝑣𝑎𝑛𝐺𝑜𝑔ℎ}

Interpretation of a role (property) P= 𝑃𝐼=all pairs of individuals (X,Y) such that X has
property P with as value Y
Example: ℎ𝑎𝑠𝑃𝑎𝑖𝑛𝑡𝑒𝑑𝐼={𝑅𝑒𝑚𝑏𝑟𝑎𝑛𝑑𝑡,𝑛𝑖𝑔ℎ𝑡𝑤𝑎𝑡𝑐ℎ,𝑑𝑎𝑉𝑖𝑛𝑐𝑖,𝑀𝑜𝑛𝑎𝐿𝑖𝑠𝑎}

135
Example

136
Helpful graphical notation

137
Helpful graphical notation for roles

138
Semantics (Knowledge Bases)

139
ABoxReasoning Tasks

Consistency: A Knowledge Base KB=(T,A) is consistent if, and only if, there is a model for T
and A.
Instance checking:An object iis an instance of a concept C wrtaKnowledgeBaseKB (written
as KB ⊨i:C) if, and only if, iI∈CIfor every model I of KB.

and many more….


A Word on Model Theory

The notion of truth cannot be defined within object language(DL), but


onlyrelativetosomeMetalanguage(Set theoretic models).
•Atomic truth can only be stipulated
•“Sneeuw is wit” iff snow is white.
•“nightwatch:Artwork” iffthenightwatchis anartwork.
•Calculated For Complex formulas using the notion of models(interpretations for complex
statements)
•Semanticentailmentis thendefinedpurelystructuralandnotbasedon the atomic definition of
truth.

140
141
The reasoning tasks are thus completely independent of the meaning of the atoms,
andonlyaboutthemodelsthatcapturethepossibleworldsthatare consistent
withtheconstraintsin theKnowledge Base.

142

You might also like