Policy Language - nets-cs-pub-ro/Symnet GitHub Wiki
check(f:Formula, p:Instruction, s:State) : Formula
- case p = {q1 ; q2 ; ... ; qm} ; p2 ; ... ; pn:
- check(f, q1 ; q2 ; ... ; qm ; p2 ; ... ; pn, s) flattening nested instruction blocks
- case p = {q1 || q2 || ... || qm} ; p2 ; ... ; pn:
-
check
(f, {q1 ; p2 ; ... ; pn} || {q2 ; p2 ; ... ; pn} || ... || {qm ; p2 ; ... ; pn}, s) flattening nested instruction blocks
-
- case p = p1 ; p2 ; ... ; pn:
- s' = execute p1 in state s
- if s' is a failing state, then return f which is true.
- otherwise:
- if
eval_seq(f,s')
yields true or false, then return f with the corresponding value. - else
check(f,p,s')
, i.e. continue execution.
- if
- case p = q1 || q2 || ... || qm:
- for each
q
in {q1, q2, ... , qm}- if
f = EF(_)
orf = EG(_)
andcheck(f,q,s)
is true, then return f which is true - if
f = AF(_)
orf = AG(_)
andcheck(f,q,s)
is not true, then return f which is false
- if
- if
f = EF(_)
orf = EG(_)
return false no branch yielded true - if
f = AF(_)
orf = AG(_)
return true no branch yielded false
- for each
- case p = _ //some instruction//
- if
f = XY(f')
where X is any path quantifier and Y is any temporal operator, thencheck(f',p,s)
strip temporal part and check formula - if
f
contains boolean operators, proceed similarly toeval_seq
- s' = execute p in state s
- if s' is a failing state, then return f which is true.
- otherwise return false.
- if
eval_seq( f : Formula, s : State) : Formula
- case
f
=AG(f')
orEG(f')
- if
eval_seq(f',s)
is False, then return f which is false. - otherwise, if f' is pending, then f would be true in this state if it is true in a next state. Also, if f' is true, we still need to check it in the next state (due to the temporal operator G), which amounts to checking f in the next state. Hence return f which is pending.
- if
- case
f
=AF(f')
orEF(f')
- if
eval_seq(f',s)
is True, then return f which is true. - otherwise, if f' is pending, then f would be true in this state if it is true in a next state. Also, if f' is false, we need to check it in the next state (due to the temporal operator F), which amounts to checking f in the next state. Hence return f which is pending.
- if
- case f is f1 AND f2
- if
eval_seq
(f1,s) is true andeval_seq
(f2,s) is true, return f which is true. - if
eval_seq
(f1,s) is false oreval_seq
(f2,s) is false, return f which is false. - otherwise return f which is pending.
- if
- case f is f1 OR f2
- if
eval_seq
(f1,s) is true oreval_seq
(f2,s) is true, return f which is true. - if
eval_seq
(f1,s) is false andeval_seq
(f2,s) is false, return f which is false. - otherwise return f which is pending.
- if
- case f is NOT f'
- if
eval_seq
(f') is true return f which is false. - if
eval_seq
(f') is false return f which is true. - otherwise return f which is pending.
- if
- case f which is atomic (a SEFL program p)
- construct
complement(p)
and execute it in the current state. If there exist successful paths, f is false, otherwise it is true.
- construct
complement(p:Program) : Program
- case p = {q1 ; q2 ; ... ; qm}
- return {complement(q1) || complement(q2) || ... || complement(qm)}
- case p =
Constrain(v,e)
returnConstrain(v,complement(e))