thys2/ReTest.thy
author Christian Urban <christian.urban@kcl.ac.uk>
Tue, 08 Feb 2022 14:29:41 +0000
changeset 423 b7199d6c672d
parent 365 ec5e4fe4cc70
permissions -rw-r--r--
updated paper
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
365
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     1
   
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     2
theory ReTest
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     3
  imports "Main" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     4
begin
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     5
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     6
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     7
section {* Sequential Composition of Sets *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     8
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
     9
definition
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    10
  Sequ :: "string set \<Rightarrow> string set \<Rightarrow> string set" ("_ ;; _" [100,100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    11
where 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    12
  "A ;; B = {s1 @ s2 | s1 s2. s1 \<in> A \<and> s2 \<in> B}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    13
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    14
fun spow where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    15
  "spow s 0 = []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    16
| "spow s (Suc n) = s @ spow s n"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    17
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    18
text {* Two Simple Properties about Sequential Composition *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    19
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    20
lemma seq_empty [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    21
  shows "A ;; {[]} = A"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    22
  and   "{[]} ;; A = A"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    23
by (simp_all add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    24
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    25
lemma seq_null [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    26
  shows "A ;; {} = {}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    27
  and   "{} ;; A = {}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    28
by (simp_all add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    29
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    30
definition
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    31
  Der :: "char \<Rightarrow> string set \<Rightarrow> string set"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    32
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    33
  "Der c A \<equiv> {s. [c] @ s \<in> A}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    34
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    35
definition 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    36
  Ders :: "string \<Rightarrow> string set \<Rightarrow> string set"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    37
where  
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    38
  "Ders s A \<equiv> {s' | s'. s @ s' \<in> A}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    39
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    40
lemma Der_null [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    41
  shows "Der c {} = {}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    42
unfolding Der_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    43
by auto
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    44
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    45
lemma Der_empty [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    46
  shows "Der c {[]} = {}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    47
unfolding Der_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    48
by auto
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    49
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    50
lemma Der_char [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    51
  shows "Der c {[d]} = (if c = d then {[]} else {})"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    52
unfolding Der_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    53
by auto
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    54
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    55
lemma Der_union [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    56
  shows "Der c (A \<union> B) = Der c A \<union> Der c B"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    57
unfolding Der_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    58
by auto
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    59
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    60
lemma Der_seq [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    61
  shows "Der c (A ;; B) = (Der c A) ;; B \<union> (if [] \<in> A then Der c B else {})"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    62
unfolding Der_def Sequ_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    63
apply (auto simp add: Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    64
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    65
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    66
lemma seq_image:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    67
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    68
  shows "f ` (A ;; B) = (f ` A) ;; (f ` B)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    69
apply(auto simp add: Sequ_def image_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    70
apply(rule_tac x="f s1" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    71
apply(rule_tac x="f s2" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    72
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    73
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    74
apply(rule_tac x="xa @ xb" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    75
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    76
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    77
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    78
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    79
section {* Kleene Star for Sets *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    80
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    81
inductive_set
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    82
  Star :: "string set \<Rightarrow> string set" ("_\<star>" [101] 102)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    83
  for A :: "string set"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    84
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    85
  start[intro]: "[] \<in> A\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    86
| step[intro]:  "\<lbrakk>s1 \<in> A; s2 \<in> A\<star>\<rbrakk> \<Longrightarrow> s1 @ s2 \<in> A\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    87
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    88
lemma star_cases:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    89
  shows "A\<star> = {[]} \<union> A ;; A\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    90
unfolding Sequ_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    91
by (auto) (metis Star.simps)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    92
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    93
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    94
fun 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    95
  pow :: "string set \<Rightarrow> nat \<Rightarrow> string set" ("_ \<up> _" [100,100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    96
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    97
  "A \<up> 0 = {[]}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    98
| "A \<up> (Suc n) = A ;; (A \<up> n)"  
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
    99
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   100
lemma star1: 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   101
  shows "s \<in> A\<star> \<Longrightarrow> \<exists>n. s \<in> A \<up> n"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   102
  apply(induct rule: Star.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   103
  apply (metis pow.simps(1) insertI1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   104
  apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   105
  apply(rule_tac x="Suc n" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   106
  apply(auto simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   107
  done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   108
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   109
lemma star2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   110
  shows "s \<in> A \<up> n \<Longrightarrow> s \<in> A\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   111
  apply(induct n arbitrary: s)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   112
  apply (metis pow.simps(1) Star.simps empty_iff insertE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   113
  apply(auto simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   114
  done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   115
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   116
lemma star3:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   117
  shows "A\<star> = (\<Union>i. A \<up> i)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   118
using star1 star2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   119
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   120
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   121
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   122
lemma star4:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   123
  shows "s \<in> A \<up> n \<Longrightarrow> \<exists>ss. s = concat ss \<and> (\<forall>s' \<in> set ss. s' \<in> A)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   124
  apply(induct n arbitrary: s)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   125
  apply(auto simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   126
  apply(rule_tac x="[]" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   127
  apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   128
  apply(drule_tac x="s2" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   129
  apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   130
by (metis concat.simps(2) insertE set_simps(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   131
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   132
lemma star5:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   133
  assumes "f [] = []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   134
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   135
  shows "(f ` A) \<up> n = f ` (A \<up> n)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   136
apply(induct n)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   137
apply(simp add: assms)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   138
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   139
apply(subst seq_image[OF assms(2)])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   140
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   141
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   142
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   143
lemma star6:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   144
  assumes "f [] = []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   145
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   146
  shows "(f ` A)\<star> = f ` (A\<star>)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   147
apply(simp add: star3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   148
apply(simp add: image_UN)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   149
apply(subst star5[OF assms])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   150
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   151
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   152
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   153
lemma star_decomp: 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   154
  assumes a: "c # x \<in> A\<star>" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   155
  shows "\<exists>a b. x = a @ b \<and> c # a \<in> A \<and> b \<in> A\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   156
using a
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   157
by (induct x\<equiv>"c # x" rule: Star.induct) 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   158
   (auto simp add: append_eq_Cons_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   159
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   160
lemma Der_star [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   161
  shows "Der c (A\<star>) = (Der c A) ;; A\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   162
proof -    
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   163
  have "Der c (A\<star>) = Der c ({[]} \<union> A ;; A\<star>)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   164
    
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   165
    by (simp only: star_cases[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   166
  also have "... = Der c (A ;; A\<star>)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   167
    by (simp only: Der_union Der_empty) (simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   168
  also have "... = (Der c A) ;; A\<star> \<union> (if [] \<in> A then Der c (A\<star>) else {})"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   169
    by simp
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   170
  also have "... =  (Der c A) ;; A\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   171
    unfolding Sequ_def Der_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   172
    by (auto dest: star_decomp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   173
  finally show "Der c (A\<star>) = (Der c A) ;; A\<star>" .
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   174
qed
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   175
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   176
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   177
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   178
section {* Regular Expressions *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   179
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   180
datatype rexp =
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   181
  NULL
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   182
| EMPTY
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   183
| CHAR char
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   184
| SEQ rexp rexp
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   185
| ALT rexp rexp
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   186
| STAR rexp
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   187
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   188
section {* Semantics of Regular Expressions *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   189
 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   190
fun
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   191
  L :: "rexp \<Rightarrow> string set"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   192
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   193
  "L (NULL) = {}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   194
| "L (EMPTY) = {[]}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   195
| "L (CHAR c) = {[c]}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   196
| "L (SEQ r1 r2) = (L r1) ;; (L r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   197
| "L (ALT r1 r2) = (L r1) \<union> (L r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   198
| "L (STAR r) = (L r)\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   199
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   200
fun
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   201
 nullable :: "rexp \<Rightarrow> bool"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   202
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   203
  "nullable (NULL) = False"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   204
| "nullable (EMPTY) = True"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   205
| "nullable (CHAR c) = False"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   206
| "nullable (ALT r1 r2) = (nullable r1 \<or> nullable r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   207
| "nullable (SEQ r1 r2) = (nullable r1 \<and> nullable r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   208
| "nullable (STAR r) = True"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   209
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   210
lemma nullable_correctness:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   211
  shows "nullable r  \<longleftrightarrow> [] \<in> (L r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   212
apply (induct r) 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   213
apply(auto simp add: Sequ_def) 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   214
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   215
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   216
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   217
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   218
section {* Values *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   219
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   220
datatype val = 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   221
  Void
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   222
| Char char
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   223
| Seq val val
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   224
| Right val
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   225
| Left val
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   226
| Stars "val list"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   227
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   228
section {* The string behind a value *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   229
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   230
fun 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   231
  flat :: "val \<Rightarrow> string"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   232
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   233
  "flat (Void) = []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   234
| "flat (Char c) = [c]"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   235
| "flat (Left v) = flat v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   236
| "flat (Right v) = flat v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   237
| "flat (Seq v1 v2) = (flat v1) @ (flat v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   238
| "flat (Stars []) = []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   239
| "flat (Stars (v#vs)) = (flat v) @ (flat (Stars vs))" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   240
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   241
lemma [simp]:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   242
 "flat (Stars vs) = concat (map flat vs)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   243
apply(induct vs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   244
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   245
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   246
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   247
section {* Relation between values and regular expressions *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   248
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   249
inductive 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   250
  NPrf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<Turnstile> _ : _" [100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   251
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   252
 "\<lbrakk>\<Turnstile> v1 : r1; \<Turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<Turnstile> Seq v1 v2 : SEQ r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   253
| "\<Turnstile> v1 : r1 \<Longrightarrow> \<Turnstile> Left v1 : ALT r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   254
| "\<Turnstile> v2 : r2 \<Longrightarrow> \<Turnstile> Right v2 : ALT r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   255
| "\<Turnstile> Void : EMPTY"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   256
| "\<Turnstile> Char c : CHAR c"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   257
| "\<Turnstile> Stars [] : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   258
| "\<lbrakk>\<Turnstile> v : r; \<Turnstile> Stars vs : STAR r; flat v \<noteq> []\<rbrakk> \<Longrightarrow> \<Turnstile> Stars (v # vs) : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   259
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   260
inductive 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   261
  Prf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<turnstile> _ : _" [100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   262
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   263
 "\<lbrakk>\<turnstile> v1 : r1; \<turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<turnstile> Seq v1 v2 : SEQ r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   264
| "\<turnstile> v1 : r1 \<Longrightarrow> \<turnstile> Left v1 : ALT r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   265
| "\<turnstile> v2 : r2 \<Longrightarrow> \<turnstile> Right v2 : ALT r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   266
| "\<turnstile> Void : EMPTY"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   267
| "\<turnstile> Char c : CHAR c"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   268
| "\<turnstile> Stars [] : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   269
| "\<lbrakk>\<turnstile> v : r; \<turnstile> Stars vs : STAR r\<rbrakk> \<Longrightarrow> \<turnstile> Stars (v # vs) : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   270
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   271
lemma NPrf_imp_Prf:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   272
  assumes "\<Turnstile> v : r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   273
  shows "\<turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   274
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   275
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   276
apply(auto intro: Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   277
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   278
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   279
lemma NPrf_Prf_val:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   280
  shows "\<turnstile> v : r \<Longrightarrow> \<exists>v'. flat v' = flat v \<and> \<Turnstile> v' : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   281
  and   "\<turnstile> Stars vs : r \<Longrightarrow> \<exists>vs'. flat (Stars vs') = flat (Stars vs) \<and> \<Turnstile> Stars vs' : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   282
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   283
apply(induct v and vs arbitrary: r and r rule: val.inducts)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   284
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   285
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   286
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   287
apply(rule_tac x="Void" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   288
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   289
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   290
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   291
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   292
apply(rule_tac x="Char c" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   293
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   294
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   295
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   296
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   297
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   298
apply(drule_tac x="r1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   299
apply(drule_tac x="r2" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   300
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   301
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   302
apply(rule_tac x="Seq v' v'a" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   303
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   304
apply (metis NPrf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   305
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   306
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   307
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   308
apply(drule_tac x="r2" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   309
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   310
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   311
apply(rule_tac x="Right v'" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   312
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   313
apply (metis NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   314
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   315
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   316
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   317
apply(drule_tac x="r1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   318
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   319
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   320
apply(rule_tac x="Left v'" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   321
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   322
apply (metis NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   323
apply(drule_tac x="r" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   324
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   325
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   326
apply(rule_tac x="Stars vs'" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   327
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   328
apply(rule_tac x="[]" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   329
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   330
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   331
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   332
apply (metis NPrf.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   333
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   334
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   335
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   336
apply(drule_tac x="ra" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   337
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   338
apply(drule_tac x="STAR ra" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   339
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   340
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   341
apply(case_tac "flat v = []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   342
apply(rule_tac x="vs'" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   343
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   344
apply(rule_tac x="v' # vs'" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   345
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   346
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   347
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   348
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   349
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   350
lemma NPrf_Prf:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   351
  shows "{flat v | v. \<turnstile> v : r} = {flat v | v. \<Turnstile> v : r}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   352
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   353
apply (metis NPrf_Prf_val(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   354
by (metis NPrf_imp_Prf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   355
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   356
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   357
lemma not_nullable_flat:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   358
  assumes "\<turnstile> v : r" "\<not>nullable r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   359
  shows "flat v \<noteq> []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   360
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   361
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   362
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   363
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   364
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   365
lemma Prf_flat_L:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   366
  assumes "\<turnstile> v : r" shows "flat v \<in> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   367
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   368
apply(induct v r rule: Prf.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   369
apply(auto simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   370
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   371
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   372
lemma NPrf_flat_L:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   373
  assumes "\<Turnstile> v : r" shows "flat v \<in> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   374
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   375
by (metis NPrf_imp_Prf Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   376
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   377
lemma Prf_Stars:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   378
  assumes "\<forall>v \<in> set vs. \<turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   379
  shows "\<turnstile> Stars vs : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   380
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   381
apply(induct vs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   382
apply (metis Prf.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   383
by (metis Prf.intros(7) insert_iff set_simps(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   384
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   385
lemma Star_string:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   386
  assumes "s \<in> A\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   387
  shows "\<exists>ss. concat ss = s \<and> (\<forall>s \<in> set ss. s \<in> A)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   388
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   389
apply(induct rule: Star.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   390
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   391
apply(rule_tac x="[]" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   392
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   393
apply(rule_tac x="s1#ss" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   394
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   395
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   396
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   397
lemma Star_val:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   398
  assumes "\<forall>s\<in>set ss. \<exists>v. s = flat v \<and> \<turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   399
  shows "\<exists>vs. concat (map flat vs) = concat ss \<and> (\<forall>v\<in>set vs. \<turnstile> v : r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   400
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   401
apply(induct ss)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   402
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   403
apply (metis empty_iff list.set(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   404
by (metis concat.simps(2) list.simps(9) set_ConsD)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   405
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   406
lemma Star_valN:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   407
  assumes "\<forall>s\<in>set ss. \<exists>v. s = flat v \<and> \<Turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   408
  shows "\<exists>vs. concat (map flat vs) = concat ss \<and> (\<forall>v\<in>set vs. \<Turnstile> v : r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   409
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   410
apply(induct ss)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   411
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   412
apply (metis empty_iff list.set(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   413
by (metis concat.simps(2) list.simps(9) set_ConsD)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   414
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   415
lemma L_flat_Prf:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   416
  "L(r) = {flat v | v. \<turnstile> v : r}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   417
apply(induct r)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   418
apply(auto dest: Prf_flat_L simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   419
apply (metis Prf.intros(4) flat.simps(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   420
apply (metis Prf.intros(5) flat.simps(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   421
apply (metis Prf.intros(1) flat.simps(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   422
apply (metis Prf.intros(2) flat.simps(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   423
apply (metis Prf.intros(3) flat.simps(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   424
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   425
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   426
apply(subgoal_tac "\<exists>vs::val list. concat (map flat vs) = x \<and> (\<forall>v \<in> set vs. \<turnstile> v : r)")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   427
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   428
apply(rule_tac x="Stars vs" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   429
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   430
apply(rule Prf_Stars)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   431
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   432
apply(drule Star_string)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   433
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   434
apply(rule Star_val)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   435
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   436
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   437
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   438
lemma L_flat_NPrf:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   439
  "L(r) = {flat v | v. \<Turnstile> v : r}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   440
by (metis L_flat_Prf NPrf_Prf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   441
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   442
text {* nicer proofs by Fahad *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   443
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   444
lemma Prf_Star_flat_L:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   445
  assumes "\<turnstile> v : STAR r" shows "flat v \<in> (L r)\<star>"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   446
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   447
apply(induct v r\<equiv>"STAR r" arbitrary: r rule: Prf.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   448
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   449
apply(simp add: star3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   450
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   451
apply(rule_tac x="Suc x" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   452
apply(auto simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   453
apply(rule_tac x="flat v" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   454
apply(rule_tac x="flat (Stars vs)" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   455
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   456
by (metis Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   457
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   458
lemma L_flat_Prf2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   459
  "L(r) = {flat v | v. \<turnstile> v : r}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   460
apply(induct r)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   461
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   462
using L.simps(1) Prf_flat_L 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   463
apply(blast)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   464
using Prf.intros(4) 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   465
apply(force)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   466
using L.simps(2) Prf_flat_L 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   467
apply(blast)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   468
using Prf.intros(5) apply force
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   469
using L.simps(3) Prf_flat_L apply blast
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   470
using L_flat_Prf apply auto[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   471
apply (smt L.simps(4) Sequ_def mem_Collect_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   472
using Prf_flat_L 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   473
apply(fastforce)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   474
apply(metis Prf.intros(2) flat.simps(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   475
apply(metis Prf.intros(3) flat.simps(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   476
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   477
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   478
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   479
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   480
using L_flat_Prf apply auto[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   481
apply (smt Collect_cong L.simps(6) mem_Collect_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   482
using Prf_Star_flat_L 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   483
apply(fastforce)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   484
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   485
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   486
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   487
section {* Values Sets *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   488
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   489
definition prefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubseteq> _" [100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   490
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   491
  "s1 \<sqsubseteq> s2 \<equiv> \<exists>s3. s1 @ s3 = s2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   492
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   493
definition sprefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubset> _" [100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   494
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   495
  "s1 \<sqsubset> s2 \<equiv> (s1 \<sqsubseteq> s2 \<and> s1 \<noteq> s2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   496
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   497
lemma length_sprefix:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   498
  "s1 \<sqsubset> s2 \<Longrightarrow> length s1 < length s2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   499
unfolding sprefix_def prefix_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   500
by (auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   501
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   502
definition Prefixes :: "string \<Rightarrow> string set" where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   503
  "Prefixes s \<equiv> {sp. sp \<sqsubseteq> s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   504
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   505
definition Suffixes :: "string \<Rightarrow> string set" where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   506
  "Suffixes s \<equiv> rev ` (Prefixes (rev s))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   507
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   508
definition SPrefixes :: "string \<Rightarrow> string set" where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   509
  "SPrefixes s \<equiv> {sp. sp \<sqsubset> s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   510
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   511
definition SSuffixes :: "string \<Rightarrow> string set" where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   512
  "SSuffixes s \<equiv> rev ` (SPrefixes (rev s))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   513
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   514
lemma Suffixes_in: 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   515
  "\<exists>s1. s1 @ s2 = s3 \<Longrightarrow> s2 \<in> Suffixes s3"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   516
unfolding Suffixes_def Prefixes_def prefix_def image_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   517
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   518
by (metis rev_rev_ident)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   519
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   520
lemma SSuffixes_in: 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   521
  "\<exists>s1. s1 \<noteq> [] \<and> s1 @ s2 = s3 \<Longrightarrow> s2 \<in> SSuffixes s3"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   522
unfolding SSuffixes_def Suffixes_def SPrefixes_def Prefixes_def sprefix_def prefix_def image_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   523
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   524
by (metis append_self_conv rev.simps(1) rev_rev_ident)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   525
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   526
lemma Prefixes_Cons:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   527
  "Prefixes (c # s) = {[]} \<union> {c # sp | sp. sp \<in> Prefixes s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   528
unfolding Prefixes_def prefix_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   529
apply(auto simp add: append_eq_Cons_conv) 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   530
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   531
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   532
lemma finite_Prefixes:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   533
  "finite (Prefixes s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   534
apply(induct s)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   535
apply(auto simp add: Prefixes_def prefix_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   536
apply(simp add: Prefixes_Cons)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   537
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   538
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   539
lemma finite_Suffixes:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   540
  "finite (Suffixes s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   541
unfolding Suffixes_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   542
apply(rule finite_imageI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   543
apply(rule finite_Prefixes)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   544
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   545
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   546
lemma prefix_Cons:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   547
  "((c # s1) \<sqsubseteq> (c # s2)) = (s1 \<sqsubseteq> s2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   548
apply(auto simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   549
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   550
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   551
lemma prefix_append:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   552
  "((s @ s1) \<sqsubseteq> (s @ s2)) = (s1 \<sqsubseteq> s2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   553
apply(induct s)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   554
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   555
apply(simp add: prefix_Cons)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   556
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   557
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   558
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   559
definition Values :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   560
  "Values r s \<equiv> {v. \<turnstile> v : r \<and> flat v \<sqsubseteq> s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   561
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   562
definition SValues :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   563
  "SValues r s \<equiv> {v. \<turnstile> v : r \<and> flat v = s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   564
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   565
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   566
definition NValues :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   567
  "NValues r s \<equiv> {v. \<Turnstile> v : r \<and> flat v \<sqsubseteq> s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   568
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   569
lemma NValues_STAR_Nil:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   570
  "NValues (STAR r) [] = {Stars []}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   571
apply(auto simp add: NValues_def prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   572
apply(erule NPrf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   573
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   574
by (metis NPrf.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   575
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   576
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   577
definition rest :: "val \<Rightarrow> string \<Rightarrow> string" where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   578
  "rest v s \<equiv> drop (length (flat v)) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   579
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   580
lemma rest_Nil:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   581
  "rest v [] = []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   582
apply(simp add: rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   583
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   584
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   585
lemma rest_Suffixes:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   586
  "rest v s \<in> Suffixes s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   587
unfolding rest_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   588
by (metis Suffixes_in append_take_drop_id)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   589
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   590
lemma rest_SSuffixes:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   591
  assumes "flat v \<noteq> []" "s \<noteq> []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   592
  shows "rest v s \<in> SSuffixes s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   593
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   594
unfolding rest_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   595
thm SSuffixes_in
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   596
apply(rule_tac SSuffixes_in)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   597
apply(rule_tac x="take (length (flat v)) s" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   598
apply(simp add: sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   599
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   600
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   601
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   602
lemma Values_recs:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   603
  "Values (NULL) s = {}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   604
  "Values (EMPTY) s = {Void}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   605
  "Values (CHAR c) s = (if [c] \<sqsubseteq> s then {Char c} else {})" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   606
  "Values (ALT r1 r2) s = {Left v | v. v \<in> Values r1 s} \<union> {Right v | v. v \<in> Values r2 s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   607
  "Values (SEQ r1 r2) s = {Seq v1 v2 | v1 v2. v1 \<in> Values r1 s \<and> v2 \<in> Values r2 (rest v1 s)}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   608
  "Values (STAR r) s = 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   609
      {Stars []} \<union> {Stars (v # vs) | v vs. v \<in> Values r s \<and> Stars vs \<in> Values (STAR r) (rest v s)}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   610
unfolding Values_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   611
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   612
(*NULL*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   613
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   614
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   615
(*EMPTY*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   616
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   617
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   618
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   619
apply (metis append_Nil prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   620
(*CHAR*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   621
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   622
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   623
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   624
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   625
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   626
(*ALT*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   627
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   628
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   629
apply (metis Prf.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   630
apply (metis Prf.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   631
(*SEQ*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   632
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   633
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   634
apply (simp add: append_eq_conv_conj prefix_def rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   635
apply (metis Prf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   636
apply (simp add: append_eq_conv_conj prefix_def rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   637
(*STAR*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   638
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   639
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   640
apply(rule conjI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   641
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   642
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   643
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   644
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   645
apply (metis append_eq_conv_conj rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   646
apply (metis Prf.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   647
apply (metis append_Nil prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   648
apply (metis Prf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   649
by (metis append_eq_conv_conj prefix_append prefix_def rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   650
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   651
lemma NValues_recs:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   652
  "NValues (NULL) s = {}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   653
  "NValues (EMPTY) s = {Void}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   654
  "NValues (CHAR c) s = (if [c] \<sqsubseteq> s then {Char c} else {})" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   655
  "NValues (ALT r1 r2) s = {Left v | v. v \<in> NValues r1 s} \<union> {Right v | v. v \<in> NValues r2 s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   656
  "NValues (SEQ r1 r2) s = {Seq v1 v2 | v1 v2. v1 \<in> NValues r1 s \<and> v2 \<in> NValues r2 (rest v1 s)}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   657
  "NValues (STAR r) s = 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   658
  {Stars []} \<union> {Stars (v # vs) | v vs. v \<in> NValues r s \<and> flat v \<noteq> [] \<and>  Stars vs \<in> NValues (STAR r) (rest v s)}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   659
unfolding NValues_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   660
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   661
(*NULL*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   662
apply(erule NPrf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   663
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   664
(*EMPTY*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   665
apply(erule NPrf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   666
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   667
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   668
apply (metis append_Nil prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   669
(*CHAR*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   670
apply(erule NPrf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   671
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   672
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   673
apply(erule NPrf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   674
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   675
(*ALT*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   676
apply(erule NPrf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   677
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   678
apply (metis NPrf.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   679
apply (metis NPrf.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   680
(*SEQ*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   681
apply(erule NPrf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   682
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   683
apply (simp add: append_eq_conv_conj prefix_def rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   684
apply (metis NPrf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   685
apply (simp add: append_eq_conv_conj prefix_def rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   686
(*STAR*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   687
apply(erule NPrf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   688
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   689
apply(rule conjI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   690
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   691
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   692
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   693
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   694
apply (metis append_eq_conv_conj rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   695
apply (metis NPrf.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   696
apply (metis append_Nil prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   697
apply (metis NPrf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   698
by (metis append_eq_conv_conj prefix_append prefix_def rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   699
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   700
lemma SValues_recs:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   701
 "SValues (NULL) s = {}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   702
 "SValues (EMPTY) s = (if s = [] then {Void} else {})"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   703
 "SValues (CHAR c) s = (if [c] = s then {Char c} else {})" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   704
 "SValues (ALT r1 r2) s = {Left v | v. v \<in> SValues r1 s} \<union> {Right v | v. v \<in> SValues r2 s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   705
 "SValues (SEQ r1 r2) s = {Seq v1 v2 | v1 v2. \<exists>s1 s2. s = s1 @ s2 \<and> v1 \<in> SValues r1 s1 \<and> v2 \<in> SValues r2 s2}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   706
 "SValues (STAR r) s = (if s = [] then {Stars []} else {}) \<union> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   707
   {Stars (v # vs) | v vs. \<exists>s1 s2. s = s1 @ s2 \<and> v \<in> SValues r s1 \<and> Stars vs \<in> SValues (STAR r) s2}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   708
unfolding SValues_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   709
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   710
(*NULL*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   711
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   712
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   713
(*EMPTY*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   714
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   715
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   716
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   717
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   718
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   719
(*CHAR*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   720
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   721
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   722
apply (metis Prf.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   723
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   724
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   725
(*ALT*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   726
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   727
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   728
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   729
apply(erule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   730
apply(erule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   731
(* SEQ case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   732
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   733
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   734
apply (metis Prf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   735
(* STAR case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   736
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   737
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   738
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   739
apply (metis Prf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   740
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   741
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   742
apply (metis Prf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   743
by (metis Prf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   744
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   745
lemma finite_image_set2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   746
  "finite {x. P x} \<Longrightarrow> finite {y. Q y} \<Longrightarrow> finite {(x, y) | x y. P x \<and> Q y}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   747
  by (rule finite_subset [where B = "\<Union>x \<in> {x. P x}. \<Union>y \<in> {y. Q y}. {(x, y)}"]) auto
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   748
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   749
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   750
lemma NValues_finite_aux:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   751
  "(\<lambda>(r, s). finite (NValues r s)) (r, s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   752
apply(rule wf_induct[of "measure size <*lex*> measure length",where P="\<lambda>(r, s). finite (NValues r s)"])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   753
apply (metis wf_lex_prod wf_measure)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   754
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   755
apply(case_tac a)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   756
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   757
apply(simp add: NValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   758
apply(simp add: NValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   759
apply(simp add: NValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   760
apply(simp add: NValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   761
apply(rule_tac f="\<lambda>(x, y). Seq x y" and 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   762
               A="{(v1, v2) | v1 v2. v1 \<in> NValues rexp1 b \<and> v2 \<in> NValues rexp2 (rest v1 b)}" in finite_surj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   763
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   764
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   765
apply(rule_tac B="\<Union>sp \<in> Suffixes b. {(v1, v2). v1 \<in> NValues rexp1 b \<and> v2 \<in> NValues rexp2 sp}" in finite_subset)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   766
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   767
apply (metis rest_Suffixes)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   768
apply(rule finite_UN_I)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   769
apply(rule finite_Suffixes)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   770
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   771
apply(simp add: NValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   772
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   773
apply(subst NValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   774
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   775
apply(rule_tac f="\<lambda>(v, vs). Stars (v # vs)" and 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   776
               A="{(v, vs) | v vs. v \<in> NValues rexp b \<and> (flat v \<noteq> [] \<and> Stars vs \<in> NValues (STAR rexp) (rest v b))}" in finite_surj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   777
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   778
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   779
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   780
apply(case_tac b)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   781
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   782
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   783
apply(rule_tac B="\<Union>sp \<in> SSuffixes b. {(v, vs) | v vs. v \<in> NValues rexp b \<and> Stars vs \<in> NValues (STAR rexp) sp}" in finite_subset)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   784
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   785
apply(rule_tac x="rest aa (a # list)" in bexI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   786
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   787
apply (rule rest_SSuffixes)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   788
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   789
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   790
apply(rule finite_UN_I)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   791
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   792
apply(frule_tac x="rexp" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   793
apply(drule_tac x="b" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   794
apply(drule conjunct1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   795
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   796
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   797
apply(drule_tac x="STAR rexp" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   798
apply(drule_tac x="sp" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   799
apply(drule conjunct2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   800
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   801
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   802
apply(simp add: prefix_def SPrefixes_def SSuffixes_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   803
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   804
apply (metis length_Cons length_rev length_sprefix rev.simps(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   805
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   806
apply(rule finite_cartesian_product)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   807
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   808
apply(rule_tac f="Stars" in finite_imageD)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   809
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   810
apply(auto simp add: inj_on_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   811
apply (metis finite_subset image_Collect_subsetI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   812
apply(simp add: rest_Nil)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   813
apply(simp add: NValues_STAR_Nil)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   814
apply(rule_tac B="{(v, vs). v \<in> NValues rexp [] \<and> vs = []}" in finite_subset)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   815
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   816
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   817
apply(rule_tac B="Suffixes b" in finite_subset)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   818
apply(auto simp add: SSuffixes_def Suffixes_def Prefixes_def SPrefixes_def sprefix_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   819
by (metis finite_Suffixes)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   820
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   821
lemma NValues_finite:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   822
  "finite (NValues r s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   823
using NValues_finite_aux
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   824
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   825
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   826
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   827
section {* Sulzmann functions *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   828
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   829
fun 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   830
  mkeps :: "rexp \<Rightarrow> val"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   831
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   832
  "mkeps(EMPTY) = Void"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   833
| "mkeps(SEQ r1 r2) = Seq (mkeps r1) (mkeps r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   834
| "mkeps(ALT r1 r2) = (if nullable(r1) then Left (mkeps r1) else Right (mkeps r2))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   835
| "mkeps(STAR r) = Stars []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   836
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   837
section {* Derivatives *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   838
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   839
fun
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   840
 der :: "char \<Rightarrow> rexp \<Rightarrow> rexp"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   841
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   842
  "der c (NULL) = NULL"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   843
| "der c (EMPTY) = NULL"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   844
| "der c (CHAR c') = (if c = c' then EMPTY else NULL)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   845
| "der c (ALT r1 r2) = ALT (der c r1) (der c r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   846
| "der c (SEQ r1 r2) = 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   847
     (if nullable r1
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   848
      then ALT (SEQ (der c r1) r2) (der c r2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   849
      else SEQ (der c r1) r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   850
| "der c (STAR r) = SEQ (der c r) (STAR r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   851
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   852
fun 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   853
 ders :: "string \<Rightarrow> rexp \<Rightarrow> rexp"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   854
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   855
  "ders [] r = r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   856
| "ders (c # s) r = ders s (der c r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   857
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   858
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   859
lemma der_correctness:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   860
  shows "L (der c r) = Der c (L r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   861
apply(induct r) 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   862
apply(simp_all add: nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   863
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   864
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   865
lemma ders_correctness:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   866
  shows "L (ders s r) = Ders s (L r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   867
apply(induct s arbitrary: r) 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   868
apply(simp add: Ders_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   869
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   870
apply(subst der_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   871
apply(simp add: Ders_def Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   872
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   873
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   874
section {* Injection function *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   875
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   876
fun injval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   877
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   878
  "injval (CHAR d) c Void = Char d"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   879
| "injval (ALT r1 r2) c (Left v1) = Left(injval r1 c v1)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   880
| "injval (ALT r1 r2) c (Right v2) = Right(injval r2 c v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   881
| "injval (SEQ r1 r2) c (Seq v1 v2) = Seq (injval r1 c v1) v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   882
| "injval (SEQ r1 r2) c (Left (Seq v1 v2)) = Seq (injval r1 c v1) v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   883
| "injval (SEQ r1 r2) c (Right v2) = Seq (mkeps r1) (injval r2 c v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   884
| "injval (STAR r) c (Seq v (Stars vs)) = Stars ((injval r c v) # vs)" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   885
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   886
fun 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   887
  lex :: "rexp \<Rightarrow> string \<Rightarrow> val option"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   888
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   889
  "lex r [] = (if nullable r then Some(mkeps r) else None)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   890
| "lex r (c#s) = (case (lex (der c r) s) of  
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   891
                    None \<Rightarrow> None
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   892
                  | Some(v) \<Rightarrow> Some(injval r c v))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   893
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   894
fun 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   895
  lex2 :: "rexp \<Rightarrow> string \<Rightarrow> val"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   896
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   897
  "lex2 r [] = mkeps r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   898
| "lex2 r (c#s) = injval r c (lex2 (der c r) s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   899
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   900
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   901
section {* Projection function *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   902
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   903
fun projval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   904
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   905
  "projval (CHAR d) c _ = Void"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   906
| "projval (ALT r1 r2) c (Left v1) = Left (projval r1 c v1)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   907
| "projval (ALT r1 r2) c (Right v2) = Right (projval r2 c v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   908
| "projval (SEQ r1 r2) c (Seq v1 v2) = 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   909
     (if flat v1 = [] then Right(projval r2 c v2) 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   910
      else if nullable r1 then Left (Seq (projval r1 c v1) v2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   911
                          else Seq (projval r1 c v1) v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   912
| "projval (STAR r) c (Stars (v # vs)) = Seq (projval r c v) (Stars vs)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   913
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   914
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   915
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   916
lemma mkeps_nullable:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   917
  assumes "nullable(r)" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   918
  shows "\<turnstile> mkeps r : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   919
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   920
apply(induct rule: nullable.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   921
apply(auto intro: Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   922
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   923
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   924
lemma mkeps_flat:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   925
  assumes "nullable(r)" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   926
  shows "flat (mkeps r) = []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   927
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   928
apply(induct rule: nullable.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   929
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   930
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   931
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   932
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   933
lemma v3:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   934
  assumes "\<turnstile> v : der c r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   935
  shows "\<turnstile> (injval r c v) : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   936
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   937
apply(induct arbitrary: v rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   938
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   939
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   940
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   941
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   942
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   943
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   944
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   945
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   946
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   947
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   948
apply (metis Prf.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   949
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   950
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   951
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   952
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   953
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   954
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   955
apply (metis Prf.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   956
apply (metis Prf.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   957
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   958
apply(case_tac "nullable r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   959
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   960
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   961
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   962
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   963
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   964
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   965
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   966
apply (metis Prf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   967
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   968
apply (metis Prf.intros(1) mkeps_nullable)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   969
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   970
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   971
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   972
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   973
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   974
apply(auto)[2]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   975
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   976
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   977
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   978
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   979
apply(rotate_tac 2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   980
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   981
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   982
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   983
apply (metis Prf.intros(6) Prf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   984
by (metis Prf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   985
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   986
lemma v3_proj:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   987
  assumes "\<Turnstile> v : r" and "\<exists>s. (flat v) = c # s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   988
  shows "\<Turnstile> (projval r c v) : der c r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   989
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   990
apply(induct rule: NPrf.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   991
prefer 4
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   992
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   993
prefer 4
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   994
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   995
apply (metis NPrf.intros(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   996
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   997
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   998
apply (metis NPrf.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
   999
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1000
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1001
apply (metis NPrf.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1002
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1003
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1004
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1005
apply (metis NPrf_imp_Prf not_nullable_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1006
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1007
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1008
apply (metis Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1009
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1010
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1011
apply (metis Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1012
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1013
(* Stars case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1014
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1015
apply (metis Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1016
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1017
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1018
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1019
lemma v4:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1020
  assumes "\<turnstile> v : der c r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1021
  shows "flat (injval r c v) = c # (flat v)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1022
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1023
apply(induct arbitrary: v rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1024
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1025
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1026
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1027
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1028
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1029
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1030
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1031
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1032
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1033
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1034
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1035
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1036
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1037
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1038
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1039
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1040
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1041
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1042
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1043
apply(case_tac "nullable r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1044
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1045
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1046
apply(simp_all (no_asm_use))[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1047
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1048
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1049
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1050
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1051
apply(simp only: injval.simps flat.simps)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1052
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1053
apply (metis mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1054
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1055
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1056
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1057
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1058
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1059
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1060
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1061
apply(rotate_tac 2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1062
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1063
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1064
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1065
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1066
lemma v4_proj:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1067
  assumes "\<Turnstile> v : r" and "\<exists>s. (flat v) = c # s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1068
  shows "c # flat (projval r c v) = flat v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1069
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1070
apply(induct rule: NPrf.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1071
prefer 4
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1072
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1073
prefer 4
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1074
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1075
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1076
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1077
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1078
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1079
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1080
apply (metis Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1081
apply(simp add: append_eq_Cons_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1082
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1083
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1084
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1085
lemma v4_proj2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1086
  assumes "\<Turnstile> v : r" and "(flat v) = c # s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1087
  shows "flat (projval r c v) = s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1088
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1089
by (metis list.inject v4_proj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1090
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1091
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1092
definition 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1093
  PC31 :: "string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1094
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1095
  "PC31 s r r' \<equiv> s \<notin> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1096
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1097
definition 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1098
  PC41 :: "string \<Rightarrow> string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1099
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1100
  "PC41 s s' r r' \<equiv> (\<forall>x. (s @ x \<in> L r \<longrightarrow> s' \<in> {x} ;; L r' \<longrightarrow> x = []))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1101
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1102
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1103
lemma
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1104
 L1: "\<not>(nullable r1) \<longrightarrow> [] \<in> L r2 \<longrightarrow> PC31 [] r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1105
 L2: "s1 \<in> L(r1) \<longrightarrow> [] \<in> L(r2) \<longrightarrow> PC41 s1 [] r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1106
 L3: "s2 \<in> L(der c r2) \<longrightarrow> PC31 s2 (der c r1) (der c r2) \<longrightarrow> PC31 (c#s2) r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1107
 L4: "s1 \<in> L(der c r1) \<longrightarrow> s2 \<in> L(r2) \<longrightarrow> PC41 s1 s2 (der c r1) r2 \<longrightarrow> PC41 (c#s1) s2 r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1108
 L5: "nullable(r1) \<longrightarrow> s2 \<in> L(der c r2) \<longrightarrow> PC31 s2 (SEQ (der c r1) r2) (der c r2) \<longrightarrow> PC41 [] (c#s2) r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1109
 L6: "s0 \<in> L(der c r0) \<longrightarrow>  s \<in> L(STAR r0) \<longrightarrow>  PC41 s0 s (der c r0) (STAR r0) \<longrightarrow> PC41 (c#s0) s r0 (STAR r0)" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1110
 L7: "s' \<in> L(r') \<longrightarrow> s' \<in> L(r) \<longrightarrow> \<not>PC31 s' r r'" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1111
 L8: "s \<in> L(r) \<longrightarrow> s' \<in> L(r') \<longrightarrow> s @ x \<in> L(r) \<longrightarrow> s' \<in> {x} ;; (L(r') ;; {y}) \<longrightarrow>  x \<noteq> [] \<longrightarrow> \<not>PC41 s s' r r'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1112
apply(auto simp add: PC31_def PC41_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1113
apply (metis nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1114
apply(auto simp add: PC31_def PC41_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1115
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1116
apply(auto simp add: PC31_def PC41_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1117
apply(simp add: der_correctness Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1118
apply(auto simp add: PC31_def PC41_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1119
apply(simp add: der_correctness Der_def Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1120
apply(auto simp add: PC31_def PC41_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1121
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1122
apply(simp add: der_correctness Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1123
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1124
apply (metis append_eq_Cons_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1125
apply(auto simp add: PC31_def PC41_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1126
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1127
apply(simp add: der_correctness Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1128
apply(auto simp add: PC31_def PC41_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1129
apply(rule impI)+
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1130
apply(rule notI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1131
(* 8 fails *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1132
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1133
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1134
definition 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1135
  PC32 :: "string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1136
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1137
  "PC32 s r r' \<equiv> \<forall>y. s \<notin> (L r ;; {y})"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1138
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1139
definition 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1140
  PC42 :: "string \<Rightarrow> string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1141
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1142
  "PC42 s s' r r' \<equiv> (\<forall>x. (s @ x \<in> L r \<longrightarrow> (\<exists>y. s' \<in> {x} ;; (L r' ;; {y})) \<longrightarrow> x = []))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1143
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1144
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1145
lemma
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1146
 L1: "\<not>(nullable r1) \<longrightarrow> [] \<in> L r2 \<longrightarrow> PC32 [] r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1147
 L2: "s1 \<in> L(r1) \<longrightarrow> [] \<in> L(r2) \<longrightarrow> PC42 s1 [] r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1148
 L3: "s2 \<in> L(der c r2) \<longrightarrow> PC32 s2 (der c r1) (der c r2) \<longrightarrow> PC32 (c#s2) r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1149
 L4: "s1 \<in> L(der c r1) \<longrightarrow> s2 \<in> L(r2) \<longrightarrow> PC42 s1 s2 (der c r1) r2 \<longrightarrow> PC42 (c#s1) s2 r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1150
 L5: "nullable(r1) \<longrightarrow> s2 \<in> L(der c r2) \<longrightarrow> PC32 s2 (SEQ (der c r1) r2) (der c r2) \<longrightarrow> PC42 [] (c#s2) r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1151
 L6: "s0 \<in> L(der c r0) \<longrightarrow>  s \<in> L(STAR r0) \<longrightarrow>  PC42 s0 s (der c r0) (STAR r0) \<longrightarrow> PC42 (c#s0) s r0 (STAR r0)" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1152
 L7: "s' \<in> L(r') \<longrightarrow> s' \<in> L(r) \<longrightarrow> \<not>PC32 s' r r'" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1153
 L8: "s \<in> L(r) \<longrightarrow> s' \<in> L(r') \<longrightarrow> s @ x \<in> L(r) \<longrightarrow> s' \<in> {x} ;; (L(r') ;; {y}) \<longrightarrow>  x \<noteq> [] \<longrightarrow> \<not>PC42 s s' r r'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1154
apply(auto simp add: PC32_def PC42_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1155
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1156
apply (metis nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1157
apply(auto simp add: PC32_def PC42_def Sequ_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1158
apply(auto simp add: PC32_def PC42_def Sequ_def der_correctness Der_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1159
apply(simp add: Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1160
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1161
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1162
apply(auto simp add: PC32_def PC42_def Sequ_def der_correctness Der_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1163
apply(auto simp add: PC32_def PC42_def Sequ_def der_correctness Der_def nullable_correctness)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1164
apply (metis append_Cons append_assoc hd_Cons_tl list.discI list.inject)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1165
apply(auto simp add: PC32_def PC42_def Sequ_def der_correctness Der_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1166
apply(auto simp add: PC32_def PC42_def Sequ_def der_correctness Der_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1167
apply(auto simp add: PC32_def PC42_def Sequ_def der_correctness Der_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1168
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1169
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1170
definition 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1171
  PC33 :: "string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1172
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1173
  "PC33 s r r' \<equiv> s \<notin> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1174
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1175
definition 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1176
  PC43 :: "string \<Rightarrow> string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1177
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1178
  "PC43 s s' r r' \<equiv> (\<forall>x. (s @ x \<in> L r \<longrightarrow> (\<exists>y. s' \<in> {x} ;; (L r' ;; {y})) \<longrightarrow> x = []))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1179
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1180
lemma
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1181
 L1: "\<not>(nullable r1) \<longrightarrow> [] \<in> L r2 \<longrightarrow> PC33 [] r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1182
 L2: "s1 \<in> L(r1) \<longrightarrow> [] \<in> L(r2) \<longrightarrow> PC43 s1 [] r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1183
 L3: "s2 \<in> L(der c r2) \<longrightarrow> PC33 s2 (der c r1) (der c r2) \<longrightarrow> PC33 (c#s2) r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1184
 L4: "s1 \<in> L(der c r1) \<longrightarrow> s2 \<in> L(r2) \<longrightarrow> PC43 s1 s2 (der c r1) r2 \<longrightarrow> PC43 (c#s1) s2 r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1185
 L5: "nullable(r1) \<longrightarrow> s2 \<in> L(der c r2) \<longrightarrow> PC33 s2 (SEQ (der c r1) r2) (der c r2) \<longrightarrow> PC43 [] (c#s2) r1 r2" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1186
 L6: "s0 \<in> L(der c r0) \<longrightarrow>  s \<in> L(STAR r0) \<longrightarrow>  PC43 s0 s (der c r0) (STAR r0) \<longrightarrow> PC43 (c#s0) s r0 (STAR r0)" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1187
 L7: "s' \<in> L(r') \<longrightarrow> s' \<in> L(r) \<longrightarrow> \<not>PC33 s' r r'" and
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1188
 L8: "s \<in> L(r) \<longrightarrow> s' \<in> L(r') \<longrightarrow> s @ x \<in> L(r) \<longrightarrow> s' \<in> {x} ;; (L(r') ;; {y}) \<longrightarrow>  x \<noteq> [] \<longrightarrow> \<not>PC43 s s' r r'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1189
apply(auto simp add: PC33_def PC43_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1190
apply (metis nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1191
apply(auto simp add: PC33_def PC43_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1192
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1193
apply(auto simp add: PC33_def PC43_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1194
apply(simp add: der_correctness Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1195
apply(auto simp add: PC33_def PC43_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1196
apply(simp add: der_correctness Der_def Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1197
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1198
(* 5 *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1199
apply(auto simp add: PC33_def PC43_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1200
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1201
apply(simp add: der_correctness Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1202
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1203
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1204
apply(auto simp add: PC33_def PC43_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1205
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1206
apply(simp add: der_correctness Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1207
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1208
apply(auto simp add: PC33_def PC43_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1209
apply(auto simp add: PC33_def PC43_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1210
(* 5 fails *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1211
apply(simp add: Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1212
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1213
apply(drule_tac x="ys'" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1214
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1215
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1216
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1217
section {* Roy's Definition *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1218
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1219
inductive 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1220
  Roy :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<rhd> _ : _" [100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1221
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1222
  "\<rhd> Void : EMPTY"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1223
| "\<rhd> Char c : CHAR c"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1224
| "\<rhd> v : r1 \<Longrightarrow> \<rhd> Left v : ALT r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1225
| "\<lbrakk>\<rhd> v : r2; flat v \<notin> L r1\<rbrakk> \<Longrightarrow> \<rhd> Right v : ALT r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1226
| "\<lbrakk>\<rhd> v1 : r1; \<rhd> v2 : r2; \<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = flat v2 \<and> (flat v1 @ s\<^sub>3) \<in> L r1 \<and> s\<^sub>4 \<in> L r2)\<rbrakk> \<Longrightarrow>
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1227
      \<rhd> Seq v1 v2 : SEQ r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1228
| "\<lbrakk>\<rhd> v : r; \<rhd> Stars vs : STAR r; flat v \<noteq> []; 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1229
   \<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = flat (Stars vs) \<and> (flat v @ s\<^sub>3) \<in> L r \<and> s\<^sub>4 \<in> L (STAR r))\<rbrakk> \<Longrightarrow>
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1230
      \<rhd> Stars (v#vs) : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1231
| "\<rhd> Stars [] : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1232
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1233
lemma drop_append:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1234
  assumes "s1 \<sqsubseteq> s2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1235
  shows "s1 @ drop (length s1) s2 = s2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1236
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1237
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1238
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1239
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1240
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1241
lemma royA: 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1242
  assumes "\<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = flat v2 \<and> (flat v1 @ s\<^sub>3) \<in> L r1 \<and> s\<^sub>4 \<in> L r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1243
  shows "\<forall>s. (s \<in> L(ders (flat v1) r1) \<and> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1244
              s \<sqsubseteq> (flat v2) \<and> drop (length s) (flat v2) \<in> L r2 \<longrightarrow> s = [])" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1245
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1246
apply -
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1247
apply(rule allI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1248
apply(rule impI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1249
apply(simp add: ders_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1250
apply(simp add: Ders_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1251
thm rest_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1252
apply(drule_tac x="s" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1253
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1254
apply(erule disjE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1255
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1256
apply(drule_tac x="drop (length s) (flat v2)" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1257
apply(simp add: drop_append)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1258
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1259
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1260
lemma royB:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1261
  assumes "\<forall>s. (s \<in> L(ders (flat v1) r1) \<and> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1262
              s \<sqsubseteq> (flat v2) \<and> drop (length s) (flat v2) \<in> L r2 \<longrightarrow> s = [])"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1263
  shows "\<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = flat v2 \<and> (flat v1 @ s\<^sub>3) \<in> L r1 \<and> s\<^sub>4 \<in> L r2)" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1264
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1265
apply -
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1266
apply(auto simp add: prefix_def ders_correctness Ders_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1267
by (metis append_eq_conv_conj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1268
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1269
lemma royC: 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1270
  assumes "\<forall>s t. (s \<in> L(ders (flat v1) r1) \<and> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1271
                s \<sqsubseteq> (flat v2 @ t) \<and> drop (length s) (flat v2 @ t) \<in> L r2 \<longrightarrow> s = [])" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1272
  shows "\<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = flat v2 \<and> (flat v1 @ s\<^sub>3) \<in> L r1 \<and> s\<^sub>4 \<in> L r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1273
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1274
apply -
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1275
apply(rule royB)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1276
apply(rule allI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1277
apply(drule_tac x="s" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1278
apply(drule_tac x="[]" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1279
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1280
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1281
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1282
inductive 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1283
  Roy2 :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("2\<rhd> _ : _" [100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1284
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1285
  "2\<rhd> Void : EMPTY"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1286
| "2\<rhd> Char c : CHAR c"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1287
| "2\<rhd> v : r1 \<Longrightarrow> 2\<rhd> Left v : ALT r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1288
| "\<lbrakk>2\<rhd> v : r2; \<forall>t. flat v \<notin> (L r1 ;; {t})\<rbrakk> \<Longrightarrow> 2\<rhd> Right v : ALT r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1289
| "\<lbrakk>2\<rhd> v1 : r1; 2\<rhd> v2 : r2;
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1290
    \<forall>s. ((flat v1 @ s \<in> L r1) \<and> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1291
         (\<exists>t. s \<sqsubseteq> (flat v2 @ t) \<and> drop (length s) (flat v2) \<in> (L r2 ;; {t}))) \<longrightarrow> s = []\<rbrakk> \<Longrightarrow>
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1292
    2\<rhd> Seq v1 v2 : SEQ r1 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1293
| "\<lbrakk>2\<rhd> v : r; 2\<rhd> Stars vs : STAR r; flat v \<noteq> []; 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1294
    \<forall>s. ((flat v @ s \<in> L r) \<and> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1295
       (\<exists>t. s \<sqsubseteq> (flat (Stars vs) @ t) \<and> drop (length s) (flat (Stars vs)) \<in> (L (STAR r) ;; {t}))) \<longrightarrow> s = []\<rbrakk>
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1296
    \<Longrightarrow> 2\<rhd> Stars (v#vs) : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1297
| "2\<rhd> Stars [] : STAR r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1298
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1299
lemma Roy2_props:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1300
  assumes "2\<rhd> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1301
  shows "\<turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1302
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1303
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1304
apply(auto intro: Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1305
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1306
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1307
lemma Roy_mkeps_nullable:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1308
  assumes "nullable(r)" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1309
  shows "2\<rhd> (mkeps r) : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1310
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1311
apply(induct rule: nullable.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1312
apply(auto intro: Roy2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1313
apply(rule Roy2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1314
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1315
apply(simp add: mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1316
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1317
apply (metis nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1318
apply(rule Roy2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1319
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1320
apply(rule allI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1321
apply(rule impI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1322
apply(auto simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1323
apply(simp add: mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1324
apply(auto simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1325
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1326
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1327
section {* Alternative Posix definition *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1328
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1329
inductive 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1330
  PMatch :: "string \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<in> _ \<rightarrow> _" [100, 100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1331
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1332
  "[] \<in> EMPTY \<rightarrow> Void"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1333
| "[c] \<in> (CHAR c) \<rightarrow> (Char c)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1334
| "s \<in> r1 \<rightarrow> v \<Longrightarrow> s \<in> (ALT r1 r2) \<rightarrow> (Left v)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1335
| "\<lbrakk>s \<in> r2 \<rightarrow> v; s \<notin> L(r1)\<rbrakk> \<Longrightarrow> s \<in> (ALT r1 r2) \<rightarrow> (Right v)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1336
| "\<lbrakk>s1 \<in> r1 \<rightarrow> v1; s2 \<in> r2 \<rightarrow> v2;
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1337
    \<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = s2 \<and> (s1 @ s\<^sub>3) \<in> L r1 \<and> s\<^sub>4 \<in> L r2)\<rbrakk> \<Longrightarrow> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1338
    (s1 @ s2) \<in> (SEQ r1 r2) \<rightarrow> (Seq v1 v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1339
| "\<lbrakk>s1 \<in> r \<rightarrow> v; s2 \<in> STAR r \<rightarrow> Stars vs; flat v \<noteq> [];
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1340
    \<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = s2 \<and> (s1 @ s\<^sub>3) \<in> L r \<and> s\<^sub>4 \<in> L (STAR r))\<rbrakk>
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1341
    \<Longrightarrow> (s1 @ s2) \<in> STAR r \<rightarrow> Stars (v # vs)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1342
| "[] \<in> STAR r \<rightarrow> Stars []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1343
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1344
inductive 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1345
  PMatchX :: "string \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("\<turnstile> _ \<in> _ \<rightarrow> _" [100, 100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1346
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1347
  "\<turnstile> s \<in> EMPTY \<rightarrow> Void"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1348
| "\<turnstile> (c # s) \<in> (CHAR c) \<rightarrow> (Char c)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1349
| "\<turnstile> s \<in> r1 \<rightarrow> v \<Longrightarrow> \<turnstile> s \<in> (ALT r1 r2) \<rightarrow> (Left v)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1350
| "\<lbrakk>\<turnstile> s \<in> r2 \<rightarrow> v; \<not>(\<exists>s'. s' \<sqsubseteq> s \<and> flat v \<sqsubseteq> s' \<and> s' \<in> L(r1))\<rbrakk> \<Longrightarrow> \<turnstile> s \<in> (ALT r1 r2) \<rightarrow> (Right v)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1351
| "\<lbrakk>s1 \<in> r1 \<rightarrow> v1; \<turnstile> s2 \<in> r2 \<rightarrow> v2;
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1352
    \<not>(\<exists>s3 s4. s3 \<noteq> [] \<and> (s3 @ s4) \<sqsubseteq> s2 \<and> (s1 @ s3) \<in> L r1 \<and> s4 \<in> L r2)\<rbrakk> \<Longrightarrow> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1353
    \<turnstile> (s1 @ s2) \<in> (SEQ r1 r2) \<rightarrow> (Seq v1 v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1354
| "\<lbrakk>s1 \<in> r \<rightarrow> v; \<turnstile> s2 \<in> STAR r \<rightarrow> Stars vs; flat v \<noteq> [];
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1355
    \<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> (s\<^sub>3 @ s\<^sub>4) \<sqsubseteq> s2 \<and> (s1 @ s\<^sub>3) \<in> L r \<and> s\<^sub>4 \<in> L (STAR r))\<rbrakk>
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1356
    \<Longrightarrow> \<turnstile> (s1 @ s2) \<in> STAR r \<rightarrow> Stars (v # vs)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1357
| "\<turnstile> s \<in> STAR r \<rightarrow> Stars []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1358
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1359
lemma PMatch1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1360
  assumes "s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1361
  shows "\<turnstile> v : r" "flat v = s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1362
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1363
apply(induct s r v rule: PMatch.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1364
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1365
apply (metis Prf.intros(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1366
apply (metis Prf.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1367
apply (metis Prf.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1368
apply (metis Prf.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1369
apply (metis Prf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1370
apply (metis Prf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1371
by (metis Prf.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1372
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1373
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1374
lemma PMatchX1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1375
  assumes "\<turnstile> s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1376
  shows "\<turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1377
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1378
apply(induct s r v rule: PMatchX.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1379
apply(auto simp add: prefix_def intro: Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1380
apply (metis PMatch1(1) Prf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1381
by (metis PMatch1(1) Prf.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1382
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1383
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1384
lemma PMatchX:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1385
  assumes "\<turnstile> s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1386
  shows "flat v \<sqsubseteq> s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1387
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1388
apply(induct s r v rule: PMatchX.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1389
apply(auto simp add: prefix_def PMatch1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1390
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1391
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1392
lemma PMatchX_PMatch:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1393
  assumes "\<turnstile> s \<in> r \<rightarrow> v" "flat v = s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1394
  shows "s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1395
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1396
apply(induct s r v rule: PMatchX.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1397
apply(auto intro: PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1398
apply(rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1399
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1400
apply (metis PMatchX Prefixes_def mem_Collect_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1401
apply (smt2 PMatch.intros(5) PMatch1(2) PMatchX append_Nil2 append_assoc append_self_conv prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1402
by (metis L.simps(6) PMatch.intros(6) PMatch1(2) append_Nil2 append_eq_conv_conj prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1403
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1404
lemma PMatch_PMatchX:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1405
  assumes "s \<in> r \<rightarrow> v" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1406
  shows "\<turnstile> s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1407
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1408
apply(induct s r v arbitrary: s' rule: PMatch.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1409
apply(auto intro: PMatchX.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1410
apply(rule PMatchX.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1411
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1412
apply(rule notI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1413
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1414
apply (metis PMatch1(2) append_eq_conv_conj length_sprefix less_imp_le_nat prefix_def sprefix_def take_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1415
apply(rule PMatchX.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1416
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1417
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1418
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1419
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1420
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1421
lemma 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1422
  assumes "\<rhd> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1423
  shows "(flat v) \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1424
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1425
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1426
apply(auto intro: PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1427
apply(rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1428
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1429
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1430
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1431
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1432
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1433
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1434
lemma 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1435
  assumes "s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1436
  shows "\<rhd> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1437
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1438
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1439
apply(auto intro: Roy.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1440
apply (metis PMatch1(2) Roy.intros(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1441
apply (metis PMatch1(2) Roy.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1442
by (metis L.simps(6) PMatch1(2) Roy.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1443
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1444
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1445
lemma PMatch_mkeps:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1446
  assumes "nullable r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1447
  shows "[] \<in> r \<rightarrow> mkeps r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1448
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1449
apply(induct r)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1450
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1451
apply (metis PMatch.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1452
apply(subst append.simps(1)[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1453
apply (rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1454
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1455
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1456
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1457
apply (rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1458
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1459
apply (rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1460
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1461
apply (rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1462
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1463
apply (metis nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1464
apply(metis PMatch.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1465
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1466
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1467
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1468
lemma PMatch1N:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1469
  assumes "s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1470
  shows "\<Turnstile> v : r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1471
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1472
apply(induct s r v rule: PMatch.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1473
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1474
apply (metis NPrf.intros(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1475
apply (metis NPrf.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1476
apply (metis NPrf.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1477
apply (metis NPrf.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1478
apply (metis NPrf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1479
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1480
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1481
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1482
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1483
apply(rule NPrf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1484
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1485
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1486
lemma PMatch_determ:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1487
  shows "\<lbrakk>s \<in> r \<rightarrow> v1; s \<in> r \<rightarrow> v2\<rbrakk> \<Longrightarrow> v1 = v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1488
  and   "\<lbrakk>s \<in> (STAR r) \<rightarrow> Stars vs1; s \<in> (STAR r) \<rightarrow> Stars vs2\<rbrakk> \<Longrightarrow> vs1 = vs2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1489
apply(induct v1 and vs1 arbitrary: s r v2 and s r vs2 rule: val.inducts)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1490
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1491
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1492
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1493
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1494
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1495
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1496
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1497
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1498
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1499
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1500
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1501
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1502
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1503
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1504
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1505
apply(rule conjI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1506
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1507
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1508
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1509
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1510
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1511
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1512
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1513
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1514
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1515
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1516
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1517
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1518
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1519
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1520
apply (metis NPrf_flat_L PMatch1(2) PMatch1N)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1521
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1522
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1523
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1524
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1525
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1526
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1527
apply (metis NPrf_flat_L PMatch1(2) PMatch1N)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1528
(* star case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1529
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1530
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1531
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1532
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1533
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1534
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1535
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1536
apply (metis PMatch1(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1537
apply(rotate_tac  3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1538
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1539
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1540
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1541
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1542
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1543
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1544
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1545
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1546
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1547
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1548
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1549
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1550
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1551
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1552
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1553
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1554
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1555
apply (metis PMatch1(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1556
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1557
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1558
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1559
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1560
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1561
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1562
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1563
apply(drule_tac x="s1 @ s2" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1564
apply(drule_tac x="rb" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1565
apply(drule_tac x="(va#vsa)" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1566
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1567
apply(drule meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1568
apply (metis L.simps(6) PMatch.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1569
apply (metis L.simps(6) PMatch.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1570
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1571
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1572
apply (metis L.simps(6) NPrf_flat_L PMatch1(2) PMatch1N)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1573
apply (metis L.simps(6) NPrf_flat_L PMatch1(2) PMatch1N)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1574
apply (metis L.simps(6) NPrf_flat_L PMatch1(2) PMatch1N)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1575
apply (metis L.simps(6) NPrf_flat_L PMatch1(2) PMatch1N)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1576
apply (metis PMatch1(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1577
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1578
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1579
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1580
by (metis PMatch1(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1581
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1582
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1583
lemma PMatch_Values:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1584
  assumes "s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1585
  shows "v \<in> Values r s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1586
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1587
apply(simp add: Values_def PMatch1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1588
by (metis append_Nil2 prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1589
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1590
lemma PMatch2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1591
  assumes "s \<in> (der c r) \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1592
  shows "(c#s) \<in> r \<rightarrow> (injval r c v)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1593
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1594
apply(induct c r arbitrary: s v rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1595
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1596
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1597
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1598
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1599
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1600
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1601
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1602
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1603
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1604
apply (metis PMatch.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1605
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1606
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1607
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1608
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1609
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1610
apply (metis PMatch.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1611
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1612
apply(rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1613
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1614
apply(simp add: L_flat_NPrf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1615
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1616
apply(frule_tac c="c" in v3_proj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1617
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1618
apply(drule_tac x="projval r1 c v" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1619
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1620
apply (metis v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1621
apply (metis NPrf_imp_Prf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1622
(* SEQ case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1623
apply(case_tac "nullable r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1624
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1625
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1626
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1627
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1628
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1629
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1630
apply(subst append.simps(2)[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1631
apply(rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1632
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1633
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1634
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1635
apply(simp add: der_correctness Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1636
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1637
(* nullable case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1638
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1639
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1640
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1641
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1642
apply(simp_all)[4]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1643
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1644
apply(simp (no_asm))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1645
apply(subst append.simps(2)[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1646
apply(rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1647
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1648
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1649
apply(erule contrapos_nn)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1650
apply(erule exE)+
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1651
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1652
apply(simp add: L_flat_NPrf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1653
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1654
thm v3_proj
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1655
apply(frule_tac c="c" in v3_proj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1656
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1657
apply(rule_tac x="s\<^sub>3" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1658
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1659
apply (metis NPrf_imp_Prf v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1660
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1661
(* interesting case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1662
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1663
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1664
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1665
apply(subst (asm) L.simps(4)[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1666
apply(simp only: L_flat_Prf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1667
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1668
apply(subst append.simps(1)[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1669
apply(rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1670
apply (metis PMatch_mkeps)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1671
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1672
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1673
apply(simp only: L_flat_NPrf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1674
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1675
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1676
apply(drule_tac x="Seq (projval r1 c v) vb" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1677
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1678
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1679
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1680
apply (metis append_Cons butlast_snoc list.sel(1) neq_Nil_conv rotate1.simps(2) v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1681
apply(subgoal_tac "\<turnstile> projval r1 c v : der c r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1682
apply (metis NPrf_imp_Prf Prf.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1683
apply(rule NPrf_imp_Prf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1684
apply(rule v3_proj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1685
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1686
apply (metis Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1687
(* Stars case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1688
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1689
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1690
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1691
apply(rotate_tac 2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1692
apply(frule_tac PMatch1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1693
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1694
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1695
apply(subst append.simps(2)[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1696
apply(rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1697
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1698
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1699
apply(rule PMatch.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1700
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1701
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1702
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1703
apply (metis L.simps(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1704
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1705
apply (metis NPrf_imp_Prf PMatch1N)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1706
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1707
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1708
apply(drule_tac x="s\<^sub>3" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1709
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1710
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1711
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1712
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1713
apply(drule_tac x="s1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1714
apply(drule_tac x="v1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1715
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1716
apply(rotate_tac 2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1717
apply(drule PMatch.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1718
apply(rule PMatch.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1719
apply (metis PMatch1(1) list.distinct(1) v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1720
apply (metis Nil_is_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1721
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1722
apply(subst der_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1723
apply(simp add: Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1724
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1725
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1726
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1727
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1728
lemma Sequ_single:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1729
  "(A ;; {t}) = {s @ t | s . s \<in> A}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1730
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1731
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1732
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1733
lemma Sequ_not:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1734
  assumes "\<forall>t. s \<notin> (L(der c r1) ;; {t})" "L r1 \<noteq> {}" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1735
  shows "\<forall>t. c # s \<notin> (L r1 ;; {t})"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1736
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1737
apply(simp add: der_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1738
apply(simp add: Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1739
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1740
apply(rule allI)+
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1741
apply(rule impI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1742
apply(simp add: Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1743
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1744
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1745
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1746
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1747
lemma PMatch_Roy2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1748
  assumes "2\<rhd> v : (der c r)" "\<exists>s. c # s \<in> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1749
  shows "2\<rhd> (injval r c v) : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1750
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1751
apply(induct c r arbitrary: v rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1752
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1753
apply(erule Roy2.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1754
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1755
apply (metis Roy2.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1756
(* alt case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1757
apply(erule Roy2.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1758
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1759
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1760
apply (metis Roy2.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1761
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1762
apply(rule Roy2.intros(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1763
apply (metis (full_types) Prf_flat_L Roy2_props v3 v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1764
apply(subgoal_tac "\<forall>t. c # flat va \<notin> L r1 ;; {t}")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1765
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1766
apply(simp add: der_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1767
apply(simp add: Der_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1768
apply(simp add: Sequ_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1769
apply(rule allI)+
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1770
apply(rule impI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1771
apply(simp add: Cons_eq_append_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1772
apply(erule disjE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1773
apply(erule conjE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1774
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1775
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1776
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1777
apply(drule_tac x="[]" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1778
apply(drule_tac x="drop 1 t" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1779
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1780
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1781
oops 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1782
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1783
lemma lex_correct1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1784
  assumes "s \<notin> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1785
  shows "lex r s = None"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1786
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1787
apply(induct s arbitrary: r)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1788
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1789
apply (metis nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1790
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1791
apply(drule_tac x="der a r" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1792
apply(drule meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1793
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1794
apply(simp add: L_flat_Prf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1795
by (metis v3 v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1796
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1797
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1798
lemma lex_correct2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1799
  assumes "s \<in> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1800
  shows "\<exists>v. lex r s = Some(v) \<and> \<turnstile> v : r \<and> flat v = s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1801
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1802
apply(induct s arbitrary: r)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1803
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1804
apply (metis mkeps_flat mkeps_nullable nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1805
apply(drule_tac x="der a r" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1806
apply(drule meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1807
apply(simp add: L_flat_NPrf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1808
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1809
apply (metis v3_proj v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1810
apply (metis v3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1811
apply(rule v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1812
by metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1813
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1814
lemma lex_correct3:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1815
  assumes "s \<in> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1816
  shows "\<exists>v. lex r s = Some(v) \<and> s \<in> r \<rightarrow> v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1817
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1818
apply(induct s arbitrary: r)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1819
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1820
apply (metis PMatch_mkeps nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1821
apply(drule_tac x="der a r" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1822
apply(drule meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1823
apply(simp add: L_flat_NPrf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1824
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1825
apply (metis v3_proj v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1826
apply(rule PMatch2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1827
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1828
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1829
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1830
lemma lex_correct4:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1831
  assumes "s \<in> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1832
  shows "\<exists>v. lex r s = Some(v) \<and> \<Turnstile> v : r \<and> flat v = s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1833
using lex_correct3[OF assms]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1834
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1835
apply (metis PMatch1N)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1836
by (metis PMatch1(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1837
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1838
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1839
lemma lex_correct5:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1840
  assumes "s \<in> L r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1841
  shows "s \<in> r \<rightarrow> (lex2 r s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1842
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1843
apply(induct s arbitrary: r)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1844
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1845
apply (metis PMatch_mkeps nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1846
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1847
apply(rule PMatch2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1848
apply(drule_tac x="der a r" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1849
apply(drule meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1850
apply(simp add: L_flat_NPrf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1851
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1852
apply (metis v3_proj v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1853
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1854
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1855
lemma 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1856
  "lex2 (ALT (CHAR a) (ALT (CHAR b) (SEQ (CHAR a) (CHAR b)))) [a,b] = Right (Right (Seq (Char a) (Char b)))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1857
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1858
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1859
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1860
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1861
(* NOT DONE YET *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1862
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1863
section {* Sulzmann's Ordering of values *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1864
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1865
inductive ValOrd :: "val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<succ>_ _" [100, 100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1866
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1867
  "v2 \<succ>r2 v2' \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1 v2')" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1868
| "\<lbrakk>v1 \<succ>r1 v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1' v2')" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1869
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Right v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1870
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Left v1)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1871
| "v2 \<succ>r2 v2' \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Right v2')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1872
| "v1 \<succ>r1 v1' \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Left v1')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1873
| "Void \<succ>EMPTY Void"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1874
| "(Char c) \<succ>(CHAR c) (Char c)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1875
| "flat (Stars (v # vs)) = [] \<Longrightarrow> (Stars []) \<succ>(STAR r) (Stars (v # vs))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1876
| "flat (Stars (v # vs)) \<noteq> [] \<Longrightarrow> (Stars (v # vs)) \<succ>(STAR r) (Stars [])"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1877
| "\<lbrakk>v1 \<succ>r v2; v1 \<noteq> v2\<rbrakk> \<Longrightarrow> (Stars (v1 # vs1)) \<succ>(STAR r) (Stars (v2 # vs2))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1878
| "(Stars vs1) \<succ>(STAR r) (Stars vs2) \<Longrightarrow> (Stars (v # vs1)) \<succ>(STAR r) (Stars (v # vs2))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1879
| "(Stars []) \<succ>(STAR r) (Stars [])"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1880
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1881
lemma PMatch_ValOrd:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1882
  assumes "s \<in> r \<rightarrow> v" "v' \<in> SValues r s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1883
  shows "v \<succ>r v'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1884
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1885
apply(induct r arbitrary: v v' s rule: rexp.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1886
apply(simp add: SValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1887
apply(simp add: SValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1888
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1889
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1890
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1891
apply(simp add: SValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1892
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1893
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1894
apply (metis ValOrd.intros(8) empty_iff singletonD)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1895
apply(simp add: SValues_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1896
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1897
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1898
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1899
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1900
apply(case_tac "v1a = v1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1901
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1902
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1903
apply(rotate_tac 1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1904
apply(drule_tac x="v2a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1905
apply(rotate_tac 8)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1906
apply(drule_tac x="v2" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1907
apply(drule_tac x="s2a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1908
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1909
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1910
apply(simp add: SValues_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1911
apply (metis PMatch1(2) same_append_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1912
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1913
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1914
apply(drule_tac x="v1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1915
apply(rotate_tac 8)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1916
apply(drule_tac x="v1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1917
apply(drule_tac x="s1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1918
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1919
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1920
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1921
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1922
apply(case_tac "us=[]")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1923
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1924
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1925
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1926
apply(simp add: SValues_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1927
apply (metis Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1928
apply(erule disjE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1929
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1930
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1931
apply(simp add: SValues_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1932
apply (metis Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1933
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1934
apply(subst (asm) (2) Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1935
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1936
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1937
apply(simp add: rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1938
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1939
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1940
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1941
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1942
apply(case_tac "us = []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1943
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1944
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1945
apply (metis append_Nil2 prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1946
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1947
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1948
apply(drule_tac mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1949
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1950
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1951
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1952
(*HERE *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1953
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1954
inductive ValOrd2 :: "val \<Rightarrow> string \<Rightarrow> val \<Rightarrow> bool" ("_ 2\<succ>_ _" [100, 100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1955
where 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1956
  "v2 2\<succ>s v2' \<Longrightarrow> (Seq v1 v2) 2\<succ>(flat v1 @ s) (Seq v1 v2')" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1957
| "\<lbrakk>v1 2\<succ>s v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) 2\<succ>s (Seq v1' v2')" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1958
| "(flat v2) \<sqsubseteq> (flat v1) \<Longrightarrow> (Left v1) 2\<succ>(flat v1) (Right v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1959
| "(flat v1) \<sqsubset> (flat v2) \<Longrightarrow> (Right v2) 2\<succ>(flat v2) (Left v1)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1960
| "v2 2\<succ>s v2' \<Longrightarrow> (Right v2) 2\<succ>s (Right v2')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1961
| "v1 2\<succ>s v1' \<Longrightarrow> (Left v1) 2\<succ>s (Left v1')" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1962
| "Void 2\<succ>[] Void"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1963
| "(Char c) 2\<succ>[c] (Char c)" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1964
| "flat (Stars (v # vs)) = [] \<Longrightarrow> (Stars []) 2\<succ>[] (Stars (v # vs))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1965
| "flat (Stars (v # vs)) \<noteq> [] \<Longrightarrow> (Stars (v # vs)) 2\<succ>(flat (Stars (v # vs))) (Stars [])"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1966
| "\<lbrakk>v1 2\<succ>s v2; v1 \<noteq> v2\<rbrakk> \<Longrightarrow> (Stars (v1 # vs1)) 2\<succ>s (Stars (v2 # vs2))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1967
| "(Stars vs1) 2\<succ>s (Stars vs2) \<Longrightarrow> (Stars (v # vs1)) 2\<succ>(flat v @ s) (Stars (v # vs2))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1968
| "(Stars []) 2\<succ>[] (Stars [])"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1969
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1970
lemma ValOrd2_string1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1971
  assumes "v1 2\<succ>s v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1972
  shows "s \<sqsubseteq> flat v1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1973
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1974
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1975
apply(auto simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1976
apply (metis append_assoc)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1977
by (metis append_assoc)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1978
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1979
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1980
lemma admissibility:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1981
  assumes "s \<in> r \<rightarrow> v" "\<turnstile> v' : r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1982
  shows "(\<forall>s'. (s' \<in> L(r) \<and> s' \<sqsubseteq> s) \<longrightarrow> v 2\<succ>s' v')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1983
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1984
apply(induct arbitrary: v')
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1985
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1986
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1987
apply (metis ValOrd2.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1988
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1989
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1990
apply (metis ValOrd2.intros(8) append_Nil2 prefix_Cons prefix_append prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1991
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1992
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1993
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1994
apply (metis ValOrd2.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1995
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1996
apply(drule_tac x="v1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1997
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1998
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  1999
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2000
apply (metis PMatch1(2) ValOrd2.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2001
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2002
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2003
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2004
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2005
apply(case_tac "v1 = v1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2006
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2007
apply(rotate_tac 3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2008
apply(drule_tac x="v2a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2009
apply(drule meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2010
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2011
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2012
apply(rule_tac x="flat v1a @ s'" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2013
apply (metis PMatch1(2) ValOrd2.intros(1) prefix_append)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2014
apply (metis PMatch1(2) ValOrd2.intros(2) ValOrd2_string1 flat.simps(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2015
prefer 4
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2016
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2017
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2018
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2019
apply (metis ValOrd2.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2020
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2021
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2022
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2023
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2024
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2025
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2026
lemma admissibility:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2027
  assumes "\<turnstile> s \<in> r \<rightarrow> v" "\<turnstile> v' : r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2028
  shows "v \<succ>r v'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2029
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2030
apply(induct arbitrary: v')
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2031
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2032
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2033
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2034
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2035
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2036
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2037
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2038
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2039
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2040
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2041
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2042
lemma admissibility:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2043
  assumes "2\<rhd> v : r" "\<turnstile> v' : r" "flat v' \<sqsubseteq> flat v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2044
  shows "v \<succ>r v'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2045
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2046
apply(induct arbitrary: v')
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2047
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2048
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2049
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2050
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2051
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2052
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2053
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2054
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2055
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2056
apply (metis ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2057
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2058
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2059
apply (metis Prf_flat_L ValOrd.intros(4) length_sprefix seq_empty(1) sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2060
apply (metis ValOrd.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2061
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2062
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2063
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2064
lemma admisibility:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2065
  assumes "\<rhd> v : r" "\<turnstile> v' : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2066
  shows "v \<succ>r v'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2067
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2068
apply(induct arbitrary: v')
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2069
prefer 5
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2070
apply(drule royA)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2071
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2072
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2073
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2074
apply(case_tac "v1 = v1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2075
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2076
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2077
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2078
apply (metis ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2079
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2080
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2081
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2082
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2083
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2084
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2085
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2086
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2087
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2088
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2089
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2090
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2091
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2092
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2093
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2094
(* seq case goes through *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2095
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2096
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2097
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2098
lemma admisibility:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2099
  assumes "\<rhd> v : r" "\<turnstile> v' : r" "flat v' \<sqsubseteq> flat v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2100
  shows "v \<succ>r v'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2101
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2102
apply(induct arbitrary: v')
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2103
prefer 5
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2104
apply(drule royA)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2105
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2106
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2107
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2108
apply(case_tac "v1 = v1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2109
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2110
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2111
apply(subst (asm) (3) prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2112
apply(erule exE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2113
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2114
apply (metis prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2115
(* the unequal case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2116
apply(subgoal_tac "flat v1 \<sqsubset> flat v1a \<or> flat v1a \<sqsubseteq> flat v1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2117
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2118
apply(simp add: prefix_def sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2119
apply (metis append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2120
apply(erule disjE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2121
(* first case  flat v1 \<sqsubset> flat v1a *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2122
apply(subst (asm) sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2123
apply(subst (asm) (5) prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2124
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2125
apply(subgoal_tac "(s3 @ flat v2a) \<sqsubseteq> flat v2")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2126
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2127
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2128
apply (metis append_assoc prefix_append)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2129
apply(subgoal_tac "s3 \<noteq> []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2130
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2131
apply (metis append_Nil2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2132
(* HERE *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2133
apply(subst (asm) (5) prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2134
apply(erule exE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2135
apply(simp add: ders_correctness Ders_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2136
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2137
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2138
apply(subst (asm) append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2139
apply(erule exE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2140
apply(erule disjE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2141
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2142
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2143
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2144
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2145
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2146
lemma ValOrd_refl:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2147
  assumes "\<turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2148
  shows "v \<succ>r v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2149
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2150
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2151
apply(auto intro: ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2152
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2153
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2154
lemma ValOrd_total:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2155
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r\<rbrakk>  \<Longrightarrow> v1 \<succ>r v2 \<or> v2 \<succ>r v1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2156
apply(induct r arbitrary: v1 v2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2157
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2158
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2159
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2160
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2161
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2162
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2163
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2164
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2165
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2166
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2167
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2168
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2169
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2170
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2171
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2172
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2173
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2174
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2175
apply(case_tac "v1a = v1b")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2176
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2177
apply(rule ValOrd.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2178
apply (metis ValOrd.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2179
apply(rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2180
apply(auto)[2]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2181
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2182
apply(rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2183
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2184
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2185
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2186
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2187
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2188
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2189
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2190
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2191
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2192
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2193
apply (metis le_eq_less_or_eq neq_iff)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2194
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2195
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2196
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2197
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2198
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2199
apply (metis le_eq_less_or_eq neq_iff)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2200
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2201
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2202
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2203
apply(metis)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2204
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2205
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2206
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2207
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2208
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2209
apply (metis ValOrd.intros(13))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2210
apply (metis ValOrd.intros(10) ValOrd.intros(9))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2211
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2212
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2213
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2214
apply (metis ValOrd.intros(10) ValOrd.intros(9))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2215
apply(case_tac "v = va")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2216
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2217
apply (metis ValOrd.intros(11))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2218
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2219
apply(rule ValOrd.intros(12))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2220
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2221
apply(rule ValOrd.intros(12))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2222
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2223
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2224
lemma Roy_posix:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2225
  assumes "\<rhd> v : r" "\<turnstile> v' : r" "flat v' \<sqsubseteq> flat v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2226
  shows "v \<succ>r v'"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2227
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2228
apply(induct r arbitrary: v v' rule: rexp.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2229
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2230
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2231
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2232
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2233
apply(erule Roy.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2234
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2235
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2236
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2237
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2238
apply(erule Roy.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2239
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2240
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2241
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2242
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2243
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2244
apply(erule Roy.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2245
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2246
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2247
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2248
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2249
apply (metis Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2250
apply(erule Roy.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2251
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2252
apply (metis ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2253
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2254
apply (metis ValOrd.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2255
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2256
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2257
apply(erule Roy.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2258
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2259
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2260
apply(case_tac "v1a = v1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2261
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2262
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2263
apply (metis prefix_append)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2264
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2265
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2266
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2267
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2268
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2269
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2270
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2271
apply(drule_tac x="v1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2272
apply(rotate_tac 9)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2273
apply(drule_tac x="v1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2274
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2275
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2276
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2277
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2278
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2279
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2280
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2281
apply(drule_tac mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2282
apply (metis Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2283
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2284
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2285
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2286
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2287
lemma ValOrd_anti:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2288
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r; v1 \<succ>r v2; v2 \<succ>r v1\<rbrakk> \<Longrightarrow> v1 = v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2289
  and   "\<lbrakk>\<turnstile> Stars vs1 : r; \<turnstile> Stars vs2 : r; Stars vs1 \<succ>r Stars vs2; Stars vs2 \<succ>r Stars vs1\<rbrakk>  \<Longrightarrow> vs1 = vs2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2290
apply(induct v1 and vs1 arbitrary: r v2 and r vs2 rule: val.inducts)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2291
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2292
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2293
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2294
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2295
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2296
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2297
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2298
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2299
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2300
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2301
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2302
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2303
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2304
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2305
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2306
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2307
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2308
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2309
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2310
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2311
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2312
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2313
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2314
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2315
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2316
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2317
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2318
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2319
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2320
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2321
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2322
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2323
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2324
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2325
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2326
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2327
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2328
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2329
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2330
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2331
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2332
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2333
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2334
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2335
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2336
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2337
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2338
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2339
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2340
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2341
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2342
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2343
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2344
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2345
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2346
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2347
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2348
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2349
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2350
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2351
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2352
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2353
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2354
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2355
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2356
(*
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2357
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2358
lemma ValOrd_PMatch:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2359
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2  \<sqsubseteq> s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2360
  shows "v1 \<succ>r v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2361
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2362
apply(induct r arbitrary: s v1 v2 rule: rexp.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2363
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2364
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2365
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2366
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2367
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2368
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2369
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2370
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2371
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2372
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2373
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2374
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2375
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2376
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2377
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2378
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2379
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2380
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2381
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2382
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2383
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2384
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2385
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2386
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2387
apply (metis ValOrd.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2388
(* Stars case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2389
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2390
apply(simp_all)[7]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2391
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2392
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2393
apply (metis Nil_is_append_conv ValOrd.intros(10) flat.simps(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2394
apply (metis ValOrd.intros(13))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2395
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2396
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2397
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2398
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2399
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2400
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2401
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2402
apply(drule_tac x="s1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2403
apply(drule_tac x="va" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2404
apply(drule_tac x="v" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2405
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2406
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2407
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2408
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2409
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2410
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2411
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2412
prefer 3
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2413
(* Seq case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2414
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2415
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2416
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2417
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2418
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2419
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2420
apply(case_tac "v1b = v1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2421
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2422
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2423
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2424
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2425
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2426
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2427
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2428
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2429
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2430
apply (metis ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2431
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2432
apply (metis ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2433
apply(case_tac "us = []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2434
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2435
apply (metis ValOrd.intros(2) append_Nil2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2436
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2437
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2438
apply(drule_tac mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2439
apply (metis Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2440
apply(drule_tac x="s1 @ us" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2441
apply(drule_tac x="v1b" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2442
apply(drule_tac x="v1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2443
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2444
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2445
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2446
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2447
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2448
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2449
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2450
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2451
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2452
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2453
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2454
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2455
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2456
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2457
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2458
apply (metis ValOrd.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2459
(* Seq case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2460
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2461
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2462
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2463
apply(case_tac "v1 = v1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2464
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2465
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2466
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2467
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2468
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2469
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2470
apply(frule PMatch1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2471
apply(frule PMatch1(2)[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2472
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2473
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2474
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2475
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2476
apply (metis ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2477
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2478
apply (metis ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2479
apply(case_tac "us = []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2480
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2481
apply (metis ValOrd.intros(2) append_Nil2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2482
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2483
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2484
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2485
apply (metis  Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2486
apply(drule_tac x="v1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2487
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2488
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2489
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2490
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2491
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2492
lemma ValOrd_PMatch:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2493
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2  \<sqsubseteq> s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2494
  shows "v1 \<succ>r v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2495
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2496
apply(induct arbitrary: v2 rule: .induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2497
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2498
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2499
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2500
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2501
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2502
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2503
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2504
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2505
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2506
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2507
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2508
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2509
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2510
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2511
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2512
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2513
apply (metis ValOrd.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2514
(* Seq case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2515
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2516
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2517
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2518
apply(case_tac "v1 = v1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2519
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2520
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2521
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2522
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2523
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2524
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2525
apply(frule PMatch1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2526
apply(frule PMatch1(2)[symmetric])
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2527
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2528
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2529
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2530
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2531
apply (metis ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2532
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2533
apply (metis ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2534
apply(case_tac "us = []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2535
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2536
apply (metis ValOrd.intros(2) append_Nil2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2537
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2538
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2539
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2540
apply (metis  Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2541
apply(drule_tac x="v1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2542
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2543
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2544
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2545
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2546
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2547
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2548
apply(rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2549
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2550
apply(drule_tac x="v1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2551
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2552
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2553
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2554
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2555
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2556
thm append_eq_append_conv
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2557
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2558
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2559
apply (metis Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2560
apply(case_tac "us = []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2561
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2562
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2563
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2564
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2565
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2566
inductive ValOrd2 :: "val \<Rightarrow> val \<Rightarrow> bool" ("_ 2\<succ> _" [100, 100] 100)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2567
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2568
  "v2 2\<succ> v2' \<Longrightarrow> (Seq v1 v2) 2\<succ> (Seq v1 v2')" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2569
| "\<lbrakk>v1 2\<succ> v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) 2\<succ> (Seq v1' v2')" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2570
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) 2\<succ> (Right v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2571
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) 2\<succ> (Left v1)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2572
| "v2 2\<succ> v2' \<Longrightarrow> (Right v2) 2\<succ> (Right v2')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2573
| "v1 2\<succ> v1' \<Longrightarrow> (Left v1) 2\<succ> (Left v1')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2574
| "Void 2\<succ> Void"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2575
| "(Char c) 2\<succ> (Char c)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2576
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2577
lemma Ord1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2578
  "v1 \<succ>r v2 \<Longrightarrow> v1 2\<succ> v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2579
apply(induct rule: ValOrd.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2580
apply(auto intro: ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2581
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2582
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2583
lemma Ord2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2584
  "v1 2\<succ> v2 \<Longrightarrow> \<exists>r. v1 \<succ>r v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2585
apply(induct v1 v2 rule: ValOrd2.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2586
apply(auto intro: ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2587
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2588
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2589
lemma Ord3:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2590
  "\<lbrakk>v1 2\<succ> v2; \<turnstile> v1 : r\<rbrakk> \<Longrightarrow> v1 \<succ>r v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2591
apply(induct v1 v2 arbitrary: r rule: ValOrd2.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2592
apply(auto intro: ValOrd.intros elim: Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2593
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2594
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2595
section {* Posix definition *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2596
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2597
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2598
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2599
  "POSIX v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v' \<sqsubseteq> flat v) \<longrightarrow> v \<succ>r v'))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2600
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2601
lemma ValOrd_refl:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2602
  assumes "\<turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2603
  shows "v \<succ>r v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2604
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2605
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2606
apply(auto intro: ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2607
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2608
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2609
lemma ValOrd_total:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2610
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r\<rbrakk>  \<Longrightarrow> v1 \<succ>r v2 \<or> v2 \<succ>r v1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2611
apply(induct r arbitrary: v1 v2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2612
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2613
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2614
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2615
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2616
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2617
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2618
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2619
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2620
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2621
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2622
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2623
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2624
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2625
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2626
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2627
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2628
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2629
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2630
apply(case_tac "v1a = v1b")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2631
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2632
apply(rule ValOrd.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2633
apply (metis ValOrd.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2634
apply(rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2635
apply(auto)[2]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2636
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2637
apply(rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2638
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2639
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2640
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2641
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2642
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2643
apply (metis Ord1 Ord3 Prf.intros(2) ValOrd2.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2644
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2645
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2646
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2647
apply (metis le_eq_less_or_eq neq_iff)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2648
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2649
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2650
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2651
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2652
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2653
apply (metis le_eq_less_or_eq neq_iff)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2654
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2655
apply(erule contrapos_np)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2656
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2657
by metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2658
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2659
lemma ValOrd_anti:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2660
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r; v1 \<succ>r v2; v2 \<succ>r v1\<rbrakk> \<Longrightarrow> v1 = v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2661
apply(induct r arbitrary: v1 v2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2662
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2663
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2664
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2665
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2666
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2667
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2668
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2669
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2670
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2671
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2672
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2673
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2674
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2675
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2676
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2677
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2678
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2679
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2680
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2681
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2682
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2683
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2684
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2685
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2686
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2687
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2688
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2689
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2690
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2691
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2692
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2693
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2694
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2695
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2696
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2697
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2698
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2699
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2700
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2701
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2702
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2703
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2704
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2705
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2706
lemma POSIX_ALT_I1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2707
  assumes "POSIX v1 r1" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2708
  shows "POSIX (Left v1) (ALT r1 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2709
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2710
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2711
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2712
apply (metis Prf.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2713
apply(rotate_tac 2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2714
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2715
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2716
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2717
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2718
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2719
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2720
by (metis le_eq_less_or_eq length_sprefix sprefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2721
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2722
lemma POSIX_ALT_I2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2723
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2724
  shows "POSIX (Right v2) (ALT r1 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2725
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2726
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2727
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2728
apply (metis Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2729
apply(rotate_tac 3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2730
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2731
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2732
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2733
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2734
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2735
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2736
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2737
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2738
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2739
thm PMatch.intros[no_vars]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2740
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2741
lemma POSIX_PMatch:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2742
  assumes "s \<in> r \<rightarrow> v" "\<turnstile> v' : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2743
  shows "length (flat v') \<le> length (flat v)" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2744
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2745
apply(induct arbitrary: s v v' rule: rexp.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2746
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2747
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2748
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2749
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2750
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2751
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2752
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2753
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2754
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2755
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2756
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2757
apply(erule PMatch.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2758
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2759
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2760
apply(simp add: L_flat_Prf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2761
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2762
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2763
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2764
apply (metis POSIX_ALT_I1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2765
apply(rule POSIX_ALT_I2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2766
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2767
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2768
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2769
apply(frule PMatch1(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2770
apply(frule PMatch1(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2771
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2772
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2773
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2774
lemma POSIX_PMatch:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2775
  assumes "s \<in> r \<rightarrow> v" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2776
  shows "POSIX v r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2777
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2778
apply(induct arbitrary: rule: PMatch.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2779
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2780
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2781
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2782
apply (metis Prf.intros(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2783
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2784
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2785
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2786
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2787
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2788
apply (metis Prf.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2789
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2790
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2791
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2792
apply (metis POSIX_ALT_I1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2793
apply(rule POSIX_ALT_I2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2794
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2795
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2796
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2797
apply(frule PMatch1(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2798
apply(frule PMatch1(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2799
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2800
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2801
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2802
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2803
lemma ValOrd_PMatch:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2804
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2 = s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2805
  shows "v1 \<succ>r v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2806
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2807
apply(induct arbitrary: v2 rule: PMatch.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2808
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2809
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2810
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2811
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2812
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2813
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2814
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2815
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2816
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2817
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2818
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2819
apply (metis PMatch1(2) ValOrd.intros(3) order_refl)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2820
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2821
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2822
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2823
apply (metis Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2824
apply (metis ValOrd.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2825
(* Seq case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2826
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2827
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2828
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2829
apply(case_tac "v1 = v1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2830
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2831
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2832
apply(rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2833
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2834
apply(drule_tac x="v1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2835
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2836
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2837
apply(drule_tac meta_mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2838
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2839
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2840
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2841
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2842
apply (metis Prf_flat_L)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2843
apply(case_tac "us = []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2844
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2845
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2846
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2847
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2848
thm L_flat_Prf
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2849
apply(simp add: L_flat_Prf)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2850
thm append_eq_append_conv2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2851
apply(simp add: append_eq_append_conv2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2852
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2853
apply(drule_tac x="us" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2854
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2855
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2856
apply (metis append_Nil2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2857
apply(case_tac "us = []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2858
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2859
apply(drule_tac x="s2" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2860
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2861
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2862
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2863
apply(drule_tac x="v1a" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2864
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2865
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2866
lemma refl_on_ValOrd:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2867
  "refl_on (Values r s) {(v1, v2). v1 \<succ>r v2 \<and> v1 \<in> Values r s \<and> v2 \<in> Values r s}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2868
unfolding refl_on_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2869
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2870
apply(rule ValOrd_refl)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2871
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2872
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2873
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2874
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2875
section {* Posix definition *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2876
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2877
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2878
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2879
  "POSIX v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v \<succ>r v'))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2880
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2881
definition POSIX2 :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2882
where
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2883
  "POSIX2 v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v 2\<succ> v'))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2884
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2885
lemma "POSIX v r = POSIX2 v r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2886
unfolding POSIX_def POSIX2_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2887
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2888
apply(rule Ord1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2889
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2890
apply(rule Ord3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2891
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2892
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2893
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2894
section {* POSIX for some constructors *}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2895
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2896
lemma POSIX_SEQ1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2897
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2898
  shows "POSIX v1 r1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2899
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2900
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2901
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2902
apply(drule_tac x="Seq v' v2" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2903
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2904
apply(erule impE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2905
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2906
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2907
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2908
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2909
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2910
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2911
by (metis ValOrd_refl)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2912
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2913
lemma POSIX_SEQ2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2914
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2915
  shows "POSIX v2 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2916
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2917
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2918
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2919
apply(drule_tac x="Seq v1 v'" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2920
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2921
apply(erule impE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2922
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2923
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2924
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2925
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2926
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2927
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2928
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2929
lemma POSIX_ALT2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2930
  assumes "POSIX (Left v1) (ALT r1 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2931
  shows "POSIX v1 r1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2932
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2933
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2934
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2935
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2936
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2937
apply(drule_tac x="Left v'" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2938
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2939
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2940
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2941
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2942
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2943
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2944
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2945
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2946
lemma POSIX_ALT1a:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2947
  assumes "POSIX (Right v2) (ALT r1 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2948
  shows "POSIX v2 r2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2949
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2950
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2951
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2952
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2953
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2954
apply(drule_tac x="Right v'" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2955
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2956
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2957
apply(rule Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2958
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2959
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2960
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2961
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2962
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2963
lemma POSIX_ALT1b:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2964
  assumes "POSIX (Right v2) (ALT r1 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2965
  shows "(\<forall>v'. (\<turnstile> v' : r2 \<and> flat v' = flat v2) \<longrightarrow> v2 \<succ>r2 v')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2966
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2967
apply(drule_tac POSIX_ALT1a)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2968
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2969
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2970
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2971
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2972
lemma POSIX_ALT_I1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2973
  assumes "POSIX v1 r1" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2974
  shows "POSIX (Left v1) (ALT r1 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2975
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2976
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2977
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2978
apply (metis Prf.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2979
apply(rotate_tac 2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2980
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2981
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2982
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2983
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2984
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2985
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2986
by simp
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2987
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2988
lemma POSIX_ALT_I2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2989
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2990
  shows "POSIX (Right v2) (ALT r1 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2991
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2992
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2993
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2994
apply (metis Prf.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2995
apply(rotate_tac 3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2996
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2997
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2998
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  2999
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3000
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3001
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3002
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3003
lemma mkeps_POSIX:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3004
  assumes "nullable r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3005
  shows "POSIX (mkeps r) r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3006
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3007
apply(induct r)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3008
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3009
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3010
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3011
apply (metis Prf.intros(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3012
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3013
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3014
apply (metis ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3015
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3016
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3017
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3018
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3019
apply (metis mkeps.simps(2) mkeps_nullable nullable.simps(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3020
apply(rotate_tac 6)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3021
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3022
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3023
apply (simp add: mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3024
apply(case_tac "mkeps r1a = v1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3025
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3026
apply (metis ValOrd.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3027
apply (rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3028
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3029
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3030
(* ALT case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3031
thm mkeps.simps
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3032
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3033
apply(erule disjE)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3034
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3035
apply (metis POSIX_ALT_I1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3036
(* *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3037
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3038
thm  POSIX_ALT_I1
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3039
apply (metis POSIX_ALT_I1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3040
apply(simp (no_asm) add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3041
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3042
apply(rule Prf.intros(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3043
apply(simp only: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3044
apply(rotate_tac 4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3045
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3046
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3047
thm mkeps_flat
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3048
apply(simp add: mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3049
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3050
thm Prf_flat_L nullable_correctness
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3051
apply (metis Prf_flat_L nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3052
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3053
apply(subst (asm) POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3054
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3055
apply(drule_tac x="v2" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3056
by simp
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3057
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3058
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3059
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3060
text {*
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3061
  Injection value is related to r
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3062
*}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3063
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3064
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3065
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3066
text {*
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3067
  The string behind the injection value is an added c
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3068
*}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3069
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3070
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3071
lemma injval_inj: "inj_on (injval r c) {v. \<turnstile> v : der c r}"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3072
apply(induct c r rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3073
unfolding inj_on_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3074
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3075
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3076
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3077
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3078
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3079
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3080
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3081
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3082
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3083
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3084
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3085
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3086
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3087
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3088
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3089
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3090
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3091
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3092
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3093
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3094
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3095
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3096
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3097
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3098
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3099
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3100
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3101
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3102
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3103
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3104
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3105
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3106
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3107
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3108
apply (metis list.distinct(1) mkeps_flat v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3109
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3110
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3111
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3112
apply(rotate_tac 6)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3113
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3114
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3115
apply (metis list.distinct(1) mkeps_flat v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3116
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3117
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3118
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3119
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3120
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3121
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3122
lemma Values_nullable:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3123
  assumes "nullable r1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3124
  shows "mkeps r1 \<in> Values r1 s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3125
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3126
apply(induct r1 arbitrary: s)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3127
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3128
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3129
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3130
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3131
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3132
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3133
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3134
lemma Values_injval:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3135
  assumes "v \<in> Values (der c r) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3136
  shows "injval r c v \<in> Values r (c#s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3137
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3138
apply(induct c r arbitrary: v s rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3139
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3140
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3141
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3142
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3143
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3144
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3145
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3146
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3147
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3148
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3149
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3150
apply(case_tac "nullable r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3151
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3152
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3153
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3154
apply(simp add: rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3155
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3156
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3157
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3158
apply(rule Values_nullable)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3159
apply(assumption)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3160
apply(simp add: rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3161
apply(subst mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3162
apply(assumption)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3163
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3164
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3165
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3166
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3167
apply(simp add: rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3168
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3169
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3170
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3171
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3172
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3173
lemma Values_projval:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3174
  assumes "v \<in> Values r (c#s)" "\<exists>s. flat v = c # s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3175
  shows "projval r c v \<in> Values (der c r) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3176
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3177
apply(induct r arbitrary: v s c rule: rexp.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3178
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3179
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3180
apply(case_tac "c = char")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3181
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3182
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3183
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3184
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3185
apply(simp add: prefix_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3186
apply(case_tac "nullable rexp1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3187
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3188
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3189
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3190
apply(simp add: rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3191
apply (metis hd_Cons_tl hd_append2 list.sel(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3192
apply(simp add: rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3193
apply(simp add: append_eq_Cons_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3194
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3195
apply(subst v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3196
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3197
apply(assumption)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3198
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3199
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3200
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3201
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3202
apply(auto simp add: Values_def not_nullable_flat)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3203
apply(simp add: append_eq_Cons_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3204
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3205
apply(simp add: append_eq_Cons_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3206
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3207
apply(simp add: rest_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3208
apply(subst v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3209
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3210
apply(assumption)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3211
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3212
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3213
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3214
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3215
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3216
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3217
definition "MValue v r s \<equiv> (v \<in> Values r s \<and> (\<forall>v' \<in> Values r s. v 2\<succ> v'))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3218
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3219
lemma MValue_ALTE:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3220
  assumes "MValue v (ALT r1 r2) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3221
  shows "(\<exists>vl. v = Left vl \<and> MValue vl r1 s \<and> (\<forall>vr \<in> Values r2 s. length (flat vr) \<le> length (flat vl))) \<or> 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3222
         (\<exists>vr. v = Right vr \<and> MValue vr r2 s \<and> (\<forall>vl \<in> Values r1 s. length (flat vl) < length (flat vr)))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3223
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3224
apply(simp add: MValue_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3225
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3226
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3227
apply(drule_tac x="Left x" in bspec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3228
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3229
apply(erule ValOrd2.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3230
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3231
apply(drule_tac x="Right vr" in bspec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3232
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3233
apply(erule ValOrd2.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3234
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3235
apply(drule_tac x="Right x" in bspec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3236
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3237
apply(erule ValOrd2.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3238
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3239
apply(drule_tac x="Left vl" in bspec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3240
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3241
apply(erule ValOrd2.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3242
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3243
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3244
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3245
lemma MValue_ALTI1:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3246
  assumes "MValue vl r1 s"  "\<forall>vr \<in> Values r2 s. length (flat vr) \<le> length (flat vl)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3247
  shows "MValue (Left vl) (ALT r1 r2) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3248
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3249
apply(simp add: MValue_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3250
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3251
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3252
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3253
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3254
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3255
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3256
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3257
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3258
lemma MValue_ALTI2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3259
  assumes "MValue vr r2 s"  "\<forall>vl \<in> Values r1 s. length (flat vl) < length (flat vr)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3260
  shows "MValue (Right vr) (ALT r1 r2) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3261
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3262
apply(simp add: MValue_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3263
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3264
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3265
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3266
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3267
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3268
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3269
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3270
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3271
lemma t: "(c#xs = c#ys) \<Longrightarrow> xs = ys"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3272
by (metis list.sel(3))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3273
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3274
lemma t2: "(xs = ys) \<Longrightarrow> (c#xs) = (c#ys)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3275
by (metis)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3276
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3277
lemma "\<not>(nullable r) \<Longrightarrow> \<not>(\<exists>v. \<turnstile> v : r \<and> flat v = [])"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3278
by (metis Prf_flat_L nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3279
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3280
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3281
lemma LeftRight:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3282
  assumes "(Left v1) \<succ>(der c (ALT r1 r2)) (Right v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3283
  and "\<turnstile> v1 : der c r1" "\<turnstile> v2 : der c r2" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3284
  shows "(injval (ALT r1 r2) c (Left v1)) \<succ>(ALT r1 r2) (injval (ALT r1 r2) c (Right v2))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3285
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3286
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3287
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3288
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3289
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3290
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3291
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3292
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3293
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3294
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3295
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3296
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3297
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3298
lemma RightLeft:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3299
  assumes "(Right v1) \<succ>(der c (ALT r1 r2)) (Left v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3300
  and "\<turnstile> v1 : der c r2" "\<turnstile> v2 : der c r1" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3301
  shows "(injval (ALT r1 r2) c (Right v1)) \<succ>(ALT r1 r2) (injval (ALT r1 r2) c (Left v2))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3302
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3303
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3304
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3305
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3306
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3307
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3308
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3309
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3310
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3311
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3312
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3313
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3314
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3315
lemma h: 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3316
  assumes "nullable r1" "\<turnstile> v1 : der c r1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3317
  shows "injval r1 c v1 \<succ>r1 mkeps r1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3318
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3319
apply(induct r1 arbitrary: v1 rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3320
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3321
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3322
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3323
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3324
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3325
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3326
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3327
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3328
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3329
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3330
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3331
apply (metis ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3332
apply (metis ValOrd.intros(3) le_add2 list.size(3) mkeps_flat monoid_add_class.add.right_neutral)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3333
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3334
apply (metis ValOrd.intros(4) length_greater_0_conv list.distinct(1) list.size(3) mkeps_flat v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3335
apply (metis ValOrd.intros(4) length_greater_0_conv list.distinct(1) list.size(3) mkeps_flat v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3336
apply (metis ValOrd.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3337
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3338
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3339
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3340
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3341
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3342
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3343
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3344
apply (metis ValOrd.intros(2) list.distinct(1) mkeps_flat v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3345
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3346
by (metis ValOrd.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3347
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3348
lemma LeftRightSeq:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3349
  assumes "(Left (Seq v1 v2)) \<succ>(der c (SEQ r1 r2)) (Right v3)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3350
  and "nullable r1" "\<turnstile> v1 : der c r1"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3351
  shows "(injval (SEQ r1 r2) c (Seq v1 v2)) \<succ>(SEQ r1 r2) (injval (SEQ r1 r2) c (Right v2))"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3352
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3353
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3354
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3355
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3356
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3357
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3358
apply(rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3359
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3360
apply (metis list.distinct(1) mkeps_flat v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3361
by (metis h)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3362
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3363
lemma rr1: 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3364
  assumes "\<turnstile> v : r" "\<not>nullable r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3365
  shows "flat v \<noteq> []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3366
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3367
by (metis Prf_flat_L nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3368
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3369
(* HERE *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3370
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3371
lemma Prf_inj_test:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3372
  assumes "v1 \<succ>(der c r) v2" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3373
          "v1 \<in> Values (der c r) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3374
          "v2 \<in> Values (der c r) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3375
          "injval r c v1 \<in> Values r (c#s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3376
          "injval r c v2 \<in> Values r (c#s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3377
  shows "(injval r c v1) 2\<succ>  (injval r c v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3378
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3379
apply(induct c r arbitrary: v1 v2 s rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3380
(* NULL case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3381
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3382
(* EMPTY case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3383
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3384
(* CHAR case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3385
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3386
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3387
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3388
apply (metis ValOrd2.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3389
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3390
(* ALT case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3391
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3392
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3393
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3394
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3395
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3396
apply (metis ValOrd2.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3397
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3398
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3399
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3400
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3401
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3402
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3403
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3404
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3405
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3406
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3407
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3408
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3409
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3410
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3411
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3412
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3413
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3414
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3415
apply (metis ValOrd2.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3416
(* SEQ case*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3417
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3418
apply(case_tac "nullable r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3419
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3420
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3421
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3422
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3423
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3424
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3425
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3426
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3427
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3428
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3429
apply (metis Ord1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3430
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3431
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3432
apply(subgoal_tac "rest v1 (flat v1 @ flat v2) = flat v2")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3433
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3434
apply(subgoal_tac "rest (injval r1 c v1) (c # flat v1 @ flat v2) = flat v2")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3435
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3436
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3437
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3438
lemma Prf_inj_test:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3439
  assumes "v1 \<succ>(der c r) v2" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3440
          "v1 \<in> Values (der c r) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3441
          "v2 \<in> Values (der c r) s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3442
          "injval r c v1 \<in> Values r (c#s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3443
          "injval r c v2 \<in> Values r (c#s)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3444
  shows "(injval r c v1) 2\<succ>  (injval r c v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3445
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3446
apply(induct c r arbitrary: v1 v2 s rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3447
(* NULL case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3448
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3449
(* EMPTY case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3450
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3451
(* CHAR case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3452
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3453
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3454
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3455
apply (metis ValOrd2.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3456
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3457
(* ALT case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3458
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3459
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3460
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3461
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3462
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3463
apply (metis ValOrd2.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3464
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3465
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3466
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3467
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3468
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3469
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3470
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3471
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3472
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3473
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3474
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3475
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3476
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3477
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3478
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3479
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3480
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3481
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3482
apply (metis ValOrd2.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3483
(* SEQ case*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3484
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3485
apply(case_tac "nullable r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3486
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3487
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3488
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3489
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3490
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3491
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3492
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3493
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3494
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3495
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3496
apply (metis Ord1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3497
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3498
apply(rule ValOrd2.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3499
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3500
using injval_inj
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3501
apply(simp add: Values_def inj_on_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3502
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3503
apply(simp add: Values_recs)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3504
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3505
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3506
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3507
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3508
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3509
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3510
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3511
apply (metis Ord1 ValOrd2.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3512
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3513
apply(rule ValOrd2.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3514
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3515
using injval_inj
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3516
apply(simp add: Values_def inj_on_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3517
apply metis
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3518
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3519
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3520
apply(rule ValOrd2.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3521
thm h
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3522
apply(rule Ord1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3523
apply(rule h)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3524
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3525
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3526
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3527
apply (metis list.distinct(1) mkeps_flat v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3528
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3529
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3530
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3531
apply(simp add: Values_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3532
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3533
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3534
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3535
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3536
apply(rule ValOrd2.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3537
apply(rotate_tac 1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3538
apply(drule_tac x="v2" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3539
apply(rotate_tac 8)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3540
apply(drule_tac x="v2'" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3541
apply(rotate_tac 8)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3542
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3543
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3544
lemma POSIX_der:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3545
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3546
  shows "POSIX (injval r c v) r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3547
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3548
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3549
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3550
thm v3
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3551
apply (erule v3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3552
thm v4
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3553
apply(subst (asm) v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3554
apply(assumption)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3555
apply(drule_tac x="projval r c v'" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3556
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3557
apply(rule conjI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3558
thm v3_proj
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3559
apply(rule v3_proj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3560
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3561
apply(rule_tac x="flat v" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3562
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3563
thm t
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3564
apply(rule_tac c="c" in  t)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3565
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3566
thm v4_proj
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3567
apply(subst v4_proj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3568
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3569
apply(rule_tac x="flat v" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3570
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3571
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3572
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3573
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3574
lemma POSIX_der:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3575
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3576
  shows "POSIX (injval r c v) r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3577
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3578
apply(induct c r arbitrary: v rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3579
(* null case*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3580
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3581
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3582
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3583
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3584
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3585
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3586
(* empty case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3587
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3588
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3589
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3590
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3591
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3592
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3593
(* char case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3594
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3595
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3596
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3597
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3598
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3599
apply (metis Prf.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3600
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3601
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3602
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3603
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3604
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3605
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3606
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3607
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3608
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3609
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3610
(* alt case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3611
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3612
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3613
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3614
apply(simp (no_asm) add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3615
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3616
apply (metis Prf.intros(2) v3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3617
apply(rotate_tac 4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3618
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3619
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3620
apply (metis POSIX_ALT2 POSIX_def ValOrd.intros(6))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3621
apply (metis ValOrd.intros(3) order_refl)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3622
apply(simp (no_asm) add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3623
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3624
apply (metis Prf.intros(3) v3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3625
apply(rotate_tac 4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3626
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3627
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3628
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3629
apply (metis POSIX_ALT1a POSIX_def ValOrd.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3630
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3631
apply(subst (asm) (5) POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3632
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3633
apply(rotate_tac 5)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3634
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3635
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3636
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3637
apply(subst (asm) v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3638
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3639
apply(drule_tac x="Left (projval r1a c v1)" in spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3640
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3641
apply(drule mp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3642
apply(rule conjI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3643
apply (metis Prf.intros(2) v3_proj)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3644
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3645
apply (metis v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3646
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3647
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3648
apply (metis less_not_refl v4_proj2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3649
(* seq case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3650
apply(case_tac "nullable r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3651
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3652
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3653
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3654
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3655
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3656
apply (metis Prf.intros(1) v3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3657
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3658
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3659
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3660
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3661
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3662
apply(subst (asm) (3) v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3663
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3664
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3665
apply(subgoal_tac "flat v1a \<noteq> []")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3666
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3667
apply (metis Prf_flat_L nullable_correctness)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3668
apply(subgoal_tac "\<exists>s. flat v1a = c # s")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3669
prefer 2
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3670
apply (metis append_eq_Cons_conv)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3671
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3672
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3673
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3674
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3675
lemma POSIX_ex: "\<turnstile> v : r \<Longrightarrow> \<exists>v. POSIX v r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3676
apply(induct r arbitrary: v)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3677
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3678
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3679
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3680
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3681
apply(rule_tac x="Void" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3682
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3683
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3684
apply (metis Prf.intros(4))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3685
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3686
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3687
apply (metis ValOrd.intros(7))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3688
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3689
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3690
apply(rule_tac x="Char c" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3691
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3692
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3693
apply (metis Prf.intros(5))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3694
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3695
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3696
apply (metis ValOrd.intros(8))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3697
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3698
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3699
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3700
apply(drule_tac x="v1" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3701
apply(drule_tac x="v2" in meta_spec)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3702
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3703
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3704
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3705
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3706
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3707
apply (metis POSIX_ALT_I1)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3708
apply (metis POSIX_ALT_I1 POSIX_ALT_I2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3709
apply(case_tac "nullable r1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3710
apply(rule_tac x="Seq (mkeps r1a) va" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3711
apply(auto simp add: POSIX_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3712
apply (metis Prf.intros(1) mkeps_nullable)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3713
apply(simp add: mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3714
apply(rotate_tac 7)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3715
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3716
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3717
apply(case_tac "mkeps r1 = v1a")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3718
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3719
apply (rule ValOrd.intros(1))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3720
apply (metis append_Nil mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3721
apply (rule ValOrd.intros(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3722
apply(drule mkeps_POSIX)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3723
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3724
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3725
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3726
lemma POSIX_ex2: "\<turnstile> v : r \<Longrightarrow> \<exists>v. POSIX v r \<and> \<turnstile> v : r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3727
apply(induct r arbitrary: v)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3728
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3729
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3730
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3731
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3732
apply(rule_tac x="Void" in exI)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3733
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3734
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3735
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3736
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3737
lemma POSIX_ALT_cases:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3738
  assumes "\<turnstile> v : (ALT r1 r2)" "POSIX v (ALT r1 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3739
  shows "(\<exists>v1. v = Left v1 \<and> POSIX v1 r1) \<or> (\<exists>v2. v = Right v2 \<and> POSIX v2 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3740
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3741
apply(erule_tac Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3742
apply(simp_all)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3743
unfolding POSIX_def
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3744
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3745
apply (metis POSIX_ALT2 POSIX_def assms(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3746
by (metis POSIX_ALT1b assms(2))
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3747
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3748
lemma POSIX_ALT_cases2:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3749
  assumes "POSIX v (ALT r1 r2)" "\<turnstile> v : (ALT r1 r2)" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3750
  shows "(\<exists>v1. v = Left v1 \<and> POSIX v1 r1) \<or> (\<exists>v2. v = Right v2 \<and> POSIX v2 r2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3751
using assms POSIX_ALT_cases by auto
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3752
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3753
lemma Prf_flat_empty:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3754
  assumes "\<turnstile> v : r" "flat v = []"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3755
  shows "nullable r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3756
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3757
apply(induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3758
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3759
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3760
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3761
lemma POSIX_proj:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3762
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3763
  shows "POSIX (projval r c v) (der c r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3764
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3765
apply(induct r c v arbitrary: rule: projval.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3766
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3767
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3768
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3769
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3770
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3771
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3772
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3773
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3774
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3775
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3776
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3777
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3778
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3779
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3780
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3781
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3782
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3783
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3784
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3785
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3786
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3787
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3788
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3789
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3790
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3791
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3792
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3793
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3794
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3795
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3796
lemma POSIX_proj:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3797
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3798
  shows "POSIX (projval r c v) (der c r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3799
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3800
apply(induct r arbitrary: c v rule: rexp.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3801
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3802
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3803
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3804
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3805
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3806
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3807
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3808
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3809
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3810
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3811
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3812
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3813
lemma POSIX_proj:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3814
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3815
  shows "POSIX (projval r c v) (der c r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3816
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3817
apply(induct r c v arbitrary: rule: projval.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3818
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3819
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3820
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3821
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3822
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3823
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3824
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3825
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3826
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3827
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3828
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3829
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3830
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3831
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3832
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3833
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3834
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3835
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3836
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3837
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3838
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3839
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3840
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3841
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3842
apply(simp add: POSIX_def)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3843
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3844
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3845
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3846
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3847
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3848
lemma Prf_inj:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3849
  assumes "v1 \<succ>(der c r) v2" "\<turnstile> v1 : der c r" "\<turnstile> v2 : der c r" "flat v1 = flat v2"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3850
  shows "(injval r c v1) \<succ>r (injval r c v2)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3851
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3852
apply(induct arbitrary: v1 v2 rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3853
(* NULL case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3854
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3855
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3856
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3857
(* EMPTY case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3858
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3859
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3860
(* CHAR case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3861
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3862
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3863
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3864
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3865
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3866
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3867
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3868
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3869
(* ALT case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3870
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3871
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3872
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3873
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3874
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3875
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3876
apply(rotate_tac 3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3877
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3878
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3879
apply(subst v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3880
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3881
apply(rotate_tac 2)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3882
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3883
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3884
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3885
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3886
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3887
apply(rotate_tac 3)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3888
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3889
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3890
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3891
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3892
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3893
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3894
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3895
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3896
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3897
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3898
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3899
(* SEQ case*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3900
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3901
apply(case_tac "nullable r1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3902
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3903
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3904
apply(erule ValOrd.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3905
apply(simp_all)[8]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3906
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3907
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3908
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3909
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3910
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3911
apply(clarify)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3912
apply(rule ValOrd.intros)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3913
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3914
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3915
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3916
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3917
text {*
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3918
  Injection followed by projection is the identity.
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3919
*}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3920
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3921
lemma proj_inj_id:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3922
  assumes "\<turnstile> v : der c r" 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3923
  shows "projval r c (injval r c v) = v"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3924
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3925
apply(induct r arbitrary: c v rule: rexp.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3926
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3927
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3928
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3929
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3930
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3931
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3932
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3933
apply(case_tac "c = char")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3934
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3935
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3936
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3937
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3938
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3939
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3940
defer
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3941
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3942
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3943
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3944
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3945
apply(case_tac "nullable rexp1")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3946
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3947
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3948
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3949
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3950
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3951
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3952
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3953
apply (metis list.distinct(1) v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3954
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3955
apply (metis mkeps_flat)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3956
apply(auto)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3957
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3958
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3959
apply(auto)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3960
apply(simp add: v4)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3961
done
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3962
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3963
text {* 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3964
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3965
  HERE: Crucial lemma that does not go through in the sequence case. 
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3966
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3967
*}
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3968
lemma v5:
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3969
  assumes "\<turnstile> v : der c r" "POSIX v (der c r)"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3970
  shows "POSIX (injval r c v) r"
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3971
using assms
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3972
apply(induct arbitrary: v rule: der.induct)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3973
(* NULL case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3974
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3975
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3976
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3977
(* EMPTY case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3978
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3979
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3980
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3981
(* CHAR case *)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3982
apply(simp)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3983
apply(case_tac "c = c'")
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3984
apply(auto simp add: POSIX_def)[1]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3985
apply(erule Prf.cases)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3986
apply(simp_all)[5]
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3987
oops
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3988
*)
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3989
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3990
ec5e4fe4cc70 for new journal/conf paper!
Chengsong
parents:
diff changeset
  3991
end