Lemma 1.10 (Ex Falso Quodlibet). T is consistent if ...... subset of {serial,re f lexive,transitive,euclidean} .... In D. M. Gabbay and F. Guenther (Eds.), Handbook of.
Modal Logics for Multi-Agent Systems
Lecture Overview 1. Classical Logic
Jürgen Dix and Wojtek Jamroga
2. Modal Logic Department of Computer Science Clausthal University of Technology, Germany
3. Action and Time 4. Combining Modalities
European Agent Systems Summer School (Durham 2007)
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007)
5. Modalities in Action
1/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007)
2/253
1. Classical Logic
Chapter 1. Classical Logic
Pointers to Other Courses
John Lloyd: Quantified Modal Logic for Building Agents (Thursday morning) Alessio Lomuscio & Wojciech Penczek: Verification of Multiagent Systems via Model Checking (Thursday afternoon)
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007)
1.1 1.2 1.3 1.4 1.5
3/253
Classical Logic Why Logic? Sentential Logic (SL) Sudoku Calculi for SL Wumpus in SL
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007)
4/253
1. Classical Logic
1. Classical Logic
In this chapter:
1.1 Why Logic?
We make the case for using formal logic as a representation formalism for reasoning about the world. We present classical propositional logic to introduce the standard language and formalism. The semantics of propositional logic is the basis of all other logics. It can be used to model many things: we show its versatility by modeling Sudoku-puzzles. We also describe two calculi for this logic and consider briefly correctness and completeness issues. We illustrate how to use propositional logic with the well-known Wumpus world.
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007)
5/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007)
1. Classical Logic
1. Why Logic?
Why logic at all?
6/253
1. Why Logic?
Why logic at all?
framework for thinking about systems, makes one realise many assumptions, . . . and then we can: investigate them, accept or reject them, weaken some of them and still use a part of the formal and conceptual machinery,
Jürgen Dix and Wojtek Jamroga ·
1. Why Logic?
European Agent Systems Summer School (Durham 2007)
: check specification against implementation, executable specification,
verification
planning as model checking
7/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007)
8/253
1. Classical Logic
1. Classical Logic
1. Why Logic?
Symbolic AI: Symbolic representation, e.g. sentential or first order logic. Agent as a theorem prover. Traditional: Theory about agents. Implementation as stepwise process (Software Engineering) over many abstractions. Symbolic AI: View the theory itself as executable specification. Internal state: Knowledge Base (KB), often simply called D (database).
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007)
2. Sentential Logic (SL)
1.2 Sentential Logic (SL)
9/253
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
2. Sentential Logic (SL)
European Agent Systems Summer School (Durham 2007) 10/253
2. Sentential Logic (SL)
Definition 1.1 (Sentential Logic LSL , Language L ⊆ LSL )
Definition 1.2 (Semantics, Valuation, Model)
The language LSL of propositional (or sentential) logic consists of and >: the constants falsum and verum, p, q, r, x1 , x2 , . . . xn , . . .: a countable set AT of SL-constants, ¬, ∧, ∨, →: the sentential connectives (¬ is unary, all others are binary operators), (, ): the parentheses to help readability. In most cases we consider only a finite set of SL-constants. They define a language L ⊆ LSL . The set of L -formulae FmlL is defined inductively.
A valuation v for a language L ⊆ LSL is a mapping from the set of SL-constants defined by L into the set {true, false} with v() = false, v(>) = true. Each valuation v can be uniquely extended to a function v¯ : FmlL → {true, false} so that: true, if v(p) ¯ = false, v(¬p) ¯ = false, if v(p) ¯ = true. true, if v(ϕ) ¯ = true and v(γ) ¯ = true, v(ϕ ¯ ∧ γ) = false, else true, if v(ϕ) ¯ = true or v(γ) ¯ = true, v(ϕ ¯ ∨ γ) = false, else
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007)
11/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 12/253
1. Classical Logic
2. Sentential Logic (SL)
Definition (continued) v(ϕ ¯ → γ) = true, if v(ϕ) ¯ = false or (v(ϕ) ¯ = true and v(γ) ¯ = true), false, else Thus each valuation v uniquely defines a v. ¯ We call v¯ L -structure. A structure determines for each formula if it is true or false. If a formula φ is true in structure v¯ we also say Av is a model of φ. From now on we will speak of models, structures and valuations synonymously. Semantics The process of mapping a set of L -formulae into {true, false} is called semantics.
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 13/253
2. Sentential Logic (SL)
Definition 1.4 (Consequence Set Cn(T ))
A formula ϕ follows from T if for all models v of T (i.e. v |= T ) also v |= ϕ holds. We write: T |= ϕ. We call CnL (T ) =def {ϕ ∈ FmlL : T |= ϕ}, or simply Cn(T ), the semantic consequence operator.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 15/253
1. Classical Logic
2. Sentential Logic (SL)
Definition 1.3 (Validity of a Formula, Tautology) 1
2
3
A formula ϕ ∈ FmlL holds under the valuation v if v(ϕ) ¯ = true. We also write v¯ |= ϕ or simply v |= ϕ. v¯ is a model of ϕ. A theory is a set of formulae: T ⊆ FmlL . v satisfies T if v(ϕ) ¯ = true for all ϕ ⊆ T . We write v |= T . A L -formula ϕ is called L -tautology if for all possible valuations v in L v |= ϕ holds.
From now on we suppress the language L , because it is obvious from context. Nevertheless it needs to be carefully defined. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 14/253
1. Classical Logic
2. Sentential Logic (SL)
Lemma 1.5 (Properties of Cn(T )) The semantic consequence operator has the following properties: 1 T -extension: T ⊆ Cn(T ), 0 0 2 Monotony: T ⊆ T ⇒ Cn(T ) ⊆ Cn(T ), 3 Closure: Cn(Cn(T )) = Cn(T ). Lemma 1.6 (ϕ 6∈ Cn(T)) ϕ 6∈ Cn(T ) if and only if
Jürgen Dix and Wojtek Jamroga ·
there is a model v with v |= T and v(ϕ) ¯ = false.
European Agent Systems Summer School (Durham 2007) 16/253
1. Classical Logic
1. Classical Logic
2. Sentential Logic (SL)
2. Sentential Logic (SL)
Definition 1.7 (MOD(T), Cn(U )) Definition 1.8 (Completeness of a Theory T )
If T ⊆ FmlL then we denote with MOD(T ) the set of all L -structures A which are models of T :
T is called complete if for each formula ϕ ∈ Fml: T |= ϕ or T |= ¬ϕ holds.
MOD(T ) =def {A : A |= T }. If U is a set of models, we consider all those sentences, which are valid in all models of U . We call this set Cn(U ):
Attention: Do not mix up this last condition with the property of a valuation (model) v: each model is complete in the above sense.
Cn(U ) =def {ϕ ∈ FmlL : ∀v ∈ U : v(ϕ) ¯ = true}. MOD is obviously dual to Cn: Cn(MOD(T )) = Cn(T ), MOD(Cn(T )) = MOD(T ).
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007)
17/253
2. Sentential Logic (SL)
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 18/253
1. Classical Logic
3. Sudoku
1.3 Sudoku Definition 1.9 (Consistency of a Theory) T is called consistent if there is a valuation (model) v with v(ϕ) ¯ = true for all ϕ ∈ T . Lemma 1.10 (Ex Falso Quodlibet) T is consistent if and only if Cn(T ) 6= FmlL .
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 19/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 20/253
1. Classical Logic
3. Sudoku
1. Classical Logic
3. Sudoku
Can they be solved with sentential logic?
Sudoku Since some time, Sudoku puzzles are becoming quite famous.
Idea: Given a Sudoku-Puzzle S, construct a language LSudoku and a theory TS ⊆ FmlLSudoku such that MOD(TS ) = Solutions of the puzzle S Solution
In fact, we construct a theory TSudoku and for each (partial) instance of a 9 × 9 puzzle S a particular theory TS such that MOD(TSudoku ∪ TS ) = {S : S is a solution of S} Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 21/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 22/253
Table 1: A simple Sudoku (S1 )
1. Classical Logic
3. Sudoku
We introduce the following language LSudoku : 1 2 3 4 5 6 7 8 9
einsi, j , 1 ≤ i, j ≤ 9, zweii, j , 1 ≤ i, j ≤ 9, dreii, j , 1 ≤ i, j ≤ 9, vieri, j , 1 ≤ i, j ≤ 9, fuenfi, j , 1 ≤ i, j ≤ 9, sechsi, j , 1 ≤ i, j ≤ 9, siebeni, j , 1 ≤ i, j ≤ 9, achti, j , 1 ≤ i, j ≤ 9, neuni, j , 1 ≤ i, j ≤ 9.
1. Classical Logic
3. Sudoku
We distinguished between the puzzle S and a solution S of it. What is a model (or valuation) in the sense of Definition 1.2?
This completes the language, the syntax. How many symbols are these? Table 2: How to construct a model S ? Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 23/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 24/253
1. Classical Logic
3. Sudoku
1. Classical Logic
We have to give our symbols a meaning: the semantics! einsi, j means i, j contains a 1 zweii, j means i, j contains a 2 .. . neuni, j means i, j contains a 9 To be precise: given a 9 × 9 square that is completely filled out, we define our valuation v as follows (for all 1 ≤ i, j ≤ 9). true, if 1 is at position (i, j), v(einsi, j ) = false, else . Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 25/253
1. Classical Logic How does
TS
3. Sudoku
true, if 2 is at position (i, j), false, else .
v(zweii, j ) =
true, if 3 is at position (i, j), false, else .
true, if 4 is at position (i, j), false, else .
v(dreii, j ) = v(vieri, j ) = etc.
v(neuni, j ) =
true, if 9 is at position (i, j), false, else .
Therefore any 9 × 9 square can be seen as a model or valuation with respect to the language LSudoku . Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 26/253
3. Sudoku
How should the theory TSudoku look like (s.t.
look like?
TS = { eins1,4 , eins5,8 , eins6,6 , zwei2,2 , zwei4,8 , drei6,8 , drei8,3 , drei9,4 , vier1,7 , vier2,5 , vier3,1 , vier4,3 , vier8,2 , vier9,8 , .. . neun3,4 , neun5,2 , neun6,9 , }
models of TSudoku ∪ TS correspond to solutions of the puzzle)?
First square: T1 1 2 3 4 5 6 7 8 9
Jürgen Dix and Wojtek Jamroga ·
3. Sudoku
European Agent Systems Summer School (Durham 2007) 27/253
eins1,1 ∨ . . . ∨ eins3,3 zwei1,1 ∨ . . . ∨ zwei3,3 drei1,1 ∨ . . . ∨ drei3,3 vier1,1 ∨ . . . ∨ vier3,3 fuenf1,1 ∨ . . . ∨ fuenf3,3 sechs1,1 ∨ . . . ∨ sechs3,3 sieben1,1 ∨ . . . ∨ sieben3,3 acht1,1 ∨ . . . ∨ acht3,3 neun1,1 ∨ . . . ∨ neun3,3
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 28/253
1. Classical Logic
3. Sudoku
The formulae on the last slide are saying, that 1 The number 1 must appear somewhere in the first square. 2 The number 2 must appear somewhere in the first square. 3 The number 3 must appear somewhere in the first square. 4 etc Does that mean, that each number 1, . . . , 9
1. Classical Logic
3. Sudoku
No! We have to say, that each number occurs only once:
T10 : 1 2 3 4 5 6 7 8
¬(einsi, j ∧ zweii, j ), 1 ≤ i, j ≤ 3, ¬(einsi, j ∧ dreii, j ), 1 ≤ i, j ≤ 3, ¬(einsi, j ∧ vieri, j ), 1 ≤ i, j ≤ 3, etc ¬(zweii, j ∧ dreii, j ), 1 ≤ i, j ≤ 3, ¬(zweii, j ∧ vieri, j ), 1 ≤ i, j ≤ 3, ¬(zweii, j ∧ fuenfi, j ), 1 ≤ i, j ≤ 3, etc
How many formulae are these?
occurs exactly once in the first square?
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 29/253
3. Sudoku
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 30/253
3. Sudoku
Second square: T2 1 2 3 4 5 6 7 8 9
eins1,4 ∨ . . . ∨ eins3,6 zwei1,4 ∨ . . . ∨ zwei3,6 drei1,4 ∨ . . . ∨ drei3,6 vier1,4 ∨ . . . ∨ vier3,6 fuenf1,4 ∨ . . . ∨ fuenf3,6 sechs1,4 ∨ . . . ∨ sechs3,6 sieben1,4 ∨ . . . ∨ sieben3,6 acht1,4 ∨ . . . ∨ acht3,6 neun1,4 ∨ . . . ∨ neun3,6
The same has to be done for all 9 squares.
And all the other formulae from the previous slides (adapted to this case): T20
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 31/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 32/253
1. Classical Logic
3. Sudoku
1. Classical Logic
3. Sudoku
First Row: TRow 1 What is still missing:
1
Rows: Each row should contain exactly the numbers from 1 to 9 (no number twice). Columns: Each column should contain exactly the numbers from 1 to 9 (no number twice).
2 3 4 5 6 7 8 9
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 33/253
1. Classical Logic
3. Sudoku
Analogously for all other rows, eg. Ninth Row: TRow 9 1 2 3 4 5 6 7 8 9
eins9,1 ∨ eins9,2 ∨ . . . ∨ eins9,9 zwei9,1 ∨ zwei9,2 ∨ . . . ∨ zwei9,9 drei9,1 ∨ drei9,2 ∨ . . . ∨ drei9,9 vier9,1 ∨ vier9,2 ∨ . . . ∨ vier9,9 fuenf9,1 ∨ fuenf9,2 ∨ . . . ∨ fuenf9,9 sechs9,1 ∨ sechs9,2 ∨ . . . ∨ sechs9,9 sieben9,1 ∨ sieben9,2 ∨ . . . ∨ sieben9,9 acht9,1 ∨ acht9,2 ∨ . . . ∨ acht9,9 neun9,1 ∨ neun9,2 ∨ . . . ∨ neun9,9
Is that sufficient? What if a row contains several
1's?
Jürgen Dix and Wojtek Jamroga ·
eins1,1 ∨ eins1,2 ∨ . . . ∨ eins1,9 zwei1,1 ∨ zwei1,2 ∨ . . . ∨ zwei1,9 drei1,1 ∨ drei1,2 ∨ . . . ∨ drei1,9 vier1,1 ∨ vier1,2 ∨ . . . ∨ vier1,9 fuenf1,1 ∨ fuenf1,2 ∨ . . . ∨ fuenf1,9 sechs1,1 ∨ sechs1,2 ∨ . . . ∨ sechs1,9 sieben1,1 ∨ sieben1,2 ∨ . . . ∨ sieben1,9 acht1,1 ∨ acht1,2 ∨ . . . ∨ acht1,9 neun1,1 ∨ neun1,2 ∨ . . . ∨ neun1,9
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
3. Sudoku
First Column: TColumn 1 1 2 3 4 5 6 7 8 9
eins1,1 ∨ eins2,1 ∨ . . . ∨ eins9,1 zwei1,1 ∨ zwei2,1 ∨ . . . ∨ zwei9,1 drei1,1 ∨ drei2,1 ∨ . . . ∨ drei9,1 vier1,1 ∨ vier2,1 ∨ . . . ∨ vier9,1 fuenf1,1 ∨ fuenf2,1 ∨ . . . ∨ fuenf9,1 sechs1,1 ∨ sechs2,1 ∨ . . . ∨ sechs9,1 sieben1,1 ∨ sieben2,1 ∨ . . . ∨ sieben9,1 acht1,1 ∨ acht2,1 ∨ . . . ∨ acht9,1 neun1,1 ∨ neun2,1 ∨ . . . ∨ neun9,1
Analogously for all other columns. Is that sufficient? What if a column contains several
European Agent Systems Summer School (Durham 2007) 35/253
European Agent Systems Summer School (Durham 2007) 34/253
1's?
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 36/253
1. Classical Logic
3. Sudoku
1. Classical Logic
3. Sudoku
Here is a more difficult one. All put together: TSudoku = T1 ∪ T10 ∪ . . . ∪ T9 ∪ T90 TRow 1 ∪ . . . ∪ TRow 9 TColumn 1 ∪ . . . ∪ TColumn 9
Table 3: A difficult Sudoku Sdifficult
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 37/253
3. Sudoku
The above formulation is strictly formulated in propositional logic. Theorem provers, even if they consider only propositional theories, often use predicates, variables etc. smodels uses a predicate logic formulation, including variables. But as there are no function symbols, such an input can be seen as a compact representation. It allows to use a few rules as a shorthand for thousands of rules using propositional constants. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 39/253
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 38/253
3. Sudoku
For example smodels uses the following constructs: 1 row(0..8) is a shorthand for row(0), row(1), ..., row(8). 2 val(1..9) is a shorthand for val(1), val(2), ..., val(9). 3 The constants 1, ..., 9 will be treated as numbers (so there are operations available to add, subtract or divide them).
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 40/253
1. Classical Logic 1
2
3. Sudoku
Statements in smodels are written as head :- body This corresponds to an implication body → head. An important feature in smodels is that all atoms that do not occur in any head, are automatically false.
For example the theory p(X, Y, 5) :- row(X), col(Y) means that the whole grid is filled with 5’s and only with 5's: eg. ¬p(X,Y, 1) is true for all X,Y , as well as ¬p(X,Y, 2) etc. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 41/253
1. Classical Logic
3. Sudoku
1. Classical Logic
3. Sudoku
More constructs in smodels 1 { p(X,Y,A) : val(A) } 1 :row(X), col(Y) this makes sure that in all entries of the grid, exactly one number (val()) is contained. 1 { p(X,Y,A) : row(X) : col(Y) : eq(div(X,3), div(R,3)) : eq(div(Y,3), div(C,3) } 1 :- val(A), row(R), col(C) this rule ensures that in each of the 9 squares each number from 1 to 9 occurs only once.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 42/253
1. Classical Logic
Sudoku formalization
4. Calculi for SL
1.4 Calculi for SL
row(0..8). col(0..8). val(1..9).
1 { p(X,Y,A) : val(A) } 1 :- row(X), col(Y). 1 { p(X,Y,A) : row(X) } 1 :- val(A), col(Y). 1 { p(X,Y,A) : col(Y) } 1 :- row(X), val(A). 1 { p(X,Y,A) : row(X) : col(Y) : eq(div(X,3),div(R,3)) : eq(div(Y,3),div(C,3)) } 1 :- row(R), col(C), val(A).
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 43/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 44/253
1. Classical Logic
4. Calculi for SL
1. Classical Logic
4. Calculi for SL
A general notion of a certain sort of calculi.
We now define a particular instance of our general notion.
Definition 1.11 (Hilbert-Type Calculi)
Definition 1.12 (Calculus for Sentential Logic SL)
A Hilbert-Type calculus over a language L is a pair hAx, Infi where Ax: is a subset of FmlL , the set of well-formed formulae in L : they are called axioms, Inf: is a set of pairs written in the form φ1 , φ2 , . . . , φn ψ where φ1 , φ2 , . . . , φn , ψ are L -formulae: they are called inference rules. Intuitively, one can assume all axioms as “true formulae” (tautologies) and then use the inference rules to derive even more new formulae.
SL We define HilbertSL L = hAxL , {MP}i, the Hilbert-Type calculus, as follows. The underlying language is L ⊆ LSL with the wellformed formulae FmlL as defined in Definition 1.1. Axioms in SL (AxSL L ) are the following formulae: 1 φ → >, → φ, ¬> → , → ¬>, 2 (φ ∧ ψ) → φ, (φ ∧ ψ) → ψ, 3 φ → (φ ∨ ψ), ψ → (φ ∨ ψ), 4 ¬¬φ → φ, (φ → ψ) → ((φ → ¬ψ) → ¬φ), 5 φ → (ψ → φ), φ → (ψ → (φ ∧ ψ)).
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 45/253
1. Classical Logic
4. Calculi for SL
The only inference rule in SL is modus ponens: MP : Fml × Fml → Fml : (ϕ, ϕ → ψ) 7→ ψ. or short ϕ, ϕ → ψ . ψ
(ϕ, ψ are arbitrarily complex formulae).
Jürgen Dix and Wojtek Jamroga ·
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 46/253
4. Calculi for SL
Definition 1.13 (Proof)
Definition (continued)
(MP)
φ, ψ stand for arbitrarily complex formulae (not just constants). They represent schemata, rather than formulae in the language.
European Agent Systems Summer School (Durham 2007) 47/253
A proof of a formula ϕ from a theory T ⊆ FmlL is a sequence ϕ1 , . . . , ϕn of formulae such that ϕn = ϕ and for all i with 1 ≤ i ≤ n one of the following conditions holds: ϕi is substitution instance of an axiom, ϕi ∈ T , there is ϕl , ϕk = (ϕl → ϕi ) with l, k < i. Then ϕi is the result of the application of modus ponens on the predecessor-formulae of ϕi . We write: T ` ϕ (ϕ can be derived from T ). Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 48/253
1. Classical Logic
4. Calculi for SL
We have now introduced two important notions: Syntactic derivability `: the notion that certain formulae can be derived from other formulae using a certain calculus, Semantic validity |=: the notion that certain formulae follow from other formulae based on the semantic notion of a model.
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 49/253
4. Calculi for SL
1. Classical Logic
4. Calculi for SL
Definition 1.14 (Correct-, Completeness for a calculus) Given an arbitrary calculus (which defines a notion `) and a semantics based on certain models (which defines a relation |=), we say that Correctness: The calculus is correct with respect to the semantics, if the following holds: Φ ` φ implies Φ |= φ. Completeness: The calculus is complete with respect to the semantics, if the following holds: Φ |= φ implies Φ ` φ.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 50/253
1. Classical Logic
4. Calculi for SL
Theorem 1.15 (Correct-, Completeness for HilbertSL L )
Theorem 1.16 (Compactness for HilbertSL L )
A formula follows semantically from a theory T if and only if it can be derived:
A formula follows from a theory T if and only if it follows from a finite subset of T : Cn(T ) =
T |= ϕ if and only if T ` ϕ
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 51/253
Jürgen Dix and Wojtek Jamroga ·
{Cn(T 0 ) : T 0 ⊆ T, T 0 finite}.
[
European Agent Systems Summer School (Durham 2007) 52/253
1. Classical Logic
4. Calculi for SL
It is well-known, that any formula φ can be written as a conjunction of disjunctions mi n _ ^
φi, j
i=1 j=1
The φi, j are just constants or negated constants. W i φi, j are called clauses of The n disjunctions mj=1 φ. Normalform
Instead of working on arbitrary formulae, it is often easier to work on finite sets of clauses.
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 53/253
4. Calculi for SL
Set-notation of clauses
A disjunction A ∨ ¬B ∨C ∨ . . . ∨ ¬E is often written as a set {A, ¬B,C, . . . , ¬E}. Thus the set-theoretic union of such sets corresponds again to a clause: {A, ¬B} ∪ {A, ¬C} represents A ∨ ¬B ∨ ¬C. Note that the empty set 0/ is identified with .
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 55/253
1. Classical Logic
4. Calculi for SL
A resolution calculus for SL The resolution calculus is defined over the language L res ⊆ LSL where the set of well-formed formulae FmlLRes res consists of all disjunctions of the following form A ∨ ¬B ∨C ∨ . . . ∨ ¬E, i.e. the disjuncts are only constants or their negations. No implications or conjunctions are allowed. These formulae are called clauses. is also a clause: the empty disjunction.
Jürgen Dix and Wojtek Jamroga ·
1. Classical Logic
European Agent Systems Summer School (Durham 2007) 54/253
4. Calculi for SL
We define the following inference rule on FmlLRes res : Definition 1.17 (SL resolution)
Let C1 ,C2 be clauses (disjunctions). Deduce the clause C1 ∨C2 from C1 ∨ A and C2 ∨ ¬A: C1 ∨ A, C2 ∨ ¬A (Res) C1 ∨C2 / then C1 ∨C2 = . If C1 = C2 = 0,
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 56/253
1. Classical Logic
4. Calculi for SL
If we use the set-notation for clauses, we can formulate the inference rule as follows: Definition 1.18 (SL resolution (Set notation))
Deduce the clause C1 ∪C2 from C1 ∪ {A} and C2 ∪ {¬A}: (Res)
C1 ∪ {A}, C2 ∪ {¬A} C1 ∪C2
Again, we identify the empty set 0/ with .
1. Classical Logic
4. Calculi for SL
Definition 1.19 (Resolution Calculus for SL)
We define the resolution calculus / {Res}i as follows. The RobinsonSL L res = h0, underlying language is L res ⊆ LSL defined on Slide 57 together with the well-formed formulae FmlLRes res . Thus there are no axioms and only one inference rule. The well-formed formulae are just clauses. Question:
Is this calculus correct and complete?
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 57/253
1. Classical Logic
4. Calculi for SL
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 58/253
1. Classical Logic
Answer: It is correct, but it is not complete!
5. Wumpus in SL
1.5 Wumpus in SL
But every problem of the kind “T |= φ” is equivalent to “T ∪ {¬φ} is unsatisfiable” or rather to T ∪ {¬φ} ` (` stands for the calculus introduced above). Theorem 1.20 (Completeness of Resolution Refutation) If M is an unsatisfiable set of clauses then the empty clause can be derived in RobinsonSL L res . We also say that resolution is refutation complete.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 59/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 60/253
1. Classical Logic Breeze
Stench
4
1. Classical Logic
5. Wumpus in SL
Breeze
3
Stench
PIT
1,4
Breeze
1,3
2,4
3,4
4,4
5. Wumpus in SL
2,3
3,3
4,3
PIT
Gold
1,2
= Agent = Breeze = Glitter, Gold = Safe square = Pit = Stench = Visited = Wumpus
1,4
2,4
3,4
4,4
1,3
2,3
3,3
4,3
2,2
3,2
4,2
2,2
3,2
4,2
1,2
2,1
3,1
4,1
1,1
Breeze
Stench
2
A B G OK P S V W
A Breeze
1
OK
2,1 V OK
Breeze
PIT
P?
OK
OK 1,1
OK
3,1
A B OK
START
1
2
Jürgen Dix and Wojtek Jamroga ·
3
European Agent Systems Summer School (Durham 2007) 61/253
1,3
W!
2,4
3,4
4,4
2,3
3,3
4,3
5. Wumpus in SL
1,2
A
2,2
S OK 1,1
4,2
= Agent = Breeze = Glitter, Gold = Safe square = Pit = Stench = Visited = Wumpus
1,4
2,4
1,3 W!
2,3
1,2
2,2
S V OK
OK 3,1
B V OK
P!
4,1
1,1
(a)
P?
3,4
4,4
3,3 P?
4,3
3,2
4,2
Jürgen Dix and Wojtek Jamroga ·
(b)
European Agent Systems Summer School (Durham 2007) 62/253
1. Classical Logic
5. Wumpus in SL
Language definition: Si, j stench Bi, j breeze Piti, j is a pit Gli, j glitters Wi, j contains Wumpus
V OK B V OK
3,1
P!
4,1
(b)
General knowledge: ¬S1,1 −→ (¬W1,1 ∧ ¬W1,2 ∧ ¬W2,1 ) ¬S2,1 −→ (¬W1,1 ∧ ¬W2,1 ∧ ¬W2,2 ∧ ¬W3,1 ) ¬S1,2 −→ (¬W1,1 ∧ ¬W1,2 ∧ ¬W2,2 ∧ ¬W1,3 ) S1,2
Jürgen Dix and Wojtek Jamroga ·
4,1
2,1 V OK
A S G B
2,1 V OK
3,2
A B G OK P S V W
P?
4
1. Classical Logic 1,4
(a)
European Agent Systems Summer School (Durham 2007) 63/253
−→ (W1,3 ∨W1,2 ∨W2,2 ∨W1,1 )
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 64/253
1. Classical Logic
5. Wumpus in SL
1. Classical Logic
5. Wumpus in SL
Knowledge after the 3rd move: ¬S1,1 ∧ ¬S2,1 ∧ S1,2 ∧ ¬B1,1 ∧ ¬B2,1 ∧ ¬B1,2 Question: Can we deduce that the wumpus is located at (1,3)? Answer: Yes. Either via resolution or using our Hilbert-calculus.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 65/253
2. Modal Logic
Programming versus knowledge engineering programming knowledge engineering choose language choose logic write program define knowledge base write compiler implement calculus run program derive new facts
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 66/253
2. Modal Logic
Chapter 2. Modal Logic In this chapter:
2.1 2.2 2.3 2.4 2.5
Modal Logic Reasoning about Knowledge Kripke Semantics Axioms for Modal Logics Normative Reasoning References
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 67/253
We extend propositional logic by modality operators. They can express beliefs, knowledge, etc. We introduce the semantics of modal logics, based on Kripke structures. Finally we consider variants of modal logics representing obligations and permissions.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 68/253
2. Modal Logic
2. Modal Logic
is an extension of classical logic by new connectives and ♦ : necessity and possibility. Modal logic
p is true” means p is necessarily true, i.e. “ true in every possible scenario, ♦ p is true” means p is possibly true, i.e. “♦ true in at least one possible scenario. Independently of the precise definition, the following holds
Various modal logics: knowledge → epistemic logic, beliefs → doxastic logic, obligations → deontic logic, actions → dynamic logic, time → temporal logic, and combinations of the above: most famous multimodal logics: BDI logics of beliefs, desires, intentions (and time).
♦p ↔ ¬¬p Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 69/253
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 70/253
2. Modal Logic
Most of it can be translated to classical logic; . . . but it looks horribly UGLY there; . . . and in most cases it’s not automatizable any more. Remember Frege’s notation of predicate logic:
Jürgen Dix and Wojtek Jamroga ·
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 71/253
Good to know: MSPASS is a theorem prover implementing many modal logics, also description logics, relational calculus, etc built upon SPASS, a resolution prover for first-order logic with equality, check out http: //www.cs.man.ac.uk/~schmidt/mspass/.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 72/253
2. Modal Logic
1. Reasoning about Knowledge
2.1 Reasoning about Knowledge
2. Modal Logic
1. Reasoning about Knowledge
Example 2.1 (Muddy children – Shoham’s version) A group of n children enters the house after having played in the mud outside. They are greeted by their father, who notices that k of them have mud on their foreheads (no kid can see whether she herself has a muddy forehead, but they can see all other foreheads). Can the kids find out whether they have a muddy forehead?
The father announces: At least one of you has mud on her forehead. He also says If you know (can prove) that your forehead is muddy, then raise your hands now. Nothing happens. The father keeps repeating the question. After exactly k rounds, all the children with muddy foreheads raise their hands. Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 73/253
1. Reasoning about Knowledge
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 74/253
1. Reasoning about Knowledge
Definition 2.2 (Partition Model) An n-agent partition model over a language L is a tuple (W , I1 , . . . , In ), where
How is that possible? The announcement of the father does not reveal anything new, or does-it?
W : is a set of possible worlds, i.e. a set of L -structures (each L -sentence ϕ is either true in each of w ∈ W or not). Ii : each Ii is a partition of W : Ii = {Wi1 ,Wi2 , . . . ,Wir } with Wi j ∩Wik = 0/ for j 6= k S and 1≤ j≤r Wi j = W . We also use the notation (w ∈ W )
Ii (w) := {w0 : w ∈ Wi j and w0 ∈ Wi j } all worlds in the partition containing world w, according to agent i’s view of the universe. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 75/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 76/253
2. Modal Logic
1. Reasoning about Knowledge
The worlds in W can be propositional valuations or even first-order structures. In this lecture, we will mainly consider the propositional version.
3
1
cc c
3 mc c
3
1
cc c
3 mc c
3 mc 1c
cc c
mc 1c
mc m 1
cc m
3 cc c
mc c
mud1 ∈ π(w) iff w = mxx mud2 ∈ π(w) iff w = xmx mud3 ∈ π(w) iff w = xxm
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 79/253
Jürgen Dix and Wojtek Jamroga ·
mm 1c
mm c
3
1
3
2
mc m
3
3 mc c
1 cm c
m m
2
cc m
1
mm c
cm c
2
1 cm c
mm 1c
3
3
2
mc m
cm c
cm m
1 cm m
2
mm c
3
2
cc m
1
mm 1c
mm m 1
mm m
3
2
mm c
cm m
3
2
mc m
mm m 1
3
3
2
1
cm c
2
cc m
1
mm c
1. Reasoning about Knowledge
mm m
3
2
2
3
2
2
mc m
2
2
1
cm c
cm m
1
2
mm m
3
3 mc c
cm m
1
3 mm c
2. Modal Logic
1. Reasoning about Knowledge
mm m
European Agent Systems Summer School (Durham 2007) 78/253
2
2. Modal Logic
Jürgen Dix and Wojtek Jamroga ·
2
European Agent Systems Summer School (Durham 2007) 77/253
2
How can we formalise the notion of one agent knowing something? And reason about what agents know and draw conclusions?
2
The language L in our example consists just of the propositional constants mud1 , . . . , mudn .
Jürgen Dix and Wojtek Jamroga ·
1. Reasoning about Knowledge
We introduce new operators Ki with the intuitive meaning Ki ϕ “agent i knows that ϕ holds”. We can now formulate statements in a language L (K1 , . . . , Kn ) containing these operators. It remains to define a precise semantics for this notion.
2
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 80/253
mc c
m m
2. Modal Logic
1. Reasoning about Knowledge
2. Modal Logic
2. Kripke Semantics
2.2 Kripke Semantics
Definition 2.3 (Semantics for partition models)
Let an n-agent partition model A = (W , I1 , . . . , In ) over a language L be given. Then we define the relation |= for L (K1 , . . . , Kn ) formulae as follows: for ϕ ∈ L : A , w |= ϕ if and only if w |= ϕ, A , w |= Ki ϕ if and only if for all worlds w0 , if w0 ∈ Ii (w) then A , w0 |= ϕ.
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 81/253
2. Kripke Semantics
A slight generalisation of partition models leads to modal logic.
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 83/253
2. Kripke Semantics
An Example
How can one look at a partition? It is like a set of equivalence classes: for agent i, all worlds in one partition are equivalent. They are all possible scenarios. So let’s generalise and introduce a binary relation R on all worlds: w1 Rw2 meaning that world w2 can be accessed (is reachable) from world w1 .
European Agent Systems Summer School (Durham 2007) 82/253
q0
x=0
q0
x=0
s s
q0
q2 x=2
Jürgen Dix and Wojtek Jamroga ·
q1
q2
x=1x=2
s s
Jürgen Dix and Wojtek Jamroga ·
q1
q2
x=1x=2
European Agent Systems Summer School (Durham 2007) 84/253
2. Modal Logic
2. Kripke Semantics
2. Modal Logic
2. Kripke Semantics
Definition 2.4 (Modal Logic with n modalities)
The language Lmodaln of modal logic with n modal operators 1 , . . . , n is the smallest set containing the propositional constants of L , and with formulae ϕ, ψ also the formulae i ϕ, ¬ϕ, ϕ ∧ ψ. We treat ∨, →, ↔, ♦ as macros (defined as usual). Note that the operators can be nested:
Definition 2.5 (Semantics of Modal Logic) The truth of a Lmodal1 -formula is evaluated relative to a world w and a Kripke structure hW , Ri, where W is a set of (propositional) models (possible worlds) and R is a binary relation on them, the accessibility relation. The relation |= is defined as follows: hW , Ri |=w p if p is primitive and w |= p, hW , Ri |=w ϕ ∧ ψ if hW , Ri |=w ϕ and hW , Ri |=w ψ. hW , Ri |=w ¬ϕ if not hW , Ri |=w ϕ hW , Ri |=w ϕ if for any w0 ∈ W with wRw0 : hW , Ri |=w0 ϕ
(1 2 1 p) ∨ 3 ¬p
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 85/253
3. Axioms for Modal Logics
2.3 Axioms for Modal Logics
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 86/253
3. Axioms for Modal Logics
As in classical logic, one can ask about a complete axiom system. Is there a calculus that allows to derive all sentences true in all Kripke models? Definition 2.6 (System K)
The system K is an extension of the propositional calculus by the axiom Axiom K (ϕ ∧ (ϕ → ψ)) → ψ and the inference rule ϕ (Necessitation) . ϕ Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 87/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 88/253
2. Modal Logic
3. Axioms for Modal Logics
Theorem 2.7 (Soundness/completeness of System K)
System K is sound and complete with respect to arbitrary Kripke models. If we allow n modalities, the theorem as well as the definitions extend in an obvious way. The calculus is then called System Kn to account for the n modalities.
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 89/253
3. Axioms for Modal Logics
To which axioms do the following properties lead? Reflexivity: xRx for all x. Transitivity: xRy and yRz implies xRz for all x, y, z. Euclidean: xRy and xRz implies yRz for all for all x, y, z. Serial: for all x there is a x0 such that xRx0 .
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 91/253
2. Modal Logic
3. Axioms for Modal Logics
Note that we have not assumed any properties of the accessibility relation R: it is just any binary relation. How does our partition model fit in this framework? A partition is nothing else than an equivalence relation! Assuming that R is an equivalence relation, what additional statements (axioms) are true in all Kripke models?
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 90/253
3. Axioms for Modal Logics
Lemma 2.8
A binary relation is an equivalence relation if and only if it is reflexive, transitive and euclidean.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 92/253
2. Modal Logic
3. Axioms for Modal Logics
2. Modal Logic
3. Axioms for Modal Logics
Definition 2.9 (Extending K by Axioms D, T, 4,5)
Theorem 2.10 (Sound/complete Subsystems of KDT45)
The system K is often extended by (a subset of) the following axioms:
Let X be any subset of {D, T, 4, 5} and let X be any subset of {serial, re f lexive,transitive, euclidean} corresponding to X. Then K ∪ X is sound and complete with respect to Kripke models the accessibility relation of which satisfies X .
K D T 4 5
(Ki ϕ ∧ Ki (ϕ → ψ)) → Ki ψ ¬Ki (ϕ ∧ ¬ϕ) Ki ϕ → ϕ Ki ϕ → Ki Ki ϕ ¬Ki ϕ → Ki ¬Ki ϕ
called as above for historical reasons. The system consisting of KT45 is also called S5.
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 93/253
3. Axioms for Modal Logics
Exercise: Show that 1 The axiom D follows from KT45. 2 Show that KD45 is not equivalent to K45: axiom D does not follow from K45.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 95/253
Corollary 2.11 (Sound-, completeness of KT45 (S5))
System KT45 is sound and complete with respect to Kripke models the accessibility relation of which is reflexive, transitive and euclidean. Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 94/253
3. Axioms for Modal Logics
Up to now we were thinking of Ki ϕ (the box operator i ) as agent i knows that ϕ. What if we interpret the operator as belief? Under such an interpretation axiom T has to be dropped. But all other axioms make sense. Axiom system KD45 is called the standard logic of beliefs. Axiom K is called logical omniscience, axiom D is called consistency, axiom 4 (resp. axiom 5) is called positive (resp. negative) introspection.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 96/253
2. Modal Logic
4. Normative Reasoning
2.4 Normative Reasoning
2. Modal Logic
4. Normative Reasoning
Deontic Logic is concerned with normative law and normative reasoning in law. The operators used denote obligation, permission, prohibition etc. We describe two systems: system OS (Von Wright, 1951) and KD (Åqvist, 1984).
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 97/253
4. Normative Reasoning
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 98/253
4. Normative Reasoning
Definition 2.12 (System OS)
The system OS is based on two modalities (deontic operators): O, meaning obligation, and P meaning permission. It is an extension of the propositional calculus by the axioms
It can be shown that this system can be seen as a modal logic with O as primitive modality. But then, because of necessitation, one has to accept the derivable sentence (O>) O(p ∨ ¬p) (stating the existence of an empty normative system): von Wright originally rejected this as an axiom.
OS1 Op ↔ ¬P¬p OS2 Pp ∨ P¬p OS3 P(p ∨ q) ↔ Pp ∨ Pq and the inference rule ϕ↔ψ (OS4) . Pϕ ↔ Pψ Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 99/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 100/253
2. Modal Logic
4. Normative Reasoning
The KD System The KD System is a von Wright-type system including the F (forbidden) operator and consisting of the following additional axioms and rules (again the classical axioms and modus ponens are included). (KD1) (KD2) (KD3) (KD4) (KD5)
O(p → q) → (Op → Oq) Op → Pp Pp ≡ ¬O¬p Fp ≡ ¬Pp p O-necessitation: Op
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 101/253
2. Modal Logic
5. References
2.5 References
2. Modal Logic
4. Normative Reasoning
Axiom (KD1) is the so called K-axiom; (KD2) is the D-axiom, stating that obligatory implies permitted; (KD3) states that permission is the dual of obligation and (KD4) says that forbidden is not permitted. (KD1) holds for any modal necessity operator. O is the basic operator (all others are definable with it). The axioms reflect the idea that something is obligated if it holds in all perfect (ideal) worlds (relative to the world where one is).
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 102/253
2. Modal Logic
5. References
[aqvist84] Åqvist, L. (1984). Deontic logic. In D. M. Gabbay and F. Guenther (Eds.), Handbook of Philosophical Logic, Vol II, pp. 605–714. Reidel. [Fagin et al. 1995] Fagin, R., Halpern, J. Y., Moses, Y. & Vardi, M. Y. Reasoning about Knowledge. MIT Press: Cambridge, MA. [fipa] Foundation for Intelligent Physical Agents. FIPA home page. http://www.fipa.org/.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 103/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 104/253
2. Modal Logic
5. References
[fipa-acl] Foundation for Intelligent Physical Agents (2002). FIPA ACL message structure specification. Approved for standard, 2002-12-06. http://www.fipa.org/specs/fipa00061/. [HiDBoHoMe98] Hindriks, K. V., F. S. de Boer, H. Hoek, and J.-J. C. Meyer (1998). Formal semantics of the core of AGENT-0. In ECAI’98 Workshop on Practical Reasoning and Rationality, pp. 20–29.
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 105/253
5. References
[mascardi02] Mascardi, V. (2002). Logic-Based Specification Environments for Multi-Agent Systems. Ph. D. thesis, Computer Science Department of Genova University, Genova, Italy. DISI-TH-2002-04. [MascardiMS04] Mascardi, V., M. Martelli, and L. Sterling (2004). Logic-based specification languages for intelligent software agents. TPLP 4(4), 429–494.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 107/253
2. Modal Logic
5. References
[kripke63b] Kripke, S. (1963a). Semantical analysis of modal logic I. Normal propositional calculi. Zeitschrift fur math. Logik und Grundlagen der Mathematik 9, 67–96. [kripke63a] Kripke, S. (1963b). Semantical considerations on modal logic. Acta Philosophica Fennica 16, 83–94. [kripke65] Kripke, S. (1965). Semantical analysis of modal logic II. Non-normal modal propositional calculi. In Addison, Henkin, and Tarski (Eds.), The theory of models, Amsterdam, North-Holland, pp. 206–220.
Jürgen Dix and Wojtek Jamroga ·
2. Modal Logic
European Agent Systems Summer School (Durham 2007) 106/253
5. References
[Parunak-odell] Odell, J., H. V. D. Parunak, and B. Bauer (2000a). Extending UML for agents. In G. Wagner, Y. Lespérance, and E. Yu (Eds.), Proceedings of the 2nd Workshop on Agent-Oriented Information Systems (AOIS’00). Held in conjunction with 17th National conference on Artificial Intelligence (AAAI’00), pp. 3–17. [aose54] Odell, J., H. V. D. Parunak, and B. Bauer (2000b). Representing agent interaction protocols in UML. In P. Ciancarini and M. Wooldridge (Eds.), Proceedings of the 1st International Workshop on Agent-Oriented Software Engineering (AOSE’00), pp. 121–140. Springer-Verlag. LNCS 1957.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 108/253
2. Modal Logic
5. References
3. Action and Time
Chapter 3. Action and Time [vonWright51] von Wright, G. H. (1951). Deontic logic. Mind 60, 1–15. Reprinted in G. H. von Wright, Logical Studies, pp. 58–74. Routledge and Kegan Paul, 1957.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 109/253
3. Action and Time
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 110/253
3. Action and Time
In this chapter:
Up to now: Several operators Ki , each defines an accessibility relation on worlds. Description of static systems: no possibility of change But: MAS are dynamic!
Jürgen Dix and Wojtek Jamroga ·
3.1 3.2 3.3 3.4
Action and Time Dynamic Logic Temporal Logic ATL References
European Agent Systems Summer School (Durham 2007) 111/253
We add program/action modalities [α], hαi, and define dynamic logic, where we can talk about actions and their outcomes. We discuss two basic kinds of temporal logic, i.e. linear and branching time temporal logic. We end with introducing ATL, in which temporal logic is combined with elements of game theory.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 112/253
3. Action and Time
1. Dynamic Logic
3.1 Dynamic Logic
3. Action and Time
1. Dynamic Logic
1st idea: Consider actions or programs α. Each such α defines a transition (accessibility relation) from worlds into worlds. 2nd idea: We need statements about the outcome of actions: [α]ϕ: “after every execution of α, ϕ holds, hαiϕ: “after some executions of α, ϕ holds. As usual, hαiϕ ≡ ¬[α]¬ϕ.
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
European Agent Systems Summer School (Durham 2007) 113/253
1. Dynamic Logic
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 114/253
3. Action and Time
1. Dynamic Logic
Definition 3.1 (Labelled Transition System)
3rd idea: Programs/actions can be combined (sequentially, nondeterministically, iteratively), e.g.: [α; β]ϕ would mean “after every execution of α and then β, formula ϕ holds”.
A labelled transition system is a pair α
hQ, {−→: α ∈ L}i where Q is a non-empty set of states and L is a non-empty set of labels and for each α ∈ L: α −→⊆ Q × Q. Definition 3.2 (Dynamic Logic: Models)
A model of propositional dynamic logic is given by a labelled transition systems and an evaluation of propositions. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 115/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 116/253
3. Action and Time
1. Dynamic Logic
3. Action and Time
wait Definition 3.3 (Semantics of DL) α
M , s |= [α]ϕ iff for every t such that s −→ t, we have M ,t |= ϕ.
q0
1. Dynamic Logic
wait
try
q1
start
wait
q0
wait
try
q1
halt start
halt
start → htryihalt start → ¬[try]halt start → htryi[wait]halt
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
European Agent Systems Summer School (Durham 2007) 117/253
1. Dynamic Logic
Definition 3.4 (Composite labels)
We require that the set of labels forms a ∪,∗∗i. We also assume that Kleene algebra hL, ;,∪ the set of labels contains constructs of the form “ϕ?”, whenever ϕ is a formula not involving any modalities.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 118/253
3. Action and Time
1. Dynamic Logic
“;” means sequential composition, ∪” means nondeterministic choice, “∪ “∗∗” means finite iteration (regular expr.), “ϕ?” means test. Thus we assume that the labels obey the following conditions: α;β
α
α∪β
α
β
s −→ t iff s −→ s0 and s0 −→ t, β
s −→ t iff s −→ t or s −→ t, α∗ s −→ t is the reflexive and transitive closure of α s −→ t, ϕ?
s −→ s iff s |=M ϕ. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 119/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 120/253
3. Action and Time
1. Dynamic Logic
3. Action and Time
1. Dynamic Logic
fuel
What has this to do with programs? roL 2 fuelOK caL
roL nofuel 1 caL
if ϕ then a else b
(ϕ?;a) ∪ (¬ϕ?;b)
5
9
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 121/253
3. Action and Time
1. Dynamic Logic
roL nofuel caP
9
roL nofuel caL
roL 2 fuelOK caL
roL nofuel caR
roL 6 fuelOK caR
roL nofuel caP
roL fuelOK caP
10
7
roP nofuel caR
roP fuelOK caR 8
roP nofuel caP 11
roP fuelOK caP 12
European Agent Systems Summer School (Durham 2007) 122/253
3. Action and Time
1. Dynamic Logic
(nofuel?;fuel)È(fuelOK?;load)
roP nofuel caL 3
roP fuelOK caL 4
roP nofuel caR
roP fuelOK caR 8
roP nofuel caP 11
roL fuelOK caP
10
Jürgen Dix and Wojtek Jamroga ·
load
5
7
roP fuelOK caL 4
(ϕ?;a)∗ ; (¬ϕ?)
while ϕ do a
1
roL 6 fuelOK caR
roL nofuel caR
roP nofuel caL 3
roL nofuel 1 caL
5
roP fuelOK caP 12
9
roL nofuel caR
roL nofuel caP
roL 2 fuelOK caL
roL 6 fuelOK caR
roL fuelOK caP
10
7
roP nofuel caL 3
roP fuelOK caL 4
roP nofuel caR
roP fuelOK caR 8
roP nofuel caP 11
roP fuelOK caP 12
caR → [(no f uel?; f uel) ∪ ( f uelOK?; load)]caR Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 123/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 124/253
3. Action and Time
2. Temporal Logic
3.2 Temporal Logic
3. Action and Time
2. Temporal Logic
Reasoning about Time: CTL Ideas: The accessibility relation represents time. time: linear vs. branching start
start
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 125/253
3. Action and Time
2. Temporal Logic
ϕ ♦ϕ ϕU ψ
ϕ is true in the next moment in time ϕ is true in all future moments ϕ is true in some future moment ϕ is true until the moment when ψ becomes true
((¬passport ∨ ¬ticket) → ¬board _ f light) send(msg, rcvr) → ♦ receive(msg, rcvr)
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
European Agent Systems Summer School (Durham 2007) 126/253
2. Temporal Logic
Temporal logic was originally developed in order to represent tense in natural language.
Typical temporal operators
ϕ
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 127/253
Within Computer Science, it has achieved a significant role in the formal specification and verification of concurrent and distributed systems. Much of this popularity has been achieved because a number of useful concepts can be formally, and concisely, specified using temporal logics, e.g. safety properties liveness properties fairness properties
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 128/253
3. Action and Time
2. Temporal Logic
Safety / maintenance: “something bad will not happen” “something good will always hold”
3. Action and Time
2. Temporal Logic
Liveness: “something good will happen”
Typical examples: Typical examples:
♦ rich roL → ♦ roP and so on . . .
¬bankrupt ( f uelOK ∨ f uelOK) and so on . . . Usually: ¬....
Jürgen Dix and Wojtek Jamroga ·
Usually: ♦ ....
European Agent Systems Summer School (Durham 2007) 129/253
3. Action and Time
2. Temporal Logic
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
European Agent Systems Summer School (Durham 2007) 130/253
2. Temporal Logic
Strong fairness
Combinations of safety and liveness possible: ♦ roP (roL → ♦ roP)
Jürgen Dix and Wojtek Jamroga ·
fairness
European Agent Systems Summer School (Durham 2007) 131/253
“if something is attempted/requested, then it will be successful/allocated” Typical examples: (attempt → ♦ success) ♦attempt → ♦success
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 132/253
3. Action and Time
2. Temporal Logic
3. Action and Time
2. Temporal Logic
Linear Time: LTL Fairness: Useful when scheduling processes, responding to messages, etc. Good for specifying properties of the environment.
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
European Agent Systems Summer School (Durham 2007) 133/253
2. Temporal Logic
: Linear Time Logic Reasoning about a particular computation of a system Time is linear: just one possible future path is included! Models: paths LTL
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
2. Temporal Logic
Important: computational vs. behavioral structure
Definition 3.5 (Models of LTL)
A model of LTL is a sequence of time moments (states). We call such models paths, and denote them by λ. Evaluation of atomic propositions at particular time moments is also needed.
1
Computational str.
2
pos0
q0
2 1
pos2
pos1 2
European Agent Systems Summer School (Durham 2007) 135/253
System
pos0
1
Notation: λ[i]: ith time moment λ[i . . . j]: all time moments between i and j λ[i . . . ∞]: all timepoints from i on
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 134/253
q2
pos2
Jürgen Dix and Wojtek Jamroga ·
q1 pos1
European Agent Systems Summer School (Durham 2007) 136/253
3. Action and Time
2. Temporal Logic
3. Action and Time
2. Temporal Logic
Important: computational vs. behavioral structure Computational str.
Behavioral str. pos0
q0
q0
pos0
LTL models are defined as behavioral structures!
q0q0 pos0
pos2
pos1
Jürgen Dix and Wojtek Jamroga ·
q0q0q1 pos1
....
q1
q2
European Agent Systems Summer School (Durham 2007) 137/253
3. Action and Time
2. Temporal Logic
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 138/253
3. Action and Time
2. Temporal Logic
Definition 3.6 (Semantics of LTL)
iff p is true at moment λ[0]; iff λ[1..∞] |= ϕ; iff λ[i..∞] |= ϕ for some i ≥ 0; iff λ[i..∞] |= ϕ for all i ≥ 0; iff λ[i..∞] |= ψ for some i ≥ 0, and λ[ j..∞] |= ϕ for all 0 ≤ j ≤ i.
l pos0
q0
l' pos1
q1
pos2
q2
pos0
q0
pos1
pos2
q1
q2
....
λ |= p λ |= ϕ λ |= ♦ϕ λ |= ϕ λ |= ϕ U ψ
pos0
q0
pos1
q1
λ |= ♦pos1 λ0 = λ[1..∞] |= pos1 pos1 ∈ π(λ0 [0])
Note that: ϕ ≡ ¬♦¬ϕ ♦ϕ ≡ ¬¬ϕ ♦ϕ ≡ > U ϕ Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 139/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 140/253
pos
q2
3. Action and Time
3. Action and Time
2. Temporal Logic
2. Temporal Logic
Branching Time: CTL
l q1
pos2
q2
pos0
q0
pos1
pos2
q1
q2
....
q0
pos1
pos0
q0
pos1
q1
λ |= ♦pos1 λ[0..∞] |= ♦pos1 λ[1..∞] |= ♦pos1 λ[2..∞] |= ♦pos1 ...
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 141/253
3. Action and Time
2. Temporal Logic
l[0..¥] pos2
q2
pos0
q0
pos1 Computational pos2 pos pos pos2 pos0 CTL: Tree 0Logic. 1 q1 q2 q q1 q2 q0 Reasoning about possible0 computations of a system Time is branching: we want all alternative paths included! Models include: states (time points, situations), transitions (changes) Paths: courses of action, computations.
....
pos0
l[0..¥]
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
pos1
European Agent Systems Summer School (Durham 2007) 142/253
2. Temporal Logic
CTL models: transition systems
Definition 3.8 (Paths)
Definition 3.7 (Transition System)
A path λ is an infinite sequence of states that can be affected by subsequent transitions. A path must be full, i.e. either infinite, or ending in a state with no outgoing transition.
A transition system is a pair hQ, −→i where Q is a non-empty set of states −→⊆ Q × Q is a transition relation. Note that, formally, a transition relation is just a modal accessibility relation.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 143/253
q1
Usually, we assume that the transition relation is serial (time flows forever). Then, all paths are infinite.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 144/253
pos2
q2
3. Action and Time
2. Temporal Logic
Reasoning about Time: CTL
“Vanilla” CTL: every temporal operator must be immediately preceded by exactly one path quantifier; CTL*: no syntactic restrictions; Reasoning in “vanilla” CTL can be automatized. European Agent Systems Summer School (Durham 2007) 145/253
3. Action and Time
2. Temporal Logic
Example: Rocket and Cargo
1
roL nofuel caL
roL 2 fuelOK caL
roP nofuel caL 3
roL nofuel caR
roL 6 fuelOK caR
7
roP nofuel caR
roP fuelOK caL 4
roP fuelOK caR 8
A(roL ∨ roP) roL → A (roP → nofuel)
9
roL nofuel caP
roL fuelOK caP
10
Jürgen Dix and Wojtek Jamroga ·
roP nofuel caP 11
A rocket and a cargo, The rocket can be moved between London (proposition roL) and Paris (proposition roP), The cargo can be in London (caL), Paris (caP), or inside the rocket (caR), The rocket can be moved only if it has its fuel tank full (fuelOK), When it moves, it consumes fuel, and nofuel holds after each flight.
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
European Agent Systems Summer School (Durham 2007) 146/253
2. Temporal Logic
Definition 3.9 (Semantics of CTL*: state formulae)
roL → E♦roP 5
2. Temporal Logic
Example: Rocket and Cargo
Path quantifiers: A (for all paths), E (there is a path); Temporal operators: (nexttime), ♦ (sometime), (always) and U (until);
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
roP fuelOK caP 12
European Agent Systems Summer School (Durham 2007) 147/253
M, q |= Eϕ if, by definition, there is a path λ, starting from q, such that M, λ |= ϕ; M, q |= Aϕ if, by definition, for all paths λ, starting from q, we have M, λ |= ϕ. Definition 3.10 (Semantics of CTL*: path formulae)
Exactly like for LTL! M, λ |= ϕ iff M, λ[1...∞] |= ϕ; M, λ |= ϕ U ψ iff M, λ[i...∞] |= ϕ for some i ≥ 0, and M, λ[ j...∞] |= ϕ for all 0 ≤ j ≤ i. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 148/253
3. Action and Time
2. Temporal Logic
3. Action and Time
2. Temporal Logic
Example: Rocket and Cargo
1
5
9
roL nofuel caL
roL 2 fuelOK caL
roL nofuel caR
roL 6 fuelOK caR
roL nofuel caP
roL fuelOK caP
10
7
roP nofuel caL 3
roP fuelOK caL 4
roP nofuel caR
roP fuelOK caR 8
roP nofuel caP 11
roP fuelOK caP 12
Jürgen Dix and Wojtek Jamroga ·
Exercise:
How to express that there is no possibility of a deadlock? E♦caP
European Agent Systems Summer School (Durham 2007) 149/253
3. Action and Time
3. ATL
3.3 ATL
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 150/253
3. Action and Time
3. ATL
ATL: What Agents Can Achieve ATL: Agent Temporal Logic [Alur et al. 1997] Temporal logic meets game theory Main idea: cooperation modalities hhAiiΦ: coalition A has a collective strategy to enforce Φ
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 151/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 152/253
3. Action and Time
3. ATL
hh jamesbondii♦win: “James Bond has an infallible plan to eventually win” hh jamesbond, bondsgirliifun U shot: “James Bond and his girlfriend are able to have fun until someone shoots at them”
Agents, actions, transitions, atomic propositions Atomic propositions + interpretation Actions are abstract
European Agent Systems Summer School (Durham 2007) 153/253
3. Action and Time
3. ATL
Definition 3.11 (Concurrent Game Structure)
A concurrent game structure is a tuple M = hAgt, Q, π, Act, d, oi, where: Agt: a finite set of all agents Q: a set of states π: a valuation of propositions Act: a finite set of (atomic) actions d : Agt × Q → P (Act) defines actions available to an agent in a state o: a deterministic transition function that assigns outcome states q0 = o(q, α1 , . . . , αk ) to states and tuples of actions Jürgen Dix and Wojtek Jamroga ·
3. ATL
ATL Models: Concurrent Game Structures
“Vanilla” ATL: every temporal operator preceded by exactly one cooperation modality; ATL*: no syntactic restrictions; Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
European Agent Systems Summer School (Durham 2007) 155/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 154/253
3. Action and Time
3. ATL
Rocket Example: Simultaneous Actions
1 2
1
5
9
Jürgen Dix and Wojtek Jamroga ·
roL nofuel caL
roL 2 fuelOK caL
roL nofuel caR
roL 6 fuelOK caR
roL nofuel caP
roL fuelOK caP
10
7
roP nofuel caL 3
roP fuelOK caL 4
roP nofuel caR
roP fuelOK caR 8
roP nofuel caP 11
roP fuelOK caP 12
European Agent Systems Summer School (Durham 2007) 156/253
3. Action and Time
3. Action and Time
3. ATL
3. ATL
Definition 3.12 (Strategy)
A strategy is a conditional plan. We represent strategies with functions sa : Q → Act.
Definition 3.13 (Semantics of ATL)
M, q |= hhAiiΦ if, by definition, there is a collective strategy SA such that, for every path λ ∈ out(q, SA ), we have M, λ |= Φ.
Function out(q, SA ) returns the set of all paths that may result from agents A executing strategy SA from state q onward.
Jürgen Dix and Wojtek Jamroga ·
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 157/253
3. Action and Time
European Agent Systems Summer School (Durham 2007) 158/253
3. Action and Time
3. ATL
3. ATL
Example: Robots and Carriage Note:
h
us
ait
it,p
sh ,w
wa
us h
ait
,w
it,p
sh
wa
pu
us h
ait ,w
it,p
sh
wa
pu
us h
,w
it,p
sh
wa
pu
pu
pos2
h
Jürgen Dix and Wojtek Jamroga ·
pos1
it
pos2
push,wait
us
pos1
wait,wait push,push is exactly the topic of the next section. push,push wait,push wait,push q1 wait q q2
wa
European Agent Systems Summer School (Durham 2007) 159/253
q1
it,p
pos2
push,wait
sh, pu
pos1
q2
wait,wait
pos0 wa
q1
wait,push
wait,wait wait,wait Which push,push push,push 2 push
it wa sh, sh pu ,pu
Jürgen Dix and Wojtek Jamroga ·
push,wait
pos0
it wa
pos2
wait,push
wait,wait wait,wait push,push push,push
q0
it wa sh, sh pu ,pu
q2
pos0
When we combine time (actions, strategies...) wait,wait wait wait,wait push,push push,push with knowledge desires, intentions, wait pos0 q0(beliefs, q0 obligations...), we finally obtain a fairly realistic model of MAS.
it wa
wait,wait push,push
q0
wait,wait push,push
it wa sh, h pu us it,p wa
ait
wait,wait push,push
push,wait
European Agent Systems Summer School (Durham 2007) 160/253
q1
w p
pos1
3. Action and Time
3. ATL
3. Action and Time
Practical importance of temporal and strategic logics:
4. References
3.4 References
Automatic verification in principle possible (model checking): good complexity results for “vanilla” CTL and “vanilla” ATL model checkers exist for LTL and “vanilla” CTL. Can be used for automated planning. Executable specifications can be used for programming. More: Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
Chapter 5. European Agent Systems Summer School (Durham 2007) 161/253
4. References
[Alur et al. 2002] R. Alur, T. A. Henzinger, and O. Kupferman. Alternating-time Temporal Logic. Journal of the ACM, 49:672–713, 2002. [Emerson 1990] E. A. Emerson. Temporal and modal logic. Handbook of Theoretical Computer Science, volume B, 995–1072. Elsevier, 1990.
Jürgen Dix and Wojtek Jamroga ·
3. Action and Time
European Agent Systems Summer School (Durham 2007) 162/253
4. References
[Huth00] Huth, M. & Ryan, M. Logic in Computer Science: Modeling and reasoning about systems. Cambridge University Press.
[Fisher 2006] Fisher, M. (2006). Temporal Logics. Kluwer.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 163/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 164/253
4. Combining Modalities
4. Combining Modalities
Chapter 4. Combining Modalities
4.1 4.2 4.3 4.4
We have seen how to model belief, knowledge, time and action using modal logic. How about combining them?
Combining Modalities BDI (Cohen et al.) BDI (Rao et al.) Beware! References
Jürgen Dix and Wojtek Jamroga ·
4. Combining Modalities
European Agent Systems Summer School (Durham 2007) 165/253
1. BDI (Cohen et al.)
4.1 BDI (Cohen et al.)
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 166/253
4. Combining Modalities
1. BDI (Cohen et al.)
Beliefs, Desires, Intentions BDI according to Cohen and Levesque: Mental primitives: beliefs and goals, Separate operators and relations for each agent Time and action: LTL and DL. Altogether:
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 167/253
Jürgen Dix and Wojtek Jamroga ·
multi-modal logic
European Agent Systems Summer School (Durham 2007) 168/253
4. Combining Modalities
Operator Bi ϕ Gi ϕ
α Done α
1. BDI (Cohen et al.)
Meaning agent i believes ϕ agent i has goal of ϕ action α will happen next action α has just happened
Additionally: Action constructors “;” and “?”, as in DL; Derived operators: ♦α (sometime α), α (always α), (Later ϕ): strict sometime, (Before ϕ , ψ): ϕ holds before ψ.
Jürgen Dix and Wojtek Jamroga ·
4. Combining Modalities
European Agent Systems Summer School (Durham 2007) 169/253
1. BDI (Cohen et al.)
4. Combining Modalities
1. BDI (Cohen et al.)
The primitive constructs above allow us to define the following operators: Derived Operator Definition Meaning
x;α?) sometime α ♦α ∃x( ♦¬α α ¬♦ always α ♦ (Later ϕ) ¬ϕ ∧ ϕ strict sometime (Before ϕ , ψ) ϕ → ψ ϕ holds before ψ Examples: Gcitizen safea G police Bcitizen safecitizen
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 170/253
4. Combining Modalities
2. BDI (Rao et al.)
All goals have to be dropped eventually:
4.2 BDI (Rao et al.)
♦ ¬(Gi (Later ϕ)) How to define a persistent goal? P-Goal i ϕ = (G i (Later ϕ)) ∧ Bi ¬ϕ ∧ Before ((Bi ϕ) ∨ (Bi ¬ϕ) (¬(Gi Later ϕ)) How to define intention?
ϕ))? ; ϕ] Intend i ϕ = (P-Goal i [Donei (Bi (
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 171/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 172/253
4. Combining Modalities
2. BDI (Rao et al.)
4. Combining Modalities
2. BDI (Rao et al.)
Example: Card Play BDI according to Rao and Georgeff: Mental primitives: beliefs, desires and intentions Time: CTL Sophisticated semantic structure
W1
q0
hasA
4. Combining Modalities
European Agent Systems Summer School (Durham 2007) 173/253
2. BDI (Rao et al.)
Bela E win : Agent A believes that there is a way to win in one step Desa A win : the agent desires that every path leads to a victory, so he does not have to worry about his decisions However, he does not believe it is possible: ¬Bela A win On the other hand, he believes that a real optimist would believe that winning forever is inevitable: Bela Belopt A win.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 175/253
AK1
W3
q0
AK2
q0
Ba
Da
hasA win
W4
q0
AK1
Da hasA
hasA
Bopt hasA win
Jürgen Dix and Wojtek Jamroga ·
W2
AQ1
hasA
AQ1
Bopt AK2
QK2
Jürgen Dix and Wojtek Jamroga ·
4. Combining Modalities
hasA
AQ2
KQ2 win
hasA win
KQ2
European Agent Systems Summer School (Durham 2007) 174/253
2. BDI (Rao et al.)
Of course, it is possible to extend BDI: horizontally: with other modal dimensions (e.g., BOID); vertically: to a language of higher order (e.g., LORA).
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 176/253
4. Combining Modalities
2. BDI (Rao et al.)
4. Combining Modalities
2. BDI (Rao et al.)
What do we use these frameworks for?
What do we use these frameworks for?
Analysis & Design
Automatic Generation of Behaviours
Modeling systems (the frameworks provide intuitive conceptual structures, and a systematic approach); Specifying desireable properties of systems.
Reasoning about concrete systems; Correctness testing.
European Agent Systems Summer School (Durham 2007) 177/253
4. Combining Modalities
Philosophy of Mind and Agency
Characterization of mental attitudes; Discussion of rational agents; Testing rationality assumptions.
Verification & Exploration
Jürgen Dix and Wojtek Jamroga ·
Programming with executable specifications; Automatic planning.
3. Beware!
Jürgen Dix and Wojtek Jamroga ·
4. Combining Modalities
European Agent Systems Summer School (Durham 2007) 178/253
3. Beware!
4.3 Beware! Let’s put ATL and epistemic logic in one box. Alternating-time Temporal Epistemic Logic
Problems!
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 179/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 180/253
4. Combining Modalities (-,-)
3. Beware!
q0
4. Combining Modalities
3. Beware!
start
Problem: The Agent Knows too Much
keep
(K,A)
trade
q3
keep
(K,Q)
trade
q4
keep
(Q,A)
trade
q5
keep
(Q,K)
trade
q6
keep
trade
win
win
win
win
win
(A,K )
(Q,K )
(K,A )
(Q,A )
(A,Q )
(K,Q )
(Q,A )
q9 q10 q11 q12 q13 q14 q15 q16 q17 q18 (K,A )
q8 (Q,K )
(A,K )
q7
q2
(K,Q )
keep
(A,Q)
trade
(A,Q )
(A,K)
q1
Agent a cannot really enforce ♦win ! Incomplete information, deterministic choices: if q is indistinguishable from q00 then a shouldn’t be allowed to plan one action in q, and another in q00 .
win
start → hhaii♦win start → Ka hhaii♦win Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 181/253
4. Combining Modalities
3. Beware!
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 182/253
4. Combining Modalities
4. References
4.4 References Beware:
Strategic and epistemic abilities are not independent!
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 183/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 184/253
4. Combining Modalities
4. References
4. Combining Modalities
4. References
[Broersen et al., 2001a] Broersen, J., Dastani, M., Huang, Z., and van der Torre, L. (2001a). The BOID architecture: conflicts between beliefs, obligations, intentions and desires. In Müller, J., Andre, E., Sen, S., and Frasson, C., editors, Proceedings of the Fifth International Conference on Autonomous Agents, pages 9–16. ACM Press.
[Rao and Georgeff1991] Rao, A. S. and M. Georgeff (1991). Modeling Rational Agents within a BDI-Architecture. In J. F. Allen, R. Fikes, and E. Sandewall (Eds.), Proceedings of the International Conference on Knowledge Representation and Reasoning, Cambridge, MA, pp. 473–484. Morgan Kaufmann.
[Cohen and Levesque, 1990] Cohen, P. and Levesque, H. (1990). Intention is choice with commitment. Artificial Intelligence, 42:213–261.
[Wooldridge, 2000] Wooldridge, M. (2000). Reasoning about Rational Agents. MIT Press : Cambridge, Mass.
[Fagin et al. 1995] Fagin, R., Halpern, J. Y., Moses, Y. & Vardi, M. Y. Reasoning about Knowledge. MIT Press: Cambridge, MA.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 185/253
5. Modalities in Action
Modalities in Action Verification and Planning Temporal Programming Agent Programming References
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 186/253
5. Modalities in Action
Chapter 5. Modalities in Action
5.1 5.2 5.3 5.4
Jürgen Dix and Wojtek Jamroga ·
In this chapter: We suggest that model checking formulas of temporal and strategic logics can be used for verification and planning in Multi-Agent Systems. We present several complexity results for CTL and ATL model checking. We mention briefly two ideas of programming agents with specifications based on modal logics: MetaTeM (programming in temporal logics) Agent-0 (programming with beliefs, capabilities and commitments), the very first agent logic developed by Shoham in the early 90ies.
European Agent Systems Summer School (Durham 2007) 187/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 188/253
5. Modalities in Action
1. Verification and Planning
5.1 Verification and Planning
5. Modalities in Action
1. Verification and Planning
Model Checking Formulae of CTL and ATL Model checking: Does ϕ hold in model M and state q? Global model checking: Return the exact set of states q in M such that ϕ holds in M , q Natural for verification of existing systems; also during design (“prototyping”)
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 189/253
5. Modalities in Action
1. Verification and Planning
Verification example: we want to make sure that the cargo can be always moved to the other location. A
Jürgen Dix and Wojtek Jamroga ·
caL → E♦caP ∧ caP → E♦caL ∧ caR → (E♦caL ∨ E♦caP)
European Agent Systems Summer School (Durham 2007) 191/253
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 190/253
1. Verification and Planning
function mcheck(M , ϕ). Model checking formulae of CTL. Returns the exact subset of Q for which formula ϕ holds. case ϕ ≡ p : return {q ∈ Q | p ∈ π(q)} case ϕ ≡ ¬ψ : return Q \ mcheck(M , ψ) case ϕ ≡ ψ1 ∧ ψ2 : return mcheck(M , ψ1 ) ∩ mcheck(M , ψ2 ) case ϕ ≡ E ψ : return pre(mcheck(M , ψ)) case ϕ ≡ Eψ : Q1 := Q; Q2 := Q3 := mcheck(M , ψ); while Q1 6⊆ Q2 do Q1 := Q1 ∩ Q2 ; Q2 := pre(Q1 ) ∩ Q3 od; return Q1 case ϕ ≡ Eψ1 U ψ2 : / Q1 := 0; Q2 := mcheck(M , ψ2 ); Q3 := mcheck(M , ψ1 ); while Q2 6⊆ Q1 do Q1 := Q1 ∪ Q2 ; Q2 := pre(Q1 ) ∩ Q3 od; return Q1 end case
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 192/253
5. Modalities in Action
1. Verification and Planning
Example: Modified Rocket Domain,
E♦caL
5. Modalities in Action
1. Verification and Planning
Two perspectives to model checking MAS: Verification
1
5
9
2
roL nofuel caL
roL fuelOK caL
roL nofuel caR
roL 6 fuelOK caR
roL nofuel caP
roL fuelOK caP
10
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
7
roP nofuel caL 3
roP fuelOK caL 4
roP nofuel caR
roP fuelOK caR 8
roP nofuel caP 11
roP fuelOK caP 12
European Agent Systems Summer School (Durham 2007) 193/253
1. Verification and Planning
Agent Planning with ATL Automated verification of ATL properties: Can the agents do it? Planning: How can we do it? Planning as model checking: CTL (Giunchiglia and Traverso, 1999). Agent planning with ATL: even more natural.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 195/253
Model represents the view of an objective observer Formula: specification to be met Planning
Model represents the subjective view of an agent Formula: goal to be achieved
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 194/253
1. Verification and Planning
function plan(ϕ). Returns a subset of Q for which formula ϕ holds, together with a (conditional) plan to achieve ϕ. The plan is sought within the context of concurrent game structure S = hAgt, Q, Π, π, oi. case ϕ ∈ Π : return {hq, −i | ϕ ∈ π(q)} case ϕ = ¬ψ : P1 := plan(ψ); return {hq, −i | q ∈ / states(P1 )} case ϕ = ψ1 ∨ ψ2 : P1 := plan(ψ1 ); P2 := plan(ψ2 ); return {hq, −i | q ∈ states(P1 ) ∪ states(P2 )} case ϕ = hhAii ψ : return pre(A, states(plan(ψ))) case ϕ = hhAiiψ : P1 := plan(true); P2 := plan(ψ); Q3 := states(P2 ); while states(P1 ) 6⊆ states(P2 ) do P1 := P2 |states(P1 ) ; P2 := pre(A, states(P1 ))|Q3 od; return P2 |states(P1 ) case ϕ = hhAiiψ1 U ψ2 : / P1 := 0; Q3 := states(plan(ψ1 )); P2 := plan(true)|states(plan(ψ2 )) ; while states(P2 ) 6⊆ states(P1 ) do P1 := P1 ⊕ P2 ; P2 := pre(A, states(P1 ))|Q3 od; return P1 end case
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 196/253
5. Modalities in Action
1. Verification and Planning
Auxiliary functions: Weakest precondition: pre(A, Q1 ) = {hq, σA i | ∀σΣ\A δ(q, σA , σΣ\A ) ∈ Q1 } States for which plan P is defined: states(P) = {q ∈ Q | ∃σ hq, σi ∈ P} Extending plan P1 with P2 : P1 ⊕ P2 = P1 ∪ {hq, σi ∈ P2 | q ∈ / states(P1 )} P restricted to the states from Q1 : P|Q1 = {hq, σi ∈ P | q ∈ Q1 }
5. Modalities in Action
1 2
1
5
9
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 197/253
1. Verification and Planning
plan(hh1ii♦caP)={ h9, −i, h10, −i, h11, −i, h12, −i } plan(hh1, 2ii♦caP)={ h2, 1 : load·2 : nopi, h6, 1 : move·2 : nopi, h7, 1 : unload·2 : unloadi, h8, 1 : unload·2 : unloadi, h9, −i, h10, −i, h11, −i, h12, −i } plan(hh1, 2, 3ii♦caP)={ h1, 1 : load·3 : loadi, h2, 1 : load·3 : loadi, h3, 1 : nop·3 : f ueli, h4, 1 : move·3 : nopi, h5, 1 : load·3 : f ueli, h6, 1 : move·3 : nopi, h7, 1 : unload·3 : nopi, h8, 1 : unload·3 : nopi, h9, −i, h10, −i, h11, −i, h12, −i }
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 199/253
1. Verification and Planning
roL nofuel caL
roL 2 fuelOK caL
roL nofuel caR
roL 6 fuelOK caR
roL nofuel caP
roL fuelOK caP
10
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
7
roP nofuel caL 3
roP fuelOK caL 4
roP nofuel caR
roP fuelOK caR 8
roP nofuel caP 11
roP fuelOK caP 12
European Agent Systems Summer School (Durham 2007) 198/253
1. Verification and Planning
Nice results: model checking CTL and ATL is tractable! Theorem (Clarke, Emerson & Sistla 1986)
CTL model checking is P-complete, and can be done in time linear in the size of the model and the length of the formula. Theorem (Alur, Kupferman & Henzinger 1998)
ATL model checking is P-complete, and can be done in time linear in the size of the model and the length of the formula. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 200/253
5. Modalities in Action
1. Verification and Planning
5. Modalities in Action
1. Verification and Planning
Complexity of Model Checking CTL and ATL Nice results: model checking CTL and ATL is tractable. But: the result is relative to the size of the model and the formula Well known catch (CTL): size of models is exponential wrt a higher-level description Another problem (ATL): transitions are labeled So: the number of transitions can be
So, let's model-check!
Not as easy as it seems.
exponential in the number of agents.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 201/253
5. Modalities in Action
1. Verification and Planning
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 202/253
1. Verification and Planning
3 agents/attributes, 12 states, 216 transitions
1 2 roL nofuel 1 caL
5
9 Jürgen Dix and Wojtek Jamroga ·
roL nofuel caR
roL nofuel caP
roL 2 fuelOK caL
roL 6 fuelOK caR
roL fuelOK caP
10
Proposition (Jamroga & Dix 2005), (Laroussinie et al. 2006)
7
roP nofuel caL 3
roP fuelOK caL 4
roP nofuel caR
roP fuelOK caR 8
roP nofuel caP 11
roP fuelOK caP 12
European Agent Systems Summer School (Durham 2007) 203/253
ATL model checking (wrt CGS) is ∆P3 -complete with respect to the number of states and agents. For positive ATL model checking (wrt CGS) is even ΣP2 -complete.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 204/253
5. Modalities in Action
1. Verification and Planning
Some Complexity Classes
5. Modalities in Action
1. Verification and Planning
Complexity Class ΣP2
P: problems solvable in polynomial time by a deterministic Turing machine NP: problems solvable in polynomial time by a non-deterministic Turing machine PSPACE: problems solvable in polynomial space EXPTIME: problems solvable in exponential time
ΣPi : problems solvable in polynomial time by a non-deterministic Turing machine making adaptive queries to a ΣPi−1 oracle ΣP2 = NPNP : problems solvable in polynomial time by a non-deterministic Turing machine making adaptive queries to an NP oracle
What is this about? Scalability! Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 205/253
5. Modalities in Action
1. Verification and Planning
Complexity of Temporal and Strategic Logics m, l
n, k, l
nlocal , k, l
CTL
P-complete [1]
P-complete [1]
PSPACE-complete [2]
ATL
P-complete [3]
ATLir ∆P2 -complete [4,7] [1] [2] [3] [4] [5] [6] [7] [8] [9]
∆P3 -complete [5,6] EXPTIME-complete [8,9] ∆P3 -complete [7]
PSPACE-complete [9]
Clarke, Emerson & Sistla (1986). Automatic verification of finite-state .... ACM Prog. Lang. Syst Kupferman, Vardi & Wolper (2000). An automata-theoretic approach to .... J. ACM Alur, Henzinger & Kupferman (2002). Alternating-time Temporal Logic. J. ACM Schobbens (2004). Alternating-time logic with imperfect recall. ENTCS Jamroga & Dix (CEEMAS 2005). Do agents make model checking explode? Laroussinie, Markey & Oreiby (FORMATS 2006). Model-Checking Timed. Jamroga & Dix (2007). Model checking abilities of agents. Theory of Computing Systems Hoek, Lomuscio & Wooldridge (AAMAS 2006). On the complexity of practical ATL model checking. Jamroga & Ågotnes (AAMAS 2007). Modular Interpreted Systems
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 207/253
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 206/253
1. Verification and Planning
Some variants: Information vs. recall ATLIr : Perfect information, no memory (imperfect recall). This is classical ATL, see [3]. ATLIR : Perfect information, full memory (perfect recall). Same complexity as ATL: polynomial in m, l. See [3]. ATLir : Imperfect information, imperfect recall: see last slide. ATLiR : Imperfect information, perfect recall: undecidable (currently working on a proof).
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 208/253
5. Modalities in Action
1. Verification and Planning
5. Modalities in Action
1. Verification and Planning
Even if model checking appears very easy, it can be very hard.
Main message: Complexity is very sensitive to the context! In particular, the way we define the input, and measure its size, is crucial.
Still, people do automatic model checking! LTL: SPIN CTL/ATL: MOCHA, MCMAS, VeriCS Even if model checking is theoretically hard, it can be feasible in practice.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 209/253
2. Temporal Programming
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 210/253
2. Temporal Programming
5.2 Temporal Programming METATEM is based on a first-order temporal logic based on discrete, linear models with finite past and infinite future, called FML.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 211/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 212/253
5. Modalities in Action
2. Temporal Programming
The formulae for FML are generated as usual, starting from a set L p of predicate symbols, a set Lv of variable symbols, a set Lc of constant symbols, the quantifiers ∀ and ∃, and the set Lt of terms (constants and variables). The set Fml is defined by: If t1 , ...,tn are in Lt and p is a predicate symbol of arity n, then p(t1 , ...,tn ) is in Fml. > (true) and ⊥ (false) are in Fml. If A and B are in Fml, then so are ¬A, A ∧ B, AU B, AS B, and (A). If A is in Fml and v is in Lv , then ∃v.A and ∀v.A are both in Fml.
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 213/253
2. Temporal Programming
ϕU ψ ϕS ψ
ϕ
−ϕ
primitive primitive [⊥U ϕ]
ϕ holds until ψ ϕ since ψ ϕ is true in the next state the current state is not the initial state, and ϕ was true in the previous state
•ϕ
if the current state is not the initial state, then ϕ was true in the previous state
♦ϕ ϕ ϕ ϕ
[⊥S ϕ]
ϕ will be true in some future state ϕ was true in some past state ϕ will be true in all future states ϕ was true in all past states
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
[¬ − ¬ϕ] [>U ϕ] [>S ϕ] [¬ ♦¬ϕ] [¬¬ϕ]
European Agent Systems Summer School (Durham 2007) 214/253
2. Temporal Programming
Definition 5.1 (FML model)
Semantics of FML. The models for FML formulae are given by a structure consisting of a sequence of worlds (also called states), together with an assignment of truth values to atomic sentences within states, a domain D which is assumed to be constant for every state, and mappings from elements of the language into denotations. Jürgen Dix and Wojtek Jamroga ·
2. Temporal Programming
Temporal operators:
Syntax of FML.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 215/253
A FML model is a tuple M = hσ, D , hc , h p i where σ is the ordered set of states s0 , s1 , s2 , ..., hc is a map from the constants into D , and h p is a map from N × L p into D n → { true, false } (the first argument of h p is the index i of the state si ). Thus, for a particular state s, and a particular predicate p of arity n, h(s, p) gives truth values to atoms constructed from n-tuples of elements of D . A variable assignment hv is a mapping from the variables into elements of D . Given a variable and the valuation function hc , a term assignment τvh is a mapping from terms into D defined in the usual way. Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 216/253
5. Modalities in Action
2. Temporal Programming
The semantics of FML is given by the |= relation that gives the truth value of a formula in a model M at a particular moment in time i and with respect to a variable assignment. hM , i, hv i |= > hM , i, hv i 6|= ⊥ hM , i, hv i |= p(x1 , ..., xn ) hM , i, hv i |= ¬ϕ hM , i, hv i |= ϕ ∨ ψ hM , i, hv i |= ϕ U ψ hM , i, hv i |= ϕ S ψ hM , i, hv i |= ∀x.ϕ hM , i, hv i |= ∃x.ϕ
h p (i, p)(τvh (x1 ), ..., τvh (xn )) = true hM , i, hv i 6|= ϕ hM , i, hv i |= ϕ or hM , i, hv i |= ψ for some k s.t. i < k, hM , k, hv i |= ψ and for all j, if i < j < k then hM , j, hv i |= ϕ iff for some k s.t. 0 ≤ k < i, hM , k, hv i |= ψ and for all j, if k < j < i then hM , j, hv i |= ϕ iff for all d ∈ D , hM , i, hv [d/x]i |= ϕ iff there exists d ∈ D s.t. hM , i, hv [d/x]i |= ϕ iff iff iff iff
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 217/253
2. Temporal Programming
An agent interface consists of three components: a unique agent identifier which names the agent a set of predicates defining what messages will be accepted by the agent – they are called environment predicates; a set of predicates defining messages that the agent may send—these are called component predicates. Besides environment and component predicates, an agent has a set of internal predicates with no external effect. The computational engine of an object is based on the METATEM paradigm of executable temporal logics. The idea behind this approach is to directly execute a declarative agent specification given as a set of program rules.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 219/253
5. Modalities in Action
2. Temporal Programming
Concurrent METATEM is a programming language for distributed AI based on FML. A system contains a number of concurrently executing agents which are able to communicate through message passing. Each agent executes a specification of its desired behavior. Each agent has two main components: an interface which defines how the agent may interact with its environment (i.e., other agents); a computational engine, defining how the agent may act.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 218/253
2. Temporal Programming
Program rules are temporal logic formulae of the form: antecedent: past → consequent: future The intuitive interpretation of such a rule is: on the basis of the past, do the future
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 220/253
5. Modalities in Action
2. Temporal Programming
Contract Proposal from [MascardiMS04] Seller
Buyer contractProposal
accept
refuse contractProposal acknowledge
accept
5. Modalities in Action
2. Temporal Programming
Seller agent may receive a contractProposal message from a buyer agent. According to the amount of merchandise required and the price proposed by the buyer, the seller may accept the proposal, refuse it or try to negotiate a new price by sending a contractProposal message back to the buyer. The buyer agent can do the same (accept, refuse or negotiate) when it receives a contractProposal message back from the seller.
refuse
contractProposal acknowledge
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 221/253
2. Temporal Programming
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 222/253
2. Temporal Programming
Behaviour of seller if the received message is contractProposal(merchandise, amount, proposed price) then if there is enough merchandise in the warehouse and the price is greater or equal than a max value, the seller accepts by sending an accept message to the buyer and concurrently ships the required merchandise to the buyer (if no concurrent actions are available, answering and shipping merchandise will be executed sequentially);
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 223/253
if there is not enough merchandise in the warehouse or the price is lower or equal than a min value, the seller agent refuses by sending a refuse message to the buyer; if there is enough merchandise in the warehouse and the price is between min and max, the seller sends a contractProposal to the buyer with a proposed price evaluated as the mean of the price proposed by the buyer and max.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 224/253
5. Modalities in Action
2. Temporal Programming
5. Modalities in Action
2. Temporal Programming
The Concurrent METATEM program for the seller agent may be as follows. The interface of the seller agent is the following
The merchandise to be exchanged are oranges, with minimum and maximum price 1 and 2 euro respectively. The initial amount of oranges that the seller possesses is 1000.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 225/253
2. Temporal Programming
The internal knowledge base of the seller agent contains the following rigid predicates (predicates whose value never changes): min-price(orange, 1). max-price(orange, 2). The internal knowledge base of the seller agent contains the following flexible predicates (predicates whose value changes over time): storing(orange, 1000).
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 227/253
seller(contractProposal)[accept, re f use, contractProposal, ship] meaning that: the seller agent, identified by the seller identifier, is able to recognize a contractProposal message with its arguments, not specified in the interface; the messages that the seller agent is able to broadcast to the environment, including both communicative acts and actions on the environment, are accept, refuse, contractProposal, ship.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 226/253
5. Modalities in Action 2. Temporal Programming The program rules of the seller agent are the following ones (lowercase symbols = constants, uppercase = variables): ∀ Buyer, Merchandise, Req_Amnt, Price
− [contractProposal(Buyer, seller, Merchandise, Req_Amnt, Price) ∧ storing(Merchandise, Old_Amount) ∧ Old_Amount ≥ Req_Amnt ∧ max − price(Merchandise, Max) ∧ Price ≥ Max] =⇒ [ship(Buyer, Merchandise, Req_Amnt, Price) ∧ accept(seller, Buyer, Merchandise, Req_Amnt, Price)]
If there was a previous state where Buyer sent a contractProposal message to seller, and in that previous state all the conditions were met to accept the proposal, then accept the Buyer’s proposal and ship the required merchandise.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 228/253
5. Modalities in Action
2. Temporal Programming
∀Buyer, Merchandise, Req_Amnt, Price
− [contractProposal(Buyer, seller, Merchandise, Req_Amnt, Price)∧ storing(Merchandise, Old_Amount)∧ min − price(Merchandise, Min)∧ Old_Amount < Req_Amnt ∨ Price ≥ Min] =⇒ re f use(seller, Buyer, Merchandise, Req_Amnt, Price)
If there was a previous state where Buyer sent a contractProposal message to seller, and in that previous state the conditions were not met to accept the Buyer’s proposal, then send a refuse message to Buyer.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 229/253
3. Agent Programming
5.3 Agent Programming
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 231/253
5. Modalities in Action
2. Temporal Programming
∀Buyer, Merchandise, Req_Amnt, Price
− [contractProposal(Buyer, seller, Merchandise, Req_Amnt, Price)∧ storing(Merchandise, Old_Amount) ∧ min − price(Merchandise, Min)∧ max − price(Merchandise, Max) ∧ Old_Amount ≥ Req_Amnt∧ Price > Min ∧ Price < Max ∧ New_Price = (Max + Price)/2] =⇒ contractProposal(seller, Buyer, Merchandise, Req_Amnt, New_Price)
If there was a previous state where Buyer sent a contractProposal message to seller, and in that previous state the conditions were met to send a contractProposal back to Buyer, then send a contractProposal message to Buyer with a new proposed price.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 230/253
3. Agent Programming
Shoham suggests the following three components of an Agent Oriented Programming system: A formal language with clear syntax for describing the mental state. A programming language for defining agents. A method of transforming legacy code into an agent.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 232/253
5. Modalities in Action
3. Agent Programming
Shoham: an agent has commitments (or obligations). One such commitment can be to perform an action. No need for action selection. But the language specification must have a mechanism for adopting commitments or not. All rules must be created at compile time: huge amount of possible scenarios.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 233/253
5. Modalities in Action
3. Agent Programming
Atoms: Sentences in a point-based temporal framework: is_ f riend(aa,bb) (facts), turn(I, le f t)t (instantaneous actions).
5. Modalities in Action
AGENT-0 Programming Language
AGENT-0 is based on a quantified multi-modal logic, with direct reference to time. Three modalities: Beliefs, Commitments, Capabilities.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 235/253
European Agent Systems Summer School (Durham 2007) 234/253
5. Modalities in Action
3. Agent Programming
Beliefs: BInow go_swimming(II ,CLZ)t : I believe now that I am going to swim in CLZ at time t. BInow ontable(block_b)t . Ba3 Bb4 is_ f riend(aa,bb).
No distinction between actions and facts.
Jürgen Dix and Wojtek Jamroga ·
3. Agent Programming
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 236/253
5. Modalities in Action
3. Agent Programming
Obligations: (also called commitments) are the beliefs that one agent will create the truth of a statement (for another agent) t+1 OBLIt ,you , you go_swimming(II ,CLZ) (at time t, I am obligated to you to go swimming in CLZ at time t + 1). The argument does not need to be you an action: OBLt(II ,you you)t+1 . you you) in_lecture(you
5. Modalities in Action
3. Agent Programming
Capabilities: An agent is said to be capable of a statement if it has the ability to see that that statement hold at the specified time: CANInow in_lecture(you)t (I am capable of seeing to it that you are in a lecture at time t.) Note: capabilities may change.
A decision is an obligation to oneself: DECat ϕ := OBLt(aa,aa) ϕ. Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 237/253
3. Agent Programming
AGENT-0 Programs
An agent in AGENT-0 consists of (1) a set of initial beliefs, (2) a set of capabilities, (3) a set of initial commitments, and (4) a set of commitment rules of the form agent (COMMITmsgcond mntlcond (agent agent, t, action)), “Commit to perform action for agent at time t (if msgcond holds of the new incoming messages, if mntlcond holds in the mental state, if the agent is currently capable of doing action).”
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 239/253
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 238/253
3. Agent Programming
agent agent: this is the name of an agent; action: a private or communicative action. Only primitive actions are allowed! Action “Find the gold and bring it home” is, most likely, not primitive. It requires a plan (a sequence of primitive actions). msgcond: a message condition of the form (Sender Type Content). mntlcond: this describes a condition about the own mental state of the agent (i.e., the agent’s beliefs and commitments); Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 240/253
5. Modalities in Action
3. Agent Programming
5. Modalities in Action
Cycle
initialize
AGENT-0 follows the following simple control loop when executing a program: At each time step 1 gather incoming messages and update the mental state accordingly, 2 execute commitments (using capabilities).
3. Agent Programming messages in
beliefs update beliefs commitments update commitments abilities
More recent agent-oriented programming languages follow similar ideas!
EXECUTE
messages out internal actions Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 241/253
3. Agent Programming
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 242/253
5. Modalities in Action
4. References
5.4 References What makes an agent do something
Jürgen Dix and Wojtek Jamroga ·
?
European Agent Systems Summer School (Durham 2007) 243/253
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 244/253
5. Modalities in Action
4. References
[BFG89] Barringer, H., M. Fisher, D. Gabbay, G. Gough, and R. Owens (1990). METATEM: A framework for programming in temporal logic. In J. W. de Bakker, W. P. de Roever, and G. Rozenberg (Eds.), Proceedings of the 1989 REX Workshop on Stepwise Refinement of Distributed Systems: Models, Formalisms, Correctness, pp. 94–129. Springer-Verlag. LNCS 430.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 245/253
4. References
[concMTM13] Fisher, M. (1993). Concurrent METATEM – A language for modeling reactive systems. In A. Bode, M. Reeve, and G. Wolf (Eds.), Proceedings of the 5th International Conference on Parallel Architectures and Language, Europe (PARLE’93), pp. 185–196. Springer-Verlag. LNCS 694. [concMTM14] Fisher, M. and H. Barringer (1991). Concurrent METATEM processes – A language for distributed AI. In E. Mosekilde (Ed.), Proceedings of the 1991 European Simulation Multiconference. SCS Press.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 247/253
5. Modalities in Action
4. References
[finger-fisher-owens] Finger, M., M. Fisher, and R. Owens (1993). METATEM at work: Modelling reactive systems using executable temporal logic. In P. Chung, G. L. Lovegrove, and M. Ali (Eds.), Proceedings of the 6th International Conference on Industrial and Engineering Applications of Artificial Intelligence and Expert Systems (IEA/AIE’93), pp. 209–218. Gordon and Breach Publishing. [fisherNormalForm] Fisher, M. (1992). A normal form for first-order temporal formulae. In D. Kapur (Ed.), Proceedings of the 11th International Conference on Automated Deduction (CADE’92), pp. 370–384. Springer-Verlag. LNCS 607.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 246/253
4. References
[concMTM16] Fisher, M. and M. Wooldridge (1993). Executable temporal logic for distributed AI. In K. Sycara (Ed.), Proceedings of the 12th International Workshop of Distributed AI (IWDAI’93), pp. 131–142. [GiunchigliaTraverso00] Fausto Giunchiglia and Paolo Traverso. In Susanne Biundo and Maria Fox (Eds.) Recent Advances in AI Planning, 5th European Conference on Planning, ECP’99, Durham, UK, September 8-10, 1999, Proceedings, 1–20, LNCS 1809, Springer 2000.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 248/253
5. Modalities in Action
4. References
[HiDBoHoMe98] Hindriks, K. V., F. S. de Boer, H. Hoek, and J.-J. C. Meyer (1998). Formal semantics of the core of AGENT-0. In ECAI’98 Workshop on Practical Reasoning and Rationality, pp. 20–29. [Jamroga, 2004] Jamroga, W. (2004). Strategic planning through model checking of ATL formulae. In et al., L. R., editor, Artificial Intelligence and Soft Computing: Proceedings of ICAISC’04, volume 3070 of Lecture Notes in Computer Science, pages 879–884. Springer Verlag.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 249/253
4. References
[mascardi02] Mascardi, V. (2002). Logic-Based Specification Environments for Multi-Agent Systems. Ph. D. thesis, Computer Science Department of Genova University, Genova, Italy. DISI-TH-2002-04. [MascardiMS04] Mascardi, V., M. Martelli, and L. Sterling (2004). Logic-based specification languages for intelligent software agents. TPLP 4(4), 429–494.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 251/253
5. Modalities in Action
4. References
[Jamroga/Dix1] Wojtek Jamroga and Jürgen Dix. Model Checking Strategic Abilities of Agents under Incomplete Information. In Mario Coppo, Elena Lodi and G. Michele Pinna (Eds.), Proceedings of the Italian Conference on Theoretical Computer Science (ICTCS ’05), pages 295–308. LNCS 3701. Springer, 2005. [Jamroga/Dix2] Wojtek Jamroga and Jürgen Dix. Do Agents Make Model Checking Explode (Computationally)? M. Pe(chouc(ek and P. Petta and L.Z. Varga (Eds.), Proceedings of the 4th International Central and Eastern European Conference on Multi-Agent Systems (CEEMAS ’05), pages 398-407. LNCS 3690. Springer, 2005.
Jürgen Dix and Wojtek Jamroga ·
5. Modalities in Action
European Agent Systems Summer School (Durham 2007) 250/253
4. References
[Parunak-odell] Odell, J., H. V. D. Parunak, and B. Bauer (2000a). Extending UML for agents. In G. Wagner, Y. Lespérance, and E. Yu (Eds.), Proceedings of the 2nd Workshop on Agent-Oriented Information Systems (AOIS’00). Held in conjunction with 17th National conference on Artificial Intelligence (AAAI’00), pp. 3–17. [aose54] Odell, J., H. V. D. Parunak, and B. Bauer (2000b). Representing agent interaction protocols in UML. In P. Ciancarini and M. Wooldridge (Eds.), Proceedings of the 1st International Workshop on Agent-Oriented Software Engineering (AOSE’00), pp. 121–140. Springer-Verlag. LNCS 1957.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 252/253
5. Modalities in Action
4. References
[Pistore and Traverso, 2001] Pistore, M. and Traverso, P. (2001). Planning as model checking for extended goals in non-deterministic domains. In Proceedings of IJCAI, pages 479–486. [Shoham90] Shoham, Y. (1993, March). Agent-oriented programming. Artificial Intelligence 60, 51–92. [placa] Thomas, S. R. (1995). The PLACA agent programming language. In M. Wooldridge and N. R. Jennings (Eds.), Proceedings of the 1st International Workshop on Agent Theories, Architectures, and Languages (ATAL’94), pp. 355–370. Springer-Verlag. LNCS 890.
Jürgen Dix and Wojtek Jamroga ·
European Agent Systems Summer School (Durham 2007) 253/253