File_renaming.thy
author chunhan
Mon, 30 Dec 2013 12:01:09 +0800
changeset 84 cebdef333899
parent 1 7d9c0ed02b56
permissions -rwxr-xr-x
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     1
theory File_renaming
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     2
imports Main OS_type_def My_list_prefix  
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     3
begin
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     4
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     5
fun parent :: "'a list \<Rightarrow> ('a list) option"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     6
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     7
   "parent []     = None"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     8
 | "parent (n#ns) = Some ns" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
     9
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    10
definition file_after_rename :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    11
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    12
  "file_after_rename oldf newf f \<equiv> (if (oldf \<preceq> f) then ((f \<setminus> oldf) @ newf) else f)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    13
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    14
definition file_before_rename :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    15
where
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    16
  "file_before_rename oldf newf f \<equiv> (if (newf \<preceq> f) then ((f \<setminus> newf) @ oldf) else f)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    17
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    18
lemma list_diff_rev_prop0: "f \<setminus> f = []"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    19
by (induct f, auto simp:list_diff_rev_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    20
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    21
lemma list_diff_rev_prop0': "f \<setminus> [] = f" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    22
apply (simp add:list_diff_rev_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    23
apply (induct f rule:rev_induct, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    24
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    25
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    26
lemma list_diff_rev_prop1_aux: "a # f\<^isub>3 \<setminus> f\<^isub>3 = [a]"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    27
by (induct f\<^isub>3, auto simp:list_diff_rev_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    28
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    29
lemma list_diff_rev_prop1: "f @ f' \<setminus> f' = f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    30
apply (subgoal_tac "f @ f' \<setminus> [] @ f' = f \<setminus> []")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    31
apply (simp add:list_diff_rev_prop0')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    32
apply (simp only: list_diff_rev_ext_left[where ys = "[]"])
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    33
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    34
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    35
lemma list_diff_rev_prop2_aux: "f \<preceq> f' \<Longrightarrow> a # f' \<setminus> f = a # (f' \<setminus> f)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    36
apply (erule no_juniorE)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    37
by (simp only:list_diff_rev_prop1 append_Cons[THEN sym])
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    38
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    39
lemma list_diff_rev_prop2: "f \<preceq> f' \<Longrightarrow> (f' \<setminus> f) @ f = f'" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    40
apply (induct f', simp add:no_junior_def list_diff_rev_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    41
apply (case_tac "f = a # f'", simp add:list_diff_rev_prop0)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    42
apply (drule no_junior_noteq, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    43
by (simp add:list_diff_rev_prop2_aux)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    44
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    45
lemma file_renaming_prop0:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    46
  "file_after_rename f\<^isub>2 f\<^isub>3 f\<^isub>2 = f\<^isub>3"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    47
apply (simp add:file_after_rename_def list_diff_rev_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    48
apply (induct f\<^isub>2, auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    49
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    50
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    51
lemma file_renaming_prop0':
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    52
  "file_before_rename f\<^isub>2 f\<^isub>3 f\<^isub>3 = f\<^isub>2"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    53
apply (simp add:file_before_rename_def list_diff_rev_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    54
apply (induct f\<^isub>3, auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    55
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    56
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    57
lemma file_renaming_prop1:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    58
  "f\<^isub>2 \<preceq> f \<Longrightarrow> f\<^isub>3 \<preceq> file_after_rename f\<^isub>2 f\<^isub>3 f "
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    59
by (simp add:file_after_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    60
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    61
lemma file_renaming_prop1':
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    62
  "f\<^isub>3 \<preceq> f \<Longrightarrow> f\<^isub>2 \<preceq> file_before_rename f\<^isub>2 f\<^isub>3 f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    63
by (simp add:file_before_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    64
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    65
lemma file_renaming_prop1'':
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    66
  "\<not> f\<^isub>3 \<preceq> file_after_rename f\<^isub>2 f\<^isub>3 f \<Longrightarrow> \<not> f\<^isub>2 \<preceq> f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    67
by (case_tac "f\<^isub>2 \<preceq> f", drule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop1, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    68
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    69
lemma file_renaming_prop2: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    70
  "\<lbrakk>f\<^isub>2 \<preceq> f; f \<noteq> f\<^isub>2\<rbrakk> \<Longrightarrow> file_after_rename f\<^isub>2 f\<^isub>3 f \<noteq> f\<^isub>3" 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    71
apply (case_tac f, simp add:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    72
apply (auto simp add:file_after_rename_def list_diff_rev_prop1_aux)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    73
apply (erule no_juniorE, simp add:list_diff_rev_prop1)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    74
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    75
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    76
lemma file_renaming_prop2':
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    77
  "\<lbrakk>f\<^isub>3 \<preceq> f; f \<noteq> f\<^isub>3\<rbrakk> \<Longrightarrow> file_before_rename f\<^isub>2 f\<^isub>3 f \<noteq> f\<^isub>2"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    78
apply (case_tac f, simp add:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    79
apply (auto simp add:file_before_rename_def list_diff_rev_prop1_aux)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    80
apply (erule no_juniorE, simp add:list_diff_rev_prop1)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    81
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    82
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    83
lemma file_renaming_prop3:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    84
  "\<lbrakk>f\<^isub>2 \<preceq> f; f\<^isub>2 \<noteq> f\<rbrakk> \<Longrightarrow> f\<^isub>3 \<preceq> file_after_rename f\<^isub>2 f\<^isub>3 f \<and> f\<^isub>3 \<noteq> file_after_rename f\<^isub>2 f\<^isub>3 f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    85
apply (frule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop1, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    86
by (drule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop2, simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    87
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    88
lemma file_renaming_prop3':
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    89
  "\<lbrakk>f\<^isub>3 \<preceq> f; f\<^isub>3 \<noteq> f\<rbrakk> \<Longrightarrow> f\<^isub>2 \<preceq> file_before_rename f\<^isub>2 f\<^isub>3 f \<and> f\<^isub>2 \<noteq> file_before_rename f\<^isub>2 f\<^isub>3 f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    90
apply (frule_tac f\<^isub>2 = f\<^isub>2 in file_renaming_prop1', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    91
by (drule_tac f\<^isub>2 = f\<^isub>2 in file_renaming_prop2', simp+)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    92
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    93
lemma file_renaming_prop4: "\<not> f\<^isub>2 \<preceq> f \<Longrightarrow> file_after_rename f\<^isub>2 f\<^isub>3 f = f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    94
by (simp add:file_after_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    95
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    96
lemma file_renaming_prop4': "\<not> f\<^isub>3 \<preceq> f \<Longrightarrow> file_before_rename f\<^isub>2 f\<^isub>3 f = f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    97
by (simp add:file_before_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    98
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
    99
lemma file_renaming_prop5: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   100
  "f\<^isub>2 \<preceq> f\<^isub>1 \<Longrightarrow> file_before_rename f\<^isub>2 f\<^isub>3 (file_after_rename f\<^isub>2 f\<^isub>3 f\<^isub>1) = f\<^isub>1"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   101
apply (case_tac "f\<^isub>1 = f\<^isub>2")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   102
apply (simp add:file_renaming_prop0 file_renaming_prop0')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   103
apply (simp add:file_after_rename_def file_before_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   104
by (simp add:list_diff_rev_prop1 list_diff_rev_prop2)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   105
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   106
lemma file_renaming_prop5': 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   107
  "f\<^isub>3 \<preceq> f\<^isub>1 \<Longrightarrow> file_after_rename f\<^isub>2 f\<^isub>3 (file_before_rename f\<^isub>2 f\<^isub>3 f\<^isub>1) = f\<^isub>1"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   108
apply (case_tac "f\<^isub>1 = f\<^isub>3")
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   109
apply (simp add:file_renaming_prop0' file_renaming_prop0)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   110
apply (simp add:file_after_rename_def file_before_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   111
by (simp add:list_diff_rev_prop1 list_diff_rev_prop2)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   112
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   113
lemma file_renaming_prop6:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   114
  "f\<^isub>2 \<preceq> f \<Longrightarrow> file_after_rename f\<^isub>2 f\<^isub>3 (a # f) = (a # (file_after_rename f\<^isub>2 f\<^isub>3 f))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   115
by (simp add:file_after_rename_def list_diff_rev_prop2_aux) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   116
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   117
lemma file_renaming_prop6':
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   118
  "f\<^isub>3 \<preceq> f \<Longrightarrow> file_before_rename f\<^isub>2 f\<^isub>3 (a # f) = (a # (file_before_rename f\<^isub>2 f\<^isub>3 f))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   119
by (simp add:file_before_rename_def list_diff_rev_prop2_aux)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   120
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   121
lemma file_renaming_prop7: "file_after_rename f\<^isub>2 f\<^isub>3 (a # f\<^isub>2) = a # f\<^isub>3"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   122
apply (auto simp:file_after_rename_def no_junior_def list_diff_rev_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   123
by (induct f\<^isub>2, auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   124
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   125
lemma file_renaming_prop7': "file_before_rename f\<^isub>2 f\<^isub>3 (a # f\<^isub>3) = a # f\<^isub>2"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   126
by (auto simp:file_before_rename_def no_junior_def list_diff_rev_prop1_aux)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   127
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   128
lemma file_renaming_prop8: "f\<^isub>2 \<preceq> f \<Longrightarrow> f\<^isub>3 \<preceq> (file_after_rename f\<^isub>2 f\<^isub>3 (a # f))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   129
by (simp add:file_after_rename_def no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   130
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   131
lemma file_renaming_prop8': "f\<^isub>3 \<preceq> f \<Longrightarrow> f\<^isub>2 \<preceq> (file_before_rename f\<^isub>2 f\<^isub>3 (a # f))"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   132
by (simp add:file_before_rename_def no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   133
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   134
lemma no_junior_prop0: "f\<preceq> f' \<Longrightarrow> f \<preceq> (a # f')"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   135
by (simp add:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   136
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   137
lemma file_renaming_prop9: 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   138
  "f\<^isub>2 \<preceq> f\<^isub>1 \<Longrightarrow> file_before_rename f\<^isub>2 f\<^isub>3 (file_after_rename f\<^isub>2 f\<^isub>3 (a # f\<^isub>1)) = (a # f\<^isub>1)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   139
by (drule_tac a = a in no_junior_prop0, simp add:file_renaming_prop5)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   140
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   141
lemma file_renaming_prop9': 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   142
  "f\<^isub>3 \<preceq> f\<^isub>1 \<Longrightarrow> file_after_rename f\<^isub>2 f\<^isub>3 (file_before_rename f\<^isub>2 f\<^isub>3 (a # f\<^isub>1)) = (a # f\<^isub>1)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   143
by (drule_tac a = a in no_junior_prop0, simp add:file_renaming_prop5')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   144
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   145
lemma file_renaming_prop10:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   146
  "\<lbrakk>a # f\<^isub>1 = file_after_rename fx fy f\<^isub>1'; file_after_rename fx fy f\<^isub>1' \<noteq> fy; fx \<preceq> f\<^isub>1'\<rbrakk> \<Longrightarrow> a # (file_before_rename fx fy f\<^isub>1) = f\<^isub>1'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   147
apply (frule_tac f\<^isub>3 = fy in file_renaming_prop1)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   148
apply (subgoal_tac "fy \<preceq> f\<^isub>1") defer apply (rotate_tac 3, erule no_juniorE, case_tac zs, simp+) 
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   149
apply (drule_tac f = f\<^isub>1 and f\<^isub>2 = fx and f\<^isub>3 = fy and a = a in file_renaming_prop6')
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   150
by (drule_tac f\<^isub>1 = f\<^isub>1' and f\<^isub>3 = fy  in file_renaming_prop5, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   151
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   152
lemma file_renaming_prop11:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   153
  "\<lbrakk>f\<^isub>2 \<preceq> f; file_after_rename f\<^isub>2 f\<^isub>3 f = f'\<rbrakk> \<Longrightarrow> f = file_before_rename f\<^isub>2 f\<^isub>3 f'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   154
by (drule_tac f\<^isub>3 = f\<^isub>3 in file_renaming_prop5, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   155
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   156
lemma file_renaming_prop11':
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   157
  "\<lbrakk>f\<^isub>3 \<preceq> f; file_before_rename f\<^isub>2 f\<^isub>3 f = f'\<rbrakk> \<Longrightarrow> f = file_after_rename f\<^isub>2 f\<^isub>3 f'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   158
by (drule_tac f\<^isub>2 = f\<^isub>2 in file_renaming_prop5', simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   159
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   160
lemma file_renaming_prop12:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   161
  "\<lbrakk>\<not> f\<^isub>3 \<preceq> aa; f\<^isub>3 \<preceq> f; file_after_rename f\<^isub>2 f\<^isub>3 aa = f\<rbrakk> \<Longrightarrow> file_before_rename f\<^isub>2 f\<^isub>3 f = aa"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   162
apply (simp add:file_after_rename_def file_before_rename_def split:if_splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   163
by (auto, simp add:list_diff_rev_prop1 list_diff_rev_prop2)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   164
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   165
lemma file_renaming_prop12':
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   166
  "\<lbrakk>\<not> f\<^isub>2 \<preceq> aa; f\<^isub>2 \<preceq> f; file_before_rename f\<^isub>2 f\<^isub>3 aa = f\<rbrakk> \<Longrightarrow> file_after_rename f\<^isub>2 f\<^isub>3 f = aa"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   167
apply (simp add:file_after_rename_def file_before_rename_def split:if_splits)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   168
by (auto, simp add:list_diff_rev_prop1 list_diff_rev_prop2)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   169
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   170
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   171
lemma file_renaming_prop13:
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   172
  "\<lbrakk>f\<^isub>3 \<preceq> f; file_before_rename f\<^isub>2 f\<^isub>3 f = f\<rbrakk> \<Longrightarrow> f\<^isub>2 \<preceq> f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   173
apply (simp add:file_before_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   174
apply (rule_tac zs = "f \<setminus> f\<^isub>3" in no_juniorI)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   175
by simp
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   176
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   177
(************ something *****************)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   178
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   179
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   180
lemma parent_is_parent: "parent f = Some pf \<Longrightarrow> f \<noteq> pf"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   181
by (case_tac f, auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   182
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   183
lemma parent_is_parent': "parent f = Some f \<Longrightarrow> false"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   184
by (drule parent_is_parent, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   185
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   186
lemma parent_is_parent'': "parent f \<noteq> Some f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   187
by (case_tac f, auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   188
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   189
lemma parent_is_parent3: "parent f = Some f' \<Longrightarrow> \<not> f \<preceq> f'"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   190
by (case_tac f, auto elim:no_juniorE)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   191
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   192
lemma parent_is_ancen: "parent f = Some f' \<Longrightarrow> f' \<preceq> f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   193
by (case_tac f, auto simp:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   194
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   195
lemma parent_is_ancen': "\<lbrakk>parent f = Some pf; f' \<preceq> pf\<rbrakk> \<Longrightarrow> f' \<preceq> f"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   196
by (case_tac f, auto simp:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   197
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   198
lemma parent_ancen: "\<lbrakk>parent f = Some pf; f' \<preceq> f; f \<noteq> f'\<rbrakk> \<Longrightarrow> f' \<preceq> pf"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   199
apply (erule no_juniorE)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   200
apply (case_tac zs, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   201
apply (rule_tac zs = list in no_juniorI)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   202
by auto
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   203
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   204
lemma parent_rename_ancen: "\<lbrakk>parent f = Some pf; f\<^isub>3 \<preceq> pf; f \<noteq> f\<^isub>3\<rbrakk> \<Longrightarrow> parent (file_before_rename f\<^isub>2 f\<^isub>3 f) = Some (file_before_rename f\<^isub>2 f\<^isub>3 pf)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   205
apply (simp add:file_before_rename_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   206
apply (case_tac f, simp, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   207
by (drule_tac a = a in list_diff_rev_prop2_aux, simp)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   208
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   209
lemma no_junior_trans: "\<lbrakk>f \<preceq> f'; f' \<preceq> f''\<rbrakk> \<Longrightarrow> f \<preceq> f''"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   210
by (auto elim:no_juniorE)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   211
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   212
lemma no_junior_conf: "\<lbrakk>a \<preceq> c; b \<preceq> c\<rbrakk> \<Longrightarrow> a \<preceq> b \<or> b \<preceq> a"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   213
apply (simp add:no_junior_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   214
apply (induct c, auto)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   215
done
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   216
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   217
lemma noJ_Anc: "x \<prec> y = (x \<preceq> y \<and> x \<noteq> y)"
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   218
apply (simp add: no_junior_expand)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   219
by (auto simp:is_ancestor_def)
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   220
7d9c0ed02b56 thy files
chunhan
parents:
diff changeset
   221
end