thys/ReStar.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Thu, 21 Jan 2016 12:47:20 +0000
changeset 89 9613e6ace30f
child 90 3c8cfdf95252
permissions -rw-r--r--
added theory for star
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
   
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
theory Re
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
  imports "Main" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
begin
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
section {* Sequential Composition of Sets *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
definition
9613e6ace30f added theory for star
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)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
where 
9613e6ace30f added theory for star
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}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
fun spow where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
  "spow s 0 = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
| "spow s (Suc n) = s @ spow s n"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
text {* Two Simple Properties about Sequential Composition *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
lemma seq_empty [simp]:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
  shows "A ;; {[]} = A"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
  and   "{[]} ;; A = A"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
by (simp_all add: Sequ_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
lemma seq_null [simp]:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
  shows "A ;; {} = {}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
  and   "{} ;; A = {}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
by (simp_all add: Sequ_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
lemma seq_image:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
  shows "f ` (A ;; B) = (f ` A) ;; (f ` B)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
apply(auto simp add: Sequ_def image_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
apply(rule_tac x="f s1" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
apply(rule_tac x="f s2" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
apply(rule_tac x="xa @ xb" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    43
section {* Kleene Star for Sets *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
inductive_set
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
  Star :: "string set \<Rightarrow> string set" ("_\<star>" [101] 102)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
  for A :: "string set"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
  start[intro]: "[] \<in> A\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
| step[intro]:  "\<lbrakk>s1 \<in> A; s2 \<in> A\<star>\<rbrakk> \<Longrightarrow> s1 @ s2 \<in> A\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    52
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
  pow :: "string set \<Rightarrow> nat \<Rightarrow> string set" ("_ \<up> _" [100,100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    54
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    55
  "A \<up> 0 = {[]}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
| "A \<up> (Suc n) = A ;; (A \<up> n)"  
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
lemma star1: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
  shows "s \<in> A\<star> \<Longrightarrow> \<exists>n. s \<in> A \<up> n"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    60
  apply(induct rule: Star.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
  apply (metis Re.pow.simps(1) insertI1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    62
  apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
  apply(rule_tac x="Suc n" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
  apply(auto simp add: Sequ_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    65
  done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
lemma star2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
  shows "s \<in> A \<up> n \<Longrightarrow> s \<in> A\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    69
  apply(induct n arbitrary: s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    70
  apply (metis Re.pow.simps(1) Star.simps empty_iff insertE)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    71
  apply(auto simp add: Sequ_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    72
  done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    74
lemma star3:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    75
  shows "A\<star> = (\<Union>i. A \<up> i)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    76
using star1 star2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    77
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    78
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    79
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    80
lemma star4:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    81
  shows "s \<in> A \<up> n \<Longrightarrow> \<exists>ss. s = concat ss \<and> (\<forall>s' \<in> set ss. s' \<in> A)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    82
  apply(induct n arbitrary: s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    83
  apply(auto simp add: Sequ_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    84
  apply(rule_tac x="[]" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    85
  apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    86
  apply(drule_tac x="s2" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    87
  apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    88
by (metis concat.simps(2) insertE set_simps(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    90
lemma star5:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    91
  assumes "f [] = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    92
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    93
  shows "(f ` A) \<up> n = f ` (A \<up> n)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    94
apply(induct n)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    95
apply(simp add: assms)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    96
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    97
apply(subst seq_image[OF assms(2)])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    98
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    99
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   100
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   101
lemma star6:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   102
  assumes "f [] = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   103
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   104
  shows "(f ` A)\<star> = f ` (A\<star>)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   105
apply(simp add: star3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   106
apply(simp add: image_UN)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   107
apply(subst star5[OF assms])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   108
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   109
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   110
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   111
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   112
lemma star_decomp: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   113
  assumes a: "c # x \<in> A\<star>" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   114
  shows "\<exists>a b. x = a @ b \<and> c # a \<in> A \<and> b \<in> A\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   115
using a
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   116
by (induct x\<equiv>"c # x" rule: Star.induct) 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   117
   (auto simp add: append_eq_Cons_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   118
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   119
section {* Regular Expressions *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   120
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   121
datatype rexp =
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   122
  NULL
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   123
| EMPTY
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   124
| CHAR char
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   125
| SEQ rexp rexp
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   126
| ALT rexp rexp
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   127
| STAR rexp
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   128
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   129
section {* Semantics of Regular Expressions *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   130
 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   131
fun
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   132
  L :: "rexp \<Rightarrow> string set"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   133
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   134
  "L (NULL) = {}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   135
| "L (EMPTY) = {[]}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   136
| "L (CHAR c) = {[c]}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   137
| "L (SEQ r1 r2) = (L r1) ;; (L r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   138
| "L (ALT r1 r2) = (L r1) \<union> (L r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   139
| "L (STAR r) = (L r)\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   140
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   141
fun
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
 nullable :: "rexp \<Rightarrow> bool"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   144
  "nullable (NULL) = False"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   145
| "nullable (EMPTY) = True"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   146
| "nullable (CHAR c) = False"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   147
| "nullable (ALT r1 r2) = (nullable r1 \<or> nullable r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   148
| "nullable (SEQ r1 r2) = (nullable r1 \<and> nullable r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   149
| "nullable (STAR r1) = True"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   150
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   151
lemma nullable_correctness:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   152
  shows "nullable r  \<longleftrightarrow> [] \<in> (L r)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   153
apply (induct r) 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   154
apply(auto simp add: Sequ_def) 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   155
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   156
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   157
section {* Values *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   158
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   159
datatype val = 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   160
  Void
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   161
| Char char
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   162
| Seq val val
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   163
| Right val
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   164
| Left val
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   165
| Star "val list"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   166
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   167
section {* The string behind a value *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   168
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   169
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   170
  flat :: "val \<Rightarrow> string"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   171
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   172
  "flat (Void) = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   173
| "flat (Char c) = [c]"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   174
| "flat (Left v) = flat v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   175
| "flat (Right v) = flat v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   176
| "flat (Seq v1 v2) = (flat v1) @ (flat v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   177
| "flat (Star []) = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   178
| "flat (Star (v#vs)) = (flat v) @ (flat (Star vs))" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   179
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   180
section {* Relation between values and regular expressions *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   181
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   182
inductive 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   183
  Prf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<turnstile> _ : _" [100, 100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   184
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   185
 "\<lbrakk>\<turnstile> v1 : r1; \<turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<turnstile> Seq v1 v2 : SEQ r1 r2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   186
| "\<turnstile> v1 : r1 \<Longrightarrow> \<turnstile> Left v1 : ALT r1 r2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   187
| "\<turnstile> v2 : r2 \<Longrightarrow> \<turnstile> Right v2 : ALT r1 r2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   188
| "\<turnstile> Void : EMPTY"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   189
| "\<turnstile> Char c : CHAR c"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   190
| "\<turnstile> Star [] : STAR r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   191
| "\<lbrakk>\<turnstile> v : r; \<turnstile> Star vs : STAR r\<rbrakk> \<Longrightarrow> \<turnstile> Star (v#vs) : STAR r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   192
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   193
lemma not_nullable_flat:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   194
  assumes "\<turnstile> v : r" "\<not>nullable r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   195
  shows "flat v \<noteq> []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   196
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   197
apply(induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   198
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   199
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   200
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   201
lemma Prf_flat_L:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   202
  assumes "\<turnstile> v : r" shows "flat v \<in> L r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   203
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   204
apply(induct v r rule: Prf.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   205
apply(auto simp add: Sequ_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   206
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   207
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   208
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   209
lemma Prf_Star_flat_L:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   210
  assumes "\<turnstile> v : STAR r" shows "flat v \<in> (L r)\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   211
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   212
apply(induct v r\<equiv>"STAR r" arbitrary: r rule: Prf.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   213
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   214
apply(simp add: star3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   215
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   216
apply(rule_tac x="Suc x" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   217
apply(auto simp add: Sequ_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   218
apply(rule_tac x="flat v" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   219
apply(rule_tac x="flat (Star vs)" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   220
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   221
by (metis Prf_flat_L)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   222
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   223
lemma L_flat_Prf:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   224
  "L(r) = {flat v | v. \<turnstile> v : r}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   225
apply(induct r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   226
apply(auto dest: Prf_flat_L simp add: Sequ_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   227
apply (metis Prf.intros(4) flat.simps(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   228
apply (metis Prf.intros(5) flat.simps(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   229
apply (metis Prf.intros(1) flat.simps(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   230
apply (metis Prf.intros(2) flat.simps(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   231
apply (metis Prf.intros(3) flat.simps(4))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   232
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   233
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   234
apply(simp add: star3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   235
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   236
sorry
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   237
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   238
section {* Greedy Ordering according to Frisch/Cardelli *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   239
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   240
inductive 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   241
  GrOrd :: "val \<Rightarrow> val \<Rightarrow> bool" ("_ gr\<succ> _")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   242
where 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   243
  "v1 gr\<succ> v1' \<Longrightarrow> (Seq v1 v2) gr\<succ> (Seq v1' v2')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   244
| "v2 gr\<succ> v2' \<Longrightarrow> (Seq v1 v2) gr\<succ> (Seq v1 v2')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   245
| "v1 gr\<succ> v2 \<Longrightarrow> (Left v1) gr\<succ> (Left v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   246
| "v1 gr\<succ> v2 \<Longrightarrow> (Right v1) gr\<succ> (Right v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   247
| "(Left v2) gr\<succ>(Right v1)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   248
| "(Char c) gr\<succ> (Char c)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   249
| "(Void) gr\<succ> (Void)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   250
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   251
lemma Gr_refl:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   252
  assumes "\<turnstile> v : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   253
  shows "v gr\<succ> v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   254
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   255
apply(induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   256
apply(auto intro: GrOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   257
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   258
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   259
lemma Gr_total:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   260
  assumes "\<turnstile> v1 : r" "\<turnstile> v2 : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   261
  shows "v1 gr\<succ> v2 \<or> v2 gr\<succ> v1"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   262
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   263
apply(induct v1 r arbitrary: v2 rule: Prf.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   264
apply(rotate_tac 4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   265
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   266
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   267
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   268
apply (metis GrOrd.intros(1) GrOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   269
apply(rotate_tac 2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   270
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   271
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   272
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   273
apply (metis GrOrd.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   274
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   275
apply (metis GrOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   276
apply(rotate_tac 2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   277
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   278
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   279
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   280
apply (metis GrOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   281
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   282
apply (metis GrOrd.intros(4))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   283
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   284
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   285
apply (metis GrOrd.intros(7))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   286
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   287
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   288
apply (metis GrOrd.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   289
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   290
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   291
lemma Gr_trans: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   292
  assumes "v1 gr\<succ> v2" "v2 gr\<succ> v3" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   293
  and     "\<turnstile> v1 : r" "\<turnstile> v2 : r" "\<turnstile> v3 : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   294
  shows "v1 gr\<succ> v3"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   295
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   296
apply(induct r arbitrary: v1 v2 v3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   297
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   298
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   299
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   300
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   301
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   302
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   303
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   304
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   305
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   306
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   307
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   308
(* ALT case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   309
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   310
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   311
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   312
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   313
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   314
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   315
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   316
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   317
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   318
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   319
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   320
apply (metis GrOrd.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   321
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   322
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   323
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   324
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   325
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   326
apply (metis GrOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   327
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   328
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   329
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   330
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   331
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   332
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   333
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   334
apply (metis GrOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   335
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   336
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   337
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   338
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   339
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   340
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   341
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   342
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   343
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   344
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   345
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   346
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   347
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   348
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   349
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   350
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   351
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   352
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   353
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   354
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   355
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   356
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   357
apply (metis GrOrd.intros(4))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   358
(* SEQ case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   359
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   360
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   361
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   362
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   363
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   364
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   365
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   366
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   367
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   368
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   369
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   370
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   371
apply (metis GrOrd.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   372
apply (metis GrOrd.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   373
apply(erule GrOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   374
apply(simp_all (no_asm_use))[7]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   375
apply (metis GrOrd.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   376
by (metis GrOrd.intros(1) Gr_refl)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   377
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   378
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   379
section {* Values Sets *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   380
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   381
definition prefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubseteq> _" [100, 100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   382
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   383
  "s1 \<sqsubseteq> s2 \<equiv> \<exists>s3. s1 @ s3 = s2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   384
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   385
definition sprefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubset> _" [100, 100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   386
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   387
  "s1 \<sqsubset> s2 \<equiv> (s1 \<sqsubseteq> s2 \<and> s1 \<noteq> s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   388
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   389
lemma length_sprefix:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   390
  "s1 \<sqsubset> s2 \<Longrightarrow> length s1 < length s2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   391
unfolding sprefix_def prefix_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   392
by (auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   393
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   394
definition Prefixes :: "string \<Rightarrow> string set" where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   395
  "Prefixes s \<equiv> {sp. sp \<sqsubseteq> s}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   396
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   397
definition Suffixes :: "string \<Rightarrow> string set" where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   398
  "Suffixes s \<equiv> rev ` (Prefixes (rev s))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   399
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   400
lemma Suffixes_in: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   401
  "\<exists>s1. s1 @ s2 = s3 \<Longrightarrow> s2 \<in> Suffixes s3"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   402
unfolding Suffixes_def Prefixes_def prefix_def image_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   403
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   404
by (metis rev_rev_ident)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   405
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   406
lemma Prefixes_Cons:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   407
  "Prefixes (c # s) = {[]} \<union> {c # sp | sp. sp \<in> Prefixes s}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   408
unfolding Prefixes_def prefix_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   409
apply(auto simp add: append_eq_Cons_conv) 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   410
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   411
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   412
lemma finite_Prefixes:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   413
  "finite (Prefixes s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   414
apply(induct s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   415
apply(auto simp add: Prefixes_def prefix_def)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   416
apply(simp add: Prefixes_Cons)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   417
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   418
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   419
lemma finite_Suffixes:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   420
  "finite (Suffixes s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   421
unfolding Suffixes_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   422
apply(rule finite_imageI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   423
apply(rule finite_Prefixes)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   424
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   425
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   426
lemma prefix_Cons:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   427
  "((c # s1) \<sqsubseteq> (c # s2)) = (s1 \<sqsubseteq> s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   428
apply(auto simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   429
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   430
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   431
lemma prefix_append:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   432
  "((s @ s1) \<sqsubseteq> (s @ s2)) = (s1 \<sqsubseteq> s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   433
apply(induct s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   434
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   435
apply(simp add: prefix_Cons)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   436
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   437
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   438
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   439
definition Values :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   440
  "Values r s \<equiv> {v. \<turnstile> v : r \<and> flat v \<sqsubseteq> s}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   441
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   442
definition rest :: "val \<Rightarrow> string \<Rightarrow> string" where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   443
  "rest v s \<equiv> drop (length (flat v)) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   444
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   445
lemma rest_Suffixes:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   446
  "rest v s \<in> Suffixes s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   447
unfolding rest_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   448
by (metis Suffixes_in append_take_drop_id)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   449
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   450
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   451
lemma Values_recs:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   452
  "Values (NULL) s = {}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   453
  "Values (EMPTY) s = {Void}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   454
  "Values (CHAR c) s = (if [c] \<sqsubseteq> s then {Char c} else {})" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   455
  "Values (ALT r1 r2) s = {Left v | v. v \<in> Values r1 s} \<union> {Right v | v. v \<in> Values r2 s}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   456
  "Values (SEQ r1 r2) s = {Seq v1 v2 | v1 v2. v1 \<in> Values r1 s \<and> v2 \<in> Values r2 (rest v1 s)}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   457
unfolding Values_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   458
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   459
(*NULL*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   460
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   461
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   462
(*EMPTY*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   463
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   464
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   465
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   466
apply (metis append_Nil prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   467
(*CHAR*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   468
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   469
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   470
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   471
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   472
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   473
(*ALT*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   474
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   475
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   476
apply (metis Prf.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   477
apply (metis Prf.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   478
(*SEQ*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   479
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   480
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   481
apply (simp add: append_eq_conv_conj prefix_def rest_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   482
apply (metis Prf.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   483
apply (simp add: append_eq_conv_conj prefix_def rest_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   484
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   485
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   486
lemma Values_finite:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   487
  "finite (Values r s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   488
apply(induct r arbitrary: s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   489
apply(simp_all add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   490
thm finite_surj
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   491
apply(rule_tac f="\<lambda>(x, y). Seq x y" and 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   492
               A="{(v1, v2) | v1 v2. v1 \<in> Values r1 s \<and> v2 \<in> Values r2 (rest v1 s)}" in finite_surj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   493
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   494
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   495
apply(rule_tac B="\<Union>sp \<in> Suffixes s. {(v1, v2). v1 \<in> Values r1 s \<and> v2 \<in> Values r2 sp}" in finite_subset)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   496
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   497
apply (metis rest_Suffixes)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   498
apply(rule finite_UN_I)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   499
apply(rule finite_Suffixes)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   500
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   501
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   502
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   503
section {* Sulzmann functions *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   504
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   505
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   506
  mkeps :: "rexp \<Rightarrow> val"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   507
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   508
  "mkeps(EMPTY) = Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   509
| "mkeps(SEQ r1 r2) = Seq (mkeps r1) (mkeps r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   510
| "mkeps(ALT r1 r2) = (if nullable(r1) then Left (mkeps r1) else Right (mkeps r2))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   511
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   512
section {* Derivatives *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   513
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   514
fun
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   515
 der :: "char \<Rightarrow> rexp \<Rightarrow> rexp"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   516
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   517
  "der c (NULL) = NULL"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   518
| "der c (EMPTY) = NULL"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   519
| "der c (CHAR c') = (if c = c' then EMPTY else NULL)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   520
| "der c (ALT r1 r2) = ALT (der c r1) (der c r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   521
| "der c (SEQ r1 r2) = 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   522
     (if nullable r1
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   523
      then ALT (SEQ (der c r1) r2) (der c r2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   524
      else SEQ (der c r1) r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   525
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   526
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   527
 ders :: "string \<Rightarrow> rexp \<Rightarrow> rexp"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   528
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   529
  "ders [] r = r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   530
| "ders (c # s) r = ders s (der c r)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   531
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   532
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   533
section {* Injection function *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   534
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   535
fun injval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   536
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   537
  "injval (EMPTY) c Void = Char c"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   538
| "injval (CHAR d) c Void = Char d"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   539
| "injval (CHAR d) c (Char c') = Seq (Char d) (Char c')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   540
| "injval (ALT r1 r2) c (Left v1) = Left(injval r1 c v1)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   541
| "injval (ALT r1 r2) c (Right v2) = Right(injval r2 c v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   542
| "injval (SEQ r1 r2) c (Char c') = Seq (Char c) (Char c')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   543
| "injval (SEQ r1 r2) c (Seq v1 v2) = Seq (injval r1 c v1) v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   544
| "injval (SEQ r1 r2) c (Left (Seq v1 v2)) = Seq (injval r1 c v1) v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   545
| "injval (SEQ r1 r2) c (Right v2) = Seq (mkeps r1) (injval r2 c v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   546
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   547
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   548
  lex :: "rexp \<Rightarrow> string \<Rightarrow> val option"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   549
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   550
  "lex r [] = (if nullable r then Some(mkeps r) else None)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   551
| "lex r (c#s) = (case (lex (der c r) s) of  
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   552
                    None \<Rightarrow> None
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   553
                  | Some(v) \<Rightarrow> Some(injval r c v))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   554
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   555
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   556
  lex2 :: "rexp \<Rightarrow> string \<Rightarrow> val"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   557
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   558
  "lex2 r [] = mkeps r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   559
| "lex2 r (c#s) = injval r c (lex2 (der c r) s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   560
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   561
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   562
section {* Projection function *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   563
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   564
fun projval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   565
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   566
  "projval (CHAR d) c _ = Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   567
| "projval (ALT r1 r2) c (Left v1) = Left (projval r1 c v1)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   568
| "projval (ALT r1 r2) c (Right v2) = Right (projval r2 c v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   569
| "projval (SEQ r1 r2) c (Seq v1 v2) = 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   570
     (if flat v1 = [] then Right(projval r2 c v2) 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   571
      else if nullable r1 then Left (Seq (projval r1 c v1) v2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   572
                          else Seq (projval r1 c v1) v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   573
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   574
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   575
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   576
lemma mkeps_nullable:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   577
  assumes "nullable(r)" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   578
  shows "\<turnstile> mkeps r : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   579
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   580
apply(induct rule: nullable.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   581
apply(auto intro: Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   582
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   583
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   584
lemma mkeps_flat:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   585
  assumes "nullable(r)" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   586
  shows "flat (mkeps r) = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   587
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   588
apply(induct rule: nullable.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   589
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   590
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   591
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   592
lemma v3:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   593
  assumes "\<turnstile> v : der c r" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   594
  shows "\<turnstile> (injval r c v) : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   595
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   596
apply(induct arbitrary: v rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   597
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   598
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   599
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   600
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   601
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   602
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   603
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   604
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   605
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   606
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   607
apply (metis Prf.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   608
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   609
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   610
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   611
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   612
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   613
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   614
apply (metis Prf.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   615
apply (metis Prf.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   616
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   617
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   618
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   619
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   620
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   621
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   622
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   623
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   624
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   625
apply (metis Prf.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   626
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   627
apply (metis Prf.intros(1) mkeps_nullable)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   628
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   629
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   630
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   631
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   632
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   633
apply(auto)[2]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   634
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   635
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   636
lemma v3_proj:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   637
  assumes "\<turnstile> v : r" and "\<exists>s. (flat v) = c # s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   638
  shows "\<turnstile> (projval r c v) : der c r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   639
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   640
apply(induct rule: Prf.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   641
prefer 4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   642
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   643
prefer 4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   644
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   645
apply (metis Prf.intros(4))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   646
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   647
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   648
apply (metis Prf.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   649
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   650
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   651
apply (metis Prf.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   652
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   653
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   654
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   655
apply (metis Prf_flat_L nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   656
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   657
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   658
apply (metis Cons_eq_append_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   659
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   660
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   661
apply (metis Cons_eq_append_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   662
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   663
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   664
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   665
lemma v4:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   666
  assumes "\<turnstile> v : der c r" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   667
  shows "flat (injval r c v) = c # (flat v)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   668
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   669
apply(induct arbitrary: v rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   670
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   671
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   672
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   673
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   674
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   675
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   676
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   677
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   678
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   679
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   680
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   681
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   682
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   683
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   684
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   685
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   686
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   687
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   688
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   689
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   690
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   691
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   692
apply(simp_all (no_asm_use))[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   693
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   694
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   695
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   696
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   697
apply(simp only: injval.simps flat.simps)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   698
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   699
apply (metis mkeps_flat)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   700
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   701
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   702
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   703
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   704
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   705
lemma v4_proj:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   706
  assumes "\<turnstile> v : r" and "\<exists>s. (flat v) = c # s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   707
  shows "c # flat (projval r c v) = flat v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   708
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   709
apply(induct rule: Prf.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   710
prefer 4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   711
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   712
prefer 4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   713
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   714
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   715
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   716
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   717
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   718
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   719
by (metis Cons_eq_append_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   720
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   721
lemma v4_proj2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   722
  assumes "\<turnstile> v : r" and "(flat v) = c # s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   723
  shows "flat (projval r c v) = s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   724
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   725
by (metis list.inject v4_proj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   726
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   727
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   728
section {* Alternative Posix definition *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   729
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   730
inductive 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   731
  PMatch :: "string \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<in> _ \<rightarrow> _" [100, 100, 100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   732
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   733
  "[] \<in> EMPTY \<rightarrow> Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   734
| "[c] \<in> (CHAR c) \<rightarrow> (Char c)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   735
| "s \<in> r1 \<rightarrow> v \<Longrightarrow> s \<in> (ALT r1 r2) \<rightarrow> (Left v)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   736
| "\<lbrakk>s \<in> r2 \<rightarrow> v; s \<notin> L(r1)\<rbrakk> \<Longrightarrow> s \<in> (ALT r1 r2) \<rightarrow> (Right v)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   737
| "\<lbrakk>s1 \<in> r1 \<rightarrow> v1; s2 \<in> r2 \<rightarrow> v2;
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   738
    \<not>(\<exists>s3 s4. s3 \<noteq> [] \<and> s3 @ s4 = s2 \<and> (s1 @ s3) \<in> L r1 \<and> s4 \<in> L r2)\<rbrakk> \<Longrightarrow> 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   739
    (s1 @ s2) \<in> (SEQ r1 r2) \<rightarrow> (Seq v1 v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   740
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   741
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   742
lemma PMatch_mkeps:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   743
  assumes "nullable r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   744
  shows "[] \<in> r \<rightarrow> mkeps r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   745
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   746
apply(induct r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   747
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   748
apply (metis PMatch.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   749
apply(subst append.simps(1)[symmetric])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   750
apply (rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   751
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   752
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   753
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   754
apply (rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   755
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   756
apply (rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   757
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   758
apply (rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   759
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   760
by (metis nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   761
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   762
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   763
lemma PMatch1:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   764
  assumes "s \<in> r \<rightarrow> v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   765
  shows "\<turnstile> v : r" "flat v = s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   766
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   767
apply(induct s r v rule: PMatch.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   768
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   769
apply (metis Prf.intros(4))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   770
apply (metis Prf.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   771
apply (metis Prf.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   772
apply (metis Prf.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   773
apply (metis Prf.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   774
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   775
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   776
lemma PMatch_Values:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   777
  assumes "s \<in> r \<rightarrow> v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   778
  shows "v \<in> Values r s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   779
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   780
apply(simp add: Values_def PMatch1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   781
by (metis append_Nil2 prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   782
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   783
lemma PMatch2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   784
  assumes "s \<in> (der c r) \<rightarrow> v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   785
  shows "(c#s) \<in> r \<rightarrow> (injval r c v)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   786
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   787
apply(induct c r arbitrary: s v rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   788
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   789
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   790
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   791
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   792
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   793
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   794
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   795
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   796
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   797
apply (metis PMatch.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   798
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   799
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   800
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   801
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   802
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   803
apply (metis PMatch.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   804
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   805
apply(rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   806
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   807
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   808
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   809
thm v3_proj
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   810
apply(frule_tac c="c" in v3_proj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   811
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   812
apply(drule_tac x="projval r1 c v" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   813
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   814
apply (metis v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   815
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   816
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   817
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   818
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   819
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   820
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   821
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   822
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   823
apply(subst append.simps(2)[symmetric])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   824
apply(rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   825
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   826
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   827
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   828
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   829
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   830
apply(frule_tac c="c" in v3_proj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   831
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   832
apply(drule_tac x="s3" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   833
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   834
apply(rule_tac x="projval r1 c v" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   835
apply(rule conjI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   836
apply (metis v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   837
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   838
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   839
(* nullable case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   840
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   841
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   842
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   843
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   844
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   845
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   846
apply(subst append.simps(2)[symmetric])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   847
apply(rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   848
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   849
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   850
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   851
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   852
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   853
apply(frule_tac c="c" in v3_proj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   854
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   855
apply(drule_tac x="s3" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   856
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   857
apply (metis v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   858
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   859
(* interesting case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   860
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   861
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   862
thm L.simps
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   863
apply(subst (asm) L.simps(4)[symmetric])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   864
apply(simp only: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   865
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   866
apply(subst append.simps(1)[symmetric])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   867
apply(rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   868
apply (metis PMatch_mkeps)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   869
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   870
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   871
apply(simp only: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   872
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   873
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   874
apply(drule_tac x="Seq (projval r1 c v) vb" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   875
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   876
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   877
apply (metis append_Cons butlast_snoc last_snoc neq_Nil_conv rotate1.simps(2) v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   878
apply(subgoal_tac "\<turnstile> projval r1 c v : der c r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   879
apply (metis Prf.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   880
apply(rule v3_proj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   881
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   882
by (metis Cons_eq_append_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   883
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   884
lemma lex_correct1:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   885
  assumes "s \<notin> L r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   886
  shows "lex r s = None"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   887
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   888
apply(induct s arbitrary: r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   889
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   890
apply (metis nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   891
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   892
apply(drule_tac x="der a r" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   893
apply(drule meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   894
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   895
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   896
by (metis v3 v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   897
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   898
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   899
lemma lex_correct2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   900
  assumes "s \<in> L r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   901
  shows "\<exists>v. lex r s = Some(v) \<and> \<turnstile> v : r \<and> flat v = s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   902
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   903
apply(induct s arbitrary: r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   904
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   905
apply (metis mkeps_flat mkeps_nullable nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   906
apply(drule_tac x="der a r" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   907
apply(drule meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   908
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   909
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   910
apply (metis v3_proj v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   911
apply (metis v3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   912
apply(rule v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   913
by metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   914
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   915
lemma lex_correct3:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   916
  assumes "s \<in> L r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   917
  shows "\<exists>v. lex r s = Some(v) \<and> s \<in> r \<rightarrow> v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   918
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   919
apply(induct s arbitrary: r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   920
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   921
apply (metis PMatch_mkeps nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   922
apply(drule_tac x="der a r" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   923
apply(drule meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   924
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   925
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   926
apply (metis v3_proj v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   927
apply(rule PMatch2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   928
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   929
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   930
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   931
lemma lex_correct4:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   932
  assumes "s \<in> L r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   933
  shows "s \<in> r \<rightarrow> (lex2 r s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   934
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   935
apply(induct s arbitrary: r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   936
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   937
apply (metis PMatch_mkeps nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   938
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   939
apply(rule PMatch2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   940
apply(drule_tac x="der a r" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   941
apply(drule meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   942
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   943
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   944
apply (metis v3_proj v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   945
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   946
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   947
lemma 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   948
  "lex2 (ALT (CHAR a) (ALT (CHAR b) (SEQ (CHAR a) (CHAR b)))) [a,b] = Right (Right (Seq (Char a) (Char b)))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   949
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   950
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   951
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   952
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   953
section {* Sulzmann's Ordering of values *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   954
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   955
thm PMatch.intros
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   956
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   957
inductive ValOrd :: "string \<Rightarrow> val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<turnstile> _ \<succ>_ _" [100, 100, 100, 100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   958
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   959
  "\<lbrakk>s2 \<turnstile> v2 \<succ>r2 v2'; flat v1 = s1\<rbrakk> \<Longrightarrow> (s1 @ s2) \<turnstile> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1 v2')" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   960
| "\<lbrakk>s1 \<turnstile> v1 \<succ>r1 v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1' v2')" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   961
| "\<lbrakk>flat v1 \<sqsubseteq> s; flat v2 \<sqsubseteq> flat v1\<rbrakk> \<Longrightarrow> s \<turnstile> (Left v1) \<succ>(ALT r1 r2) (Right v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   962
| "\<lbrakk>flat v2 \<sqsubseteq> s; flat v1 \<sqsubset>  flat v2\<rbrakk> \<Longrightarrow> s \<turnstile> (Right v2) \<succ>(ALT r1 r2) (Left v1)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   963
| "s \<turnstile> v2 \<succ>r2 v2' \<Longrightarrow> s \<turnstile> (Right v2) \<succ>(ALT r1 r2) (Right v2')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   964
| "s \<turnstile> v1 \<succ>r1 v1' \<Longrightarrow> s \<turnstile> (Left v1) \<succ>(ALT r1 r2) (Left v1')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   965
| "s \<turnstile> Void \<succ>EMPTY Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   966
| "(c#s) \<turnstile> (Char c) \<succ>(CHAR c) (Char c)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   967
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   968
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   969
inductive ValOrd :: "val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<succ>_ _" [100, 100, 100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   970
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   971
  "v2 \<succ>r2 v2' \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1 v2')" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   972
| "\<lbrakk>v1 \<succ>r1 v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1' v2')" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   973
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Right v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   974
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Left v1)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   975
| "v2 \<succ>r2 v2' \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Right v2')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   976
| "v1 \<succ>r1 v1' \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Left v1')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   977
| "Void \<succ>EMPTY Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   978
| "(Char c) \<succ>(CHAR c) (Char c)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   979
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   980
lemma ValOrd_PMatch:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   981
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2  \<sqsubseteq> s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   982
  shows "v1 \<succ>r v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   983
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   984
apply(induct r arbitrary: s v1 v2 rule: rexp.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   985
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   986
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   987
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   988
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   989
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   990
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   991
apply (metis ValOrd.intros(7))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   992
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   993
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   994
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   995
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   996
apply (metis ValOrd.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   997
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   998
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   999
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1000
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1001
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1002
apply (metis ValOrd.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1003
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1004
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1005
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1006
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1007
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1008
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1009
apply (metis ValOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1010
(* Seq case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1011
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1012
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1013
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1014
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1015
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1016
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1017
apply(case_tac "v1b = v1a")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1018
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1019
apply(simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1020
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1021
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1022
apply(simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1023
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1024
apply(simp add: append_eq_append_conv2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1025
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1026
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1027
apply (metis ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1028
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1029
apply (metis ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1030
apply(case_tac "us = []")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1031
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1032
apply (metis ValOrd.intros(2) append_Nil2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1033
apply(drule_tac x="us" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1034
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1035
apply(drule_tac mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1036
apply (metis Prf_flat_L)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1037
apply(drule_tac x="s1 @ us" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1038
apply(drule_tac x="v1b" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1039
apply(drule_tac x="v1a" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1040
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1041
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1042
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1043
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1044
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1045
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1046
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1047
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1048
apply (metis ValOrd.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1049
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1050
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1051
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1052
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1053
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1054
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1055
apply (metis ValOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1056
(* Seq case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1057
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1058
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1059
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1060
apply(case_tac "v1 = v1a")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1061
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1062
apply(simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1063
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1064
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1065
apply(simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1066
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1067
apply(frule PMatch1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1068
apply(frule PMatch1(2)[symmetric])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1069
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1070
apply(simp add: append_eq_append_conv2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1071
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1072
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1073
apply (metis ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1074
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1075
apply (metis ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1076
apply(case_tac "us = []")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1077
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1078
apply (metis ValOrd.intros(2) append_Nil2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1079
apply(drule_tac x="us" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1080
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1081
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1082
apply (metis  Prf_flat_L)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1083
apply(drule_tac x="v1a" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1084
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1085
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1086
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1087
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1088
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1089
lemma ValOrd_PMatch:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1090
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2  \<sqsubseteq> s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1091
  shows "v1 \<succ>r v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1092
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1093
apply(induct arbitrary: v2 rule: .induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1094
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1095
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1096
apply (metis ValOrd.intros(7))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1097
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1098
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1099
apply (metis ValOrd.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1100
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1101
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1102
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1103
apply (metis ValOrd.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1104
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1105
apply (metis PMatch1(2) ValOrd.intros(3) length_sprefix less_imp_le_nat order_refl sprefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1106
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1107
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1108
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1109
apply (metis PMatch1(2) Prf_flat_L ValOrd.intros(4) length_sprefix sprefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1110
apply (metis ValOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1111
(* Seq case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1112
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1113
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1114
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1115
apply(case_tac "v1 = v1a")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1116
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1117
apply(simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1118
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1119
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1120
apply(simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1121
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1122
apply(frule PMatch1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1123
apply(frule PMatch1(2)[symmetric])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1124
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1125
apply(simp add: append_eq_append_conv2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1126
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1127
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1128
apply (metis ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1129
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1130
apply (metis ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1131
apply(case_tac "us = []")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1132
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1133
apply (metis ValOrd.intros(2) append_Nil2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1134
apply(drule_tac x="us" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1135
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1136
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1137
apply (metis  Prf_flat_L)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1138
apply(drule_tac x="v1a" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1139
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1140
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1141
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1142
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1143
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1144
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1145
apply(rule ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1146
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1147
apply(drule_tac x="v1a" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1148
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1149
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1150
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1151
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1152
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1153
thm append_eq_append_conv
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1154
apply(simp add: append_eq_append_conv2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1155
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1156
apply (metis Prf_flat_L)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1157
apply(case_tac "us = []")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1158
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1159
apply(drule_tac x="us" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1160
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1161
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1162
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1163
inductive ValOrd2 :: "val \<Rightarrow> val \<Rightarrow> bool" ("_ 2\<succ> _" [100, 100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1164
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1165
  "v2 2\<succ> v2' \<Longrightarrow> (Seq v1 v2) 2\<succ> (Seq v1 v2')" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1166
| "\<lbrakk>v1 2\<succ> v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) 2\<succ> (Seq v1' v2')" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1167
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) 2\<succ> (Right v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1168
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) 2\<succ> (Left v1)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1169
| "v2 2\<succ> v2' \<Longrightarrow> (Right v2) 2\<succ> (Right v2')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1170
| "v1 2\<succ> v1' \<Longrightarrow> (Left v1) 2\<succ> (Left v1')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1171
| "Void 2\<succ> Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1172
| "(Char c) 2\<succ> (Char c)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1173
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1174
lemma Ord1:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1175
  "v1 \<succ>r v2 \<Longrightarrow> v1 2\<succ> v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1176
apply(induct rule: ValOrd.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1177
apply(auto intro: ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1178
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1179
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1180
lemma Ord2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1181
  "v1 2\<succ> v2 \<Longrightarrow> \<exists>r. v1 \<succ>r v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1182
apply(induct v1 v2 rule: ValOrd2.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1183
apply(auto intro: ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1184
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1185
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1186
lemma Ord3:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1187
  "\<lbrakk>v1 2\<succ> v2; \<turnstile> v1 : r\<rbrakk> \<Longrightarrow> v1 \<succ>r v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1188
apply(induct v1 v2 arbitrary: r rule: ValOrd2.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1189
apply(auto intro: ValOrd.intros elim: Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1190
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1191
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1192
section {* Posix definition *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1193
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1194
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1195
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1196
  "POSIX v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v' \<sqsubseteq> flat v) \<longrightarrow> v \<succ>r v'))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1197
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1198
lemma ValOrd_refl:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1199
  assumes "\<turnstile> v : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1200
  shows "v \<succ>r v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1201
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1202
apply(induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1203
apply(auto intro: ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1204
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1205
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1206
lemma ValOrd_total:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1207
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r\<rbrakk>  \<Longrightarrow> v1 \<succ>r v2 \<or> v2 \<succ>r v1"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1208
apply(induct r arbitrary: v1 v2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1209
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1210
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1211
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1212
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1213
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1214
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1215
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1216
apply (metis ValOrd.intros(7))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1217
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1218
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1219
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1220
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1221
apply (metis ValOrd.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1222
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1223
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1224
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1225
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1226
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1227
apply(case_tac "v1a = v1b")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1228
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1229
apply(rule ValOrd.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1230
apply (metis ValOrd.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1231
apply(rule ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1232
apply(auto)[2]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1233
apply(erule contrapos_np)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1234
apply(rule ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1235
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1236
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1237
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1238
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1239
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1240
apply (metis Ord1 Ord3 Prf.intros(2) ValOrd2.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1241
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1242
apply(erule contrapos_np)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1243
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1244
apply (metis le_eq_less_or_eq neq_iff)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1245
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1246
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1247
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1248
apply(erule contrapos_np)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1249
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1250
apply (metis le_eq_less_or_eq neq_iff)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1251
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1252
apply(erule contrapos_np)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1253
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1254
by metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1255
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1256
lemma ValOrd_anti:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1257
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r; v1 \<succ>r v2; v2 \<succ>r v1\<rbrakk> \<Longrightarrow> v1 = v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1258
apply(induct r arbitrary: v1 v2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1259
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1260
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1261
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1262
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1263
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1264
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1265
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1266
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1267
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1268
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1269
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1270
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1271
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1272
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1273
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1274
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1275
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1276
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1277
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1278
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1279
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1280
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1281
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1282
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1283
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1284
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1285
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1286
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1287
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1288
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1289
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1290
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1291
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1292
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1293
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1294
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1295
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1296
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1297
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1298
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1299
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1300
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1301
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1302
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1303
lemma POSIX_ALT_I1:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1304
  assumes "POSIX v1 r1" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1305
  shows "POSIX (Left v1) (ALT r1 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1306
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1307
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1308
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1309
apply (metis Prf.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1310
apply(rotate_tac 2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1311
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1312
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1313
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1314
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1315
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1316
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1317
by (metis le_eq_less_or_eq length_sprefix sprefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1318
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1319
lemma POSIX_ALT_I2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1320
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1321
  shows "POSIX (Right v2) (ALT r1 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1322
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1323
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1324
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1325
apply (metis Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1326
apply(rotate_tac 3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1327
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1328
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1329
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1330
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1331
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1332
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1333
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1334
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1335
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1336
thm PMatch.intros[no_vars]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1337
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1338
lemma POSIX_PMatch:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1339
  assumes "s \<in> r \<rightarrow> v" "\<turnstile> v' : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1340
  shows "length (flat v') \<le> length (flat v)" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1341
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1342
apply(induct arbitrary: s v v' rule: rexp.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1343
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1344
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1345
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1346
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1347
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1348
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1349
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1350
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1351
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1352
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1353
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1354
apply(erule PMatch.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1355
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1356
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1357
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1358
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1359
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1360
apply (metis ValOrd.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1361
apply (metis POSIX_ALT_I1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1362
apply(rule POSIX_ALT_I2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1363
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1364
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1365
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1366
apply(frule PMatch1(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1367
apply(frule PMatch1(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1368
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1369
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1370
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1371
lemma POSIX_PMatch:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1372
  assumes "s \<in> r \<rightarrow> v" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1373
  shows "POSIX v r" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1374
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1375
apply(induct arbitrary: rule: PMatch.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1376
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1377
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1378
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1379
apply (metis Prf.intros(4))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1380
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1381
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1382
apply (metis ValOrd.intros(7))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1383
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1384
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1385
apply (metis Prf.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1386
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1387
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1388
apply (metis ValOrd.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1389
apply (metis POSIX_ALT_I1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1390
apply(rule POSIX_ALT_I2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1391
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1392
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1393
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1394
apply(frule PMatch1(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1395
apply(frule PMatch1(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1396
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1397
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1398
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1399
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1400
lemma ValOrd_PMatch:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1401
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2 = s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1402
  shows "v1 \<succ>r v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1403
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1404
apply(induct arbitrary: v2 rule: PMatch.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1405
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1406
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1407
apply (metis ValOrd.intros(7))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1408
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1409
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1410
apply (metis ValOrd.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1411
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1412
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1413
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1414
apply (metis ValOrd.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1415
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1416
apply (metis PMatch1(2) ValOrd.intros(3) order_refl)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1417
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1418
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1419
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1420
apply (metis Prf_flat_L)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1421
apply (metis ValOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1422
(* Seq case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1423
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1424
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1425
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1426
apply(case_tac "v1 = v1a")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1427
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1428
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1429
apply(rule ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1430
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1431
apply(drule_tac x="v1a" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1432
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1433
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1434
apply(drule_tac meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1435
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1436
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1437
apply(simp add: append_eq_append_conv2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1438
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1439
apply (metis Prf_flat_L)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1440
apply(case_tac "us = []")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1441
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1442
apply(drule_tac x="us" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1443
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1444
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1445
thm L_flat_Prf
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1446
apply(simp add: L_flat_Prf)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1447
thm append_eq_append_conv2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1448
apply(simp add: append_eq_append_conv2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1449
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1450
apply(drule_tac x="us" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1451
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1452
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1453
apply (metis append_Nil2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1454
apply(case_tac "us = []")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1455
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1456
apply(drule_tac x="s2" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1457
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1458
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1459
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1460
apply(drule_tac x="v1a" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1461
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1462
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1463
lemma refl_on_ValOrd:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1464
  "refl_on (Values r s) {(v1, v2). v1 \<succ>r v2 \<and> v1 \<in> Values r s \<and> v2 \<in> Values r s}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1465
unfolding refl_on_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1466
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1467
apply(rule ValOrd_refl)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1468
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1469
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1470
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1471
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1472
section {* Posix definition *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1473
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1474
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1475
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1476
  "POSIX v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v \<succ>r v'))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1477
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1478
definition POSIX2 :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1479
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1480
  "POSIX2 v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v 2\<succ> v'))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1481
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1482
lemma "POSIX v r = POSIX2 v r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1483
unfolding POSIX_def POSIX2_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1484
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1485
apply(rule Ord1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1486
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1487
apply(rule Ord3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1488
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1489
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1490
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1491
section {* POSIX for some constructors *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1492
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1493
lemma POSIX_SEQ1:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1494
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1495
  shows "POSIX v1 r1"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1496
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1497
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1498
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1499
apply(drule_tac x="Seq v' v2" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1500
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1501
apply(erule impE)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1502
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1503
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1504
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1505
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1506
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1507
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1508
by (metis ValOrd_refl)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1509
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1510
lemma POSIX_SEQ2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1511
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1512
  shows "POSIX v2 r2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1513
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1514
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1515
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1516
apply(drule_tac x="Seq v1 v'" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1517
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1518
apply(erule impE)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1519
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1520
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1521
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1522
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1523
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1524
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1525
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1526
lemma POSIX_ALT2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1527
  assumes "POSIX (Left v1) (ALT r1 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1528
  shows "POSIX v1 r1"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1529
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1530
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1531
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1532
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1533
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1534
apply(drule_tac x="Left v'" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1535
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1536
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1537
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1538
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1539
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1540
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1541
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1542
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1543
lemma POSIX_ALT1a:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1544
  assumes "POSIX (Right v2) (ALT r1 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1545
  shows "POSIX v2 r2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1546
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1547
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1548
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1549
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1550
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1551
apply(drule_tac x="Right v'" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1552
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1553
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1554
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1555
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1556
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1557
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1558
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1559
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1560
lemma POSIX_ALT1b:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1561
  assumes "POSIX (Right v2) (ALT r1 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1562
  shows "(\<forall>v'. (\<turnstile> v' : r2 \<and> flat v' = flat v2) \<longrightarrow> v2 \<succ>r2 v')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1563
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1564
apply(drule_tac POSIX_ALT1a)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1565
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1566
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1567
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1568
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1569
lemma POSIX_ALT_I1:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1570
  assumes "POSIX v1 r1" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1571
  shows "POSIX (Left v1) (ALT r1 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1572
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1573
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1574
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1575
apply (metis Prf.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1576
apply(rotate_tac 2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1577
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1578
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1579
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1580
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1581
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1582
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1583
by simp
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1584
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1585
lemma POSIX_ALT_I2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1586
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1587
  shows "POSIX (Right v2) (ALT r1 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1588
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1589
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1590
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1591
apply (metis Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1592
apply(rotate_tac 3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1593
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1594
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1595
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1596
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1597
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1598
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1599
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1600
lemma mkeps_POSIX:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1601
  assumes "nullable r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1602
  shows "POSIX (mkeps r) r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1603
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1604
apply(induct r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1605
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1606
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1607
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1608
apply (metis Prf.intros(4))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1609
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1610
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1611
apply (metis ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1612
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1613
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1614
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1615
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1616
apply (metis mkeps.simps(2) mkeps_nullable nullable.simps(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1617
apply(rotate_tac 6)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1618
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1619
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1620
apply (simp add: mkeps_flat)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1621
apply(case_tac "mkeps r1a = v1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1622
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1623
apply (metis ValOrd.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1624
apply (rule ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1625
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1626
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1627
(* ALT case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1628
thm mkeps.simps
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1629
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1630
apply(erule disjE)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1631
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1632
apply (metis POSIX_ALT_I1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1633
(* *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1634
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1635
thm  POSIX_ALT_I1
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1636
apply (metis POSIX_ALT_I1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1637
apply(simp (no_asm) add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1638
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1639
apply(rule Prf.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1640
apply(simp only: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1641
apply(rotate_tac 4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1642
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1643
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1644
thm mkeps_flat
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1645
apply(simp add: mkeps_flat)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1646
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1647
thm Prf_flat_L nullable_correctness
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1648
apply (metis Prf_flat_L nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1649
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1650
apply(subst (asm) POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1651
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1652
apply(drule_tac x="v2" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1653
by simp
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1654
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1655
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1656
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1657
text {*
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1658
  Injection value is related to r
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1659
*}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1660
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1661
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1662
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1663
text {*
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1664
  The string behind the injection value is an added c
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1665
*}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1666
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1667
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1668
lemma injval_inj: "inj_on (injval r c) {v. \<turnstile> v : der c r}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1669
apply(induct c r rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1670
unfolding inj_on_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1671
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1672
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1673
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1674
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1675
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1676
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1677
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1678
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1679
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1680
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1681
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1682
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1683
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1684
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1685
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1686
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1687
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1688
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1689
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1690
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1691
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1692
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1693
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1694
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1695
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1696
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1697
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1698
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1699
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1700
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1701
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1702
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1703
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1704
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1705
apply (metis list.distinct(1) mkeps_flat v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1706
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1707
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1708
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1709
apply(rotate_tac 6)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1710
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1711
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1712
apply (metis list.distinct(1) mkeps_flat v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1713
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1714
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1715
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1716
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1717
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1718
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1719
lemma Values_nullable:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1720
  assumes "nullable r1"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1721
  shows "mkeps r1 \<in> Values r1 s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1722
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1723
apply(induct r1 arbitrary: s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1724
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1725
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1726
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1727
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1728
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1729
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1730
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1731
lemma Values_injval:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1732
  assumes "v \<in> Values (der c r) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1733
  shows "injval r c v \<in> Values r (c#s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1734
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1735
apply(induct c r arbitrary: v s rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1736
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1737
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1738
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1739
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1740
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1741
apply(simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1742
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1743
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1744
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1745
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1746
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1747
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1748
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1749
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1750
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1751
apply(simp add: rest_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1752
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1753
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1754
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1755
apply(rule Values_nullable)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1756
apply(assumption)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1757
apply(simp add: rest_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1758
apply(subst mkeps_flat)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1759
apply(assumption)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1760
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1761
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1762
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1763
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1764
apply(simp add: rest_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1765
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1766
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1767
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1768
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1769
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1770
lemma Values_projval:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1771
  assumes "v \<in> Values r (c#s)" "\<exists>s. flat v = c # s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1772
  shows "projval r c v \<in> Values (der c r) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1773
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1774
apply(induct r arbitrary: v s c rule: rexp.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1775
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1776
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1777
apply(case_tac "c = char")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1778
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1779
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1780
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1781
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1782
apply(simp add: prefix_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1783
apply(case_tac "nullable rexp1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1784
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1785
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1786
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1787
apply(simp add: rest_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1788
apply (metis hd_Cons_tl hd_append2 list.sel(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1789
apply(simp add: rest_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1790
apply(simp add: append_eq_Cons_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1791
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1792
apply(subst v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1793
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1794
apply(assumption)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1795
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1796
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1797
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1798
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1799
apply(auto simp add: Values_def not_nullable_flat)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1800
apply(simp add: append_eq_Cons_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1801
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1802
apply(simp add: append_eq_Cons_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1803
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1804
apply(simp add: rest_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1805
apply(subst v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1806
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1807
apply(assumption)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1808
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1809
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1810
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1811
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1812
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1813
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1814
definition "MValue v r s \<equiv> (v \<in> Values r s \<and> (\<forall>v' \<in> Values r s. v 2\<succ> v'))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1815
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1816
lemma MValue_ALTE:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1817
  assumes "MValue v (ALT r1 r2) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1818
  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> 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1819
         (\<exists>vr. v = Right vr \<and> MValue vr r2 s \<and> (\<forall>vl \<in> Values r1 s. length (flat vl) < length (flat vr)))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1820
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1821
apply(simp add: MValue_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1822
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1823
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1824
apply(drule_tac x="Left x" in bspec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1825
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1826
apply(erule ValOrd2.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1827
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1828
apply(drule_tac x="Right vr" in bspec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1829
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1830
apply(erule ValOrd2.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1831
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1832
apply(drule_tac x="Right x" in bspec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1833
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1834
apply(erule ValOrd2.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1835
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1836
apply(drule_tac x="Left vl" in bspec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1837
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1838
apply(erule ValOrd2.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1839
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1840
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1841
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1842
lemma MValue_ALTI1:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1843
  assumes "MValue vl r1 s"  "\<forall>vr \<in> Values r2 s. length (flat vr) \<le> length (flat vl)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1844
  shows "MValue (Left vl) (ALT r1 r2) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1845
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1846
apply(simp add: MValue_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1847
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1848
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1849
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1850
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1851
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1852
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1853
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1854
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1855
lemma MValue_ALTI2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1856
  assumes "MValue vr r2 s"  "\<forall>vl \<in> Values r1 s. length (flat vl) < length (flat vr)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1857
  shows "MValue (Right vr) (ALT r1 r2) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1858
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1859
apply(simp add: MValue_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1860
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1861
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1862
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1863
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1864
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1865
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1866
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1867
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1868
lemma t: "(c#xs = c#ys) \<Longrightarrow> xs = ys"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1869
by (metis list.sel(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1870
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1871
lemma t2: "(xs = ys) \<Longrightarrow> (c#xs) = (c#ys)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1872
by (metis)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1873
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1874
lemma "\<not>(nullable r) \<Longrightarrow> \<not>(\<exists>v. \<turnstile> v : r \<and> flat v = [])"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1875
by (metis Prf_flat_L nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1876
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1877
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1878
lemma LeftRight:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1879
  assumes "(Left v1) \<succ>(der c (ALT r1 r2)) (Right v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1880
  and "\<turnstile> v1 : der c r1" "\<turnstile> v2 : der c r2" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1881
  shows "(injval (ALT r1 r2) c (Left v1)) \<succ>(ALT r1 r2) (injval (ALT r1 r2) c (Right v2))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1882
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1883
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1884
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1885
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1886
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1887
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1888
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1889
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1890
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1891
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1892
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1893
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1894
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1895
lemma RightLeft:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1896
  assumes "(Right v1) \<succ>(der c (ALT r1 r2)) (Left v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1897
  and "\<turnstile> v1 : der c r2" "\<turnstile> v2 : der c r1" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1898
  shows "(injval (ALT r1 r2) c (Right v1)) \<succ>(ALT r1 r2) (injval (ALT r1 r2) c (Left v2))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1899
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1900
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1901
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1902
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1903
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1904
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1905
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1906
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1907
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1908
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1909
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1910
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1911
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1912
lemma h: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1913
  assumes "nullable r1" "\<turnstile> v1 : der c r1"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1914
  shows "injval r1 c v1 \<succ>r1 mkeps r1"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1915
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1916
apply(induct r1 arbitrary: v1 rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1917
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1918
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1919
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1920
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1921
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1922
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1923
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1924
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1925
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1926
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1927
apply (metis ValOrd.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1928
apply (metis ValOrd.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1929
apply (metis ValOrd.intros(3) le_add2 list.size(3) mkeps_flat monoid_add_class.add.right_neutral)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1930
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1931
apply (metis ValOrd.intros(4) length_greater_0_conv list.distinct(1) list.size(3) mkeps_flat v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1932
apply (metis ValOrd.intros(4) length_greater_0_conv list.distinct(1) list.size(3) mkeps_flat v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1933
apply (metis ValOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1934
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1935
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1936
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1937
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1938
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1939
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1940
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1941
apply (metis ValOrd.intros(2) list.distinct(1) mkeps_flat v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1942
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1943
by (metis ValOrd.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1944
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1945
lemma LeftRightSeq:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1946
  assumes "(Left (Seq v1 v2)) \<succ>(der c (SEQ r1 r2)) (Right v3)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1947
  and "nullable r1" "\<turnstile> v1 : der c r1"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1948
  shows "(injval (SEQ r1 r2) c (Seq v1 v2)) \<succ>(SEQ r1 r2) (injval (SEQ r1 r2) c (Right v2))"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1949
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1950
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1951
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1952
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1953
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1954
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1955
apply(rule ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1956
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1957
apply (metis list.distinct(1) mkeps_flat v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1958
by (metis h)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1959
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1960
lemma rr1: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1961
  assumes "\<turnstile> v : r" "\<not>nullable r" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1962
  shows "flat v \<noteq> []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1963
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1964
by (metis Prf_flat_L nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1965
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1966
(* HERE *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1967
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1968
lemma Prf_inj_test:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1969
  assumes "v1 \<succ>(der c r) v2" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1970
          "v1 \<in> Values (der c r) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1971
          "v2 \<in> Values (der c r) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1972
          "injval r c v1 \<in> Values r (c#s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1973
          "injval r c v2 \<in> Values r (c#s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1974
  shows "(injval r c v1) 2\<succ>  (injval r c v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1975
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1976
apply(induct c r arbitrary: v1 v2 s rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1977
(* NULL case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1978
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1979
(* EMPTY case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1980
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1981
(* CHAR case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1982
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1983
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1984
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1985
apply (metis ValOrd2.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1986
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1987
(* ALT case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1988
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1989
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1990
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1991
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1992
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1993
apply (metis ValOrd2.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1994
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1995
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1996
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1997
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1998
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1999
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2000
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2001
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2002
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2003
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2004
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2005
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2006
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2007
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2008
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2009
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2010
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2011
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2012
apply (metis ValOrd2.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2013
(* SEQ case*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2014
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2015
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2016
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2017
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2018
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2019
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2020
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2021
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2022
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2023
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2024
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2025
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2026
apply (metis Ord1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2027
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2028
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2029
apply(subgoal_tac "rest v1 (flat v1 @ flat v2) = flat v2")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2030
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2031
apply(subgoal_tac "rest (injval r1 c v1) (c # flat v1 @ flat v2) = flat v2")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2032
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2033
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2034
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2035
lemma Prf_inj_test:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2036
  assumes "v1 \<succ>(der c r) v2" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2037
          "v1 \<in> Values (der c r) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2038
          "v2 \<in> Values (der c r) s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2039
          "injval r c v1 \<in> Values r (c#s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2040
          "injval r c v2 \<in> Values r (c#s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2041
  shows "(injval r c v1) 2\<succ>  (injval r c v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2042
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2043
apply(induct c r arbitrary: v1 v2 s rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2044
(* NULL case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2045
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2046
(* EMPTY case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2047
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2048
(* CHAR case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2049
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2050
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2051
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2052
apply (metis ValOrd2.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2053
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2054
(* ALT case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2055
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2056
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2057
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2058
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2059
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2060
apply (metis ValOrd2.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2061
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2062
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2063
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2064
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2065
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2066
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2067
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2068
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2069
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2070
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2071
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2072
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2073
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2074
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2075
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2076
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2077
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2078
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2079
apply (metis ValOrd2.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2080
(* SEQ case*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2081
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2082
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2083
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2084
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2085
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2086
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2087
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2088
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2089
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2090
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2091
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2092
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2093
apply (metis Ord1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2094
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2095
apply(rule ValOrd2.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2096
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2097
using injval_inj
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2098
apply(simp add: Values_def inj_on_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2099
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2100
apply(simp add: Values_recs)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2101
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2102
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2103
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2104
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2105
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2106
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2107
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2108
apply (metis Ord1 ValOrd2.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2109
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2110
apply(rule ValOrd2.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2111
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2112
using injval_inj
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2113
apply(simp add: Values_def inj_on_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2114
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2115
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2116
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2117
apply(rule ValOrd2.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2118
thm h
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2119
apply(rule Ord1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2120
apply(rule h)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2121
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2122
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2123
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2124
apply (metis list.distinct(1) mkeps_flat v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2125
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2126
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2127
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2128
apply(simp add: Values_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2129
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2130
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2131
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2132
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2133
apply(rule ValOrd2.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2134
apply(rotate_tac 1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2135
apply(drule_tac x="v2" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2136
apply(rotate_tac 8)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2137
apply(drule_tac x="v2'" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2138
apply(rotate_tac 8)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2139
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2140
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2141
lemma POSIX_der:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2142
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2143
  shows "POSIX (injval r c v) r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2144
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2145
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2146
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2147
thm v3
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2148
apply (erule v3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2149
thm v4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2150
apply(subst (asm) v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2151
apply(assumption)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2152
apply(drule_tac x="projval r c v'" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2153
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2154
apply(rule conjI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2155
thm v3_proj
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2156
apply(rule v3_proj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2157
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2158
apply(rule_tac x="flat v" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2159
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2160
thm t
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2161
apply(rule_tac c="c" in  t)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2162
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2163
thm v4_proj
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2164
apply(subst v4_proj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2165
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2166
apply(rule_tac x="flat v" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2167
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2168
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2169
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2170
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2171
lemma POSIX_der:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2172
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2173
  shows "POSIX (injval r c v) r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2174
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2175
apply(induct c r arbitrary: v rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2176
(* null case*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2177
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2178
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2179
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2180
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2181
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2182
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2183
(* empty case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2184
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2185
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2186
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2187
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2188
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2189
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2190
(* char case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2191
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2192
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2193
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2194
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2195
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2196
apply (metis Prf.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2197
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2198
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2199
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2200
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2201
apply (metis ValOrd.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2202
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2203
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2204
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2205
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2206
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2207
(* alt case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2208
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2209
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2210
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2211
apply(simp (no_asm) add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2212
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2213
apply (metis Prf.intros(2) v3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2214
apply(rotate_tac 4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2215
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2216
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2217
apply (metis POSIX_ALT2 POSIX_def ValOrd.intros(6))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2218
apply (metis ValOrd.intros(3) order_refl)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2219
apply(simp (no_asm) add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2220
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2221
apply (metis Prf.intros(3) v3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2222
apply(rotate_tac 4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2223
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2224
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2225
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2226
apply (metis POSIX_ALT1a POSIX_def ValOrd.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2227
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2228
apply(subst (asm) (5) POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2229
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2230
apply(rotate_tac 5)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2231
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2232
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2233
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2234
apply(subst (asm) v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2235
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2236
apply(drule_tac x="Left (projval r1a c v1)" in spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2237
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2238
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2239
apply(rule conjI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2240
apply (metis Prf.intros(2) v3_proj)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2241
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2242
apply (metis v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2243
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2244
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2245
apply (metis less_not_refl v4_proj2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2246
(* seq case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2247
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2248
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2249
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2250
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2251
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2252
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2253
apply (metis Prf.intros(1) v3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2254
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2255
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2256
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2257
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2258
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2259
apply(subst (asm) (3) v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2260
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2261
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2262
apply(subgoal_tac "flat v1a \<noteq> []")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2263
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2264
apply (metis Prf_flat_L nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2265
apply(subgoal_tac "\<exists>s. flat v1a = c # s")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2266
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2267
apply (metis append_eq_Cons_conv)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2268
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2269
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2270
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2271
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2272
lemma POSIX_ex: "\<turnstile> v : r \<Longrightarrow> \<exists>v. POSIX v r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2273
apply(induct r arbitrary: v)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2274
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2275
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2276
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2277
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2278
apply(rule_tac x="Void" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2279
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2280
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2281
apply (metis Prf.intros(4))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2282
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2283
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2284
apply (metis ValOrd.intros(7))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2285
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2286
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2287
apply(rule_tac x="Char c" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2288
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2289
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2290
apply (metis Prf.intros(5))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2291
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2292
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2293
apply (metis ValOrd.intros(8))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2294
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2295
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2296
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2297
apply(drule_tac x="v1" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2298
apply(drule_tac x="v2" in meta_spec)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2299
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2300
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2301
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2302
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2303
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2304
apply (metis POSIX_ALT_I1)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2305
apply (metis POSIX_ALT_I1 POSIX_ALT_I2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2306
apply(case_tac "nullable r1a")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2307
apply(rule_tac x="Seq (mkeps r1a) va" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2308
apply(auto simp add: POSIX_def)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2309
apply (metis Prf.intros(1) mkeps_nullable)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2310
apply(simp add: mkeps_flat)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2311
apply(rotate_tac 7)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2312
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2313
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2314
apply(case_tac "mkeps r1 = v1a")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2315
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2316
apply (rule ValOrd.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2317
apply (metis append_Nil mkeps_flat)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2318
apply (rule ValOrd.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2319
apply(drule mkeps_POSIX)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2320
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2321
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2322
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2323
lemma POSIX_ex2: "\<turnstile> v : r \<Longrightarrow> \<exists>v. POSIX v r \<and> \<turnstile> v : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2324
apply(induct r arbitrary: v)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2325
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2326
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2327
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2328
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2329
apply(rule_tac x="Void" in exI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2330
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2331
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2332
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2333
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2334
lemma POSIX_ALT_cases:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2335
  assumes "\<turnstile> v : (ALT r1 r2)" "POSIX v (ALT r1 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2336
  shows "(\<exists>v1. v = Left v1 \<and> POSIX v1 r1) \<or> (\<exists>v2. v = Right v2 \<and> POSIX v2 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2337
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2338
apply(erule_tac Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2339
apply(simp_all)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2340
unfolding POSIX_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2341
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2342
apply (metis POSIX_ALT2 POSIX_def assms(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2343
by (metis POSIX_ALT1b assms(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2344
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2345
lemma POSIX_ALT_cases2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2346
  assumes "POSIX v (ALT r1 r2)" "\<turnstile> v : (ALT r1 r2)" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2347
  shows "(\<exists>v1. v = Left v1 \<and> POSIX v1 r1) \<or> (\<exists>v2. v = Right v2 \<and> POSIX v2 r2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2348
using assms POSIX_ALT_cases by auto
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2349
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2350
lemma Prf_flat_empty:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2351
  assumes "\<turnstile> v : r" "flat v = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2352
  shows "nullable r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2353
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2354
apply(induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2355
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2356
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2357
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2358
lemma POSIX_proj:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2359
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2360
  shows "POSIX (projval r c v) (der c r)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2361
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2362
apply(induct r c v arbitrary: rule: projval.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2363
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2364
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2365
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2366
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2367
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2368
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2369
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2370
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2371
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2372
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2373
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2374
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2375
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2376
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2377
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2378
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2379
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2380
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2381
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2382
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2383
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2384
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2385
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2386
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2387
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2388
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2389
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2390
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2391
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2392
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2393
lemma POSIX_proj:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2394
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2395
  shows "POSIX (projval r c v) (der c r)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2396
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2397
apply(induct r arbitrary: c v rule: rexp.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2398
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2399
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2400
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2401
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2402
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2403
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2404
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2405
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2406
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2407
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2408
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2409
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2410
lemma POSIX_proj:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2411
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2412
  shows "POSIX (projval r c v) (der c r)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2413
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2414
apply(induct r c v arbitrary: rule: projval.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2415
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2416
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2417
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2418
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2419
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2420
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2421
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2422
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2423
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2424
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2425
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2426
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2427
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2428
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2429
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2430
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2431
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2432
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2433
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2434
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2435
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2436
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2437
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2438
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2439
apply(simp add: POSIX_def)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2440
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2441
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2442
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2443
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2444
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2445
lemma Prf_inj:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2446
  assumes "v1 \<succ>(der c r) v2" "\<turnstile> v1 : der c r" "\<turnstile> v2 : der c r" "flat v1 = flat v2"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2447
  shows "(injval r c v1) \<succ>r (injval r c v2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2448
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2449
apply(induct arbitrary: v1 v2 rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2450
(* NULL case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2451
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2452
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2453
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2454
(* EMPTY case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2455
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2456
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2457
(* CHAR case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2458
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2459
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2460
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2461
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2462
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2463
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2464
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2465
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2466
(* ALT case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2467
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2468
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2469
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2470
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2471
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2472
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2473
apply(rotate_tac 3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2474
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2475
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2476
apply(subst v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2477
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2478
apply(rotate_tac 2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2479
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2480
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2481
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2482
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2483
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2484
apply(rotate_tac 3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2485
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2486
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2487
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2488
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2489
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2490
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2491
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2492
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2493
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2494
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2495
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2496
(* SEQ case*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2497
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2498
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2499
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2500
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2501
apply(erule ValOrd.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2502
apply(simp_all)[8]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2503
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2504
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2505
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2506
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2507
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2508
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2509
apply(rule ValOrd.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2510
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2511
oops
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2512
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2513
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2514
text {*
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2515
  Injection followed by projection is the identity.
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2516
*}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2517
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2518
lemma proj_inj_id:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2519
  assumes "\<turnstile> v : der c r" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2520
  shows "projval r c (injval r c v) = v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2521
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2522
apply(induct r arbitrary: c v rule: rexp.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2523
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2524
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2525
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2526
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2527
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2528
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2529
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2530
apply(case_tac "c = char")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2531
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2532
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2533
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2534
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2535
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2536
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2537
defer
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2538
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2539
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2540
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2541
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2542
apply(case_tac "nullable rexp1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2543
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2544
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2545
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2546
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2547
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2548
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2549
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2550
apply (metis list.distinct(1) v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2551
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2552
apply (metis mkeps_flat)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2553
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2554
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2555
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2556
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2557
apply(simp add: v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2558
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2559
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2560
text {* 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2561
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2562
  HERE: Crucial lemma that does not go through in the sequence case. 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2563
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2564
*}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2565
lemma v5:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2566
  assumes "\<turnstile> v : der c r" "POSIX v (der c r)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2567
  shows "POSIX (injval r c v) r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2568
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2569
apply(induct arbitrary: v rule: der.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2570
(* NULL case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2571
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2572
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2573
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2574
(* EMPTY case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2575
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2576
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2577
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2578
(* CHAR case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2579
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2580
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2581
apply(auto simp add: POSIX_def)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2582
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2583
apply(simp_all)[5]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2584
oops