epistemic-group-gossip-0.1.0.0
Copyright(c) Jesper Kuiper 2021
Leander van Boven 2021
Ramon Meffert 2021
LicenseBSD3
Safe HaskellNone
LanguageHaskell2010

GossipKnowledge

Description

 
Synopsis

Atomic proposition for Dynamic Gossip

data GossipAtom Source #

An atomic proposition in a gossip state: Rel(Agent, Agent).

Constructors

GAt Rel Agent Agent 

data Rel Source #

The relation type of a GossipAtom.

Constructors

N

Indicates that x knows the number of y.

S

Indicates that x knows the secret of y.

C

Indicates that x has called y.

Instances

Instances details
Enum Rel Source # 
Instance details

Defined in GossipKnowledge

Methods

succ :: Rel -> Rel #

pred :: Rel -> Rel #

toEnum :: Int -> Rel #

fromEnum :: Rel -> Int #

enumFrom :: Rel -> [Rel] #

enumFromThen :: Rel -> Rel -> [Rel] #

enumFromTo :: Rel -> Rel -> [Rel] #

enumFromThenTo :: Rel -> Rel -> Rel -> [Rel] #

Eq Rel Source # 
Instance details

Defined in GossipKnowledge

Methods

(==) :: Rel -> Rel -> Bool #

(/=) :: Rel -> Rel -> Bool #

Ord Rel Source # 
Instance details

Defined in GossipKnowledge

Methods

compare :: Rel -> Rel -> Ordering #

(<) :: Rel -> Rel -> Bool #

(<=) :: Rel -> Rel -> Bool #

(>) :: Rel -> Rel -> Bool #

(>=) :: Rel -> Rel -> Bool #

max :: Rel -> Rel -> Rel #

min :: Rel -> Rel -> Rel #

Show Rel Source # 
Instance details

Defined in GossipKnowledge

Methods

showsPrec :: Int -> Rel -> ShowS #

show :: Rel -> String #

showList :: [Rel] -> ShowS #

Conversion to and from BDDs

intToGAt :: Int -> Int -> GossipAtom Source #

Converts a BDD variable index to a GossipAtom. Note that the first Int argument corresponds to the amount of agents present in the gossip graph. This is a bijective function to allow for unique indexing of atomic gossip propositions.

>>> intToGAt 3 0
Naa
>>> intToGAt 3 12
Sba

bddToGAt :: Int -> Bdd -> [GossipAtom] Source #

Converts a BDD formula to a list of GossipAtoms for all variables in the formula. Internally calls intToGAt.

>>> bddToGAt 3 ((var 0) `imp` (var 12))
>>> [Naa, Sba]

gAtToInt :: Int -> GossipAtom -> Int Source #

Converts a GossipAtom to a unique integer index that can be used for a BDD variable.

>>> gAtToInt 3 (GAt S b a)
12

gAtToBdd :: Int -> GossipAtom -> Bdd Source #

Converts a GossipAtom to a unique but labelled BDD variable. Note that the first argument corresponds to the amount of agents present in the gossip graph.

>>> gAtToBdd 3 (GAt S b a)
Sba

Note that, while this function prints the normal gossip atom, the type that is returned is of BDD instead of GossipAtom. Internally, a unique variable index has been generated.

Texification

texifyGAt :: GossipAtom -> String Source #

Converts an atomic gossip proposition into a LaTeX string.

>>> texify (GAt N a b)
\texttt{N}ab

texifyBddVar :: Int -> Int -> String Source #

Converts a BDD variable index to a GossipAtom, and converts that to a LaTeX string.

>>> texifyBddVar 3 12
"\texttt{S}ba"

Epistemic formulae for Dyamic Gossip

data Form Source #

An epistemic formula, defined in terms of BDDs. This data structure allows for propositional formulae, as well as (higher-order) agent knowledge.

Constructors

Fact Bdd 
K Agent Form 
M Agent Form 

Instances

Instances details
Show Form Source # 
Instance details

Defined in GossipKnowledge

Methods

showsPrec :: Int -> Form -> ShowS #

show :: Form -> String #

showList :: [Form] -> ShowS #

data GossipForm Source #

A recursively defined propositional formula build out of GossipAtoms.

Constructors

Top

Always true

Atom GossipAtom

Atom

Neg GossipForm

Negation

Conj [GossipForm]

Conjunction

Disj [GossipForm]

Disjunction

Impl GossipForm GossipForm

Implication

Instances

Instances details
Show GossipForm Source # 
Instance details

Defined in GossipKnowledge

Knowledge Structures for Dynamic Gossip

data GossipKnowledgeStructure Source #

A knowledge structure (Gattinger, 2018) which represents the knowledge of a Gossip State.

Constructors

GKS (Set Int) Bdd (Map Agent (Set Int)) 

Knowledge Structure fields

vocabulary :: GossipKnowledgeStructure -> Set Int Source #

The set of propositional atoms available in the model.

stateLaw :: GossipKnowledgeStructure -> Bdd Source #

A boolean formula representing the law that every state needs to adhere to.

observables :: GossipKnowledgeStructure -> Map Agent (Set Int) Source #

The set of atoms seen by some agent. If an atom is observable for an agent, then they are certain as to whether this atom is true or false.

nag :: GossipKnowledgeStructure -> Int Source #

Extracts the number of agents from the Knowledge Structure.

Generation and validation

fromGossipGraph :: GossipGraph -> GossipKnowledgeStructure Source #

Converts a gossip graph to its corresponding knowledge structure. Note that this doesn't convert a gossip state, i.e. no call sequence is encoded. This is meant for the conversion of the _initial_ gossip state, (G, ε) (van Ditmarsch et al., 2017)

validKS :: GossipKnowledgeStructure -> Bool Source #

Checks if a given Knowledge Structure is valid. It checks whether the variables found in both the state law and the observable sets are present in the vocabulary.

Transition from epistemic to boolean formulae

formToBdd :: GossipKnowledgeStructure -> Form -> Bdd Source #

Converts an epistemic formula to a boolean formula, given a knowledge structure in Gattinger (2018), `fromToBdd k ϕ` is denoted by ||ϕ||_k.

(<|>) :: GossipKnowledgeStructure -> Form -> Bdd infix 9 Source #

An infix operator for the formToBdd function.

Knowledge Transformers for Dyamic Gossip

data KnowledgeTransformer Source #

The Knowledge Transformer data structure, as defined in (Gattinger, 2018).

Constructors

KT (Set Int) Bdd (Map Agent (Set Int)) 

Knowledge Transformer fields

addVocab :: KnowledgeTransformer -> Set Int Source #

Additional vocabulary.

addObs :: KnowledgeTransformer -> Map Agent (Set Int) Source #

Additional observables.

Generation and validation

baseTransformer :: KnowledgeTransformer Source #

A base Knowledge Transformer structure, which will not change the Knowledge Structure.

validKT :: GossipKnowledgeStructure -> KnowledgeTransformer -> Bool Source #

Checks if a Knowledge Transformer is valid. Checks whether all atoms in the additional vocabulary are actually new, whether the event law only uses variables that are contained in either the original vocabulary or the additional vocabulary, and whether the additional observables are items from the additional vocabulary.

Updating Knowledge Structures

update :: GossipKnowledgeStructure -> KnowledgeTransformer -> GossipKnowledgeStructure Source #

Updates a Knowledge Structure, given a Knowledge Transformer.

(|+|) :: GossipKnowledgeStructure -> KnowledgeTransformer -> GossipKnowledgeStructure infixl 9 Source #

An infix operator for the update function.

updateWithCall :: GossipKnowledgeStructure -> Int -> Call -> GossipKnowledgeStructure Source #

Updates a Knowledge Structure for a given call made between two agents. The integer argument denotes the tick counter.