(*File: VS.thy*) (*Authors: Lennart Beringer and Martin Hofmann, LMU Munich 2008*) theory VS imports VDM begin section‹Base-line noninterference›
text‹\label{sec:BaseLineNI} We now show how to interprete the type
of Volpano, Smith and Irvine~cite‹"VolpanoSmithIrvine:JCS1996"›,
described in Section 3 of our
~cite‹"BeringerHofmann:CSF2007"›.›
subsection‹Basic definitions›
text‹Muli-level security being treated in Section
ref{sec:HuntSands}, we restrict our attention in the present section
the two-point security lattice.›
datatype TP = low | high
text‹A global context assigns a security type to each program
.›
constsCONTEXT :: "Var ==> TP"
text‹Next, we define when two states are considered (low)
.›
definition twiddle::"State ==> State ==> bool" (‹ _ ≈ _ › [100,100] 100) where"s ≈ ss = (∀ x. CONTEXT x = low ⟶ s x = ss x)"
text‹A command $c$ is \emph{secure} if the low equivalence of any two
states entails the equivalence of the corresponding final
.›
definition secure::"IMP ==> bool" where"secure c = (∀ s t ss tt . s ≈ t ⟶ (s,c ⇓ ss) ⟶ (t,c ⇓ tt) ⟶ ss ≈ tt)"
text‹Here is the definition of the assertion transformer
is called $\mathit{Sec}$ in the paper \ldots›
definition Sec :: "((State × State) ==> bool) ==> VDMAssn" where"Sec Φ s t = ((∀ r . s ≈ r ⟶ Φ(t, r)) ∧ (∀ r . Φ(r ,s) ⟶ r ≈ t))"
text‹\ldots and the proofs of two directions of its characteristic
, Proposition 1.›
lemma Prop1A:"⊨ c : (Sec Φ) ==> secure c" (*<*) by (simp add: VDM_valid_def secure_def Sec_def) (*>*)
lemma Prop1B: "secure c ==>⊨ c : Sec (λ (r, t) . ∃ s . (s , c ⇓ r) ∧ s ≈ t)" (*<*) apply (simp add: VDM_valid_def Sec_def) apply clarsimp apply (unfold secure_def) apply rule apply (rule, rule) apply (rule_tac x=s in exI) apply(rule, assumption+) apply (rule, rule, erule exE, erule conjE) apply fast done (*>*)
lemma Prop1BB:"secure c ==>∃ Φ . ⊨ c : Sec Φ" (*<*) by (drule Prop1B, fast) (*>*)
lemma Prop1: "(secure c) = (⊨ c : Sec (λ (r, t) . ∃ s . (s , c ⇓ r) ∧ s ≈ t))" (*<*) apply rule apply (erule Prop1B) apply (erule Prop1A) done (*>*)
subsection‹Derivation of the LOW rules›
text‹We now derive the interpretation of the LOW rules of Volpano et
's paper according to the constructions given in the paper. (The
themselves are given later, since they are not yet needed).›
lemma CAST[rule_format]: "G ⊳ c : twiddle ⟶ G ⊳ c : Sec (λ (s,t) . s ≈ t)" (*<*) apply clarsimp apply (erule VDMConseq) apply (simp add: twiddle_def Sec_def) done (*>*)
lemma ASSIGN: "(∀ s ss. s ≈ ss ⟶ evalE e s = evalE e ss) ==> G ⊳ (Assign x e) : (Sec (λ (s, t) . s ≈ (update t x (evalE e t))))" (*<*) apply (rule VDMConseq) apply(rule VDMAssign) apply clarsimp apply (simp add: Sec_def) apply clarsimp apply (erule_tac x=s in allE, erule_tac x=r in allE, clarsimp) apply (simp add: twiddle_def update_def) done (*>*)
lemma COMP: "[ G ⊳ c1 : (Sec Φ); G ⊳ c2 : (Sec Ψ)]==> G ⊳ (Comp c1 c2) : (Sec (λ (s,t) . ∃ r . Φ(r, t) ∧ (∀ w . (r ≈ w ⟶ Ψ(s, w)))))" (*<*) apply (rule VDMConseq) apply (erule VDMComp) apply assumption apply (simp add: Sec_def, clarsimp) apply rule apply clarsimp apply (erule_tac x=ra in allE, clarsimp) apply (rule_tac x=r in exI, clarsimp) apply clarsimp done (*>*)
lemma IFF: "[ (∀ s ss. s ≈ ss ⟶ evalB b s = evalB b ss); G ⊳ c1 : (Sec Φ); G ⊳ c2 : (Sec Ψ)]==> G ⊳ (Iff b c1 c2) : Sec (λ (s, t) . (evalB b t ⟶ Φ(s,t)) ∧ ((¬ evalB b t) ⟶ Ψ(s,t)))" (*<*) apply (rule VDMConseq) apply(rule VDMIff) apply assumption+ apply clarsimp apply (simp add: Sec_def) apply clarsimp apply (case_tac "evalB b s") apply clarsimp apply clarsimp done (*>*)
text‹We introduce an explicit fixed point construction over the type
TT$ of the invariants $\Phi$.›
type_synonym TT = "(State × State) ==> bool"
text‹We deliberately introduce a new type here since the agreement ‹VDMAssn› (modulo currying) is purely coincidental. In
, in the generalisation for objects in Section
ref{sec:Objects} the type of invariants will differ from the
of program logic assertions.›
definition PhiWhile::"BExpr ==> TT ==> TT" where"PhiWhile b Φ = FIX (PhiWhileOp b Φ)"
text‹which we can use to derive the following rule.›
lemma WHILE: "[ (∀ s t. s ≈ t ⟶ evalB b s = evalB b t); G ⊳ c : (Sec Φ)]==> G ⊳ (While b c) : (Sec (PhiWhile b Φ))" (*<*) apply (rule VDMConseq) apply (rule VDMWhile) prefer4apply (subgoal_tac "∀s t. (Sec (PhiWhileOp b Φ (PhiWhile b Φ))) s t ∧¬ evalB b t ⟶ Sec (PhiWhile b Φ) s t") apply assumption apply clarsimp apply (subgoal_tac "PhiWhileOp b Φ (PhiWhile b Φ)= PhiWhile b Φ", clarsimp) apply (simp add: PhiWhile_def) apply (rule Fix_lemma) apply (rule PhiWhileOp_Monotone) apply assumption apply clarsimp apply (simp add: Sec_def) apply (rule, clarsimp) apply (simp add: PhiWhileOp_def) apply clarsimp apply (simp add: PhiWhileOp_def) apply clarsimp apply (simp add: Sec_def) apply rule prefer2apply clarsimp apply (subgoal_tac "∃r. Φ (r, s) ∧ (∀w. r ≈ w ⟶ (PhiWhile b Φ) (ra, w))") prefer2apply (simp add: PhiWhileOp_def) apply clarsimp apply (rotate_tac -3, erule thin_rl) apply (rotate_tac -1, erule_tac x=ra in allE, erule mp) apply (rotate_tac 1, erule_tac x=r in allE, erule impE) apply fast apply (subgoal_tac "PhiWhileOp b Φ (PhiWhile b Φ) = PhiWhile b Φ", clarsimp) apply (simp add: PhiWhile_def) apply (rule Fix_lemma) apply (rule PhiWhileOp_Monotone) apply clarsimp apply (simp (no_asm_simp) add: PhiWhileOp_def) apply (rule_tac x=r in exI, rule) apply simp apply clarsimp apply (rotate_tac 5, erule_tac x=w in allE, clarsimp) apply (subgoal_tac "PhiWhileOp b Φ (PhiWhile b Φ) = PhiWhile b Φ", clarsimp) apply (simp add: PhiWhile_def) apply (rule Fix_lemma) apply (rule PhiWhileOp_Monotone) done (*>*)
text‹The operator that given $\Phi$ returns the invariant
in the conclusion of the rule is itself monotone - this is
property required for the rule for procedure invocations.›
text‹We now derive an alternative while rule that employs an
formulation of a variant that replaces the fixed point
. This version is given in the paper.›
text‹First, the inductive definition of the $\mathit{var}$ relation.›
inductive_set var::"(BExpr × TT × State × State) set" where
varFalse: "[¬ evalB b t; s ≈ t]==> (b,Φ,s,t):var"
| varTrue:"[evalB b t; Φ(r,t); ∀ w . r ≈ w ⟶ (b,Φ,s,w): var] ==> (b,Φ,s,t):var"
text‹It is easy to prove the equivalence of $\mathit{var}$ and the
point:›
(*<*) lemma varFIX: "(b,Φ,s,t):var ==> PhiWhile b Φ (s,t)" apply (erule var.induct) apply (simp add: PhiWhile_def) apply (subgoal_tac "PhiWhileOp b Φ (FIX (PhiWhileOp b Φ)) (s,t)") apply (subgoal_tac "PhiWhileOp b Φ (FIX (PhiWhileOp b Φ)) = FIX (PhiWhileOp b Φ)", clarsimp) apply (rule Fix_lemma) apply (rule PhiWhileOp_Monotone) apply (simp add: PhiWhileOp_def) apply (simp (no_asm_simp) add: PhiWhile_def) apply (subgoal_tac "PhiWhileOp b Φ (FIX (PhiWhileOp b Φ)) (s,t)") apply (subgoal_tac "PhiWhileOp b Φ (FIX (PhiWhileOp b Φ)) = FIX (PhiWhileOp b Φ)", clarsimp) apply (rule Fix_lemma) apply (rule PhiWhileOp_Monotone) apply (simp add: PhiWhileOp_def) apply (rule_tac x=r in exI, simp) apply clarsimp apply (erule_tac x=w in allE, clarsimp) apply (simp add: PhiWhile_def) apply (simp add: PhiWhileOp_def) done
lemma FIXvarFIX: "(PhiWhile b) = (λ Φ . (λ (s,t) . (b,Φ,s,t):var))" (*<*) by (rule, rule FIXvarFIX') (*>*)
text‹From this rule and the rule WHILE above, one may derive the
rule we gave in the paper.›
lemma WHILE_IND: "[ (∀ s t. s ≈ t ⟶ evalB b s = evalB b t); G ⊳ c : (Sec Φ)]==> G ⊳ (While b c) : (Sec (λ (s,t) . (b,Φ,s,t):var))" (*<*) apply (rule VDMConseq) apply (rule WHILE [of b G c Φ]) apply assumption+ apply (simp add: FIXvarFIX) done (*>*)
text‹Not suprisingly, the construction $\mathit{var}$ can be shown to
monotone in $\Phi$.› (*<*) lemma varMonotoneAux[rule_format]: "(b, Φ, s, t) ∈ var ==> (∀s t. Φ (s, t) ⟶ Ψ (s, t)) ⟶ (b, Ψ, s, t) ∈ var" apply (erule var.induct) apply clarsimp apply (erule varFalse, simp) apply clarsimp apply (erule varTrue) apply fast apply simp done (*>*)
lemma HIGH_IFF: "[ G ⊳ c1 : twiddle; G ⊳ c2 : twiddle ] ==> G ⊳ (Iff b c1 c2) : twiddle" (*<*) apply (rule VDMConseq, rule VDMIff) apply assumption+ apply (simp add: twiddle_def) done (*>*)
lemma HIGH_WHILE: "[ G ⊳ c : twiddle]==> G ⊳ (While b c) : twiddle" (*<*) apply (rule VDMConseq) apply (rule VDMWhile) apply (subgoal_tac "G ⊳ c : (λs t. evalB b s ⟶ s ≈ t)", erule thin_rl, assumption) apply (erule VDMConseq) apply simp prefer3apply (subgoal_tac "∀s t. s ≈ t ∧¬ evalB b t ⟶ s ≈ t", assumption) apply simp apply (simp add: twiddle_def) apply (simp add: twiddle_def) done (*>*)
lemma HIGH_CALL: "({twiddle} ∪ G) ⊳ body : twiddle ==> G ⊳ Call : twiddle" (*<*) by (erule VDMCall) (*>*)
subsection‹The type system of Volpano, Smith and Irvine›
text‹We now give the type system of Volpano et al.~and then prove its
into the system of derived rules. First, type systems for
and boolean expressions.›
text‹The semantic of typing judgements for commands is now the
one: HIGH commands require initial and final state be low
(i.e.~the low variables in the final state can't depend on
high variables of the initial state), while LOW commands must
the above mentioned security property.›
primrec SemCom::"TP ==> IMP ==> bool" where "SemCom low c = (∀ s ss t tt. s ≈ ss ⟶ (s,c ⇓ t) ⟶ (ss,c ⇓ tt) ⟶ t ≈ tt)" | "SemCom high c = (∀ s t . (s,c ⇓ t) ⟶ s ≈ t)"
text‹Combining theorem ‹VS_com_VDM› with the soundness result
the program logic and the definition of validity yields the
of Volpano et al.'s type system.›
text‹As a further minor result, we prove that all judgements
the low rules indeed yield assertions $A$ of the form $A
Sec(\Phi(FIX \Phi))$ for some monotone $\Phi$.›
inductive_set Deriv ::"(VDMAssn set × IMP × VDMAssn) set" where
D_CAST: "(G,c,twiddle):Deriv ==> (G, c, Sec (λ (s,t) . s ≈ t)) : Deriv"
| C_IFF: "[ (∀ s ss. s ≈ ss ⟶ evalB b s = evalB b ss); (G, c1, Sec Φ):Deriv; (G,c2, Sec Ψ):Deriv]==> (G, Iff b c1 c2, Sec (λ (s, t) . (evalB b t ⟶ Φ(s,t)) ∧ ((¬ evalB b t) ⟶ Ψ(s,t)))):Deriv"
| D_WHILE: "[ (∀ s ss. s ≈ ss ⟶ evalB b s = evalB b ss); (G, c, Sec Φ):Deriv]==> (G, While b c, Sec (PhiWhile b Φ)):Deriv"
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.