SLIDE 1
Implementation of a Coalgebraic Model Checker
Aaron Strahlberger 16.07.2019
SLIDE 2 Parity Game based Model Checker
- Game-Based Local Model Checking for the Coalgebraic
µ-Calculus by Daniel Hausmann and Lutz Schröder [1] (CONCUR 2019)
- Extension to Coalgebraic Ontology Logic Reasoner (COOL) [2]
1
SLIDE 3 Coalgebraic µ-Calculus [3]
Formulae (NNF) φ,ψ ∶∶= ⊺ ∣ ∣ φ∨ψ ∣ φ∧ψ ∣ ♡φ ∣ X ∣ ηX.φ (♡ ∈ Λ,X ∈ V ,η ∈ {µ,ν})
- Λ set of modal operators, closed under duals
- V set of fixpoint variables
- µ,ν fixpoint opererators
2
SLIDE 4 Coalgebraic µ-Calculus [3]
Semantics
- System type: functor T∶Set → Set
- System: coalgebra (C,ξ) where
- C is the set of states
- ξ∶C → TC is the transition map
- Modal operator as monotone predicate liftings
i.e. natural transformations ⟦♡⟧∶2X → 2TX ⟦♡⟧(A) = TC/⟦♡⟧(C/A)
3
SLIDE 5
Coalgebraic µ-Calculus [3]
Semantics given σ∶V → P(C) ⟦⊺⟧σ = C ⟦⟧σ = ∅ ⟦X⟧σ = σ(X) ⟦φ ∧ ψ⟧σ = ⟦φ⟧σ ∩ ⟦ψ⟧σ ⟦φ ∨ ψ⟧σ = ⟦φ⟧σ ∪ ⟦ψ⟧σ ⟦♡φ⟧σ = ξ−1[⟦♡⟧(⟦φ⟧σ)] ⟦µX.φ⟧σ = LFP⟦φ⟧X
σ
⟦νX.φ⟧σ = GFP⟦φ⟧X
σ
where ⟦φ⟧X
σ (A) = ⟦φ⟧σ[X↦A] 4
SLIDE 6 Example: Labeled Transition System
- Functor TX = P(Prop) × P(X)L,
Λ = {◻a,◇a ∣ a ∈ L} ∪ {p,¬p ∣ p ∈ Prop}
⟦◻a⟧(A) = {B ∈ TC ∣ π2(B)(a) ⊆ A} ⟦p⟧() = {B ∈ TC ∣ p ∈ π1(B)}
x ξ(x) x1 ({p},[a ↦ {x1},b ↦ {x2},c ↦ ∅]) x2 (∅,[a ↦ ∅,b ↦ ∅,c ↦ {x1}]) x1 p x2 ¬p a b c
5
SLIDE 7
Model checking Problem
Definition Given a closed formula φ, a coalgebra ξ∶C → TC and a state x ∈ C the model checking problem is to decide whether x ∈ ⟦φ⟧.
6
SLIDE 8
Implementation
encoded problem Parsing Solver Solution
7
SLIDE 9
Parsing the Model
(** internal representation of functor elements *) type functor_element = | Id of string (* identifier *) | INT of int | RAT of int * int | Tuple of functor_element list | Set of functor_element list | Function of (functor_element, functor_element)Hashtbl.t
→ as a context free grammar for parser generator menhir [4]
8
SLIDE 10
Example: Labeled Transition System
x1 : ({p}, [ a : {x1}, b : {x2} ]) x2 : ({}, [ c : {x1} ]) x1 p x2 ¬p a b c
9
SLIDE 11
Implementation
encoded problem Parsing Solver Solution
10
SLIDE 12 Parity games
Definition (Parity game) A parity game played by two players Eloise (∃) and Abelard (∀) consists of:
- a directed graph G = (V = V∃ ˙
∪V∀,A).
- a priority function α∶V → N
Definition (Play) A play is a path in G.
- finite plays v0v1 ...vn are won by Eloise iff vn ∈ V∀.
- infinite plays are won by Eloise iff
max{p ∣ ∀j ∈ N.∃k ≥ j.α(vk) = p} is even.
- otherwise plays are won by Abelard
11
SLIDE 13
Implementation
encoded problem Parsing Solver reduce to parity game parity game solver Solution → used PGSolver [5] for solving parity games
12
SLIDE 14
One-step Satisfaction Problem [1]
Definition For a functor T and set C the one-step satisfaction problem is for input t ∈ TC,♡ ∈ Λ,U ⊆ C to decide whether t ∈ ⟦♡⟧U.
13
SLIDE 15 One-step Satisfaction Games [1]
Definition: A one-step game (A♡,t, U), played by two players Eloise and Abelard consists of:
- one-step satisfaction arena A♡,t
- V♡,t = {(♡,t)} ∪ I♡,t ∪ C,
- E♡,t ⊆ V♡,t × V♡,t s.t. E♡,t(x) = ∅ for x ∈ C
- a set U ⊆ C, encoding a winning condition
- Eloise wins game if:
- it ends in x ∈ U
- it ends in Abelard-node
- A♡,t is one-step sound and complete if for all U ⊆ C∶
t ∈ ⟦♡⟧U iff Eloise wins (A♡,t,U).
14
SLIDE 16 Example for Graded µ-Calculus [1]
Functor, Predicate Lifting TX = (N ∪ ∞)X, ⟦◇g⟧(A) = {β ∈ TC ∣ ∑
x∈A
β(x) > g} Nodes
- I◇g,t = {1,...,∣C∣ + 1} × {0,...,g + 1} × {0,1}
- for n ≤ ∣C∣: (n, c, 0) belongs to Eloise and (n, c, 1) to Abelard
a node (|C|+1, c, 0) belongs to ⎧ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎩ Abelard , if c > g Eloise , else Moves (n ≤ ∣C∣)
- referee move (◇g,t) → (1,0,0)
- E◇g,t(n,c,0) = {(n,min(g + 1,c + t(vn)),1),(n + 1,c,0)}
- E◇g,t(n,c,1) = {vn,(n + 1,c,0)}
15
SLIDE 17
Example for Graded µ-Calculus
(◇2,t) ∃ (1,0,0) ∃ (2,0,0) ∃ (3,0,0) ∀ (1,3,1) ∀ (2,2,1) x1 ∃ (2,3,0) ∃ (3,2,0) ∀ (2,3,1) x2 ∀ (3,3,0) x1 x2
3 2
t = [x1 ↦ 3,x2 ↦ 2]
16
SLIDE 18 Model Checking Game [1]
The model checking game Gχ = (V ,E,α) for χ is a parity game played over:
V = (Cl(χ) × C) ∪ ⋃
♡ψ∈Cl(χ),x∈C
({ψ} × V♡,t) E(ψ,x) = ⎧ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎩ ∅ if x ∈ C, ψ = ⊺ or ψ = {(ψ1,x),(ψ2,x)} if x ∈ C, ψ = ψ1 ∧ ψ2 or ψ = ψ1 ∨ ψ2 {(ψ1,x)} if x ∈ C, ψ = ηX.ψ1 {(Θ(X),x)} if x ∈ C, ψ = X {(ψ1,(♡,ξ(x)))} if x ∈ C, ψ = ♡ψ1 {ψ} × E♡,t(x) if x ∈ V♡,t/C V∀ = {(φ,x) ∣ φ ∈ {⊺,φ1 ∧ φ2,νX.φ1}} ∪ V♡,t,∀ V∃ = {(φ,x) ∣ φ ∈ {,φ1 ∨ φ2,µX.φ1}} ∪ V♡,t,∃ α(φ,x) = 0 if φ ≠ ηX.φ1 otherwise α(φ,x) = ad(φ)
17
SLIDE 19
Model Checking Game [1]
Theorem We have x ∈ ⟦χ⟧ iff Eloise wins the node (χ,x) in Gχ Corrolary Model checking C against χ can be done in time O(((∣χ∣ ⋅ ∣C∣) ⋅ max
♡∈Cl(χ), t∈ξ(C)
∣I♡,t∣)log(k)+6)
18
SLIDE 20 Implementation
reduce to parity game create outer game create one step game
model checking problem parity game all but modal-
modaloperators exit nodes 19
SLIDE 21 Type of Nodes
- game nodes Cl(χ) × C
- initial nodes (♡,t)
- inner nodes I♡,t
(* exit nodes are just Normal Nodes *) type mnode = | NormalNode of F.formula * M.functor_element | EntryNode
* (F.formula * M.functor_element option) * M.functor_element | InnerNode
20
SLIDE 22 Create outer Game
... match formula with | F.FALSE
| F.TRUE
| F.OR(x1, x2)
>>= fun lst -> reccall lst x1 >>= fun lst -> reccall lst x2 | F.AND(x1, x2) -> ret_arg 0 abelard >>= fun lst -> reccall lst x1 >>= fun lst -> reccall lst x2 ...
21
SLIDE 23 Create outer Game
... (* for fixpoints and fixpointvars the owner is irrelevant *) | F.MU(s, f')
- > alternation_depth formula
>>= fun prio -> ret_arg prio abelard >>= fun lst -> reccall lst f' ... (* modalities handled by one step arena functions *) | F.AX(s, f) -> onestep abelard f | F.EX(s, f) -> onestep eloise f ...
22
SLIDE 24
Create One-Step Arena in Relational µ-Calculus
... let succs = List.map (fun x -> NormalNode (form, x)) exit_nodes in (* add move from entry_node to its successors *) (Success ((entry_node, (0, player, succs, Some (mnode_to_string entry_node))) :: ret_list)) >>= fun ret_list -> call_outer_on_exitnodes (k_one_step_arena k) theta xi ret_list exit_nodes form
23
SLIDE 25
Create One-Step Arena in Graded µ-Calculus
let edges = function | Graded(n, c, 0, s) -> Success (if n > c_size then [] else [ (InnerNode (form, (Graded (n, min (grade + 1) (c + (t (v n))), 1, s)))) ; (InnerNode (form, (Graded (n+1, c, 0, s))))]) | Graded(n, c, 1, s) -> Success (if n > c_size then [] else [ (NormalNode(form, (v n))) ; (InnerNode (form, (Graded (n+1, c, 0, s))))]) | _ -> Error(NotHappeningCase "edges graded") in ...
24
SLIDE 26
Create One-Step Arena in Graded µ-Calculus
let rec create_exit_ret exit_nodes ret snode = (match snode with | InnerNode (f, x) -> edges x | _ -> Success []) >>= fun succ_snode -> (match snode with | InnerNode (f, Graded(n, c, 0, s)) -> Success (exit_nodes, appendet ret snode succ_snode eloise) ... | NormalNode (f, e) -> Success (e :: exit_nodes, ret) | _ -> Error (NotHappeningCase "graded ret exit")) |> fun x -> List.fold_left (fun tl hd -> tl >>= fun (exit_nodes, ret) -> create_exit_ret exit_nodes ret hd) x succ_snode in create_exit_ret [] ret_list initial_node >>= ...
25
SLIDE 27
Time complexity [1]
Relational O((∣χ∣ ⋅ ∣C∣)log(k)+6) (Serial) Monotone O((∣χ∣⋅∣C∣⋅size(C))log(k)+6) Graded (unary coded) O((∣χ∣⋅∣C∣2⋅size(χ))log(k)+6) Alternating Time O((∣χ∣⋅∣C∣⋅size(χ))log(k)+6) In general solving the modelchecking problem is in O((∣χ∣ ⋅ ∣C∣ ⋅ max
♡∈Cl(χ), t∈ξ(C)
∣I♡,t∣)log(k)+6)
26
SLIDE 28 Example coalgebraic µ-Calculi
Graded
- TX = (N ∪ ∞)X (multi sets)
- ⟦◇g⟧(A) = {β ∈ TC ∣ ∑
x∈A
β(x) > g} Probabilistic
x∈X
P(x) = 1} (probability distributions)
x∈A
P(x) > p}
27
SLIDE 29 Example coalgebraic µ-Calculi
Monotone
- TX = {A ∈ 2(2X ) ∣ A upwards closed}
(monotone neighbourhood frames)
- ⟦◻⟧(A) = {A ∈ TC ∣ A ∈ A}
Alternating-time let [k] = {1,. . . ,k}, given a set of agents N = [n]
- TX = {(k1,...,kn,f ) ∣ k1,...kn ∈ N/{0},f ∶ ∏
i∈N
[ki] → X}
- ⟦◻D⟧(A) = {(k1,...,kn,f ) ∈ TC ∣ ∃sD.∀sN/D.f (sD,sN/D) ∈ A}
28
SLIDE 30
Literature i
[1] D. Hausmann and L. Schröder, “Game-based local model checking for the coalgebraic µ-calculus,” in International Conference on Concurrency Theory (CONCUR 19), 2019. [2] “The coalgebraic ontology locic reasoner.” https://git8.cs.fau.de/software/cool. Accessed: 2019-07-15. [3] C. Cîrstea, C. Kupke, and D. Pattinson, “EXPTIME Tableaux for the Coalgebraic µ-Calculus,” in Proceedings of the 18th EACSL Annual Conference / 23rd International Workshop on Computer Science Logic CSL 09, vol. 5771 of Lecture Notes in Computer Science, pp. 179–193, Springer International Publishing, 2009.
29
SLIDE 31
Literature ii
[4] “Menhir.” https://gitlab.inria.fr/fpottier/menhir. Accessed: 2019-07-15. [5] “Pgsolver.” https://github.com/tcsprojects/pgsolver. Accessed: 2019-07-15.
30