src/HOL/IMP/Sec_Typing.thy
changeset 54863 82acc20ded73
parent 53015 a1119cf551e8
child 54864 a064732223ad
equal deleted inserted replaced
54862:c65e5cbdbc97 54863:82acc20ded73
    46 next
    46 next
    47   case Seq thus ?case by auto
    47   case Seq thus ?case by auto
    48 next
    48 next
    49   case (IfTrue b s c1)
    49   case (IfTrue b s c1)
    50   hence "max (sec b) l \<turnstile> c1" by auto
    50   hence "max (sec b) l \<turnstile> c1" by auto
    51   hence "l \<turnstile> c1" by (metis le_maxI2 anti_mono)
    51   hence "l \<turnstile> c1" by (metis max.cobounded2 anti_mono)
    52   thus ?case using IfTrue.IH by metis
    52   thus ?case using IfTrue.IH by metis
    53 next
    53 next
    54   case (IfFalse b s c2)
    54   case (IfFalse b s c2)
    55   hence "max (sec b) l \<turnstile> c2" by auto
    55   hence "max (sec b) l \<turnstile> c2" by auto
    56   hence "l \<turnstile> c2" by (metis le_maxI2 anti_mono)
    56   hence "l \<turnstile> c2" by (metis max.cobounded2 anti_mono)
    57   thus ?case using IfFalse.IH by metis
    57   thus ?case using IfFalse.IH by metis
    58 next
    58 next
    59   case WhileFalse thus ?case by auto
    59   case WhileFalse thus ?case by auto
    60 next
    60 next
    61   case (WhileTrue b s1 c)
    61   case (WhileTrue b s1 c)
    62   hence "max (sec b) l \<turnstile> c" by auto
    62   hence "max (sec b) l \<turnstile> c" by auto
    63   hence "l \<turnstile> c" by (metis le_maxI2 anti_mono)
    63   hence "l \<turnstile> c" by (metis max.cobounded2 anti_mono)
    64   thus ?case using WhileTrue by metis
    64   thus ?case using WhileTrue by metis
    65 qed
    65 qed
    66 
    66 
    67 
    67 
    68 theorem noninterference:
    68 theorem noninterference:
   198 lemma sec_type_sec_type': "l \<turnstile> c \<Longrightarrow> l \<turnstile>' c"
   198 lemma sec_type_sec_type': "l \<turnstile> c \<Longrightarrow> l \<turnstile>' c"
   199 apply(induction rule: sec_type.induct)
   199 apply(induction rule: sec_type.induct)
   200 apply (metis Skip')
   200 apply (metis Skip')
   201 apply (metis Assign')
   201 apply (metis Assign')
   202 apply (metis Seq')
   202 apply (metis Seq')
   203 apply (metis min_max.inf_sup_ord(3) min_max.sup_absorb2 nat_le_linear If' anti_mono')
   203 apply (metis min_max.inf_sup_ord(3) max.absorb2 nat_le_linear If' anti_mono')
   204 by (metis less_or_eq_imp_le min_max.sup_absorb1 min_max.sup_absorb2 nat_le_linear While' anti_mono')
   204 by (metis less_or_eq_imp_le max.absorb1 max.absorb2 nat_le_linear While' anti_mono')
   205 
   205 
   206 
   206 
   207 lemma sec_type'_sec_type: "l \<turnstile>' c \<Longrightarrow> l \<turnstile> c"
   207 lemma sec_type'_sec_type: "l \<turnstile>' c \<Longrightarrow> l \<turnstile> c"
   208 apply(induction rule: sec_type'.induct)
   208 apply(induction rule: sec_type'.induct)
   209 apply (metis Skip)
   209 apply (metis Skip)
   210 apply (metis Assign)
   210 apply (metis Assign)
   211 apply (metis Seq)
   211 apply (metis Seq)
   212 apply (metis min_max.sup_absorb2 If)
   212 apply (metis max.absorb2 If)
   213 apply (metis min_max.sup_absorb2 While)
   213 apply (metis max.absorb2 While)
   214 by (metis anti_mono)
   214 by (metis anti_mono)
   215 
   215 
   216 subsection "A Bottom-Up Typing System"
   216 subsection "A Bottom-Up Typing System"
   217 
   217 
   218 inductive sec_type2 :: "com \<Rightarrow> level \<Rightarrow> bool" ("(\<turnstile> _ : _)" [0,0] 50) where
   218 inductive sec_type2 :: "com \<Rightarrow> level \<Rightarrow> bool" ("(\<turnstile> _ : _)" [0,0] 50) where
   231 
   231 
   232 lemma sec_type2_sec_type': "\<turnstile> c : l \<Longrightarrow> l \<turnstile>' c"
   232 lemma sec_type2_sec_type': "\<turnstile> c : l \<Longrightarrow> l \<turnstile>' c"
   233 apply(induction rule: sec_type2.induct)
   233 apply(induction rule: sec_type2.induct)
   234 apply (metis Skip')
   234 apply (metis Skip')
   235 apply (metis Assign' eq_imp_le)
   235 apply (metis Assign' eq_imp_le)
   236 apply (metis Seq' anti_mono' min_max.inf_le1 min_max.inf_le2)
   236 apply (metis Seq' anti_mono' min.cobounded1 min.cobounded2)
   237 apply (metis If' anti_mono' min_max.inf_absorb2 min_max.le_iff_inf nat_le_linear)
   237 apply (metis If' anti_mono' min.absorb2 min.absorb_iff1 nat_le_linear)
   238 by (metis While')
   238 by (metis While')
   239 
   239 
   240 lemma sec_type'_sec_type2: "l \<turnstile>' c \<Longrightarrow> \<exists> l' \<ge> l. \<turnstile> c : l'"
   240 lemma sec_type'_sec_type2: "l \<turnstile>' c \<Longrightarrow> \<exists> l' \<ge> l. \<turnstile> c : l'"
   241 apply(induction rule: sec_type'.induct)
   241 apply(induction rule: sec_type'.induct)
   242 apply (metis Skip2 le_refl)
   242 apply (metis Skip2 le_refl)
   243 apply (metis Assign2)
   243 apply (metis Assign2)
   244 apply (metis Seq2 min_max.inf_greatest)
   244 apply (metis Seq2 min.boundedI)
   245 apply (metis If2 inf_greatest inf_nat_def le_trans)
   245 apply (metis If2 inf_greatest inf_nat_def le_trans)
   246 apply (metis While2 le_trans)
   246 apply (metis While2 le_trans)
   247 by (metis le_trans)
   247 by (metis le_trans)
   248 
   248 
   249 end
   249 end