thys/ReTest.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 24 Feb 2016 21:08:35 +0000
changeset 104 59bad592a009
child 105 80218dddbb15
permissions -rw-r--r--
updated theories and cleaned them up
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
   
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
theory ReTest
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
  imports "Main" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
begin
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
section {* Sequential Composition of Sets *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
definition
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
  Sequ :: "string set \<Rightarrow> string set \<Rightarrow> string set" ("_ ;; _" [100,100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
where 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
  "A ;; B = {s1 @ s2 | s1 s2. s1 \<in> A \<and> s2 \<in> B}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
fun spow where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
  "spow s 0 = []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
| "spow s (Suc n) = s @ spow s n"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
text {* Two Simple Properties about Sequential Composition *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
lemma seq_empty [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
  shows "A ;; {[]} = A"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
  and   "{[]} ;; A = A"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
by (simp_all add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
lemma seq_null [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
  shows "A ;; {} = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
  and   "{} ;; A = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
by (simp_all add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
definition
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
  Der :: "char \<Rightarrow> string set \<Rightarrow> string set"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
  "Der c A \<equiv> {s. [c] @ s \<in> A}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
definition 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
  Ders :: "string \<Rightarrow> string set \<Rightarrow> string set"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
where  
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
  "Ders s A \<equiv> {s' | s'. s @ s' \<in> A}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
lemma Der_null [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
  shows "Der c {} = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
unfolding Der_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    43
by auto
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
lemma Der_empty [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
  shows "Der c {[]} = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
unfolding Der_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
by auto
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
lemma Der_char [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
  shows "Der c {[d]} = (if c = d then {[]} else {})"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    52
unfolding Der_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
by auto
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    54
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    55
lemma Der_union [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
  shows "Der c (A \<union> B) = Der c A \<union> Der c B"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
unfolding Der_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
by auto
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    60
lemma Der_seq [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
  shows "Der c (A ;; B) = (Der c A) ;; B \<union> (if [] \<in> A then Der c B else {})"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    62
unfolding Der_def Sequ_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
apply (auto simp add: Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    65
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
lemma seq_image:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
  shows "f ` (A ;; B) = (f ` A) ;; (f ` B)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    69
apply(auto simp add: Sequ_def image_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    70
apply(rule_tac x="f s1" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    71
apply(rule_tac x="f s2" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    72
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    74
apply(rule_tac x="xa @ xb" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    75
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    76
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    77
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    78
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    79
section {* Kleene Star for Sets *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    80
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    81
inductive_set
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    82
  Star :: "string set \<Rightarrow> string set" ("_\<star>" [101] 102)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    83
  for A :: "string set"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    84
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    85
  start[intro]: "[] \<in> A\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    86
| step[intro]:  "\<lbrakk>s1 \<in> A; s2 \<in> A\<star>\<rbrakk> \<Longrightarrow> s1 @ s2 \<in> A\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    87
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    88
lemma star_cases:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    89
  shows "A\<star> = {[]} \<union> A ;; A\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    90
unfolding Sequ_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    91
by (auto) (metis Star.simps)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    92
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    93
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    94
fun 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    95
  pow :: "string set \<Rightarrow> nat \<Rightarrow> string set" ("_ \<up> _" [100,100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    96
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    97
  "A \<up> 0 = {[]}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    98
| "A \<up> (Suc n) = A ;; (A \<up> n)"  
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    99
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   100
lemma star1: 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   101
  shows "s \<in> A\<star> \<Longrightarrow> \<exists>n. s \<in> A \<up> n"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   102
  apply(induct rule: Star.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   103
  apply (metis pow.simps(1) insertI1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   104
  apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   105
  apply(rule_tac x="Suc n" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   106
  apply(auto simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   107
  done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   108
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   109
lemma star2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   110
  shows "s \<in> A \<up> n \<Longrightarrow> s \<in> A\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   111
  apply(induct n arbitrary: s)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   112
  apply (metis pow.simps(1) Star.simps empty_iff insertE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   113
  apply(auto simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   114
  done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   115
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   116
lemma star3:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   117
  shows "A\<star> = (\<Union>i. A \<up> i)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   118
using star1 star2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   119
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   120
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   121
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   122
lemma star4:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   124
  apply(induct n arbitrary: s)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   125
  apply(auto simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   126
  apply(rule_tac x="[]" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   127
  apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   128
  apply(drule_tac x="s2" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   129
  apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   130
by (metis concat.simps(2) insertE set_simps(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   131
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   132
lemma star5:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   133
  assumes "f [] = []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   134
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   135
  shows "(f ` A) \<up> n = f ` (A \<up> n)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   136
apply(induct n)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   137
apply(simp add: assms)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   138
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   139
apply(subst seq_image[OF assms(2)])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   140
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   141
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
lemma star6:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   144
  assumes "f [] = []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   145
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   146
  shows "(f ` A)\<star> = f ` (A\<star>)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   147
apply(simp add: star3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   148
apply(simp add: image_UN)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   149
apply(subst star5[OF assms])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   150
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   151
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   152
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   153
lemma star_decomp: 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   154
  assumes a: "c # x \<in> A\<star>" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   155
  shows "\<exists>a b. x = a @ b \<and> c # a \<in> A \<and> b \<in> A\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   156
using a
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   157
by (induct x\<equiv>"c # x" rule: Star.induct) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   158
   (auto simp add: append_eq_Cons_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   159
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   160
lemma Der_star [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   161
  shows "Der c (A\<star>) = (Der c A) ;; A\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   162
proof -    
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   163
  have "Der c (A\<star>) = Der c ({[]} \<union> A ;; A\<star>)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   164
    
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   165
    by (simp only: star_cases[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   166
  also have "... = Der c (A ;; A\<star>)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   167
    by (simp only: Der_union Der_empty) (simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   168
  also have "... = (Der c A) ;; A\<star> \<union> (if [] \<in> A then Der c (A\<star>) else {})"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   169
    by simp
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   170
  also have "... =  (Der c A) ;; A\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   171
    unfolding Sequ_def Der_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   172
    by (auto dest: star_decomp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   173
  finally show "Der c (A\<star>) = (Der c A) ;; A\<star>" .
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   174
qed
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   175
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   176
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   177
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   178
section {* Regular Expressions *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   179
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   180
datatype rexp =
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   181
  NULL
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   182
| EMPTY
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   183
| CHAR char
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   184
| SEQ rexp rexp
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   185
| ALT rexp rexp
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   186
| STAR rexp
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   187
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   188
section {* Semantics of Regular Expressions *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   189
 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   190
fun
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   191
  L :: "rexp \<Rightarrow> string set"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   192
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   193
  "L (NULL) = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   194
| "L (EMPTY) = {[]}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   195
| "L (CHAR c) = {[c]}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   196
| "L (SEQ r1 r2) = (L r1) ;; (L r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   197
| "L (ALT r1 r2) = (L r1) \<union> (L r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   198
| "L (STAR r) = (L r)\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   199
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   200
fun
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   201
 nullable :: "rexp \<Rightarrow> bool"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   202
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   203
  "nullable (NULL) = False"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   204
| "nullable (EMPTY) = True"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   205
| "nullable (CHAR c) = False"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   206
| "nullable (ALT r1 r2) = (nullable r1 \<or> nullable r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   207
| "nullable (SEQ r1 r2) = (nullable r1 \<and> nullable r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   208
| "nullable (STAR r) = True"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   209
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   210
lemma nullable_correctness:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   211
  shows "nullable r  \<longleftrightarrow> [] \<in> (L r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   212
apply (induct r) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   213
apply(auto simp add: Sequ_def) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   214
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   215
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   216
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   217
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   218
section {* Values *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   219
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   220
datatype val = 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   221
  Void
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   222
| Char char
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   223
| Seq val val
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   224
| Right val
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   225
| Left val
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   226
| Stars "val list"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   227
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   228
section {* The string behind a value *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   229
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   230
fun 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   231
  flat :: "val \<Rightarrow> string"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   232
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   233
  "flat (Void) = []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   234
| "flat (Char c) = [c]"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   235
| "flat (Left v) = flat v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   236
| "flat (Right v) = flat v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   237
| "flat (Seq v1 v2) = (flat v1) @ (flat v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   238
| "flat (Stars []) = []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   239
| "flat (Stars (v#vs)) = (flat v) @ (flat (Stars vs))" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   240
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   241
lemma [simp]:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   242
 "flat (Stars vs) = concat (map flat vs)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   243
apply(induct vs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   244
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   245
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   246
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   247
section {* Relation between values and regular expressions *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   248
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   249
inductive 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   250
  NPrf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<Turnstile> _ : _" [100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   251
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   252
 "\<lbrakk>\<Turnstile> v1 : r1; \<Turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<Turnstile> Seq v1 v2 : SEQ r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   253
| "\<Turnstile> v1 : r1 \<Longrightarrow> \<Turnstile> Left v1 : ALT r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   254
| "\<Turnstile> v2 : r2 \<Longrightarrow> \<Turnstile> Right v2 : ALT r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   255
| "\<Turnstile> Void : EMPTY"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   256
| "\<Turnstile> Char c : CHAR c"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   257
| "\<Turnstile> Stars [] : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   258
| "\<lbrakk>\<Turnstile> v : r; \<Turnstile> Stars vs : STAR r; flat v \<noteq> []\<rbrakk> \<Longrightarrow> \<Turnstile> Stars (v # vs) : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   259
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   260
inductive 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   261
  Prf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<turnstile> _ : _" [100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   262
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   263
 "\<lbrakk>\<turnstile> v1 : r1; \<turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<turnstile> Seq v1 v2 : SEQ r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   264
| "\<turnstile> v1 : r1 \<Longrightarrow> \<turnstile> Left v1 : ALT r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   265
| "\<turnstile> v2 : r2 \<Longrightarrow> \<turnstile> Right v2 : ALT r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   266
| "\<turnstile> Void : EMPTY"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   267
| "\<turnstile> Char c : CHAR c"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   268
| "\<turnstile> Stars [] : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   269
| "\<lbrakk>\<turnstile> v : r; \<turnstile> Stars vs : STAR r\<rbrakk> \<Longrightarrow> \<turnstile> Stars (v # vs) : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   270
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   271
lemma NPrf_imp_Prf:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   272
  assumes "\<Turnstile> v : r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   273
  shows "\<turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   274
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   275
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   276
apply(auto intro: Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   277
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   278
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   279
lemma NPrf_Prf_val:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   280
  shows "\<turnstile> v : r \<Longrightarrow> \<exists>v'. flat v' = flat v \<and> \<Turnstile> v' : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   281
  and   "\<turnstile> Stars vs : r \<Longrightarrow> \<exists>vs'. flat (Stars vs') = flat (Stars vs) \<and> \<Turnstile> Stars vs' : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   282
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   283
apply(induct v and vs arbitrary: r and r rule: val.inducts)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   284
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   285
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   286
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   287
apply(rule_tac x="Void" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   288
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   289
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   290
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   291
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   292
apply(rule_tac x="Char c" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   293
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   294
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   295
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   296
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   297
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   298
apply(drule_tac x="r1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   299
apply(drule_tac x="r2" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   300
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   301
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   302
apply(rule_tac x="Seq v' v'a" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   303
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   304
apply (metis NPrf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   305
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   306
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   307
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   308
apply(drule_tac x="r2" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   309
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   310
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   311
apply(rule_tac x="Right v'" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   312
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   313
apply (metis NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   314
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   315
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   316
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   317
apply(drule_tac x="r1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   318
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   319
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   320
apply(rule_tac x="Left v'" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   321
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   322
apply (metis NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   323
apply(drule_tac x="r" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   324
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   325
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   326
apply(rule_tac x="Stars vs'" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   327
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   328
apply(rule_tac x="[]" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   329
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   330
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   331
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   332
apply (metis NPrf.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   333
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   334
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   335
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   336
apply(drule_tac x="ra" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   337
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   338
apply(drule_tac x="STAR ra" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   339
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   340
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   341
apply(case_tac "flat v = []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   342
apply(rule_tac x="vs'" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   343
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   344
apply(rule_tac x="v' # vs'" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   345
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   346
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   347
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   348
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   349
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   350
lemma NPrf_Prf:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   351
  shows "{flat v | v. \<turnstile> v : r} = {flat v | v. \<Turnstile> v : r}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   352
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   353
apply (metis NPrf_Prf_val(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   354
by (metis NPrf_imp_Prf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   355
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   356
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   357
lemma not_nullable_flat:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   358
  assumes "\<turnstile> v : r" "\<not>nullable r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   359
  shows "flat v \<noteq> []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   360
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   361
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   362
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   363
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   364
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   365
lemma Prf_flat_L:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   366
  assumes "\<turnstile> v : r" shows "flat v \<in> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   367
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   368
apply(induct v r rule: Prf.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   369
apply(auto simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   370
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   371
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   372
lemma NPrf_flat_L:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   373
  assumes "\<Turnstile> v : r" shows "flat v \<in> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   374
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   375
by (metis NPrf_imp_Prf Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   376
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   377
lemma Prf_Stars:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   378
  assumes "\<forall>v \<in> set vs. \<turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   379
  shows "\<turnstile> Stars vs : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   380
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   381
apply(induct vs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   382
apply (metis Prf.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   383
by (metis Prf.intros(7) insert_iff set_simps(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   384
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   385
lemma Star_string:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   386
  assumes "s \<in> A\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   387
  shows "\<exists>ss. concat ss = s \<and> (\<forall>s \<in> set ss. s \<in> A)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   388
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   389
apply(induct rule: Star.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   390
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   391
apply(rule_tac x="[]" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   392
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   393
apply(rule_tac x="s1#ss" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   394
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   395
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   396
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   397
lemma Star_val:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   398
  assumes "\<forall>s\<in>set ss. \<exists>v. s = flat v \<and> \<turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   399
  shows "\<exists>vs. concat (map flat vs) = concat ss \<and> (\<forall>v\<in>set vs. \<turnstile> v : r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   400
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   401
apply(induct ss)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   402
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   403
apply (metis empty_iff list.set(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   404
by (metis concat.simps(2) list.simps(9) set_ConsD)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   405
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   406
lemma Star_valN:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   407
  assumes "\<forall>s\<in>set ss. \<exists>v. s = flat v \<and> \<Turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   408
  shows "\<exists>vs. concat (map flat vs) = concat ss \<and> (\<forall>v\<in>set vs. \<Turnstile> v : r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   409
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   410
apply(induct ss)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   411
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   412
apply (metis empty_iff list.set(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   413
by (metis concat.simps(2) list.simps(9) set_ConsD)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   414
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   415
lemma L_flat_Prf:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   416
  "L(r) = {flat v | v. \<turnstile> v : r}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   417
apply(induct r)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   418
apply(auto dest: Prf_flat_L simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   419
apply (metis Prf.intros(4) flat.simps(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   420
apply (metis Prf.intros(5) flat.simps(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   421
apply (metis Prf.intros(1) flat.simps(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   422
apply (metis Prf.intros(2) flat.simps(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   423
apply (metis Prf.intros(3) flat.simps(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   424
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   425
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   427
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   428
apply(rule_tac x="Stars vs" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   429
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   430
apply(rule Prf_Stars)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   431
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   432
apply(drule Star_string)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   433
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   434
apply(rule Star_val)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   435
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   436
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   437
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   438
lemma L_flat_NPrf:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   439
  "L(r) = {flat v | v. \<Turnstile> v : r}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   440
by (metis L_flat_Prf NPrf_Prf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   441
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   442
text {* nicer proofs by Fahad *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   443
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   444
lemma Prf_Star_flat_L:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   445
  assumes "\<turnstile> v : STAR r" shows "flat v \<in> (L r)\<star>"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   446
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   447
apply(induct v r\<equiv>"STAR r" arbitrary: r rule: Prf.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   448
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   449
apply(simp add: star3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   450
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   451
apply(rule_tac x="Suc x" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   452
apply(auto simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   453
apply(rule_tac x="flat v" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   454
apply(rule_tac x="flat (Stars vs)" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   455
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   456
by (metis Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   457
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   458
lemma L_flat_Prf2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   459
  "L(r) = {flat v | v. \<turnstile> v : r}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   460
apply(induct r)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   461
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   462
using L.simps(1) Prf_flat_L 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   463
apply(blast)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   464
using Prf.intros(4) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   465
apply(force)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   466
using L.simps(2) Prf_flat_L 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   467
apply(blast)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   468
using Prf.intros(5) apply force
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   469
using L.simps(3) Prf_flat_L apply blast
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   470
using L_flat_Prf apply auto[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   471
apply (smt L.simps(4) Sequ_def mem_Collect_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   472
using Prf_flat_L 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   473
apply(fastforce)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   474
apply(metis Prf.intros(2) flat.simps(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   475
apply(metis Prf.intros(3) flat.simps(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   476
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   477
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   478
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   479
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   480
using L_flat_Prf apply auto[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   481
apply (smt Collect_cong L.simps(6) mem_Collect_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   482
using Prf_Star_flat_L 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   483
apply(fastforce)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   484
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   485
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   486
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   487
section {* Values Sets *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   488
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   489
definition prefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubseteq> _" [100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   490
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   491
  "s1 \<sqsubseteq> s2 \<equiv> \<exists>s3. s1 @ s3 = s2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   492
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   493
definition sprefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubset> _" [100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   494
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   495
  "s1 \<sqsubset> s2 \<equiv> (s1 \<sqsubseteq> s2 \<and> s1 \<noteq> s2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   496
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   497
lemma length_sprefix:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   498
  "s1 \<sqsubset> s2 \<Longrightarrow> length s1 < length s2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   499
unfolding sprefix_def prefix_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   500
by (auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   501
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   502
definition Prefixes :: "string \<Rightarrow> string set" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   503
  "Prefixes s \<equiv> {sp. sp \<sqsubseteq> s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   504
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   505
definition Suffixes :: "string \<Rightarrow> string set" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   506
  "Suffixes s \<equiv> rev ` (Prefixes (rev s))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   507
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   508
definition SPrefixes :: "string \<Rightarrow> string set" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   509
  "SPrefixes s \<equiv> {sp. sp \<sqsubset> s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   510
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   511
definition SSuffixes :: "string \<Rightarrow> string set" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   512
  "SSuffixes s \<equiv> rev ` (SPrefixes (rev s))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   513
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   514
lemma Suffixes_in: 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   515
  "\<exists>s1. s1 @ s2 = s3 \<Longrightarrow> s2 \<in> Suffixes s3"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   516
unfolding Suffixes_def Prefixes_def prefix_def image_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   517
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   518
by (metis rev_rev_ident)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   519
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   520
lemma SSuffixes_in: 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   521
  "\<exists>s1. s1 \<noteq> [] \<and> s1 @ s2 = s3 \<Longrightarrow> s2 \<in> SSuffixes s3"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   522
unfolding SSuffixes_def Suffixes_def SPrefixes_def Prefixes_def sprefix_def prefix_def image_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   523
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   524
by (metis append_self_conv rev.simps(1) rev_rev_ident)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   525
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   526
lemma Prefixes_Cons:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   527
  "Prefixes (c # s) = {[]} \<union> {c # sp | sp. sp \<in> Prefixes s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   528
unfolding Prefixes_def prefix_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   529
apply(auto simp add: append_eq_Cons_conv) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   530
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   531
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   532
lemma finite_Prefixes:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   533
  "finite (Prefixes s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   534
apply(induct s)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   535
apply(auto simp add: Prefixes_def prefix_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   536
apply(simp add: Prefixes_Cons)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   537
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   538
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   539
lemma finite_Suffixes:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   540
  "finite (Suffixes s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   541
unfolding Suffixes_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   542
apply(rule finite_imageI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   543
apply(rule finite_Prefixes)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   544
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   545
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   546
lemma prefix_Cons:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   547
  "((c # s1) \<sqsubseteq> (c # s2)) = (s1 \<sqsubseteq> s2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   548
apply(auto simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   549
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   550
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   551
lemma prefix_append:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   552
  "((s @ s1) \<sqsubseteq> (s @ s2)) = (s1 \<sqsubseteq> s2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   553
apply(induct s)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   554
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   555
apply(simp add: prefix_Cons)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   556
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   557
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   558
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   559
definition Values :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   560
  "Values r s \<equiv> {v. \<turnstile> v : r \<and> flat v \<sqsubseteq> s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   561
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   562
definition SValues :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   563
  "SValues r s \<equiv> {v. \<turnstile> v : r \<and> flat v = s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   564
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   565
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   566
definition NValues :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   567
  "NValues r s \<equiv> {v. \<Turnstile> v : r \<and> flat v \<sqsubseteq> s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   568
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   569
lemma NValues_STAR_Nil:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   570
  "NValues (STAR r) [] = {Stars []}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   571
apply(auto simp add: NValues_def prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   572
apply(erule NPrf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   573
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   574
by (metis NPrf.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   575
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   576
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   577
definition rest :: "val \<Rightarrow> string \<Rightarrow> string" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   578
  "rest v s \<equiv> drop (length (flat v)) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   579
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   580
lemma rest_Nil:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   581
  "rest v [] = []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   582
apply(simp add: rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   583
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   584
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   585
lemma rest_Suffixes:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   586
  "rest v s \<in> Suffixes s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   587
unfolding rest_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   588
by (metis Suffixes_in append_take_drop_id)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   589
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   590
lemma rest_SSuffixes:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   591
  assumes "flat v \<noteq> []" "s \<noteq> []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   592
  shows "rest v s \<in> SSuffixes s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   593
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   594
unfolding rest_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   595
thm SSuffixes_in
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   596
apply(rule_tac SSuffixes_in)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   597
apply(rule_tac x="take (length (flat v)) s" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   598
apply(simp add: sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   599
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   600
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   601
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   602
lemma Values_recs:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   603
  "Values (NULL) s = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   604
  "Values (EMPTY) s = {Void}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   605
  "Values (CHAR c) s = (if [c] \<sqsubseteq> s then {Char c} else {})" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   608
  "Values (STAR r) s = 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   610
unfolding Values_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   611
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   612
(*NULL*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   613
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   614
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   615
(*EMPTY*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   616
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   617
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   618
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   619
apply (metis append_Nil prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   620
(*CHAR*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   621
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   622
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   623
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   624
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   625
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   626
(*ALT*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   627
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   628
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   629
apply (metis Prf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   630
apply (metis Prf.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   631
(*SEQ*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   632
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   633
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   634
apply (simp add: append_eq_conv_conj prefix_def rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   635
apply (metis Prf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   636
apply (simp add: append_eq_conv_conj prefix_def rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   637
(*STAR*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   638
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   639
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   640
apply(rule conjI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   641
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   642
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   643
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   644
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   645
apply (metis append_eq_conv_conj rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   646
apply (metis Prf.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   647
apply (metis append_Nil prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   648
apply (metis Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   649
by (metis append_eq_conv_conj prefix_append prefix_def rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   650
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   651
lemma NValues_recs:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   652
  "NValues (NULL) s = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   653
  "NValues (EMPTY) s = {Void}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   654
  "NValues (CHAR c) s = (if [c] \<sqsubseteq> s then {Char c} else {})" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   657
  "NValues (STAR r) s = 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   659
unfolding NValues_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   660
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   661
(*NULL*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   662
apply(erule NPrf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   663
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   664
(*EMPTY*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   665
apply(erule NPrf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   666
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   667
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   668
apply (metis append_Nil prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   669
(*CHAR*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   670
apply(erule NPrf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   671
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   672
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   673
apply(erule NPrf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   674
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   675
(*ALT*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   676
apply(erule NPrf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   677
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   678
apply (metis NPrf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   679
apply (metis NPrf.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   680
(*SEQ*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   681
apply(erule NPrf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   682
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   683
apply (simp add: append_eq_conv_conj prefix_def rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   684
apply (metis NPrf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   685
apply (simp add: append_eq_conv_conj prefix_def rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   686
(*STAR*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   687
apply(erule NPrf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   688
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   689
apply(rule conjI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   690
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   691
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   692
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   693
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   694
apply (metis append_eq_conv_conj rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   695
apply (metis NPrf.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   696
apply (metis append_Nil prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   697
apply (metis NPrf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   698
by (metis append_eq_conv_conj prefix_append prefix_def rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   699
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   700
lemma SValues_recs:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   701
 "SValues (NULL) s = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   702
 "SValues (EMPTY) s = (if s = [] then {Void} else {})"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   703
 "SValues (CHAR c) s = (if [c] = s then {Char c} else {})" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   706
 "SValues (STAR r) s = (if s = [] then {Stars []} else {}) \<union> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   708
unfolding SValues_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   709
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   710
(*NULL*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   711
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   712
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   713
(*EMPTY*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   714
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   715
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   716
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   717
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   718
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   719
(*CHAR*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   720
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   721
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   722
apply (metis Prf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   723
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   724
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   725
(*ALT*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   726
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   727
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   728
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   729
apply(erule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   730
apply(erule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   731
(* SEQ case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   732
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   733
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   734
apply (metis Prf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   735
(* STAR case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   736
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   737
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   738
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   739
apply (metis Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   740
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   741
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   742
apply (metis Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   743
by (metis Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   744
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   745
lemma finite_image_set2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   746
  "finite {x. P x} \<Longrightarrow> finite {y. Q y} \<Longrightarrow> finite {(x, y) | x y. P x \<and> Q y}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   748
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   749
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   750
lemma NValues_finite_aux:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   751
  "(\<lambda>(r, s). finite (NValues r s)) (r, s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   752
apply(rule wf_induct[of "measure size <*lex*> measure length",where P="\<lambda>(r, s). finite (NValues r s)"])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   753
apply (metis wf_lex_prod wf_measure)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   754
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   755
apply(case_tac a)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   756
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   757
apply(simp add: NValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   758
apply(simp add: NValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   759
apply(simp add: NValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   760
apply(simp add: NValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   761
apply(rule_tac f="\<lambda>(x, y). Seq x y" and 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   763
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   764
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   766
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   767
apply (metis rest_Suffixes)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   768
apply(rule finite_UN_I)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   769
apply(rule finite_Suffixes)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   770
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   771
apply(simp add: NValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   772
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   773
apply(subst NValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   774
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   775
apply(rule_tac f="\<lambda>(v, vs). Stars (v # vs)" and 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   777
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   778
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   779
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   780
apply(case_tac b)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   781
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   782
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   784
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   785
apply(rule_tac x="rest aa (a # list)" in bexI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   786
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   787
apply (rule rest_SSuffixes)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   788
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   789
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   790
apply(rule finite_UN_I)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   791
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   792
apply(frule_tac x="rexp" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   793
apply(drule_tac x="b" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   794
apply(drule conjunct1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   795
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   796
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   797
apply(drule_tac x="STAR rexp" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   798
apply(drule_tac x="sp" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   799
apply(drule conjunct2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   800
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   801
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   802
apply(simp add: prefix_def SPrefixes_def SSuffixes_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   803
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   804
apply (metis length_Cons length_rev length_sprefix rev.simps(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   805
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   806
apply(rule finite_cartesian_product)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   807
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   808
apply(rule_tac f="Stars" in finite_imageD)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   809
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   810
apply(auto simp add: inj_on_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   811
apply (metis finite_subset image_Collect_subsetI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   812
apply(simp add: rest_Nil)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   813
apply(simp add: NValues_STAR_Nil)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   814
apply(rule_tac B="{(v, vs). v \<in> NValues rexp [] \<and> vs = []}" in finite_subset)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   815
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   816
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   817
apply(rule_tac B="Suffixes b" in finite_subset)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   818
apply(auto simp add: SSuffixes_def Suffixes_def Prefixes_def SPrefixes_def sprefix_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   819
by (metis finite_Suffixes)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   820
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   821
lemma NValues_finite:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   822
  "finite (NValues r s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   823
using NValues_finite_aux
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   824
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   825
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   826
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   827
section {* Sulzmann functions *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   828
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   829
fun 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   830
  mkeps :: "rexp \<Rightarrow> val"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   831
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   832
  "mkeps(EMPTY) = Void"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   833
| "mkeps(SEQ r1 r2) = Seq (mkeps r1) (mkeps r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   834
| "mkeps(ALT r1 r2) = (if nullable(r1) then Left (mkeps r1) else Right (mkeps r2))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   835
| "mkeps(STAR r) = Stars []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   836
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   837
section {* Derivatives *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   838
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   839
fun
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   840
 der :: "char \<Rightarrow> rexp \<Rightarrow> rexp"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   841
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   842
  "der c (NULL) = NULL"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   843
| "der c (EMPTY) = NULL"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   844
| "der c (CHAR c') = (if c = c' then EMPTY else NULL)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   845
| "der c (ALT r1 r2) = ALT (der c r1) (der c r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   846
| "der c (SEQ r1 r2) = 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   847
     (if nullable r1
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   848
      then ALT (SEQ (der c r1) r2) (der c r2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   849
      else SEQ (der c r1) r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   850
| "der c (STAR r) = SEQ (der c r) (STAR r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   851
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   852
fun 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   853
 ders :: "string \<Rightarrow> rexp \<Rightarrow> rexp"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   854
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   855
  "ders [] r = r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   856
| "ders (c # s) r = ders s (der c r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   857
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   858
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   859
lemma der_correctness:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   860
  shows "L (der c r) = Der c (L r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   861
apply(induct r) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   862
apply(simp_all add: nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   863
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   864
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   865
lemma ders_correctness:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   866
  shows "L (ders s r) = Ders s (L r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   867
apply(induct s arbitrary: r) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   868
apply(simp add: Ders_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   869
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   870
apply(subst der_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   871
apply(simp add: Ders_def Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   872
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   873
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   874
section {* Injection function *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   875
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   876
fun injval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   877
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   878
  "injval (CHAR d) c Void = Char d"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   879
| "injval (ALT r1 r2) c (Left v1) = Left(injval r1 c v1)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   880
| "injval (ALT r1 r2) c (Right v2) = Right(injval r2 c v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   881
| "injval (SEQ r1 r2) c (Seq v1 v2) = Seq (injval r1 c v1) v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   882
| "injval (SEQ r1 r2) c (Left (Seq v1 v2)) = Seq (injval r1 c v1) v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   883
| "injval (SEQ r1 r2) c (Right v2) = Seq (mkeps r1) (injval r2 c v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   884
| "injval (STAR r) c (Seq v (Stars vs)) = Stars ((injval r c v) # vs)" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   885
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   886
fun 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   887
  lex :: "rexp \<Rightarrow> string \<Rightarrow> val option"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   888
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   889
  "lex r [] = (if nullable r then Some(mkeps r) else None)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   890
| "lex r (c#s) = (case (lex (der c r) s) of  
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   891
                    None \<Rightarrow> None
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   892
                  | Some(v) \<Rightarrow> Some(injval r c v))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   893
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   894
fun 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   895
  lex2 :: "rexp \<Rightarrow> string \<Rightarrow> val"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   896
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   897
  "lex2 r [] = mkeps r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   898
| "lex2 r (c#s) = injval r c (lex2 (der c r) s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   899
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   900
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   901
section {* Projection function *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   902
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   903
fun projval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   904
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   905
  "projval (CHAR d) c _ = Void"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   906
| "projval (ALT r1 r2) c (Left v1) = Left (projval r1 c v1)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   907
| "projval (ALT r1 r2) c (Right v2) = Right (projval r2 c v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   908
| "projval (SEQ r1 r2) c (Seq v1 v2) = 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   909
     (if flat v1 = [] then Right(projval r2 c v2) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   910
      else if nullable r1 then Left (Seq (projval r1 c v1) v2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   911
                          else Seq (projval r1 c v1) v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   912
| "projval (STAR r) c (Stars (v # vs)) = Seq (projval r c v) (Stars vs)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   913
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   914
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   915
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   916
lemma mkeps_nullable:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   917
  assumes "nullable(r)" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   918
  shows "\<turnstile> mkeps r : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   919
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   920
apply(induct rule: nullable.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   921
apply(auto intro: Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   922
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   923
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   924
lemma mkeps_flat:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   925
  assumes "nullable(r)" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   926
  shows "flat (mkeps r) = []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   927
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   928
apply(induct rule: nullable.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   929
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   930
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   931
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   932
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   933
lemma v3:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   934
  assumes "\<turnstile> v : der c r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   935
  shows "\<turnstile> (injval r c v) : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   936
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   937
apply(induct arbitrary: v rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   938
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   939
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   940
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   941
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   942
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   943
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   944
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   945
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   946
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   947
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   948
apply (metis Prf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   949
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   950
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   951
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   952
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   953
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   954
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   955
apply (metis Prf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   956
apply (metis Prf.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   957
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   958
apply(case_tac "nullable r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   959
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   960
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   961
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   962
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   963
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   964
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   965
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   966
apply (metis Prf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   967
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   968
apply (metis Prf.intros(1) mkeps_nullable)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   969
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   970
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   971
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   972
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   973
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   974
apply(auto)[2]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   975
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   976
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   977
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   978
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   979
apply(rotate_tac 2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   980
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   981
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   982
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   983
apply (metis Prf.intros(6) Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   984
by (metis Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   985
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   986
lemma v3_proj:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   987
  assumes "\<Turnstile> v : r" and "\<exists>s. (flat v) = c # s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   988
  shows "\<Turnstile> (projval r c v) : der c r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   989
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   990
apply(induct rule: NPrf.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   991
prefer 4
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   992
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   993
prefer 4
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   994
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   995
apply (metis NPrf.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   996
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   997
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   998
apply (metis NPrf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   999
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1000
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1001
apply (metis NPrf.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1002
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1003
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1004
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1005
apply (metis NPrf_imp_Prf not_nullable_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1006
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1007
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1008
apply (metis Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1009
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1010
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1011
apply (metis Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1012
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1013
(* Stars case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1014
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1015
apply (metis Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1016
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1017
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1018
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1019
lemma v4:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1020
  assumes "\<turnstile> v : der c r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1021
  shows "flat (injval r c v) = c # (flat v)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1022
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1023
apply(induct arbitrary: v rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1024
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1025
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1026
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1027
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1028
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1029
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1030
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1031
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1032
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1033
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1034
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1035
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1036
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1037
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1038
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1039
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1040
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1041
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1042
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1043
apply(case_tac "nullable r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1044
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1045
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1046
apply(simp_all (no_asm_use))[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1047
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1048
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1049
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1050
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1051
apply(simp only: injval.simps flat.simps)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1052
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1053
apply (metis mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1054
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1055
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1056
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1057
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1058
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1059
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1060
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1061
apply(rotate_tac 2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1062
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1063
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1064
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1065
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1066
lemma v4_proj:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1067
  assumes "\<Turnstile> v : r" and "\<exists>s. (flat v) = c # s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1068
  shows "c # flat (projval r c v) = flat v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1069
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1070
apply(induct rule: NPrf.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1071
prefer 4
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1072
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1073
prefer 4
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1074
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1075
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1076
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1077
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1078
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1079
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1080
apply (metis Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1081
apply(simp add: append_eq_Cons_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1082
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1083
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1084
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1085
lemma v4_proj2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1086
  assumes "\<Turnstile> v : r" and "(flat v) = c # s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1087
  shows "flat (projval r c v) = s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1088
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1089
by (metis list.inject v4_proj)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1090
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1091
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1092
definition 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1093
  PC31 :: "string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1094
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1095
  "PC31 s r r' \<equiv> s \<notin> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1096
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1097
definition 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1098
  PC41 :: "string \<Rightarrow> string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1099
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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 = []))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1101
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1102
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1103
lemma
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1104
 L1: "\<not>(nullable r1) \<longrightarrow> [] \<in> L r2 \<longrightarrow> PC31 [] r1 r2" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1105
 L2: "s1 \<in> L(r1) \<longrightarrow> [] \<in> L(r2) \<longrightarrow> PC41 s1 [] r1 r2" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1110
 L7: "s' \<in> L(r') \<longrightarrow> s' \<in> L(r) \<longrightarrow> \<not>PC31 s' r r'" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1112
apply(auto simp add: PC31_def PC41_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1113
apply (metis nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1114
apply(auto simp add: PC31_def PC41_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1115
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1116
apply(auto simp add: PC31_def PC41_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1117
apply(simp add: der_correctness Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1118
apply(auto simp add: PC31_def PC41_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1119
apply(simp add: der_correctness Der_def Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1120
apply(auto simp add: PC31_def PC41_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1121
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1122
apply(simp add: der_correctness Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1123
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1124
apply (metis append_eq_Cons_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1125
apply(auto simp add: PC31_def PC41_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1126
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1127
apply(simp add: der_correctness Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1128
apply(auto simp add: PC31_def PC41_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1129
apply(rule impI)+
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1130
apply(rule notI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1131
(* 8 fails *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1132
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1133
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1134
definition 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1135
  PC32 :: "string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1136
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1137
  "PC32 s r r' \<equiv> \<forall>y. s \<notin> (L r ;; {y})"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1138
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1139
definition 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1140
  PC42 :: "string \<Rightarrow> string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1141
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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 = []))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1143
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1144
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1145
lemma
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1146
 L1: "\<not>(nullable r1) \<longrightarrow> [] \<in> L r2 \<longrightarrow> PC32 [] r1 r2" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1147
 L2: "s1 \<in> L(r1) \<longrightarrow> [] \<in> L(r2) \<longrightarrow> PC42 s1 [] r1 r2" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1152
 L7: "s' \<in> L(r') \<longrightarrow> s' \<in> L(r) \<longrightarrow> \<not>PC32 s' r r'" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
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'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1154
apply(auto simp add: PC32_def PC42_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1155
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1156
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1157
definition 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1158
  PC33 :: "string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1159
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1160
  "PC33 s r r' \<equiv> s \<notin> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1161
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1162
definition 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1163
  PC43 :: "string \<Rightarrow> string \<Rightarrow> rexp \<Rightarrow> rexp \<Rightarrow> bool"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1164
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1165
  "PC43 s s' r r' \<equiv> (\<forall>x. (s @ x \<in> L r \<longrightarrow> (\<exists>y. s' \<in> {x} ;; (L r' ;; {y})) \<longrightarrow> x = []))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1166
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1167
lemma
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1168
 L1: "\<not>(nullable r1) \<longrightarrow> [] \<in> L r2 \<longrightarrow> PC33 [] r1 r2" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1169
 L2: "s1 \<in> L(r1) \<longrightarrow> [] \<in> L(r2) \<longrightarrow> PC43 s1 [] r1 r2" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1170
 L3: "s2 \<in> L(der c r2) \<longrightarrow> PC33 s2 (der c r1) (der c r2) \<longrightarrow> PC33 (c#s2) r1 r2" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1171
 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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1172
 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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1173
 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
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1174
 L7: "s' \<in> L(r') \<longrightarrow> s' \<in> L(r) \<longrightarrow> \<not>PC33 s' r r'" and
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1175
 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'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1176
apply(auto simp add: PC33_def PC43_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1177
apply (metis nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1178
apply(auto simp add: PC33_def PC43_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1179
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1180
apply(auto simp add: PC33_def PC43_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1181
apply(simp add: der_correctness Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1182
apply(auto simp add: PC33_def PC43_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1183
apply(simp add: der_correctness Der_def Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1184
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1185
(* 5 *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1186
apply(auto simp add: PC33_def PC43_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1187
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1188
apply(simp add: der_correctness Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1189
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1190
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1191
apply(auto simp add: PC33_def PC43_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1192
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1193
apply(simp add: der_correctness Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1194
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1195
apply(auto simp add: PC33_def PC43_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1196
apply(auto simp add: PC33_def PC43_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1197
(* 5 fails *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1198
apply(simp add: Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1199
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1200
apply(drule_tac x="ys'" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1201
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1202
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1203
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1204
section {* Roy's Definition *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1205
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1206
inductive 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1207
  Roy :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<rhd> _ : _" [100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1208
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1209
  "\<rhd> Void : EMPTY"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1210
| "\<rhd> Char c : CHAR c"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1211
| "\<rhd> v : r1 \<Longrightarrow> \<rhd> Left v : ALT r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1212
| "\<lbrakk>\<rhd> v : r2; flat v \<notin> L r1\<rbrakk> \<Longrightarrow> \<rhd> Right v : ALT r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1213
| "\<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>
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1214
      \<rhd> Seq v1 v2 : SEQ r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1215
| "\<lbrakk>\<rhd> v : r; \<rhd> Stars vs : STAR r; flat v \<noteq> []; 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1216
   \<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>
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1217
      \<rhd> Stars (v#vs) : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1218
| "\<rhd> Stars [] : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1219
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1220
lemma drop_append:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1221
  assumes "s1 \<sqsubseteq> s2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1222
  shows "s1 @ drop (length s1) s2 = s2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1223
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1224
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1225
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1226
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1227
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1228
lemma royA: 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1229
  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)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1230
  shows "\<forall>s. (s \<in> L(ders (flat v1) r1) \<and> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1231
              s \<sqsubseteq> (flat v2) \<and> drop (length s) (flat v2) \<in> L r2 \<longrightarrow> s = [])" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1232
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1233
apply -
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1234
apply(rule allI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1235
apply(rule impI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1236
apply(simp add: ders_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1237
apply(simp add: Ders_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1238
thm rest_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1239
apply(drule_tac x="s" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1240
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1241
apply(erule disjE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1242
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1243
apply(drule_tac x="drop (length s) (flat v2)" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1244
apply(simp add: drop_append)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1245
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1246
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1247
lemma royB:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1248
  assumes "\<forall>s. (s \<in> L(ders (flat v1) r1) \<and> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1249
              s \<sqsubseteq> (flat v2) \<and> drop (length s) (flat v2) \<in> L r2 \<longrightarrow> s = [])"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1250
  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)" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1251
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1252
apply -
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1253
apply(auto simp add: prefix_def ders_correctness Ders_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1254
by (metis append_eq_conv_conj)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1255
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1256
lemma royC: 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1257
  assumes "\<forall>s t. (s \<in> L(ders (flat v1) r1) \<and> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1258
                s \<sqsubseteq> (flat v2 @ t) \<and> drop (length s) (flat v2 @ t) \<in> L r2 \<longrightarrow> s = [])" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1259
  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)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1260
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1261
apply -
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1262
apply(rule royB)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1263
apply(rule allI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1264
apply(drule_tac x="s" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1265
apply(drule_tac x="[]" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1266
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1267
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1268
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1269
inductive 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1270
  Roy2 :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("2\<rhd> _ : _" [100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1271
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1272
  "2\<rhd> Void : EMPTY"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1273
| "2\<rhd> Char c : CHAR c"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1274
| "2\<rhd> v : r1 \<Longrightarrow> 2\<rhd> Left v : ALT r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1275
| "\<lbrakk>2\<rhd> v : r2; \<forall>t. flat v \<notin> (L r1 ;; {t})\<rbrakk> \<Longrightarrow> 2\<rhd> Right v : ALT r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1276
| "\<lbrakk>2\<rhd> v1 : r1; 2\<rhd> v2 : r2;
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1277
    \<forall>s. ((flat v1 @ s \<in> L r1) \<and> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1278
         (\<exists>t. s \<sqsubseteq> (flat v2 @ t) \<and> drop (length s) (flat v2) \<in> (L r2 ;; {t}))) \<longrightarrow> s = []\<rbrakk> \<Longrightarrow>
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1279
    2\<rhd> Seq v1 v2 : SEQ r1 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1280
| "\<lbrakk>2\<rhd> v : r; 2\<rhd> Stars vs : STAR r; flat v \<noteq> []; 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1281
    \<forall>s. ((flat v @ s \<in> L r) \<and> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1282
       (\<exists>t. s \<sqsubseteq> (flat (Stars vs) @ t) \<and> drop (length s) (flat (Stars vs)) \<in> (L (STAR r) ;; {t}))) \<longrightarrow> s = []\<rbrakk>
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1283
    \<Longrightarrow> 2\<rhd> Stars (v#vs) : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1284
| "2\<rhd> Stars [] : STAR r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1285
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1286
lemma Roy2_props:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1287
  assumes "2\<rhd> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1288
  shows "\<turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1289
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1290
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1291
apply(auto intro: Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1292
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1293
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1294
lemma Roy_mkeps_nullable:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1295
  assumes "nullable(r)" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1296
  shows "2\<rhd> (mkeps r) : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1297
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1298
apply(induct rule: nullable.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1299
apply(auto intro: Roy2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1300
apply(rule Roy2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1301
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1302
apply(simp add: mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1303
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1304
apply (metis nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1305
apply(rule Roy2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1306
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1307
apply(rule allI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1308
apply(rule impI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1309
apply(auto simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1310
apply(simp add: mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1311
apply(auto simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1312
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1313
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1314
section {* Alternative Posix definition *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1315
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1316
inductive 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1317
  PMatch :: "string \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<in> _ \<rightarrow> _" [100, 100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1318
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1319
  "[] \<in> EMPTY \<rightarrow> Void"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1320
| "[c] \<in> (CHAR c) \<rightarrow> (Char c)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1321
| "s \<in> r1 \<rightarrow> v \<Longrightarrow> s \<in> (ALT r1 r2) \<rightarrow> (Left v)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1322
| "\<lbrakk>s \<in> r2 \<rightarrow> v; s \<notin> L(r1)\<rbrakk> \<Longrightarrow> s \<in> (ALT r1 r2) \<rightarrow> (Right v)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1323
| "\<lbrakk>s1 \<in> r1 \<rightarrow> v1; s2 \<in> r2 \<rightarrow> v2;
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1324
    \<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> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1325
    (s1 @ s2) \<in> (SEQ r1 r2) \<rightarrow> (Seq v1 v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1326
| "\<lbrakk>s1 \<in> r \<rightarrow> v; s2 \<in> STAR r \<rightarrow> Stars vs; flat v \<noteq> [];
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1327
    \<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>
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1328
    \<Longrightarrow> (s1 @ s2) \<in> STAR r \<rightarrow> Stars (v # vs)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1329
| "[] \<in> STAR r \<rightarrow> Stars []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1330
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1331
inductive 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1332
  PMatchX :: "string \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("\<turnstile> _ \<in> _ \<rightarrow> _" [100, 100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1333
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1334
  "\<turnstile> s \<in> EMPTY \<rightarrow> Void"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1335
| "\<turnstile> (c # s) \<in> (CHAR c) \<rightarrow> (Char c)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1336
| "\<turnstile> s \<in> r1 \<rightarrow> v \<Longrightarrow> \<turnstile> s \<in> (ALT r1 r2) \<rightarrow> (Left v)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1337
| "\<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)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1338
| "\<lbrakk>s1 \<in> r1 \<rightarrow> v1; \<turnstile> s2 \<in> r2 \<rightarrow> v2;
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1339
    \<not>(\<exists>s3 s4. s3 \<noteq> [] \<and> (s3 @ s4) \<sqsubseteq> s2 \<and> (s1 @ s3) \<in> L r1 \<and> s4 \<in> L r2)\<rbrakk> \<Longrightarrow> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1340
    \<turnstile> (s1 @ s2) \<in> (SEQ r1 r2) \<rightarrow> (Seq v1 v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1341
| "\<lbrakk>s1 \<in> r \<rightarrow> v; \<turnstile> s2 \<in> STAR r \<rightarrow> Stars vs; flat v \<noteq> [];
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1342
    \<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>
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1343
    \<Longrightarrow> \<turnstile> (s1 @ s2) \<in> STAR r \<rightarrow> Stars (v # vs)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1344
| "\<turnstile> s \<in> STAR r \<rightarrow> Stars []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1345
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1346
lemma PMatch1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1347
  assumes "s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1348
  shows "\<turnstile> v : r" "flat v = s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1349
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1350
apply(induct s r v rule: PMatch.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1351
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1352
apply (metis Prf.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1353
apply (metis Prf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1354
apply (metis Prf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1355
apply (metis Prf.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1356
apply (metis Prf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1357
apply (metis Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1358
by (metis Prf.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1359
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1360
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1361
lemma PMatchX1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1362
  assumes "\<turnstile> s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1363
  shows "\<turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1364
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1365
apply(induct s r v rule: PMatchX.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1366
apply(auto simp add: prefix_def intro: Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1367
apply (metis PMatch1(1) Prf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1368
by (metis PMatch1(1) Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1369
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1370
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1371
lemma PMatchX:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1372
  assumes "\<turnstile> s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1373
  shows "flat v \<sqsubseteq> s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1374
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1375
apply(induct s r v rule: PMatchX.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1376
apply(auto simp add: prefix_def PMatch1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1377
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1378
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1379
lemma PMatchX_PMatch:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1380
  assumes "\<turnstile> s \<in> r \<rightarrow> v" "flat v = s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1381
  shows "s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1382
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1383
apply(induct s r v rule: PMatchX.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1384
apply(auto intro: PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1385
apply(rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1386
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1387
apply (metis PMatchX Prefixes_def mem_Collect_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1388
apply (smt2 PMatch.intros(5) PMatch1(2) PMatchX append_Nil2 append_assoc append_self_conv prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1389
by (metis L.simps(6) PMatch.intros(6) PMatch1(2) append_Nil2 append_eq_conv_conj prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1390
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1391
lemma PMatch_PMatchX:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1392
  assumes "s \<in> r \<rightarrow> v" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1393
  shows "\<turnstile> s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1394
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1395
apply(induct s r v arbitrary: s' rule: PMatch.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1396
apply(auto intro: PMatchX.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1397
apply(rule PMatchX.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1398
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1399
apply(rule notI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1400
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1401
apply (metis PMatch1(2) append_eq_conv_conj length_sprefix less_imp_le_nat prefix_def sprefix_def take_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1402
apply(rule PMatchX.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1403
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1404
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1405
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1406
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1407
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1408
lemma 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1409
  assumes "\<rhd> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1410
  shows "(flat v) \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1411
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1412
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1413
apply(auto intro: PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1414
apply(rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1415
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1416
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1417
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1418
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1419
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1420
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1421
lemma 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1422
  assumes "s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1423
  shows "\<rhd> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1424
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1425
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1426
apply(auto intro: Roy.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1427
apply (metis PMatch1(2) Roy.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1428
apply (metis PMatch1(2) Roy.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1429
by (metis L.simps(6) PMatch1(2) Roy.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1430
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1431
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1432
lemma PMatch_mkeps:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1433
  assumes "nullable r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1434
  shows "[] \<in> r \<rightarrow> mkeps r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1435
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1436
apply(induct r)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1437
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1438
apply (metis PMatch.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1439
apply(subst append.simps(1)[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1440
apply (rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1441
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1442
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1443
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1444
apply (rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1445
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1446
apply (rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1447
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1448
apply (rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1449
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1450
apply (metis nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1451
apply(metis PMatch.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1452
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1453
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1454
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1455
lemma PMatch1N:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1456
  assumes "s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1457
  shows "\<Turnstile> v : r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1458
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1459
apply(induct s r v rule: PMatch.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1460
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1461
apply (metis NPrf.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1462
apply (metis NPrf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1463
apply (metis NPrf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1464
apply (metis NPrf.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1465
apply (metis NPrf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1466
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1467
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1468
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1469
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1470
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1471
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1472
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1473
lemma PMatch_determ:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1474
  shows "\<lbrakk>s \<in> r \<rightarrow> v1; s \<in> r \<rightarrow> v2\<rbrakk> \<Longrightarrow> v1 = v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1475
  and   "\<lbrakk>s \<in> (STAR r) \<rightarrow> Stars vs1; s \<in> (STAR r) \<rightarrow> Stars vs2\<rbrakk> \<Longrightarrow> vs1 = vs2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1476
apply(induct v1 and vs1 arbitrary: s r v2 and s r vs2 rule: val.inducts)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1477
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1478
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1479
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1480
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1481
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1482
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1483
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1484
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1485
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1486
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1487
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1488
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1489
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1490
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1491
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1492
apply(rule conjI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1493
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1494
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1495
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1496
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1497
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1498
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1499
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1500
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1501
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1502
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1503
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1504
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1505
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1506
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1507
apply (metis NPrf_flat_L PMatch1(2) PMatch1N)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1508
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1509
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1510
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1511
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1512
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1513
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1514
apply (metis NPrf_flat_L PMatch1(2) PMatch1N)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1515
(* star case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1516
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1517
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1518
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1519
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1520
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1521
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1522
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1523
apply (metis PMatch1(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1524
apply(rotate_tac  3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1525
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1526
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1527
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1528
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1529
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1530
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1531
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1532
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1533
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1534
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1535
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1536
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1537
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1538
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1539
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1540
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1541
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1542
apply (metis PMatch1(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1543
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1544
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1545
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1546
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1547
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1548
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1549
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1550
apply(drule_tac x="s1 @ s2" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1551
apply(drule_tac x="rb" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1552
apply(drule_tac x="(va#vsa)" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1553
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1554
apply(drule meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1555
apply (metis L.simps(6) PMatch.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1556
apply (metis L.simps(6) PMatch.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1557
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1558
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1559
apply (metis L.simps(6) NPrf_flat_L PMatch1(2) PMatch1N)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1560
apply (metis L.simps(6) NPrf_flat_L PMatch1(2) PMatch1N)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1561
apply (metis L.simps(6) NPrf_flat_L PMatch1(2) PMatch1N)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1562
apply (metis L.simps(6) NPrf_flat_L PMatch1(2) PMatch1N)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1563
apply (metis PMatch1(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1564
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1565
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1566
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1567
by (metis PMatch1(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1568
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1569
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1570
lemma PMatch_Values:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1571
  assumes "s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1572
  shows "v \<in> Values r s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1573
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1574
apply(simp add: Values_def PMatch1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1575
by (metis append_Nil2 prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1576
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1577
lemma PMatch2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1578
  assumes "s \<in> (der c r) \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1579
  shows "(c#s) \<in> r \<rightarrow> (injval r c v)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1580
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1581
apply(induct c r arbitrary: s v rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1582
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1583
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1584
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1585
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1586
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1587
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1588
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1589
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1590
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1591
apply (metis PMatch.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1592
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1593
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1594
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1595
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1596
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1597
apply (metis PMatch.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1598
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1599
apply(rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1600
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1601
apply(simp add: L_flat_NPrf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1602
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1603
apply(frule_tac c="c" in v3_proj)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1604
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1605
apply(drule_tac x="projval r1 c v" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1606
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1607
apply (metis v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1608
apply (metis NPrf_imp_Prf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1609
(* SEQ case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1610
apply(case_tac "nullable r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1611
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1612
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1613
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1614
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1615
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1616
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1617
apply(subst append.simps(2)[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1618
apply(rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1619
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1620
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1621
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1622
apply(simp add: der_correctness Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1623
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1624
(* nullable case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1625
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1626
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1627
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1628
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1629
apply(simp_all)[4]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1630
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1631
apply(simp (no_asm))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1632
apply(subst append.simps(2)[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1633
apply(rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1634
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1635
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1636
apply(erule contrapos_nn)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1637
apply(erule exE)+
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1638
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1639
apply(simp add: L_flat_NPrf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1640
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1641
thm v3_proj
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1642
apply(frule_tac c="c" in v3_proj)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1643
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1644
apply(rule_tac x="s\<^sub>3" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1645
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1646
apply (metis NPrf_imp_Prf v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1647
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1648
(* interesting case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1649
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1650
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1651
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1652
apply(subst (asm) L.simps(4)[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1653
apply(simp only: L_flat_Prf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1654
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1655
apply(subst append.simps(1)[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1656
apply(rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1657
apply (metis PMatch_mkeps)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1658
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1659
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1660
apply(simp only: L_flat_NPrf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1661
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1662
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1663
apply(drule_tac x="Seq (projval r1 c v) vb" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1664
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1665
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1666
apply (metis append_Cons butlast_snoc list.sel(1) neq_Nil_conv rotate1.simps(2) v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1667
apply(subgoal_tac "\<turnstile> projval r1 c v : der c r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1668
apply (metis NPrf_imp_Prf Prf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1669
apply(rule NPrf_imp_Prf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1670
apply(rule v3_proj)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1671
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1672
apply (metis Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1673
(* Stars case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1674
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1675
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1676
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1677
apply(rotate_tac 2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1678
apply(frule_tac PMatch1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1679
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1680
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1681
apply(subst append.simps(2)[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1682
apply(rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1683
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1684
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1685
apply(rule PMatch.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1686
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1687
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1688
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1689
apply (metis L.simps(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1690
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1691
apply (metis NPrf_imp_Prf PMatch1N)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1692
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1693
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1694
apply(drule_tac x="s\<^sub>3" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1695
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1696
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1697
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1698
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1699
apply(drule_tac x="s1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1700
apply(drule_tac x="v1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1701
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1702
apply(rotate_tac 2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1703
apply(drule PMatch.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1704
apply(rule PMatch.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1705
apply (metis PMatch1(1) list.distinct(1) v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1706
apply (metis Nil_is_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1707
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1708
apply(subst der_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1709
apply(simp add: Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1710
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1711
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1712
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1713
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1714
lemma Sequ_single:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1715
  "(A ;; {t}) = {s @ t | s . s \<in> A}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1716
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1717
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1718
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1719
lemma Sequ_not:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1720
  assumes "\<forall>t. s \<notin> (L(der c r1) ;; {t})" "L r1 \<noteq> {}" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1721
  shows "\<forall>t. c # s \<notin> (L r1 ;; {t})"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1722
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1723
apply(simp add: der_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1724
apply(simp add: Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1725
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1726
apply(rule allI)+
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1727
apply(rule impI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1728
apply(simp add: Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1729
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1730
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1731
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1732
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1733
lemma PMatch_Roy2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1734
  assumes "2\<rhd> v : (der c r)" "\<exists>s. c # s \<in> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1735
  shows "2\<rhd> (injval r c v) : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1736
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1737
apply(induct c r arbitrary: v rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1738
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1739
apply(erule Roy2.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1740
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1741
apply (metis Roy2.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1742
(* alt case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1743
apply(erule Roy2.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1744
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1745
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1746
apply (metis Roy2.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1747
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1748
apply(rule Roy2.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1749
apply (metis (full_types) Prf_flat_L Roy2_props v3 v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1750
apply(subgoal_tac "\<forall>t. c # flat va \<notin> L r1 ;; {t}")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1751
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1752
apply(simp add: der_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1753
apply(simp add: Der_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1754
apply(simp add: Sequ_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1755
apply(rule allI)+
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1756
apply(rule impI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1757
apply(simp add: Cons_eq_append_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1758
apply(erule disjE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1759
apply(erule conjE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1760
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1761
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1762
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1763
apply(drule_tac x="[]" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1764
apply(drule_tac x="drop 1 t" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1765
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1766
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1767
oops 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1768
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1769
lemma lex_correct1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1770
  assumes "s \<notin> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1771
  shows "lex r s = None"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1772
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1773
apply(induct s arbitrary: r)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1774
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1775
apply (metis nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1776
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1777
apply(drule_tac x="der a r" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1778
apply(drule meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1779
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1780
apply(simp add: L_flat_Prf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1781
by (metis v3 v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1782
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1783
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1784
lemma lex_correct2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1785
  assumes "s \<in> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1786
  shows "\<exists>v. lex r s = Some(v) \<and> \<turnstile> v : r \<and> flat v = s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1787
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1788
apply(induct s arbitrary: r)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1789
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1790
apply (metis mkeps_flat mkeps_nullable nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1791
apply(drule_tac x="der a r" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1792
apply(drule meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1793
apply(simp add: L_flat_NPrf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1794
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1795
apply (metis v3_proj v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1796
apply (metis v3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1797
apply(rule v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1798
by metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1799
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1800
lemma lex_correct3:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1801
  assumes "s \<in> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1802
  shows "\<exists>v. lex r s = Some(v) \<and> s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1803
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1804
apply(induct s arbitrary: r)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1805
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1806
apply (metis PMatch_mkeps nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1807
apply(drule_tac x="der a r" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1808
apply(drule meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1809
apply(simp add: L_flat_NPrf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1810
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1811
apply (metis v3_proj v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1812
apply(rule PMatch2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1813
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1814
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1815
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1816
lemma lex_correct4:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1817
  assumes "s \<in> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1818
  shows "\<exists>v. lex r s = Some(v) \<and> \<Turnstile> v : r \<and> flat v = s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1819
using lex_correct3[OF assms]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1820
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1821
apply (metis PMatch1N)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1822
by (metis PMatch1(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1823
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1824
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1825
lemma lex_correct5:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1826
  assumes "s \<in> L r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1827
  shows "s \<in> r \<rightarrow> (lex2 r s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1828
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1829
apply(induct s arbitrary: r)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1830
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1831
apply (metis PMatch_mkeps nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1832
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1833
apply(rule PMatch2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1834
apply(drule_tac x="der a r" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1835
apply(drule meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1836
apply(simp add: L_flat_NPrf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1837
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1838
apply (metis v3_proj v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1839
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1840
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1841
lemma 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1842
  "lex2 (ALT (CHAR a) (ALT (CHAR b) (SEQ (CHAR a) (CHAR b)))) [a,b] = Right (Right (Seq (Char a) (Char b)))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1843
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1844
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1845
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1846
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1847
(* NOT DONE YET *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1848
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1849
section {* Sulzmann's Ordering of values *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1850
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1851
inductive ValOrd :: "val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<succ>_ _" [100, 100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1852
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1853
  "v2 \<succ>r2 v2' \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1 v2')" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1854
| "\<lbrakk>v1 \<succ>r1 v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1' v2')" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1855
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Right v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1856
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Left v1)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1857
| "v2 \<succ>r2 v2' \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Right v2')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1858
| "v1 \<succ>r1 v1' \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Left v1')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1859
| "Void \<succ>EMPTY Void"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1860
| "(Char c) \<succ>(CHAR c) (Char c)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1861
| "flat (Stars (v # vs)) = [] \<Longrightarrow> (Stars []) \<succ>(STAR r) (Stars (v # vs))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1862
| "flat (Stars (v # vs)) \<noteq> [] \<Longrightarrow> (Stars (v # vs)) \<succ>(STAR r) (Stars [])"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1863
| "\<lbrakk>v1 \<succ>r v2; v1 \<noteq> v2\<rbrakk> \<Longrightarrow> (Stars (v1 # vs1)) \<succ>(STAR r) (Stars (v2 # vs2))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1864
| "(Stars vs1) \<succ>(STAR r) (Stars vs2) \<Longrightarrow> (Stars (v # vs1)) \<succ>(STAR r) (Stars (v # vs2))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1865
| "(Stars []) \<succ>(STAR r) (Stars [])"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1866
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1867
lemma PMatch_ValOrd:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1868
  assumes "s \<in> r \<rightarrow> v" "v' \<in> SValues r s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1869
  shows "v \<succ>r v'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1870
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1871
apply(induct r arbitrary: v v' s rule: rexp.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1872
apply(simp add: SValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1873
apply(simp add: SValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1874
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1875
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1876
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1877
apply(simp add: SValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1878
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1879
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1880
apply (metis ValOrd.intros(8) empty_iff singletonD)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1881
apply(simp add: SValues_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1882
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1883
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1884
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1885
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1886
apply(case_tac "v1a = v1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1887
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1888
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1889
apply(rotate_tac 1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1890
apply(drule_tac x="v2a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1891
apply(rotate_tac 8)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1892
apply(drule_tac x="v2" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1893
apply(drule_tac x="s2a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1894
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1895
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1896
apply(simp add: SValues_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1897
apply (metis PMatch1(2) same_append_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1898
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1899
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1900
apply(drule_tac x="v1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1901
apply(rotate_tac 8)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1902
apply(drule_tac x="v1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1903
apply(drule_tac x="s1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1904
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1905
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1906
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1907
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1908
apply(case_tac "us=[]")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1909
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1910
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1911
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1912
apply(simp add: SValues_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1913
apply (metis Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1914
apply(erule disjE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1915
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1916
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1917
apply(simp add: SValues_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1918
apply (metis Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1919
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1920
apply(subst (asm) (2) Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1921
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1922
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1923
apply(simp add: rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1924
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1925
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1926
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1927
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1928
apply(case_tac "us = []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1929
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1930
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1931
apply (metis append_Nil2 prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1932
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1933
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1934
apply(drule_tac mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1935
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1936
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1937
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1938
(*HERE *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1939
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1940
inductive ValOrd2 :: "val \<Rightarrow> string \<Rightarrow> val \<Rightarrow> bool" ("_ 2\<succ>_ _" [100, 100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1941
where 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1942
  "v2 2\<succ>s v2' \<Longrightarrow> (Seq v1 v2) 2\<succ>(flat v1 @ s) (Seq v1 v2')" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1943
| "\<lbrakk>v1 2\<succ>s v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) 2\<succ>s (Seq v1' v2')" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1944
| "(flat v2) \<sqsubseteq> (flat v1) \<Longrightarrow> (Left v1) 2\<succ>(flat v1) (Right v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1945
| "(flat v1) \<sqsubset> (flat v2) \<Longrightarrow> (Right v2) 2\<succ>(flat v2) (Left v1)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1946
| "v2 2\<succ>s v2' \<Longrightarrow> (Right v2) 2\<succ>s (Right v2')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1947
| "v1 2\<succ>s v1' \<Longrightarrow> (Left v1) 2\<succ>s (Left v1')" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1948
| "Void 2\<succ>[] Void"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1949
| "(Char c) 2\<succ>[c] (Char c)" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1950
| "flat (Stars (v # vs)) = [] \<Longrightarrow> (Stars []) 2\<succ>[] (Stars (v # vs))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1951
| "flat (Stars (v # vs)) \<noteq> [] \<Longrightarrow> (Stars (v # vs)) 2\<succ>(flat (Stars (v # vs))) (Stars [])"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1952
| "\<lbrakk>v1 2\<succ>s v2; v1 \<noteq> v2\<rbrakk> \<Longrightarrow> (Stars (v1 # vs1)) 2\<succ>s (Stars (v2 # vs2))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1953
| "(Stars vs1) 2\<succ>s (Stars vs2) \<Longrightarrow> (Stars (v # vs1)) 2\<succ>(flat v @ s) (Stars (v # vs2))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1954
| "(Stars []) 2\<succ>[] (Stars [])"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1955
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1956
lemma ValOrd2_string1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1957
  assumes "v1 2\<succ>s v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1958
  shows "s \<sqsubseteq> flat v1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1959
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1960
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1961
apply(auto simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1962
apply (metis append_assoc)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1963
by (metis append_assoc)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1964
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1965
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1966
lemma admissibility:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1967
  assumes "s \<in> r \<rightarrow> v" "\<turnstile> v' : r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1968
  shows "(\<forall>s'. (s' \<in> L(r) \<and> s' \<sqsubseteq> s) \<longrightarrow> v 2\<succ>s' v')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1969
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1970
apply(induct arbitrary: v')
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1971
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1972
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1973
apply (metis ValOrd2.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1974
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1975
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1976
apply (metis ValOrd2.intros(8) append_Nil2 prefix_Cons prefix_append prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1977
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1978
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1979
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1980
apply (metis ValOrd2.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1981
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1982
apply(drule_tac x="v1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1983
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1984
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1985
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1986
apply (metis PMatch1(2) ValOrd2.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1987
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1988
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1989
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1990
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1991
apply(case_tac "v1 = v1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1992
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1993
apply(rotate_tac 3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1994
apply(drule_tac x="v2a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1995
apply(drule meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1996
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1997
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1998
apply(rule_tac x="flat v1a @ s'" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1999
apply (metis PMatch1(2) ValOrd2.intros(1) prefix_append)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2000
apply (metis PMatch1(2) ValOrd2.intros(2) ValOrd2_string1 flat.simps(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2001
prefer 4
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2002
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2003
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2004
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2005
apply (metis ValOrd2.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2006
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2007
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2008
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2009
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2010
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2011
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2012
lemma admissibility:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2013
  assumes "\<turnstile> s \<in> r \<rightarrow> v" "\<turnstile> v' : r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2014
  shows "v \<succ>r v'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2015
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2016
apply(induct arbitrary: v')
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2017
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2018
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2019
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2020
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2021
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2022
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2023
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2024
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2025
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2026
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2027
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2028
lemma admissibility:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2029
  assumes "2\<rhd> v : r" "\<turnstile> v' : r" "flat v' \<sqsubseteq> flat v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2030
  shows "v \<succ>r v'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2031
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2032
apply(induct arbitrary: v')
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2033
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2034
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2035
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2036
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2037
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2038
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2039
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2040
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2041
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2042
apply (metis ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2043
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2044
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2045
apply (metis Prf_flat_L ValOrd.intros(4) length_sprefix seq_empty(1) sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2046
apply (metis ValOrd.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2047
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2048
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2049
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2050
lemma admisibility:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2051
  assumes "\<rhd> v : r" "\<turnstile> v' : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2052
  shows "v \<succ>r v'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2053
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2054
apply(induct arbitrary: v')
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2055
prefer 5
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2056
apply(drule royA)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2057
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2058
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2059
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2060
apply(case_tac "v1 = v1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2061
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2062
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2063
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2064
apply (metis ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2065
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2066
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2067
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2068
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2069
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2070
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2071
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2072
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2073
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2074
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2075
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2076
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2077
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2078
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2079
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2080
(* seq case goes through *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2081
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2082
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2083
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2084
lemma admisibility:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2085
  assumes "\<rhd> v : r" "\<turnstile> v' : r" "flat v' \<sqsubseteq> flat v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2086
  shows "v \<succ>r v'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2087
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2088
apply(induct arbitrary: v')
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2089
prefer 5
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2090
apply(drule royA)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2091
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2092
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2093
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2094
apply(case_tac "v1 = v1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2095
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2096
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2097
apply(subst (asm) (3) prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2098
apply(erule exE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2099
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2100
apply (metis prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2101
(* the unequal case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2102
apply(subgoal_tac "flat v1 \<sqsubset> flat v1a \<or> flat v1a \<sqsubseteq> flat v1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2103
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2104
apply(simp add: prefix_def sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2105
apply (metis append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2106
apply(erule disjE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2107
(* first case  flat v1 \<sqsubset> flat v1a *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2108
apply(subst (asm) sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2109
apply(subst (asm) (5) prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2110
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2111
apply(subgoal_tac "(s3 @ flat v2a) \<sqsubseteq> flat v2")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2112
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2113
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2114
apply (metis append_assoc prefix_append)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2115
apply(subgoal_tac "s3 \<noteq> []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2116
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2117
apply (metis append_Nil2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2118
(* HERE *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2119
apply(subst (asm) (5) prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2120
apply(erule exE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2121
apply(simp add: ders_correctness Ders_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2122
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2123
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2124
apply(subst (asm) append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2125
apply(erule exE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2126
apply(erule disjE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2127
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2128
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2129
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2130
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2131
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2132
lemma ValOrd_refl:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2133
  assumes "\<turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2134
  shows "v \<succ>r v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2135
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2136
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2137
apply(auto intro: ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2138
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2139
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2140
lemma ValOrd_total:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2141
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r\<rbrakk>  \<Longrightarrow> v1 \<succ>r v2 \<or> v2 \<succ>r v1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2142
apply(induct r arbitrary: v1 v2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2143
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2144
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2145
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2146
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2147
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2148
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2149
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2150
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2151
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2152
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2153
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2154
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2155
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2156
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2157
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2158
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2159
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2160
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2161
apply(case_tac "v1a = v1b")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2162
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2163
apply(rule ValOrd.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2164
apply (metis ValOrd.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2165
apply(rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2166
apply(auto)[2]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2167
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2168
apply(rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2169
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2170
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2171
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2172
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2173
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2174
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2175
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2176
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2177
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2178
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2179
apply (metis le_eq_less_or_eq neq_iff)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2180
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2181
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2182
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2183
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2184
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2185
apply (metis le_eq_less_or_eq neq_iff)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2186
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2187
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2188
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2189
apply(metis)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2190
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2191
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2192
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2193
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2194
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2195
apply (metis ValOrd.intros(13))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2196
apply (metis ValOrd.intros(10) ValOrd.intros(9))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2197
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2198
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2199
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2200
apply (metis ValOrd.intros(10) ValOrd.intros(9))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2201
apply(case_tac "v = va")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2202
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2203
apply (metis ValOrd.intros(11))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2204
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2205
apply(rule ValOrd.intros(12))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2206
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2207
apply(rule ValOrd.intros(12))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2208
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2209
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2210
lemma Roy_posix:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2211
  assumes "\<rhd> v : r" "\<turnstile> v' : r" "flat v' \<sqsubseteq> flat v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2212
  shows "v \<succ>r v'"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2213
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2214
apply(induct r arbitrary: v v' rule: rexp.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2215
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2216
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2217
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2218
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2219
apply(erule Roy.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2220
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2221
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2222
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2223
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2224
apply(erule Roy.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2225
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2226
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2227
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2228
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2229
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2230
apply(erule Roy.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2231
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2232
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2233
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2234
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2235
apply (metis Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2236
apply(erule Roy.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2237
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2238
apply (metis ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2239
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2240
apply (metis ValOrd.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2241
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2242
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2243
apply(erule Roy.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2244
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2245
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2246
apply(case_tac "v1a = v1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2247
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2248
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2249
apply (metis prefix_append)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2250
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2251
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2252
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2253
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2254
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2255
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2256
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2257
apply(drule_tac x="v1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2258
apply(rotate_tac 9)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2259
apply(drule_tac x="v1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2260
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2261
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2262
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2263
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2264
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2265
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2266
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2267
apply(drule_tac mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2268
apply (metis Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2269
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2270
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2271
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2272
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2273
lemma ValOrd_anti:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2274
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r; v1 \<succ>r v2; v2 \<succ>r v1\<rbrakk> \<Longrightarrow> v1 = v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2275
  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"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2276
apply(induct v1 and vs1 arbitrary: r v2 and r vs2 rule: val.inducts)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2277
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2278
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2279
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2280
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2281
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2282
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2283
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2284
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2285
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2286
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2287
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2288
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2289
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2290
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2291
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2292
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2293
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2294
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2295
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2296
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2297
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2298
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2299
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2300
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2301
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2302
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2303
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2304
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2305
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2306
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2307
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2308
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2309
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2310
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2311
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2312
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2313
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2314
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2315
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2316
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2317
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2318
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2319
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2320
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2321
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2322
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2323
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2324
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2325
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2326
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2327
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2328
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2329
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2330
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2331
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2332
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2333
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2334
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2335
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2336
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2337
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2338
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2339
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2340
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2341
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2342
(*
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2343
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2344
lemma ValOrd_PMatch:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2345
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2  \<sqsubseteq> s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2346
  shows "v1 \<succ>r v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2347
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2348
apply(induct r arbitrary: s v1 v2 rule: rexp.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2349
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2350
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2351
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2352
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2353
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2354
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2355
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2356
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2357
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2358
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2359
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2360
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2361
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2362
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2363
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2364
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2365
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2366
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2367
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2368
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2369
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2370
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2371
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2372
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2373
apply (metis ValOrd.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2374
(* Stars case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2375
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2376
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2377
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2378
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2379
apply (metis Nil_is_append_conv ValOrd.intros(10) flat.simps(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2380
apply (metis ValOrd.intros(13))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2381
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2382
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2383
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2384
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2385
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2386
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2387
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2388
apply(drule_tac x="s1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2389
apply(drule_tac x="va" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2390
apply(drule_tac x="v" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2391
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2392
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2393
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2394
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2395
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2396
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2397
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2398
prefer 3
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2399
(* Seq case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2400
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2401
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2402
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2403
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2404
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2405
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2406
apply(case_tac "v1b = v1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2407
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2408
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2409
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2410
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2411
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2412
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2413
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2414
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2415
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2416
apply (metis ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2417
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2418
apply (metis ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2419
apply(case_tac "us = []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2420
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2421
apply (metis ValOrd.intros(2) append_Nil2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2422
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2423
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2424
apply(drule_tac mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2425
apply (metis Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2426
apply(drule_tac x="s1 @ us" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2427
apply(drule_tac x="v1b" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2428
apply(drule_tac x="v1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2429
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2430
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2431
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2432
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2433
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2434
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2435
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2436
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2437
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2438
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2439
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2440
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2441
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2442
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2443
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2444
apply (metis ValOrd.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2445
(* Seq case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2446
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2447
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2448
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2449
apply(case_tac "v1 = v1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2450
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2451
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2452
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2453
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2454
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2455
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2456
apply(frule PMatch1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2457
apply(frule PMatch1(2)[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2458
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2459
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2460
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2461
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2462
apply (metis ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2463
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2464
apply (metis ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2465
apply(case_tac "us = []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2466
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2467
apply (metis ValOrd.intros(2) append_Nil2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2468
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2469
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2470
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2471
apply (metis  Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2472
apply(drule_tac x="v1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2473
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2474
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2475
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2476
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2477
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2478
lemma ValOrd_PMatch:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2479
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2  \<sqsubseteq> s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2480
  shows "v1 \<succ>r v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2481
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2482
apply(induct arbitrary: v2 rule: .induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2483
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2484
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2485
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2486
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2487
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2488
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2489
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2490
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2491
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2492
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2493
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2494
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2495
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2496
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2497
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2498
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2499
apply (metis ValOrd.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2500
(* Seq case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2501
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2502
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2503
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2504
apply(case_tac "v1 = v1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2505
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2506
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2507
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2508
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2509
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2510
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2511
apply(frule PMatch1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2512
apply(frule PMatch1(2)[symmetric])
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2513
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2514
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2515
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2516
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2517
apply (metis ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2518
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2519
apply (metis ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2520
apply(case_tac "us = []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2521
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2522
apply (metis ValOrd.intros(2) append_Nil2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2523
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2524
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2525
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2526
apply (metis  Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2527
apply(drule_tac x="v1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2528
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2529
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2530
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2531
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2532
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2533
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2534
apply(rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2535
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2536
apply(drule_tac x="v1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2537
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2538
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2539
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2540
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2541
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2542
thm append_eq_append_conv
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2543
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2544
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2545
apply (metis Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2546
apply(case_tac "us = []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2547
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2548
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2549
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2550
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2551
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2552
inductive ValOrd2 :: "val \<Rightarrow> val \<Rightarrow> bool" ("_ 2\<succ> _" [100, 100] 100)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2553
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2554
  "v2 2\<succ> v2' \<Longrightarrow> (Seq v1 v2) 2\<succ> (Seq v1 v2')" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2555
| "\<lbrakk>v1 2\<succ> v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) 2\<succ> (Seq v1' v2')" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2556
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) 2\<succ> (Right v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2557
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) 2\<succ> (Left v1)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2558
| "v2 2\<succ> v2' \<Longrightarrow> (Right v2) 2\<succ> (Right v2')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2559
| "v1 2\<succ> v1' \<Longrightarrow> (Left v1) 2\<succ> (Left v1')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2560
| "Void 2\<succ> Void"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2561
| "(Char c) 2\<succ> (Char c)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2562
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2563
lemma Ord1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2564
  "v1 \<succ>r v2 \<Longrightarrow> v1 2\<succ> v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2565
apply(induct rule: ValOrd.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2566
apply(auto intro: ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2567
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2568
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2569
lemma Ord2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2570
  "v1 2\<succ> v2 \<Longrightarrow> \<exists>r. v1 \<succ>r v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2571
apply(induct v1 v2 rule: ValOrd2.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2572
apply(auto intro: ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2573
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2574
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2575
lemma Ord3:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2576
  "\<lbrakk>v1 2\<succ> v2; \<turnstile> v1 : r\<rbrakk> \<Longrightarrow> v1 \<succ>r v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2577
apply(induct v1 v2 arbitrary: r rule: ValOrd2.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2578
apply(auto intro: ValOrd.intros elim: Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2579
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2580
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2581
section {* Posix definition *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2582
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2583
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2584
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2585
  "POSIX v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v' \<sqsubseteq> flat v) \<longrightarrow> v \<succ>r v'))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2586
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2587
lemma ValOrd_refl:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2588
  assumes "\<turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2589
  shows "v \<succ>r v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2590
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2591
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2592
apply(auto intro: ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2593
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2594
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2595
lemma ValOrd_total:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2596
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r\<rbrakk>  \<Longrightarrow> v1 \<succ>r v2 \<or> v2 \<succ>r v1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2597
apply(induct r arbitrary: v1 v2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2598
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2599
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2600
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2601
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2602
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2603
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2604
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2605
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2606
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2607
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2608
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2609
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2610
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2611
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2612
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2613
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2614
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2615
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2616
apply(case_tac "v1a = v1b")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2617
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2618
apply(rule ValOrd.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2619
apply (metis ValOrd.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2620
apply(rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2621
apply(auto)[2]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2622
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2623
apply(rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2624
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2625
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2626
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2627
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2628
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2629
apply (metis Ord1 Ord3 Prf.intros(2) ValOrd2.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2630
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2631
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2632
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2633
apply (metis le_eq_less_or_eq neq_iff)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2634
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2635
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2636
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2637
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2638
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2639
apply (metis le_eq_less_or_eq neq_iff)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2640
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2641
apply(erule contrapos_np)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2642
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2643
by metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2644
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2645
lemma ValOrd_anti:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2646
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r; v1 \<succ>r v2; v2 \<succ>r v1\<rbrakk> \<Longrightarrow> v1 = v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2647
apply(induct r arbitrary: v1 v2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2648
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2649
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2650
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2651
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2652
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2653
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2654
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2655
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2656
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2657
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2658
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2659
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2660
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2661
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2662
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2663
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2664
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2665
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2666
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2667
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2668
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2669
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2670
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2671
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2672
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2673
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2674
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2675
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2676
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2677
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2678
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2679
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2680
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2681
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2682
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2683
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2684
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2685
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2686
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2687
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2688
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2689
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2690
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2691
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2692
lemma POSIX_ALT_I1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2693
  assumes "POSIX v1 r1" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2694
  shows "POSIX (Left v1) (ALT r1 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2695
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2696
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2697
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2698
apply (metis Prf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2699
apply(rotate_tac 2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2700
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2701
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2702
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2703
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2704
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2705
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2706
by (metis le_eq_less_or_eq length_sprefix sprefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2707
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2708
lemma POSIX_ALT_I2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2709
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2710
  shows "POSIX (Right v2) (ALT r1 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2711
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2712
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2713
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2714
apply (metis Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2715
apply(rotate_tac 3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2716
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2717
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2718
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2719
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2720
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2721
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2722
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2723
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2724
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2725
thm PMatch.intros[no_vars]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2726
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2727
lemma POSIX_PMatch:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2728
  assumes "s \<in> r \<rightarrow> v" "\<turnstile> v' : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2729
  shows "length (flat v') \<le> length (flat v)" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2730
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2731
apply(induct arbitrary: s v v' rule: rexp.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2732
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2733
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2734
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2735
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2736
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2737
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2738
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2739
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2740
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2741
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2742
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2743
apply(erule PMatch.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2744
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2745
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2746
apply(simp add: L_flat_Prf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2747
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2748
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2749
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2750
apply (metis POSIX_ALT_I1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2751
apply(rule POSIX_ALT_I2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2752
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2753
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2754
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2755
apply(frule PMatch1(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2756
apply(frule PMatch1(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2757
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2758
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2759
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2760
lemma POSIX_PMatch:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2761
  assumes "s \<in> r \<rightarrow> v" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2762
  shows "POSIX v r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2763
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2764
apply(induct arbitrary: rule: PMatch.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2765
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2766
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2767
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2768
apply (metis Prf.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2769
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2770
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2771
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2772
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2773
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2774
apply (metis Prf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2775
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2776
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2777
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2778
apply (metis POSIX_ALT_I1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2779
apply(rule POSIX_ALT_I2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2780
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2781
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2782
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2783
apply(frule PMatch1(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2784
apply(frule PMatch1(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2785
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2786
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2787
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2788
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2789
lemma ValOrd_PMatch:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2790
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2 = s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2791
  shows "v1 \<succ>r v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2792
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2793
apply(induct arbitrary: v2 rule: PMatch.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2794
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2795
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2796
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2797
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2798
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2799
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2800
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2801
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2802
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2803
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2804
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2805
apply (metis PMatch1(2) ValOrd.intros(3) order_refl)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2806
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2807
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2808
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2809
apply (metis Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2810
apply (metis ValOrd.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2811
(* Seq case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2812
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2813
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2814
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2815
apply(case_tac "v1 = v1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2816
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2817
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2818
apply(rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2819
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2820
apply(drule_tac x="v1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2821
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2822
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2823
apply(drule_tac meta_mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2824
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2825
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2826
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2827
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2828
apply (metis Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2829
apply(case_tac "us = []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2830
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2831
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2832
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2833
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2834
thm L_flat_Prf
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2835
apply(simp add: L_flat_Prf)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2836
thm append_eq_append_conv2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2837
apply(simp add: append_eq_append_conv2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2838
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2839
apply(drule_tac x="us" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2840
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2841
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2842
apply (metis append_Nil2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2843
apply(case_tac "us = []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2844
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2845
apply(drule_tac x="s2" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2846
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2847
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2848
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2849
apply(drule_tac x="v1a" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2850
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2851
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2852
lemma refl_on_ValOrd:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2853
  "refl_on (Values r s) {(v1, v2). v1 \<succ>r v2 \<and> v1 \<in> Values r s \<and> v2 \<in> Values r s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2854
unfolding refl_on_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2855
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2856
apply(rule ValOrd_refl)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2857
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2858
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2859
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2860
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2861
section {* Posix definition *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2862
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2863
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2864
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2865
  "POSIX v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v \<succ>r v'))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2866
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2867
definition POSIX2 :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2868
where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2869
  "POSIX2 v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v 2\<succ> v'))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2870
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2871
lemma "POSIX v r = POSIX2 v r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2872
unfolding POSIX_def POSIX2_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2873
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2874
apply(rule Ord1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2875
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2876
apply(rule Ord3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2877
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2878
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2879
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2880
section {* POSIX for some constructors *}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2881
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2882
lemma POSIX_SEQ1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2883
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2884
  shows "POSIX v1 r1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2885
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2886
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2887
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2888
apply(drule_tac x="Seq v' v2" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2889
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2890
apply(erule impE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2891
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2892
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2893
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2894
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2895
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2896
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2897
by (metis ValOrd_refl)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2898
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2899
lemma POSIX_SEQ2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2900
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2901
  shows "POSIX v2 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2902
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2903
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2904
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2905
apply(drule_tac x="Seq v1 v'" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2906
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2907
apply(erule impE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2908
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2909
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2910
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2911
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2912
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2913
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2914
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2915
lemma POSIX_ALT2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2916
  assumes "POSIX (Left v1) (ALT r1 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2917
  shows "POSIX v1 r1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2918
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2919
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2920
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2921
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2922
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2923
apply(drule_tac x="Left v'" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2924
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2925
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2926
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2927
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2928
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2929
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2930
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2931
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2932
lemma POSIX_ALT1a:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2933
  assumes "POSIX (Right v2) (ALT r1 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2934
  shows "POSIX v2 r2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2935
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2936
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2937
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2938
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2939
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2940
apply(drule_tac x="Right v'" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2941
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2942
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2943
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2944
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2945
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2946
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2947
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2948
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2949
lemma POSIX_ALT1b:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2950
  assumes "POSIX (Right v2) (ALT r1 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2951
  shows "(\<forall>v'. (\<turnstile> v' : r2 \<and> flat v' = flat v2) \<longrightarrow> v2 \<succ>r2 v')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2952
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2953
apply(drule_tac POSIX_ALT1a)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2954
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2955
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2956
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2957
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2958
lemma POSIX_ALT_I1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2959
  assumes "POSIX v1 r1" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2960
  shows "POSIX (Left v1) (ALT r1 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2961
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2962
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2963
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2964
apply (metis Prf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2965
apply(rotate_tac 2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2966
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2967
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2968
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2969
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2970
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2971
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2972
by simp
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2973
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2974
lemma POSIX_ALT_I2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2975
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2976
  shows "POSIX (Right v2) (ALT r1 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2977
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2978
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2979
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2980
apply (metis Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2981
apply(rotate_tac 3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2982
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2983
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2984
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2985
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2986
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2987
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2988
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2989
lemma mkeps_POSIX:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2990
  assumes "nullable r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2991
  shows "POSIX (mkeps r) r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2992
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2993
apply(induct r)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2994
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2995
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2996
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2997
apply (metis Prf.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2998
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2999
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3000
apply (metis ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3001
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3002
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3003
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3004
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3005
apply (metis mkeps.simps(2) mkeps_nullable nullable.simps(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3006
apply(rotate_tac 6)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3007
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3008
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3009
apply (simp add: mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3010
apply(case_tac "mkeps r1a = v1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3011
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3012
apply (metis ValOrd.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3013
apply (rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3014
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3015
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3016
(* ALT case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3017
thm mkeps.simps
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3018
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3019
apply(erule disjE)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3020
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3021
apply (metis POSIX_ALT_I1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3022
(* *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3023
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3024
thm  POSIX_ALT_I1
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3025
apply (metis POSIX_ALT_I1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3026
apply(simp (no_asm) add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3027
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3028
apply(rule Prf.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3029
apply(simp only: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3030
apply(rotate_tac 4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3031
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3032
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3033
thm mkeps_flat
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3034
apply(simp add: mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3035
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3036
thm Prf_flat_L nullable_correctness
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3037
apply (metis Prf_flat_L nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3038
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3039
apply(subst (asm) POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3040
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3041
apply(drule_tac x="v2" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3042
by simp
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3043
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3044
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3045
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3046
text {*
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3047
  Injection value is related to r
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3048
*}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3049
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3050
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3051
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3052
text {*
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3053
  The string behind the injection value is an added c
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3054
*}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3055
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3056
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3057
lemma injval_inj: "inj_on (injval r c) {v. \<turnstile> v : der c r}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3058
apply(induct c r rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3059
unfolding inj_on_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3060
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3061
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3062
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3063
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3064
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3065
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3066
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3067
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3068
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3069
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3070
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3071
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3072
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3073
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3074
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3075
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3076
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3077
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3078
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3079
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3080
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3081
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3082
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3083
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3084
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3085
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3086
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3087
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3088
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3089
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3090
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3091
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3092
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3093
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3094
apply (metis list.distinct(1) mkeps_flat v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3095
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3096
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3097
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3098
apply(rotate_tac 6)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3099
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3100
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3101
apply (metis list.distinct(1) mkeps_flat v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3102
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3103
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3104
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3105
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3106
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3107
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3108
lemma Values_nullable:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3109
  assumes "nullable r1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3110
  shows "mkeps r1 \<in> Values r1 s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3111
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3112
apply(induct r1 arbitrary: s)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3113
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3114
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3115
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3116
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3117
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3118
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3119
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3120
lemma Values_injval:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3121
  assumes "v \<in> Values (der c r) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3122
  shows "injval r c v \<in> Values r (c#s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3123
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3124
apply(induct c r arbitrary: v s rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3125
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3126
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3127
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3128
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3129
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3130
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3131
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3132
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3133
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3134
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3135
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3136
apply(case_tac "nullable r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3137
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3138
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3139
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3140
apply(simp add: rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3141
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3142
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3143
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3144
apply(rule Values_nullable)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3145
apply(assumption)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3146
apply(simp add: rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3147
apply(subst mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3148
apply(assumption)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3149
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3150
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3151
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3152
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3153
apply(simp add: rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3154
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3155
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3156
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3157
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3158
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3159
lemma Values_projval:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3160
  assumes "v \<in> Values r (c#s)" "\<exists>s. flat v = c # s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3161
  shows "projval r c v \<in> Values (der c r) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3162
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3163
apply(induct r arbitrary: v s c rule: rexp.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3164
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3165
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3166
apply(case_tac "c = char")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3167
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3168
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3169
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3170
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3171
apply(simp add: prefix_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3172
apply(case_tac "nullable rexp1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3173
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3174
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3175
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3176
apply(simp add: rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3177
apply (metis hd_Cons_tl hd_append2 list.sel(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3178
apply(simp add: rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3179
apply(simp add: append_eq_Cons_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3180
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3181
apply(subst v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3182
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3183
apply(assumption)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3184
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3185
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3186
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3187
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3188
apply(auto simp add: Values_def not_nullable_flat)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3189
apply(simp add: append_eq_Cons_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3190
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3191
apply(simp add: append_eq_Cons_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3192
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3193
apply(simp add: rest_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3194
apply(subst v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3195
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3196
apply(assumption)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3197
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3198
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3199
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3200
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3201
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3202
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3203
definition "MValue v r s \<equiv> (v \<in> Values r s \<and> (\<forall>v' \<in> Values r s. v 2\<succ> v'))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3204
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3205
lemma MValue_ALTE:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3206
  assumes "MValue v (ALT r1 r2) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3207
  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> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3208
         (\<exists>vr. v = Right vr \<and> MValue vr r2 s \<and> (\<forall>vl \<in> Values r1 s. length (flat vl) < length (flat vr)))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3209
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3210
apply(simp add: MValue_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3211
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3212
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3213
apply(drule_tac x="Left x" in bspec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3214
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3215
apply(erule ValOrd2.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3216
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3217
apply(drule_tac x="Right vr" in bspec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3218
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3219
apply(erule ValOrd2.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3220
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3221
apply(drule_tac x="Right x" in bspec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3222
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3223
apply(erule ValOrd2.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3224
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3225
apply(drule_tac x="Left vl" in bspec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3226
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3227
apply(erule ValOrd2.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3228
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3229
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3230
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3231
lemma MValue_ALTI1:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3232
  assumes "MValue vl r1 s"  "\<forall>vr \<in> Values r2 s. length (flat vr) \<le> length (flat vl)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3233
  shows "MValue (Left vl) (ALT r1 r2) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3234
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3235
apply(simp add: MValue_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3236
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3237
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3238
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3239
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3240
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3241
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3242
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3243
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3244
lemma MValue_ALTI2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3245
  assumes "MValue vr r2 s"  "\<forall>vl \<in> Values r1 s. length (flat vl) < length (flat vr)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3246
  shows "MValue (Right vr) (ALT r1 r2) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3247
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3248
apply(simp add: MValue_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3249
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3250
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3251
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3252
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3253
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3254
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3255
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3256
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3257
lemma t: "(c#xs = c#ys) \<Longrightarrow> xs = ys"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3258
by (metis list.sel(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3259
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3260
lemma t2: "(xs = ys) \<Longrightarrow> (c#xs) = (c#ys)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3261
by (metis)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3262
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3263
lemma "\<not>(nullable r) \<Longrightarrow> \<not>(\<exists>v. \<turnstile> v : r \<and> flat v = [])"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3264
by (metis Prf_flat_L nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3265
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3266
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3267
lemma LeftRight:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3268
  assumes "(Left v1) \<succ>(der c (ALT r1 r2)) (Right v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3269
  and "\<turnstile> v1 : der c r1" "\<turnstile> v2 : der c r2" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3270
  shows "(injval (ALT r1 r2) c (Left v1)) \<succ>(ALT r1 r2) (injval (ALT r1 r2) c (Right v2))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3271
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3272
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3273
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3274
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3275
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3276
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3277
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3278
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3279
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3280
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3281
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3282
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3283
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3284
lemma RightLeft:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3285
  assumes "(Right v1) \<succ>(der c (ALT r1 r2)) (Left v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3286
  and "\<turnstile> v1 : der c r2" "\<turnstile> v2 : der c r1" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3287
  shows "(injval (ALT r1 r2) c (Right v1)) \<succ>(ALT r1 r2) (injval (ALT r1 r2) c (Left v2))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3288
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3289
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3290
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3291
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3292
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3293
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3294
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3295
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3296
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3297
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3298
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3299
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3300
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3301
lemma h: 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3302
  assumes "nullable r1" "\<turnstile> v1 : der c r1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3303
  shows "injval r1 c v1 \<succ>r1 mkeps r1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3304
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3305
apply(induct r1 arbitrary: v1 rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3306
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3307
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3308
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3309
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3310
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3311
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3312
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3313
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3314
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3315
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3316
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3317
apply (metis ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3318
apply (metis ValOrd.intros(3) le_add2 list.size(3) mkeps_flat monoid_add_class.add.right_neutral)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3319
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3320
apply (metis ValOrd.intros(4) length_greater_0_conv list.distinct(1) list.size(3) mkeps_flat v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3321
apply (metis ValOrd.intros(4) length_greater_0_conv list.distinct(1) list.size(3) mkeps_flat v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3322
apply (metis ValOrd.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3323
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3324
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3325
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3326
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3327
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3328
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3329
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3330
apply (metis ValOrd.intros(2) list.distinct(1) mkeps_flat v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3331
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3332
by (metis ValOrd.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3333
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3334
lemma LeftRightSeq:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3335
  assumes "(Left (Seq v1 v2)) \<succ>(der c (SEQ r1 r2)) (Right v3)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3336
  and "nullable r1" "\<turnstile> v1 : der c r1"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3337
  shows "(injval (SEQ r1 r2) c (Seq v1 v2)) \<succ>(SEQ r1 r2) (injval (SEQ r1 r2) c (Right v2))"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3338
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3339
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3340
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3341
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3342
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3343
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3344
apply(rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3345
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3346
apply (metis list.distinct(1) mkeps_flat v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3347
by (metis h)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3348
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3349
lemma rr1: 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3350
  assumes "\<turnstile> v : r" "\<not>nullable r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3351
  shows "flat v \<noteq> []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3352
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3353
by (metis Prf_flat_L nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3354
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3355
(* HERE *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3356
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3357
lemma Prf_inj_test:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3358
  assumes "v1 \<succ>(der c r) v2" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3359
          "v1 \<in> Values (der c r) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3360
          "v2 \<in> Values (der c r) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3361
          "injval r c v1 \<in> Values r (c#s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3362
          "injval r c v2 \<in> Values r (c#s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3363
  shows "(injval r c v1) 2\<succ>  (injval r c v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3364
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3365
apply(induct c r arbitrary: v1 v2 s rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3366
(* NULL case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3367
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3368
(* EMPTY case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3369
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3370
(* CHAR case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3371
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3372
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3373
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3374
apply (metis ValOrd2.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3375
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3376
(* ALT case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3377
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3378
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3379
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3380
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3381
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3382
apply (metis ValOrd2.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3383
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3384
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3385
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3386
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3387
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3388
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3389
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3390
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3391
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3392
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3393
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3394
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3395
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3396
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3397
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3398
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3399
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3400
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3401
apply (metis ValOrd2.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3402
(* SEQ case*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3403
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3404
apply(case_tac "nullable r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3405
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3406
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3407
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3408
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3409
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3410
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3411
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3412
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3413
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3414
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3415
apply (metis Ord1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3416
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3417
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3418
apply(subgoal_tac "rest v1 (flat v1 @ flat v2) = flat v2")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3419
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3420
apply(subgoal_tac "rest (injval r1 c v1) (c # flat v1 @ flat v2) = flat v2")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3421
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3422
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3423
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3424
lemma Prf_inj_test:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3425
  assumes "v1 \<succ>(der c r) v2" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3426
          "v1 \<in> Values (der c r) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3427
          "v2 \<in> Values (der c r) s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3428
          "injval r c v1 \<in> Values r (c#s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3429
          "injval r c v2 \<in> Values r (c#s)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3430
  shows "(injval r c v1) 2\<succ>  (injval r c v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3431
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3432
apply(induct c r arbitrary: v1 v2 s rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3433
(* NULL case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3434
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3435
(* EMPTY case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3436
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3437
(* CHAR case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3438
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3439
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3440
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3441
apply (metis ValOrd2.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3442
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3443
(* ALT case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3444
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3445
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3446
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3447
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3448
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3449
apply (metis ValOrd2.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3450
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3451
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3452
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3453
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3454
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3455
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3456
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3457
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3458
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3459
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3460
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3461
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3462
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3463
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3464
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3465
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3466
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3467
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3468
apply (metis ValOrd2.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3469
(* SEQ case*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3470
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3471
apply(case_tac "nullable r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3472
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3473
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3474
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3475
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3476
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3477
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3478
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3479
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3480
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3481
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3482
apply (metis Ord1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3483
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3484
apply(rule ValOrd2.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3485
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3486
using injval_inj
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3487
apply(simp add: Values_def inj_on_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3488
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3489
apply(simp add: Values_recs)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3490
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3491
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3492
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3493
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3494
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3495
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3496
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3497
apply (metis Ord1 ValOrd2.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3498
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3499
apply(rule ValOrd2.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3500
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3501
using injval_inj
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3502
apply(simp add: Values_def inj_on_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3503
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3504
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3505
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3506
apply(rule ValOrd2.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3507
thm h
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3508
apply(rule Ord1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3509
apply(rule h)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3510
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3511
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3512
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3513
apply (metis list.distinct(1) mkeps_flat v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3514
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3515
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3516
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3517
apply(simp add: Values_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3518
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3519
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3520
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3521
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3522
apply(rule ValOrd2.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3523
apply(rotate_tac 1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3524
apply(drule_tac x="v2" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3525
apply(rotate_tac 8)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3526
apply(drule_tac x="v2'" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3527
apply(rotate_tac 8)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3528
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3529
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3530
lemma POSIX_der:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3531
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3532
  shows "POSIX (injval r c v) r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3533
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3534
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3535
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3536
thm v3
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3537
apply (erule v3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3538
thm v4
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3539
apply(subst (asm) v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3540
apply(assumption)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3541
apply(drule_tac x="projval r c v'" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3542
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3543
apply(rule conjI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3544
thm v3_proj
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3545
apply(rule v3_proj)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3546
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3547
apply(rule_tac x="flat v" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3548
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3549
thm t
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3550
apply(rule_tac c="c" in  t)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3551
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3552
thm v4_proj
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3553
apply(subst v4_proj)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3554
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3555
apply(rule_tac x="flat v" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3556
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3557
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3558
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3559
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3560
lemma POSIX_der:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3561
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3562
  shows "POSIX (injval r c v) r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3563
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3564
apply(induct c r arbitrary: v rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3565
(* null case*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3566
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3567
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3568
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3569
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3570
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3571
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3572
(* empty case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3573
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3574
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3575
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3576
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3577
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3578
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3579
(* char case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3580
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3581
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3582
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3583
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3584
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3585
apply (metis Prf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3586
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3587
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3588
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3589
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3590
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3591
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3592
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3593
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3594
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3595
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3596
(* alt case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3597
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3598
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3599
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3600
apply(simp (no_asm) add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3601
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3602
apply (metis Prf.intros(2) v3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3603
apply(rotate_tac 4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3604
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3605
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3606
apply (metis POSIX_ALT2 POSIX_def ValOrd.intros(6))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3607
apply (metis ValOrd.intros(3) order_refl)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3608
apply(simp (no_asm) add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3609
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3610
apply (metis Prf.intros(3) v3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3611
apply(rotate_tac 4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3612
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3613
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3614
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3615
apply (metis POSIX_ALT1a POSIX_def ValOrd.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3616
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3617
apply(subst (asm) (5) POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3618
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3619
apply(rotate_tac 5)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3620
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3621
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3622
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3623
apply(subst (asm) v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3624
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3625
apply(drule_tac x="Left (projval r1a c v1)" in spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3626
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3627
apply(drule mp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3628
apply(rule conjI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3629
apply (metis Prf.intros(2) v3_proj)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3630
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3631
apply (metis v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3632
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3633
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3634
apply (metis less_not_refl v4_proj2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3635
(* seq case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3636
apply(case_tac "nullable r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3637
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3638
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3639
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3640
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3641
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3642
apply (metis Prf.intros(1) v3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3643
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3644
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3645
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3646
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3647
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3648
apply(subst (asm) (3) v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3649
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3650
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3651
apply(subgoal_tac "flat v1a \<noteq> []")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3652
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3653
apply (metis Prf_flat_L nullable_correctness)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3654
apply(subgoal_tac "\<exists>s. flat v1a = c # s")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3655
prefer 2
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3656
apply (metis append_eq_Cons_conv)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3657
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3658
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3659
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3660
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3661
lemma POSIX_ex: "\<turnstile> v : r \<Longrightarrow> \<exists>v. POSIX v r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3662
apply(induct r arbitrary: v)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3663
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3664
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3665
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3666
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3667
apply(rule_tac x="Void" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3668
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3669
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3670
apply (metis Prf.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3671
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3672
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3673
apply (metis ValOrd.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3674
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3675
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3676
apply(rule_tac x="Char c" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3677
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3678
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3679
apply (metis Prf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3680
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3681
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3682
apply (metis ValOrd.intros(8))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3683
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3684
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3685
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3686
apply(drule_tac x="v1" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3687
apply(drule_tac x="v2" in meta_spec)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3688
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3689
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3690
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3691
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3692
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3693
apply (metis POSIX_ALT_I1)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3694
apply (metis POSIX_ALT_I1 POSIX_ALT_I2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3695
apply(case_tac "nullable r1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3696
apply(rule_tac x="Seq (mkeps r1a) va" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3697
apply(auto simp add: POSIX_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3698
apply (metis Prf.intros(1) mkeps_nullable)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3699
apply(simp add: mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3700
apply(rotate_tac 7)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3701
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3702
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3703
apply(case_tac "mkeps r1 = v1a")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3704
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3705
apply (rule ValOrd.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3706
apply (metis append_Nil mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3707
apply (rule ValOrd.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3708
apply(drule mkeps_POSIX)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3709
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3710
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3711
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3712
lemma POSIX_ex2: "\<turnstile> v : r \<Longrightarrow> \<exists>v. POSIX v r \<and> \<turnstile> v : r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3713
apply(induct r arbitrary: v)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3714
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3715
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3716
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3717
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3718
apply(rule_tac x="Void" in exI)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3719
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3720
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3721
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3722
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3723
lemma POSIX_ALT_cases:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3724
  assumes "\<turnstile> v : (ALT r1 r2)" "POSIX v (ALT r1 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3725
  shows "(\<exists>v1. v = Left v1 \<and> POSIX v1 r1) \<or> (\<exists>v2. v = Right v2 \<and> POSIX v2 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3726
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3727
apply(erule_tac Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3728
apply(simp_all)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3729
unfolding POSIX_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3730
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3731
apply (metis POSIX_ALT2 POSIX_def assms(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3732
by (metis POSIX_ALT1b assms(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3733
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3734
lemma POSIX_ALT_cases2:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3735
  assumes "POSIX v (ALT r1 r2)" "\<turnstile> v : (ALT r1 r2)" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3736
  shows "(\<exists>v1. v = Left v1 \<and> POSIX v1 r1) \<or> (\<exists>v2. v = Right v2 \<and> POSIX v2 r2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3737
using assms POSIX_ALT_cases by auto
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3738
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3739
lemma Prf_flat_empty:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3740
  assumes "\<turnstile> v : r" "flat v = []"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3741
  shows "nullable r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3742
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3743
apply(induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3744
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3745
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3746
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3747
lemma POSIX_proj:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3748
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3749
  shows "POSIX (projval r c v) (der c r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3750
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3751
apply(induct r c v arbitrary: rule: projval.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3752
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3753
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3754
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3755
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3756
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3757
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3758
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3759
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3760
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3761
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3762
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3763
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3764
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3765
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3766
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3767
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3768
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3769
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3770
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3771
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3772
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3773
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3774
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3775
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3776
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3777
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3778
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3779
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3780
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3781
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3782
lemma POSIX_proj:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3783
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3784
  shows "POSIX (projval r c v) (der c r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3785
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3786
apply(induct r arbitrary: c v rule: rexp.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3787
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3788
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3789
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3790
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3791
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3792
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3793
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3794
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3795
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3796
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3797
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3798
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3799
lemma POSIX_proj:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3800
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3801
  shows "POSIX (projval r c v) (der c r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3802
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3803
apply(induct r c v arbitrary: rule: projval.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3804
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3805
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3806
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3807
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3808
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3809
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3810
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3811
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3812
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3813
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3814
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3815
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3816
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3817
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3818
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3819
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3820
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3821
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3822
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3823
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3824
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3825
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3826
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3827
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3828
apply(simp add: POSIX_def)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3829
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3830
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3831
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3832
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3833
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3834
lemma Prf_inj:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3835
  assumes "v1 \<succ>(der c r) v2" "\<turnstile> v1 : der c r" "\<turnstile> v2 : der c r" "flat v1 = flat v2"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3836
  shows "(injval r c v1) \<succ>r (injval r c v2)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3837
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3838
apply(induct arbitrary: v1 v2 rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3839
(* NULL case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3840
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3841
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3842
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3843
(* EMPTY case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3844
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3845
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3846
(* CHAR case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3847
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3848
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3849
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3850
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3851
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3852
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3853
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3854
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3855
(* ALT case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3856
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3857
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3858
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3859
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3860
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3861
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3862
apply(rotate_tac 3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3863
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3864
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3865
apply(subst v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3866
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3867
apply(rotate_tac 2)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3868
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3869
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3870
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3871
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3872
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3873
apply(rotate_tac 3)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3874
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3875
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3876
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3877
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3878
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3879
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3880
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3881
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3882
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3883
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3884
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3885
(* SEQ case*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3886
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3887
apply(case_tac "nullable r1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3888
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3889
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3890
apply(erule ValOrd.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3891
apply(simp_all)[8]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3892
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3893
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3894
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3895
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3896
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3897
apply(clarify)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3898
apply(rule ValOrd.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3899
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3900
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3901
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3902
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3903
text {*
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3904
  Injection followed by projection is the identity.
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3905
*}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3906
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3907
lemma proj_inj_id:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3908
  assumes "\<turnstile> v : der c r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3909
  shows "projval r c (injval r c v) = v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3910
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3911
apply(induct r arbitrary: c v rule: rexp.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3912
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3913
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3914
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3915
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3916
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3917
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3918
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3919
apply(case_tac "c = char")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3920
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3921
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3922
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3923
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3924
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3925
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3926
defer
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3927
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3928
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3929
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3930
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3931
apply(case_tac "nullable rexp1")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3932
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3933
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3934
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3935
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3936
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3937
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3938
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3939
apply (metis list.distinct(1) v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3940
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3941
apply (metis mkeps_flat)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3942
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3943
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3944
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3945
apply(auto)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3946
apply(simp add: v4)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3947
done
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3948
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3949
text {* 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3950
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3951
  HERE: Crucial lemma that does not go through in the sequence case. 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3952
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3953
*}
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3954
lemma v5:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3955
  assumes "\<turnstile> v : der c r" "POSIX v (der c r)"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3956
  shows "POSIX (injval r c v) r"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3957
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3958
apply(induct arbitrary: v rule: der.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3959
(* NULL case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3960
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3961
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3962
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3963
(* EMPTY case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3964
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3965
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3966
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3967
(* CHAR case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3968
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3969
apply(case_tac "c = c'")
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3970
apply(auto simp add: POSIX_def)[1]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3971
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3972
apply(simp_all)[5]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3973
oops
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3974
*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3975
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3976
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3977
end