no_shm_selinux/New_obj_prop.thy
author chunhan
Thu, 09 Jan 2014 22:53:45 +0800
changeset 94 042e1e7fd505
parent 93 dfde07c7cd6b
permissions -rw-r--r--
new childf new-version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
77
chunhan
parents:
diff changeset
     1
theory New_obj_prop
chunhan
parents:
diff changeset
     2
imports Main Finite_current Flask_type Flask Static
chunhan
parents:
diff changeset
     3
begin
chunhan
parents:
diff changeset
     4
chunhan
parents:
diff changeset
     5
context tainting_s begin
chunhan
parents:
diff changeset
     6
chunhan
parents:
diff changeset
     7
lemma nn_notin_aux: "finite s \<Longrightarrow> \<forall> a \<in> s. Max s \<ge> a "
chunhan
parents:
diff changeset
     8
apply (erule finite.induct, simp)
chunhan
parents:
diff changeset
     9
apply (rule ballI)
chunhan
parents:
diff changeset
    10
apply (case_tac "aa = a", simp+)
chunhan
parents:
diff changeset
    11
done
chunhan
parents:
diff changeset
    12
chunhan
parents:
diff changeset
    13
lemma nn_notin: "finite s \<Longrightarrow> next_nat s \<notin> s"
chunhan
parents:
diff changeset
    14
apply (drule nn_notin_aux)
chunhan
parents:
diff changeset
    15
apply (simp add:next_nat_def)
chunhan
parents:
diff changeset
    16
by (auto)
chunhan
parents:
diff changeset
    17
chunhan
parents:
diff changeset
    18
chunhan
parents:
diff changeset
    19
(* lemmas of new created obj *)
chunhan
parents:
diff changeset
    20
chunhan
parents:
diff changeset
    21
lemma np_notin_curp: "valid \<tau> \<Longrightarrow> new_proc \<tau> \<notin> current_procs \<tau>" using finite_cp
chunhan
parents:
diff changeset
    22
by (simp add:new_proc_def nn_notin)
chunhan
parents:
diff changeset
    23
chunhan
parents:
diff changeset
    24
lemma np_notin_curp': "\<lbrakk>new_proc \<tau> \<in> current_procs \<tau>; valid \<tau>\<rbrakk> \<Longrightarrow> False"
chunhan
parents:
diff changeset
    25
apply (drule np_notin_curp, simp)
chunhan
parents:
diff changeset
    26
done
chunhan
parents:
diff changeset
    27
chunhan
parents:
diff changeset
    28
lemma ni_notin_curi: "valid \<tau> \<Longrightarrow> new_inode_num \<tau> \<notin> current_inode_nums \<tau>"
chunhan
parents:
diff changeset
    29
apply (drule finite_ci)
chunhan
parents:
diff changeset
    30
by (simp add:new_inode_num_def nn_notin)
chunhan
parents:
diff changeset
    31
chunhan
parents:
diff changeset
    32
lemma ni_notin_curi': "\<lbrakk>new_inode_num \<tau> \<in> current_inode_nums \<tau>; valid \<tau>\<rbrakk> \<Longrightarrow> False"
chunhan
parents:
diff changeset
    33
by (drule ni_notin_curi, simp)
chunhan
parents:
diff changeset
    34
chunhan
parents:
diff changeset
    35
lemma nm_notin_curm: "valid \<tau> \<Longrightarrow> new_msgq \<tau> \<notin> current_msgqs \<tau>" using finite_cm
chunhan
parents:
diff changeset
    36
by (simp add:new_msgq_def nn_notin)
chunhan
parents:
diff changeset
    37
chunhan
parents:
diff changeset
    38
lemma nm_notin_curm': "\<lbrakk>new_msgq \<tau> \<in> current_msgqs \<tau>; valid \<tau>\<rbrakk> \<Longrightarrow> False"
chunhan
parents:
diff changeset
    39
by (drule nm_notin_curm, simp)
chunhan
parents:
diff changeset
    40
chunhan
parents:
diff changeset
    41
(*
chunhan
parents:
diff changeset
    42
lemma nh_notin_curh: "valid \<tau> \<Longrightarrow> new_shm \<tau> \<notin> current_shms \<tau>" using finite_ch
chunhan
parents:
diff changeset
    43
by (simp add:new_shm_def nn_notin)
chunhan
parents:
diff changeset
    44
chunhan
parents:
diff changeset
    45
lemma nh_notin_curh': "\<lbrakk>new_shm \<tau> \<in> current_shms \<tau>; valid \<tau>\<rbrakk> \<Longrightarrow> False"
chunhan
parents:
diff changeset
    46
by (drule nh_notin_curh, simp)
chunhan
parents:
diff changeset
    47
*)
chunhan
parents:
diff changeset
    48
chunhan
parents:
diff changeset
    49
lemma nfd_notin_curfd: "valid \<tau> \<Longrightarrow> new_proc_fd \<tau> p \<notin> current_proc_fds \<tau> p" 
chunhan
parents:
diff changeset
    50
using finite_cfd[where p = p]
chunhan
parents:
diff changeset
    51
apply (simp add:new_proc_fd_def nn_notin)
chunhan
parents:
diff changeset
    52
done
chunhan
parents:
diff changeset
    53
chunhan
parents:
diff changeset
    54
lemma nfd_notin_curfd': "\<lbrakk>new_proc_fd \<tau> p \<in> current_proc_fds \<tau> p; valid \<tau>\<rbrakk> \<Longrightarrow> False"
chunhan
parents:
diff changeset
    55
by (drule nfd_notin_curfd[where p = p], simp)
chunhan
parents:
diff changeset
    56
chunhan
parents:
diff changeset
    57
lemma nim_notin_curim: "valid \<tau> \<Longrightarrow> new_inode_num \<tau> \<notin> current_inode_nums \<tau>"
chunhan
parents:
diff changeset
    58
by (drule finite_ci, simp add:new_inode_num_def nn_notin)
chunhan
parents:
diff changeset
    59
chunhan
parents:
diff changeset
    60
lemma nim_notin_curim': "\<lbrakk>new_inode_num \<tau> \<in> current_inode_nums \<tau>; valid \<tau>\<rbrakk> \<Longrightarrow> False"
chunhan
parents:
diff changeset
    61
by (drule nim_notin_curim, simp)
chunhan
parents:
diff changeset
    62
chunhan
parents:
diff changeset
    63
lemma len_fname_all: "length (fname_all_a len) = len"
chunhan
parents:
diff changeset
    64
by (induct len, auto simp:fname_all_a.simps)
chunhan
parents:
diff changeset
    65
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    66
lemma finite_fs_fnames:
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    67
  "finite (fs::t_file set) \<Longrightarrow> finite {fn. fn # f \<in> fs}"
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    68
thm finite_imageI
77
chunhan
parents:
diff changeset
    69
apply (drule_tac h = "\<lambda> f'. case f' of [] \<Rightarrow> '''' | fn # pf' \<Rightarrow> if (pf' = f) then fn else ''''" in finite_imageI)
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    70
apply (rule_tac B = "(list_case [] (\<lambda>fn pf'. if pf' = f then fn else []) ` fs)" in finite_subset)
77
chunhan
parents:
diff changeset
    71
unfolding image_def
chunhan
parents:
diff changeset
    72
apply (clarsimp  split:if_splits)
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    73
apply (rule_tac x = "x # f" in bexI, simp+) 
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    74
done
77
chunhan
parents:
diff changeset
    75
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    76
lemma ncf_notin_curf_aux:
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    77
  "finite (fs::t_file set) \<Longrightarrow> Suc (Max (fname_length_set {fn. fn # f \<in> fs})) \<notin> fname_length_set {fn. fn # f \<in> fs}"
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    78
apply (drule_tac f = f in finite_fs_fnames)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    79
apply (drule_tac h = length in finite_imageI)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    80
apply (simp add:fname_length_set_def)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    81
apply (drule nn_notin_aux)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    82
apply auto
77
chunhan
parents:
diff changeset
    83
done
chunhan
parents:
diff changeset
    84
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    85
lemma ncf_notin_curf_general:
94
042e1e7fd505 new childf new-version
chunhan
parents: 93
diff changeset
    86
  assumes fin_fs: "finite fs"
042e1e7fd505 new childf new-version
chunhan
parents: 93
diff changeset
    87
  shows "new_childf_general f fs \<notin> fs"
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    88
proof-
94
042e1e7fd505 new childf new-version
chunhan
parents: 93
diff changeset
    89
  have a1: "Suc (Max (fname_length_set {fn. fn # f \<in> fs})) \<notin> 
042e1e7fd505 new childf new-version
chunhan
parents: 93
diff changeset
    90
    fname_length_set {fn. fn # f \<in> fs}"
042e1e7fd505 new childf new-version
chunhan
parents: 93
diff changeset
    91
    using fin_fs
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    92
    by (erule_tac ncf_notin_curf_aux)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    93
  have a2: "\<And> f pf fs. f # pf \<in> fs \<Longrightarrow> f \<in> {fn. fn # pf \<in> fs}" by auto
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    94
  have a3: "\<And> f pf fs. f \<in> {fn. fn # pf \<in> fs} \<Longrightarrow> length f \<in> fname_length_set {fn. fn # pf \<in> fs}"
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    95
    by (auto simp:fname_length_set_def)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    96
  show ?thesis
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    97
    apply (simp only:new_childf_general_def next_fname_def all_fname_under_dir_def)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    98
    apply (rule notI)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
    99
    apply (drule a2, drule a3)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   100
    apply (simp only:len_fname_all)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   101
    using a1 by auto
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   102
qed
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   103
  
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   104
lemma ncf_notin_curf:
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   105
 "valid \<tau> \<Longrightarrow> new_childf f \<tau> \<notin> (current_files \<tau>)"
94
042e1e7fd505 new childf new-version
chunhan
parents: 93
diff changeset
   106
apply (drule finite_cf)
042e1e7fd505 new childf new-version
chunhan
parents: 93
diff changeset
   107
apply (drule_tac fs = "current_files \<tau>" in ncf_notin_curf_general)
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   108
apply (simp add:new_childf_def)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   109
done
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   110
94
042e1e7fd505 new childf new-version
chunhan
parents: 93
diff changeset
   111
lemma ncf_parent_general: "valid \<tau> \<Longrightarrow> parent (new_childf_general f fs) = Some f"
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   112
by (simp add:new_childf_general_def)
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   113
77
chunhan
parents:
diff changeset
   114
lemma ncf_parent: "valid \<tau> \<Longrightarrow> parent (new_childf f \<tau>) = Some f"
93
dfde07c7cd6b new_childf generalized
chunhan
parents: 77
diff changeset
   115
by (simp add:new_childf_def ncf_parent_general)
77
chunhan
parents:
diff changeset
   116
chunhan
parents:
diff changeset
   117
end
chunhan
parents:
diff changeset
   118
chunhan
parents:
diff changeset
   119
end