• No se han encontrado resultados

Comunidad educativa

CAPÍTULO 7. DESCRIPCIÓN DE LA SOLUCIÓN 7.1 Aplicación Android

7.1.5. Interfaz gráfica

Union and intersection of sets of states in a state model corresponds to logical disjunction and con- junction of epistemic programs defined over that state model. However, only union makes sense in the context of programs. We can of course form the intersection of a sub set of actions, but program wise it would not correspond to a meaningful program operations based on its subset programs. Natural operations on programs are choice of two programs and also sequential composition of them. In this section we show how these two connectives can be defined in our setting.

Non-Deterministic Choice We first introduce the notion ofnon-determinismon epistemic programs using the inclusion between the two: whenever a program is a subset of another oneπ1 ⊆π2 then the

bigger programπ2is obtained from the smaller oneπ1by increasing non-determinism. So we have the

following

π={σ1, σ2} stands for “either actionσ1or actionσ2takes place”.

That is for example programπ1has only one state butπ2has two states, one of them he shares withπ1: π1 ={σ1} ⊆ {σ1, σ2}=π2

so we say that since π2 has more states, it can perform either of them, and so it is firstly non-

deterministic and also more non-deterministic thanπ1, since in this exampleπ1 only has one state

and is very deterministic. We can also have inclusions like the following

π2 ={σ1, σ2} ⊆ {σ1, σ2, σ3}=π3

whereπ2 is more deterministic than π3, since π3 has three states either of which can be performed,

where asπ2has two.

In our example where the referee took a peek, pictured below GFED @ABC?>=<89:;σH C I I A,B //?>=<89:; τ ii A,B,C GFED @ABC?>=<89:;σT nn C A,B O O

we have three actionsσH,σT andτ and the epistemic program{σH, σT}stands for the non-deterministic

actionσ, which says that what the referee sees after taking a peek, can be headsσH or tailsσT, either

can happen and it is not the referee that controls it.

Definition 6.5.1 We define thenon-deterministic choiceof two epistemic programsΣ1andΣ2overS

of two action modelsΣ1andΣ2as the union of them Σ1∪Σ2

It means either doΣ1or doΣ2. The set of states of this program is the union of the set of states of Σ1andΣ2. The appearance maps of the union is the union of appearance maps and the precondition of

the unions is also the union of preconditions.

Sequential Composition Another natural operation on programs is the sequential composition of them. This cannot be defined as easy as the choice, we have to form the cartesian product of the two programs that are sequentially composing, and build a new action model for the composition.

Definition 6.5.2 The sequential compositionΣ1•Σ2overSof two action modelsΣ1andΣ2both over Smeans ‘first doΣ1 and then doΣ2’ and is defined as

Σ1•Σ2:= Σ1×Σ2 fA(σ1, σ2) :=fA(σ1)×fA(σ2) µ(σ1, σ2) :=µ(σ1)∩[σ1]µ(σ2).

This construction is very similar to the update of an action model and a state model, the first difference is that there we had partial cartesian product, here we have the full product set. This means that we assume any program can be sequentially composed with another program, although when updating, the composed program might not go through. This is because of the other difference, which is about calculating the precondition of the composition. The precondition of the composition of two actions, is the intersection of the precondition of the first one and the weakest precondition that should be true before the second one so that the precondition of the second one becomes true afterwards. So if the first action can be performed on a state, but it results in a state that does not satisfy the precondition of the second action, then the composition can not go through, although its first action was successful. This says that a composition only goes through if firstly, the first action can go through and secondly, the resulting states of the first update satisfy the precondition of the second action.

As an example consider the sequential composition of the taking a peek (discussed before) and an announcements of heads. So the refereeC, first takes a peek and sees that for example the coin is heads, and then announces the result publicly to every one. The action model for the announcement has just one state call itσ0, which is accessible to all the agents (the action is public) and its precondition is headsH. It is pictured as follows

GFED

@ABCσ0 A,B,C

k

k

We want to compose this with the action of taking a peek, that is we want to form the following sequential composition GFED @ABCσH C I I A,B //?>=<89:;

τ ii A,B,C • GFED@ABCσ0 kk A,B,C

If we call the first action modelΣ1 and the second one Σ2, the set of the states of the result action

model is

Σ1×Σ2={(σH, σ0),(τ, σ0)}

The appearance map of agentAon the state(σH, σ0)is calculated as follows

fA(σH, σ0) =fA(σH)×fA(σ0) ={τ} × {σ0}={(τ, σ0)}

which is also equal tofB(σH, σ0). The appearance ofCon this state is

In the same way the appearance of the three of them of the second state(τ, σ0)is

fA(τ, σ0) =fB(τ, σ0) =fC(τ, σ0) ={(τ, σ0)}

The model of the composition is pictured as follows WVUT PQRS σH, σ0 C M M

A,B // ONMLHIJK

τ, σ0 yy A,B,C

The preconditions for the first state is calculated as follows

µ(σH, σ0) =µ(σH)∩[σH]µ(σ0) ={H} ∩ {H}={H}

since in order forσH to perform, the coin should be heads, which is the same as the precondition of the

announcement of heads inσ0. For the second state we have

µ(τ, σ0) =µ(τ)∩[τ]µ(σ0) ={H, T} ∩ {H}={H}

Note that if for exampleT was announced inσ0, then we hadµ(τ, σ0) =∅, which means the composi- tion could not go through and update our state model.

We define the sequential composition of the epistemic programs, or the subsets of our actions as follows

Definition 6.5.3 We define the sequential composition of two epistemic programsπ1 overΣ1 andπ2

overΣ2 as the epistemic propositionπ1•π2 :=π1×π2overΣ1•Σ2.

Before proceedings to state our theorem, we need to construct an action model from the action that does nothing, that isτ. We need this since we want to (later) close our action models under sequential composition.

The action model over a state modelSis aτ model iff

τ ={τ} µτ =S fA(τ) ={τ}.

Notice the use of systematic ambiguity: we denoted with the same nameτ both the programτ and its only action. It is easy to see that this action is a unit, up to isomorphism, both for update product and sequential composition, that is