thys/ReStar.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 24 Feb 2016 21:08:35 +0000
changeset 104 59bad592a009
parent 103 ffe5d850df62
child 105 80218dddbb15
permissions -rw-r--r--
updated theories and cleaned them up
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
   
92
98d0d77005f3 ReStar changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 91
diff changeset
     2
theory ReStar
89
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
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    30
definition
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    31
  Der :: "char \<Rightarrow> string set \<Rightarrow> string set"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    32
where
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    33
  "Der c A \<equiv> {s. [c] @ s \<in> A}"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    34
101
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
    35
definition 
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
    36
  Ders :: "string \<Rightarrow> string set \<Rightarrow> string set"
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
    37
where  
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
    38
  "Ders s A \<equiv> {s' | s'. s @ s' \<in> A}"
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
    39
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    40
lemma Der_null [simp]:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    41
  shows "Der c {} = {}"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    42
unfolding Der_def
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    43
by auto
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    44
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    45
lemma Der_empty [simp]:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    46
  shows "Der c {[]} = {}"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    47
unfolding Der_def
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    48
by auto
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    49
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    50
lemma Der_char [simp]:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    51
  shows "Der c {[d]} = (if c = d then {[]} else {})"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    52
unfolding Der_def
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    53
by auto
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    54
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    55
lemma Der_union [simp]:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    56
  shows "Der c (A \<union> B) = Der c A \<union> Der c B"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    57
unfolding Der_def
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    58
by auto
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    59
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    60
lemma Der_seq [simp]:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    61
  shows "Der c (A ;; B) = (Der c A) ;; B \<union> (if [] \<in> A then Der c B else {})"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    62
unfolding Der_def Sequ_def
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    63
apply (auto simp add: Cons_eq_append_conv)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    64
done
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    65
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
lemma seq_image:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
  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
    69
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
    70
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
    71
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
    72
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    74
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
    75
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    76
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    77
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    78
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    79
section {* Kleene Star for Sets *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    80
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    81
inductive_set
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    82
  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
    83
  for A :: "string set"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    84
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    85
  start[intro]: "[] \<in> A\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    86
| step[intro]:  "\<lbrakk>s1 \<in> A; s2 \<in> A\<star>\<rbrakk> \<Longrightarrow> s1 @ s2 \<in> A\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    87
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    88
lemma star_cases:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    89
  shows "A\<star> = {[]} \<union> A ;; A\<star>"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    90
unfolding Sequ_def
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    91
by (auto) (metis Star.simps)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    92
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
    93
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    94
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    95
  pow :: "string set \<Rightarrow> nat \<Rightarrow> string set" ("_ \<up> _" [100,100] 100)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    96
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    97
  "A \<up> 0 = {[]}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    98
| "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
    99
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   100
lemma star1: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   101
  shows "s \<in> A\<star> \<Longrightarrow> \<exists>n. s \<in> A \<up> n"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   102
  apply(induct rule: Star.induct)
92
98d0d77005f3 ReStar changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 91
diff changeset
   103
  apply (metis pow.simps(1) insertI1)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   104
  apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   105
  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
   106
  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
   107
  done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   108
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   109
lemma star2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   110
  shows "s \<in> A \<up> n \<Longrightarrow> s \<in> A\<star>"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   111
  apply(induct n arbitrary: s)
92
98d0d77005f3 ReStar changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 91
diff changeset
   112
  apply (metis pow.simps(1) Star.simps empty_iff insertE)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   113
  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
   114
  done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   115
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   116
lemma star3:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   117
  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
   118
using star1 star2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   119
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   120
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   121
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   122
lemma star4:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   123
  shows "s \<in> A \<up> n \<Longrightarrow> \<exists>ss. s = concat ss \<and> (\<forall>s' \<in> set ss. s' \<in> A)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   124
  apply(induct n arbitrary: s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   125
  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
   126
  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
   127
  apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   128
  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
   129
  apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   130
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
   131
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   132
lemma star5:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   133
  assumes "f [] = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   134
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   135
  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
   136
apply(induct n)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   137
apply(simp add: assms)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   138
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   139
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
   140
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   141
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
lemma star6:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   144
  assumes "f [] = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   145
  assumes "\<forall>s1 s2. f (s1 @ s2) = (f s1) @ (f s2)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   146
  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
   147
apply(simp add: star3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   148
apply(simp add: image_UN)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   149
apply(subst star5[OF assms])
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   150
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   151
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   152
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   153
lemma star_decomp: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   154
  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
   155
  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
   156
using a
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   157
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
   158
   (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
   159
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   160
lemma Der_star [simp]:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   161
  shows "Der c (A\<star>) = (Der c A) ;; A\<star>"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   162
proof -    
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   163
  have "Der c (A\<star>) = Der c ({[]} \<union> A ;; A\<star>)"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   164
    
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   165
    by (simp only: star_cases[symmetric])
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   166
  also have "... = Der c (A ;; A\<star>)"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   167
    by (simp only: Der_union Der_empty) (simp)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   168
  also have "... = (Der c A) ;; A\<star> \<union> (if [] \<in> A then Der c (A\<star>) else {})"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   169
    by simp
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   170
  also have "... =  (Der c A) ;; A\<star>"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   171
    unfolding Sequ_def Der_def
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   172
    by (auto dest: star_decomp)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   173
  finally show "Der c (A\<star>) = (Der c A) ;; A\<star>" .
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   174
qed
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   175
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   176
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   177
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   178
section {* Regular Expressions *}
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
datatype rexp =
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   181
  NULL
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   182
| EMPTY
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   183
| CHAR char
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   184
| SEQ rexp rexp
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   185
| ALT rexp rexp
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   186
| STAR rexp
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   187
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   188
section {* Semantics of Regular Expressions *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   189
 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   190
fun
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   191
  L :: "rexp \<Rightarrow> string set"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   192
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   193
  "L (NULL) = {}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   194
| "L (EMPTY) = {[]}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   195
| "L (CHAR c) = {[c]}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   196
| "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
   197
| "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
   198
| "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
   199
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   200
fun
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   201
 nullable :: "rexp \<Rightarrow> bool"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   202
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   203
  "nullable (NULL) = False"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   204
| "nullable (EMPTY) = True"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   205
| "nullable (CHAR c) = False"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   206
| "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
   207
| "nullable (SEQ r1 r2) = (nullable r1 \<and> nullable r2)"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   208
| "nullable (STAR r) = True"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   209
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   210
lemma nullable_correctness:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   211
  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
   212
apply (induct r) 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   213
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
   214
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   215
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   216
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   217
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   218
section {* Values *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   219
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   220
datatype val = 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   221
  Void
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   222
| Char char
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   223
| Seq val val
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   224
| Right val
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   225
| Left val
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   226
| Stars "val list"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   227
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   228
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
   229
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   230
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   231
  flat :: "val \<Rightarrow> string"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   232
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   233
  "flat (Void) = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   234
| "flat (Char c) = [c]"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   235
| "flat (Left v) = flat v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   236
| "flat (Right v) = flat v"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   237
| "flat (Seq v1 v2) = (flat v1) @ (flat v2)"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   238
| "flat (Stars []) = []"
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   239
| "flat (Stars (v#vs)) = (flat v) @ (flat (Stars vs))" 
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   240
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   241
lemma [simp]:
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   242
 "flat (Stars vs) = concat (map flat vs)"
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   243
apply(induct vs)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   244
apply(auto)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   245
done
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   246
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   247
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
   248
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   249
(* non-problematic values...needed in order to fix the *) 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   250
(* proj lemma in Sulzmann & lu *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   251
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   252
inductive 
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   253
  NPrf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<Turnstile> _ : _" [100, 100] 100)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   254
where
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   255
 "\<lbrakk>\<Turnstile> v1 : r1; \<Turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<Turnstile> Seq v1 v2 : SEQ r1 r2"
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   256
| "\<Turnstile> v1 : r1 \<Longrightarrow> \<Turnstile> Left v1 : ALT r1 r2"
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   257
| "\<Turnstile> v2 : r2 \<Longrightarrow> \<Turnstile> Right v2 : ALT r1 r2"
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   258
| "\<Turnstile> Void : EMPTY"
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   259
| "\<Turnstile> Char c : CHAR c"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   260
| "\<Turnstile> Stars [] : STAR r"
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   261
| "\<lbrakk>\<Turnstile> v : r; \<Turnstile> Stars vs : STAR r; flat v \<noteq> []\<rbrakk> \<Longrightarrow> \<Turnstile> Stars (v # vs) : STAR r"
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   262
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   263
inductive 
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   264
  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
   265
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   266
 "\<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
   267
| "\<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
   268
| "\<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
   269
| "\<turnstile> Void : EMPTY"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   270
| "\<turnstile> Char c : CHAR c"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   271
| "\<turnstile> Stars [] : STAR r"
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   272
| "\<lbrakk>\<turnstile> v : r; \<turnstile> Stars vs : STAR r\<rbrakk> \<Longrightarrow> \<turnstile> Stars (v # vs) : STAR r"
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   273
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   274
lemma NPrf_imp_Prf:
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   275
  assumes "\<Turnstile> v : r" 
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   276
  shows "\<turnstile> v : r"
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   277
using assms
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   278
apply(induct)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   279
apply(auto intro: Prf.intros)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   280
done
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   281
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   282
lemma NPrf_Prf_val:
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   283
  shows "\<turnstile> v : r \<Longrightarrow> \<exists>v'. flat v' = flat v \<and> \<Turnstile> v' : r"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   284
  and   "\<turnstile> Stars vs : r \<Longrightarrow> \<exists>vs'. flat (Stars vs') = flat (Stars vs) \<and> \<Turnstile> Stars vs' : r"
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   285
using assms
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   286
apply(induct v and vs arbitrary: r and r rule: val.inducts)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   287
apply(auto)[1]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   288
apply(erule Prf.cases)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   289
apply(simp_all)[7]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   290
apply(rule_tac x="Void" in exI)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   291
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   292
apply(rule NPrf.intros)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   293
apply(erule Prf.cases)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   294
apply(simp_all)[7]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   295
apply(rule_tac x="Char c" in exI)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   296
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   297
apply(rule NPrf.intros)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   298
apply(erule Prf.cases)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   299
apply(simp_all)[7]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   300
apply(auto)[1]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   301
apply(drule_tac x="r1" in meta_spec)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   302
apply(drule_tac x="r2" in meta_spec)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   303
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   304
apply(auto)[1]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   305
apply(rule_tac x="Seq v' v'a" in exI)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   306
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   307
apply (metis NPrf.intros(1))
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   308
apply(erule Prf.cases)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   309
apply(simp_all)[7]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   310
apply(clarify)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   311
apply(drule_tac x="r2" in meta_spec)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   312
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   313
apply(auto)[1]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   314
apply(rule_tac x="Right v'" in exI)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   315
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   316
apply (metis NPrf.intros)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   317
apply(erule Prf.cases)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   318
apply(simp_all)[7]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   319
apply(clarify)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   320
apply(drule_tac x="r1" in meta_spec)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   321
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   322
apply(auto)[1]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   323
apply(rule_tac x="Left v'" in exI)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   324
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   325
apply (metis NPrf.intros)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   326
apply(drule_tac x="r" in meta_spec)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   327
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   328
apply(auto)[1]
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   329
apply(rule_tac x="Stars vs'" in exI)
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   330
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   331
apply(rule_tac x="[]" in exI)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   332
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   333
apply(erule Prf.cases)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   334
apply(simp_all)[7]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   335
apply (metis NPrf.intros(6))
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   336
apply(erule Prf.cases)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   337
apply(simp_all)[7]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   338
apply(auto)[1]
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   339
apply(drule_tac x="ra" in meta_spec)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   340
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   341
apply(drule_tac x="STAR ra" in meta_spec)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   342
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   343
apply(auto)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   344
apply(case_tac "flat v = []")
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   345
apply(rule_tac x="vs'" in exI)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   346
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   347
apply(rule_tac x="v' # vs'" in exI)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   348
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   349
apply(rule NPrf.intros)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   350
apply(auto)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   351
done
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   352
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   353
lemma NPrf_Prf:
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   354
  shows "{flat v | v. \<turnstile> v : r} = {flat v | v. \<Turnstile> v : r}"
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   355
apply(auto)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   356
apply (metis NPrf_Prf_val(1))
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   357
by (metis NPrf_imp_Prf)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   358
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   359
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   360
lemma not_nullable_flat:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   361
  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
   362
  shows "flat v \<noteq> []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   363
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   364
apply(induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   365
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   366
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   367
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   368
lemma Prf_flat_L:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   369
  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
   370
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   371
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
   372
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
   373
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   374
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   375
lemma NPrf_flat_L:
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   376
  assumes "\<Turnstile> v : r" shows "flat v \<in> L r"
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   377
using assms
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   378
by (metis NPrf_imp_Prf Prf_flat_L)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   379
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   380
lemma Prf_Stars:
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   381
  assumes "\<forall>v \<in> set vs. \<turnstile> v : r"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   382
  shows "\<turnstile> Stars vs : STAR r"
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   383
using assms
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   384
apply(induct vs)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   385
apply (metis Prf.intros(6))
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   386
by (metis Prf.intros(7) insert_iff set_simps(2))
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   387
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   388
lemma Star_string:
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   389
  assumes "s \<in> A\<star>"
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   390
  shows "\<exists>ss. concat ss = s \<and> (\<forall>s \<in> set ss. s \<in> A)"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   391
using assms
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   392
apply(induct rule: Star.induct)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   393
apply(auto)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   394
apply(rule_tac x="[]" in exI)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   395
apply(simp)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   396
apply(rule_tac x="s1#ss" in exI)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   397
apply(simp)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   398
done
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   399
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   400
lemma Star_val:
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   401
  assumes "\<forall>s\<in>set ss. \<exists>v. s = flat v \<and> \<turnstile> v : r"
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   402
  shows "\<exists>vs. concat (map flat vs) = concat ss \<and> (\<forall>v\<in>set vs. \<turnstile> v : r)"
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   403
using assms
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   404
apply(induct ss)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   405
apply(auto)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   406
apply (metis empty_iff list.set(1))
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   407
by (metis concat.simps(2) list.simps(9) set_ConsD)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   408
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   409
lemma Star_valN:
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   410
  assumes "\<forall>s\<in>set ss. \<exists>v. s = flat v \<and> \<Turnstile> v : r"
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   411
  shows "\<exists>vs. concat (map flat vs) = concat ss \<and> (\<forall>v\<in>set vs. \<Turnstile> v : r)"
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   412
using assms
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   413
apply(induct ss)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   414
apply(auto)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   415
apply (metis empty_iff list.set(1))
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   416
by (metis concat.simps(2) list.simps(9) set_ConsD)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   417
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   418
lemma L_flat_Prf:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   419
  "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
   420
apply(induct r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   421
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
   422
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
   423
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
   424
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
   425
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
   426
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
   427
apply(erule Prf.cases)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   428
apply(auto)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   429
apply(subgoal_tac "\<exists>vs::val list. concat (map flat vs) = x \<and> (\<forall>v \<in> set vs. \<turnstile> v : r)")
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   430
apply(auto)[1]
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   431
apply(rule_tac x="Stars vs" in exI)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   432
apply(simp)
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   433
apply(rule Prf_Stars)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   434
apply(simp)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   435
apply(drule Star_string)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   436
apply(auto)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   437
apply(rule Star_val)
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   438
apply(simp)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   439
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   440
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   441
lemma L_flat_NPrf:
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   442
  "L(r) = {flat v | v. \<Turnstile> v : r}"
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   443
by (metis L_flat_Prf NPrf_Prf)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
   444
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   445
section {* Values Sets *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   446
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   447
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
   448
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   449
  "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
   450
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   451
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
   452
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   453
  "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
   454
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   455
lemma length_sprefix:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   456
  "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
   457
unfolding sprefix_def prefix_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   458
by (auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   459
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   460
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
   461
  "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
   462
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   463
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
   464
  "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
   465
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   466
definition SPrefixes :: "string \<Rightarrow> string set" where
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   467
  "SPrefixes s \<equiv> {sp. sp \<sqsubset> s}"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   468
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   469
definition SSuffixes :: "string \<Rightarrow> string set" where
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   470
  "SSuffixes s \<equiv> rev ` (SPrefixes (rev s))"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   471
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   472
lemma Suffixes_in: 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   473
  "\<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
   474
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
   475
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   476
by (metis rev_rev_ident)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   477
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   478
lemma SSuffixes_in: 
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   479
  "\<exists>s1. s1 \<noteq> [] \<and> s1 @ s2 = s3 \<Longrightarrow> s2 \<in> SSuffixes s3"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   480
unfolding SSuffixes_def Suffixes_def SPrefixes_def Prefixes_def sprefix_def prefix_def image_def
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   481
apply(auto)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   482
by (metis append_self_conv rev.simps(1) rev_rev_ident)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   483
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   484
lemma Prefixes_Cons:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   485
  "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
   486
unfolding Prefixes_def prefix_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   487
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
   488
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   489
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   490
lemma finite_Prefixes:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   491
  "finite (Prefixes s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   492
apply(induct s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   493
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
   494
apply(simp add: Prefixes_Cons)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   495
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   496
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   497
lemma finite_Suffixes:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   498
  "finite (Suffixes s)"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   499
unfolding Suffixes_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   500
apply(rule finite_imageI)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   501
apply(rule finite_Prefixes)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   502
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   503
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   504
lemma prefix_Cons:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   505
  "((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
   506
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
   507
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   508
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   509
lemma prefix_append:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   510
  "((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
   511
apply(induct s)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   512
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   513
apply(simp add: prefix_Cons)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   514
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   515
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   516
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   517
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
   518
  "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
   519
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   520
definition SValues :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   521
  "SValues r s \<equiv> {v. \<turnstile> v : r \<and> flat v = s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   522
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   523
definition NValues :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   524
  "NValues r s \<equiv> {v. \<Turnstile> v : r \<and> flat v \<sqsubseteq> s}"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   525
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   526
lemma NValues_STAR_Nil:
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   527
  "NValues (STAR r) [] = {Stars []}"
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   528
apply(auto simp add: NValues_def prefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   529
apply(erule NPrf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   530
apply(auto)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   531
by (metis NPrf.intros(6))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   532
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   533
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   534
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
   535
  "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
   536
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   537
lemma rest_Nil:
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   538
  "rest v [] = []"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   539
apply(simp add: rest_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   540
done
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   541
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   542
lemma rest_Suffixes:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   543
  "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
   544
unfolding rest_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   545
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
   546
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   547
lemma rest_SSuffixes:
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   548
  assumes "flat v \<noteq> []" "s \<noteq> []"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   549
  shows "rest v s \<in> SSuffixes s"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   550
using assms
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   551
unfolding rest_def
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   552
thm SSuffixes_in
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   553
apply(rule_tac SSuffixes_in)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   554
apply(rule_tac x="take (length (flat v)) s" in exI)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   555
apply(simp add: sprefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   556
done
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   557
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   558
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   559
lemma Values_recs:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   560
  "Values (NULL) s = {}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   561
  "Values (EMPTY) s = {Void}"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   562
  "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
   563
  "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
   564
  "Values (SEQ r1 r2) s = {Seq v1 v2 | v1 v2. v1 \<in> Values r1 s \<and> v2 \<in> Values r2 (rest v1 s)}"
95
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
   565
  "Values (STAR r) s = 
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   566
      {Stars []} \<union> {Stars (v # vs) | v vs. v \<in> Values r s \<and> Stars vs \<in> Values (STAR r) (rest v s)}"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   567
unfolding Values_def
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   568
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   569
(*NULL*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   570
apply(erule Prf.cases)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   571
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   572
(*EMPTY*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   573
apply(erule Prf.cases)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   574
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   575
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   576
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
   577
(*CHAR*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   578
apply(erule Prf.cases)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   579
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   580
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   581
apply(erule Prf.cases)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   582
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   583
(*ALT*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   584
apply(erule Prf.cases)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   585
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   586
apply (metis Prf.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   587
apply (metis Prf.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   588
(*SEQ*)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   589
apply(erule Prf.cases)
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   590
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   591
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
   592
apply (metis Prf.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   593
apply (simp add: append_eq_conv_conj prefix_def rest_def)
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   594
(*STAR*)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   595
apply(erule Prf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   596
apply(simp_all)[7]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   597
apply(rule conjI)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   598
apply(simp add: prefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   599
apply(auto)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   600
apply(simp add: prefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   601
apply(auto)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   602
apply (metis append_eq_conv_conj rest_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   603
apply (metis Prf.intros(6))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   604
apply (metis append_Nil prefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   605
apply (metis Prf.intros(7))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   606
by (metis append_eq_conv_conj prefix_append prefix_def rest_def)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   607
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   608
lemma NValues_recs:
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   609
  "NValues (NULL) s = {}"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   610
  "NValues (EMPTY) s = {Void}"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   611
  "NValues (CHAR c) s = (if [c] \<sqsubseteq> s then {Char c} else {})" 
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   612
  "NValues (ALT r1 r2) s = {Left v | v. v \<in> NValues r1 s} \<union> {Right v | v. v \<in> NValues r2 s}"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   613
  "NValues (SEQ r1 r2) s = {Seq v1 v2 | v1 v2. v1 \<in> NValues r1 s \<and> v2 \<in> NValues r2 (rest v1 s)}"
95
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
   614
  "NValues (STAR r) s = 
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   615
  {Stars []} \<union> {Stars (v # vs) | v vs. v \<in> NValues r s \<and> flat v \<noteq> [] \<and>  Stars vs \<in> NValues (STAR r) (rest v s)}"
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   616
unfolding NValues_def
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   617
apply(auto)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   618
(*NULL*)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   619
apply(erule NPrf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   620
apply(simp_all)[7]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   621
(*EMPTY*)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   622
apply(erule NPrf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   623
apply(simp_all)[7]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   624
apply(rule NPrf.intros)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   625
apply (metis append_Nil prefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   626
(*CHAR*)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   627
apply(erule NPrf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   628
apply(simp_all)[7]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   629
apply(rule NPrf.intros)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   630
apply(erule NPrf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   631
apply(simp_all)[7]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   632
(*ALT*)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   633
apply(erule NPrf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   634
apply(simp_all)[7]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   635
apply (metis NPrf.intros(2))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   636
apply (metis NPrf.intros(3))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   637
(*SEQ*)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   638
apply(erule NPrf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   639
apply(simp_all)[7]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   640
apply (simp add: append_eq_conv_conj prefix_def rest_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   641
apply (metis NPrf.intros(1))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   642
apply (simp add: append_eq_conv_conj prefix_def rest_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   643
(*STAR*)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   644
apply(erule NPrf.cases)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   645
apply(simp_all)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   646
apply(rule conjI)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   647
apply(simp add: prefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   648
apply(auto)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   649
apply(simp add: prefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   650
apply(auto)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   651
apply (metis append_eq_conv_conj rest_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   652
apply (metis NPrf.intros(6))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   653
apply (metis append_Nil prefix_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   654
apply (metis NPrf.intros(7))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   655
by (metis append_eq_conv_conj prefix_append prefix_def rest_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   656
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   657
lemma SValues_recs:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   658
 "SValues (NULL) s = {}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   659
 "SValues (EMPTY) s = (if s = [] then {Void} else {})"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   660
 "SValues (CHAR c) s = (if [c] = s then {Char c} else {})" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   661
 "SValues (ALT r1 r2) s = {Left v | v. v \<in> SValues r1 s} \<union> {Right v | v. v \<in> SValues r2 s}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   662
 "SValues (SEQ r1 r2) s = {Seq v1 v2 | v1 v2. \<exists>s1 s2. s = s1 @ s2 \<and> v1 \<in> SValues r1 s1 \<and> v2 \<in> SValues r2 s2}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   663
 "SValues (STAR r) s = (if s = [] then {Stars []} else {}) \<union> 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   664
   {Stars (v # vs) | v vs. \<exists>s1 s2. s = s1 @ s2 \<and> v \<in> SValues r s1 \<and> Stars vs \<in> SValues (STAR r) s2}"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   665
unfolding SValues_def
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   666
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   667
(*NULL*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   668
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   669
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   670
(*EMPTY*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   671
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   672
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   673
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   674
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   675
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   676
(*CHAR*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   677
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   678
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   679
apply (metis Prf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   680
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   681
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   682
(*ALT*)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   683
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   684
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   685
apply metis
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   686
apply(erule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   687
apply(erule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   688
(* SEQ case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   689
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   690
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   691
apply (metis Prf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   692
(* STAR case *)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   693
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   694
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   695
apply(rule Prf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   696
apply (metis Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   697
apply(erule Prf.cases)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   698
apply(simp_all)[7]
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   699
apply (metis Prf.intros(7))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
   700
by (metis Prf.intros(7))
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   701
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   702
lemma finite_image_set2:
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   703
  "finite {x. P x} \<Longrightarrow> finite {y. Q y} \<Longrightarrow> finite {(x, y) | x y. P x \<and> Q y}"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   704
  by (rule finite_subset [where B = "\<Union>x \<in> {x. P x}. \<Union>y \<in> {y. Q y}. {(x, y)}"]) auto
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   705
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   706
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   707
lemma NValues_finite_aux:
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   708
  "(\<lambda>(r, s). finite (NValues r s)) (r, s)"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   709
apply(rule wf_induct[of "measure size <*lex*> measure length",where P="\<lambda>(r, s). finite (NValues r s)"])
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   710
apply (metis wf_lex_prod wf_measure)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   711
apply(auto)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   712
apply(case_tac a)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   713
apply(simp_all)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   714
apply(simp add: NValues_recs)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   715
apply(simp add: NValues_recs)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   716
apply(simp add: NValues_recs)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   717
apply(simp add: NValues_recs)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   718
apply(rule_tac f="\<lambda>(x, y). Seq x y" and 
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   719
               A="{(v1, v2) | v1 v2. v1 \<in> NValues rexp1 b \<and> v2 \<in> NValues rexp2 (rest v1 b)}" in finite_surj)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   720
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   721
apply(auto)[1]
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   722
apply(rule_tac B="\<Union>sp \<in> Suffixes b. {(v1, v2). v1 \<in> NValues rexp1 b \<and> v2 \<in> NValues rexp2 sp}" in finite_subset)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   723
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   724
apply (metis rest_Suffixes)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   725
apply(rule finite_UN_I)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   726
apply(rule finite_Suffixes)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   727
apply(simp)
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   728
apply(simp add: NValues_recs)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   729
apply(clarify)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   730
apply(subst NValues_recs)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   731
apply(simp)
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   732
apply(rule_tac f="\<lambda>(v, vs). Stars (v # vs)" and 
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   733
               A="{(v, vs) | v vs. v \<in> NValues rexp b \<and> (flat v \<noteq> [] \<and> Stars vs \<in> NValues (STAR rexp) (rest v b))}" in finite_surj)
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   734
prefer 2
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   735
apply(auto)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   736
apply(auto)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   737
apply(case_tac b)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   738
apply(simp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   739
defer
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   740
apply(rule_tac B="\<Union>sp \<in> SSuffixes b. {(v, vs) | v vs. v \<in> NValues rexp b \<and> Stars vs \<in> NValues (STAR rexp) sp}" in finite_subset)
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   741
apply(auto)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   742
apply(rule_tac x="rest aa (a # list)" in bexI)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   743
apply(simp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   744
apply (rule rest_SSuffixes)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   745
apply(simp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   746
apply(simp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   747
apply(rule finite_UN_I)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   748
defer
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   749
apply(frule_tac x="rexp" in spec)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   750
apply(drule_tac x="b" in spec)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   751
apply(drule conjunct1)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   752
apply(drule mp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   753
apply(simp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   754
apply(drule_tac x="STAR rexp" in spec)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   755
apply(drule_tac x="sp" in spec)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   756
apply(drule conjunct2)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   757
apply(drule mp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   758
apply(simp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   759
apply(simp add: prefix_def SPrefixes_def SSuffixes_def)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   760
apply(auto)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   761
apply (metis length_Cons length_rev length_sprefix rev.simps(2))
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   762
apply(simp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   763
apply(rule finite_cartesian_product)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   764
apply(simp)
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   765
apply(rule_tac f="Stars" in finite_imageD)
94
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   766
prefer 2
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   767
apply(auto simp add: inj_on_def)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   768
apply (metis finite_subset image_Collect_subsetI)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   769
apply(simp add: rest_Nil)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   770
apply(simp add: NValues_STAR_Nil)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   771
apply(rule_tac B="{(v, vs). v \<in> NValues rexp [] \<and> vs = []}" in finite_subset)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   772
apply(auto)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   773
apply(simp)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   774
apply(rule_tac B="Suffixes b" in finite_subset)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   775
apply(auto simp add: SSuffixes_def Suffixes_def Prefixes_def SPrefixes_def sprefix_def)[1]
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   776
by (metis finite_Suffixes)
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   777
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   778
lemma NValues_finite:
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   779
  "finite (NValues r s)"
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   780
using NValues_finite_aux
5b01f7c233f8 proved also finiteness of non-problematic values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   781
apply(simp)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   782
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   783
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   784
section {* Sulzmann functions *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   785
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   786
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   787
  mkeps :: "rexp \<Rightarrow> val"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   788
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   789
  "mkeps(EMPTY) = Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   790
| "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
   791
| "mkeps(ALT r1 r2) = (if nullable(r1) then Left (mkeps r1) else Right (mkeps r2))"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   792
| "mkeps(STAR r) = Stars []"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   793
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   794
section {* Derivatives *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   795
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   796
fun
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   797
 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
   798
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   799
  "der c (NULL) = NULL"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   800
| "der c (EMPTY) = NULL"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   801
| "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
   802
| "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
   803
| "der c (SEQ r1 r2) = 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   804
     (if nullable r1
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   805
      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
   806
      else SEQ (der c r1) r2)"
90
3c8cfdf95252 proved some lemmas about star and mkeps (injval etc not yet done)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 89
diff changeset
   807
| "der c (STAR r) = SEQ (der c r) (STAR r)"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   808
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   809
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   810
 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
   811
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   812
  "ders [] r = r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   813
| "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
   814
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   815
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   816
lemma der_correctness:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   817
  shows "L (der c r) = Der c (L r)"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   818
apply(induct r) 
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   819
apply(simp_all add: nullable_correctness)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   820
done
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
   821
101
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   822
lemma ders_correctness:
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   823
  shows "L (ders s r) = Ders s (L r)"
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   824
apply(induct s arbitrary: r) 
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   825
apply(simp add: Ders_def)
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   826
apply(simp)
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   827
apply(subst der_correctness)
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   828
apply(simp add: Ders_def Der_def)
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   829
done
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   830
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   831
section {* Injection function *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   832
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   833
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
   834
where
101
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   835
  "injval (CHAR d) c Void = Char d"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   836
| "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
   837
| "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
   838
| "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
   839
| "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
   840
| "injval (SEQ r1 r2) c (Right v2) = Seq (mkeps r1) (injval r2 c v2)"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   841
| "injval (STAR r) c (Seq v (Stars vs)) = Stars ((injval r c v) # vs)" 
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   842
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   843
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   844
  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
   845
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   846
  "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
   847
| "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
   848
                    None \<Rightarrow> None
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   849
                  | 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
   850
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   851
fun 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   852
  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
   853
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   854
  "lex2 r [] = mkeps r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   855
| "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
   856
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   857
section {* Projection function *}
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   858
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   859
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
   860
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   861
  "projval (CHAR d) c _ = Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   862
| "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
   863
| "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
   864
| "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
   865
     (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
   866
      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
   867
                          else Seq (projval r1 c v1) v2)"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   868
| "projval (STAR r) c (Stars (v # vs)) = Seq (projval r c v) (Stars vs)"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   869
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   870
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   871
lemma mkeps_nullable:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   872
  assumes "nullable(r)" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   873
  shows "\<turnstile> mkeps r : r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   874
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   875
apply(induct rule: nullable.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   876
apply(auto intro: Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   877
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   878
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   879
lemma mkeps_flat:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   880
  assumes "nullable(r)" 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   881
  shows "flat (mkeps r) = []"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   882
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   883
apply(induct rule: nullable.induct)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   884
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   885
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   886
101
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
   887
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   888
lemma v3:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   889
  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
   890
  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
   891
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   892
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
   893
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   894
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   895
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   896
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   897
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   898
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   899
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   900
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   901
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   902
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   903
apply (metis Prf.intros(5))
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(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   906
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   907
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   908
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   909
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   910
apply (metis Prf.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   911
apply (metis Prf.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   912
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   913
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   914
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   915
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   916
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   917
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   918
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   919
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   920
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   921
apply (metis Prf.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   922
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   923
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
   924
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   925
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   926
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   927
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   928
apply(rule Prf.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   929
apply(auto)[2]
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   930
apply(simp)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   931
apply(erule Prf.cases)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   932
apply(simp_all)[7]
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   933
apply(clarify)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   934
apply(rotate_tac 2)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   935
apply(erule Prf.cases)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   936
apply(simp_all)[7]
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   937
apply(auto)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   938
apply (metis Prf.intros(6) Prf.intros(7))
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   939
by (metis Prf.intros(7))
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   940
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   941
lemma v3_proj:
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   942
  assumes "\<Turnstile> v : r" and "\<exists>s. (flat v) = c # s"
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   943
  shows "\<Turnstile> (projval r c v) : der c r"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   944
using assms
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   945
apply(induct rule: NPrf.induct)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   946
prefer 4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   947
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   948
prefer 4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   949
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   950
apply (metis NPrf.intros(4))
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   951
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   952
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   953
apply (metis NPrf.intros(2))
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   954
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   955
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   956
apply (metis NPrf.intros(3))
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   957
apply(auto)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   958
apply(rule NPrf.intros)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   959
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   960
apply (metis NPrf_imp_Prf not_nullable_flat)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   961
apply(rule NPrf.intros)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   962
apply(rule NPrf.intros)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   963
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
   964
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   965
apply(rule NPrf.intros)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   966
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
   967
apply(simp)
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
   968
(* Stars case *)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   969
apply(rule NPrf.intros)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   970
apply (metis Cons_eq_append_conv)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   971
apply(auto)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   972
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   973
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   974
lemma v4:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   975
  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
   976
  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
   977
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   978
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
   979
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   980
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   981
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   982
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   983
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   984
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   985
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   986
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   987
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   988
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   989
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   990
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   991
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   992
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   993
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   994
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   995
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
   996
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   997
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   998
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   999
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1000
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1001
apply(simp_all (no_asm_use))[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1002
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1003
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1004
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1005
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1006
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
  1007
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1008
apply (metis mkeps_flat)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1009
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1010
apply(erule Prf.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1011
apply(simp_all)[7]
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1012
apply(simp)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1013
apply(erule Prf.cases)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1014
apply(simp_all)[7]
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1015
apply(auto)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1016
apply(rotate_tac 2)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1017
apply(erule Prf.cases)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1018
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1019
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1020
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1021
lemma v4_proj:
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1022
  assumes "\<Turnstile> v : r" and "\<exists>s. (flat v) = c # s"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1023
  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
  1024
using assms
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1025
apply(induct rule: NPrf.induct)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1026
prefer 4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1027
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1028
prefer 4
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1029
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1030
prefer 2
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
prefer 2
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1033
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1034
apply(auto)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1035
apply (metis Cons_eq_append_conv)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1036
apply(simp add: append_eq_Cons_conv)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1037
apply(auto)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1038
done
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1039
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1040
lemma v4_proj2:
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1041
  assumes "\<Turnstile> v : r" and "(flat v) = c # s"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1042
  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
  1043
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1044
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
  1045
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1046
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1047
section {* Our Alternative Posix definition *}
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1048
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1049
inductive 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1050
  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
  1051
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1052
  "[] \<in> EMPTY \<rightarrow> Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1053
| "[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
  1054
| "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
  1055
| "\<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
  1056
| "\<lbrakk>s1 \<in> r1 \<rightarrow> v1; s2 \<in> r2 \<rightarrow> v2;
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1057
    \<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = s2 \<and> (s1 @ s\<^sub>3) \<in> L r1 \<and> s\<^sub>4 \<in> L r2)\<rbrakk> \<Longrightarrow> 
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1058
    (s1 @ s2) \<in> (SEQ r1 r2) \<rightarrow> (Seq v1 v2)"
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1059
| "\<lbrakk>s1 \<in> r \<rightarrow> v; s2 \<in> STAR r \<rightarrow> Stars vs; flat v \<noteq> [];
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1060
    \<not>(\<exists>s\<^sub>3 s\<^sub>4. s\<^sub>3 \<noteq> [] \<and> s\<^sub>3 @ s\<^sub>4 = s2 \<and> (s1 @ s\<^sub>3) \<in> L r \<and> s\<^sub>4 \<in> L (STAR r))\<rbrakk>
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1061
    \<Longrightarrow> (s1 @ s2) \<in> STAR r \<rightarrow> Stars (v # vs)"
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1062
| "[] \<in> STAR r \<rightarrow> Stars []"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1063
101
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1064
lemma PMatch1:
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1065
  assumes "s \<in> r \<rightarrow> v"
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1066
  shows "\<turnstile> v : r" "flat v = s"
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1067
using assms
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1068
apply(induct s r v rule: PMatch.induct)
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1069
apply(auto)
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1070
apply (metis Prf.intros(4))
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1071
apply (metis Prf.intros(5))
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1072
apply (metis Prf.intros(2))
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1073
apply (metis Prf.intros(3))
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1074
apply (metis Prf.intros(1))
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1075
apply (metis Prf.intros(7))
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1076
by (metis Prf.intros(6))
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1077
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1078
lemma PMatch_mkeps:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1079
  assumes "nullable r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1080
  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
  1081
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1082
apply(induct r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1083
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1084
apply (metis PMatch.intros(1))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1085
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
  1086
apply (rule PMatch.intros)
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
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1089
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1090
apply (rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1091
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1092
apply (rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1093
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1094
apply (rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1095
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1096
apply (metis nullable_correctness)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1097
apply(metis PMatch.intros(7))
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1098
done
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1099
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1100
lemma PMatch_determ:
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1101
  shows "\<lbrakk>s \<in> r \<rightarrow> v1; s \<in> r \<rightarrow> v2\<rbrakk> \<Longrightarrow> v1 = v2"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1102
  and   "\<lbrakk>s \<in> (STAR r) \<rightarrow> Stars vs1; s \<in> (STAR r) \<rightarrow> Stars vs2\<rbrakk> \<Longrightarrow> vs1 = vs2"
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1103
apply(induct v1 and vs1 arbitrary: s r v2 and s r vs2 rule: val.inducts)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1104
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1105
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1106
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1107
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1108
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1109
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1110
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1111
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1112
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1113
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1114
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1115
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1116
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1117
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1118
apply metis
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1119
apply(rule conjI)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1120
apply(simp add: append_eq_append_conv2)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1121
apply(auto)[1]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1122
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1123
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1124
apply(simp add: append_eq_append_conv2)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1125
apply(auto)[1]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1126
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1127
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1128
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1129
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1130
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1131
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1132
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1133
apply(clarify)
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1134
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1135
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1136
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1137
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1138
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1139
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1140
apply(clarify)
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1141
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1142
(* star case *)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1143
defer
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1144
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1145
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1146
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1147
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1148
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1149
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1150
apply (metis PMatch1(2))
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1151
apply(rotate_tac  3)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1152
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1153
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1154
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1155
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1156
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1157
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1158
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1159
apply metis
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1160
apply(simp add: append_eq_append_conv2)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1161
apply(auto)[1]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1162
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1163
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1164
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1165
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1166
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1167
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1168
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1169
apply (metis PMatch1(2))
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1170
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1171
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1172
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1173
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1174
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1175
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1176
apply(subgoal_tac "s1 = s1a \<and> s2 = s2a")
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1177
apply(drule_tac x="s1 @ s2" in meta_spec)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1178
apply(drule_tac x="rb" in meta_spec)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1179
apply(drule_tac x="(va#vsa)" in meta_spec)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1180
apply(simp)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1181
apply(drule meta_mp)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1182
apply (metis L.simps(6) PMatch.intros(6))
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1183
apply (metis L.simps(6) PMatch.intros(6))
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1184
apply(simp add: append_eq_append_conv2)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1185
apply(auto)[1]
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1186
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1187
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1188
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1189
apply (metis L.simps(6) PMatch1(1) PMatch1(2) Prf_flat_L)
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1190
apply (metis PMatch1(2))
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1191
apply(erule PMatch.cases)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1192
apply(simp_all)[7]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1193
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1194
by (metis PMatch1(2))
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1195
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1196
lemma PMatch1N:
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1197
  assumes "s \<in> r \<rightarrow> v"
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1198
  shows "\<Turnstile> v : r" 
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1199
using assms
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1200
apply(induct s r v rule: PMatch.induct)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1201
apply(auto)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1202
apply (metis NPrf.intros(4))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1203
apply (metis NPrf.intros(5))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1204
apply (metis NPrf.intros(2))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1205
apply (metis NPrf.intros(3))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1206
apply (metis NPrf.intros(1))
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1207
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1208
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1209
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1210
apply(simp)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1211
apply(rule NPrf.intros)
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1212
done
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1213
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1214
lemma PMatch_Values:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1215
  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
  1216
  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
  1217
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1218
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
  1219
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
  1220
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1221
lemma PMatch2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1222
  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
  1223
  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
  1224
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1225
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
  1226
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1227
apply(erule PMatch.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1228
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1229
apply(erule PMatch.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1230
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1231
apply(case_tac "c = c'")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1232
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1233
apply(erule PMatch.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1234
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1235
apply (metis PMatch.intros(2))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1236
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1237
apply(erule PMatch.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1238
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1239
apply(erule PMatch.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1240
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1241
apply (metis PMatch.intros(3))
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1242
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1243
apply(rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1244
apply metis
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1245
apply(simp add: der_correctness Der_def)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1246
(* SEQ case *)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1247
apply(case_tac "nullable r1")
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1248
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1249
prefer 2
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1250
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1251
apply(erule PMatch.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1252
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1253
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1254
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
  1255
apply(rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1256
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1257
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1258
apply(auto)[1]
103
ffe5d850df62 added some slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
  1259
apply(simp add: der_correctness Der_def)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1260
apply(auto)[1]
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1261
(* nullable case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1262
apply(erule PMatch.cases)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1263
apply(simp_all)[7]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1264
apply(clarify)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1265
apply(erule PMatch.cases)
102
7f589bfecffa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 101
diff changeset
  1266
apply(simp_all)[4]
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1267
apply(clarify)
102
7f589bfecffa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 101
diff changeset
  1268
apply(simp (no_asm))
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1269
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
  1270
apply(rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1271
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1272
apply metis
102
7f589bfecffa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 101
diff changeset
  1273
apply(erule contrapos_nn)
7f589bfecffa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 101
diff changeset
  1274
apply(erule exE)+
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1275
apply(auto)[1]
104
59bad592a009 updated theories and cleaned them up
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 103
diff changeset
  1276
apply(simp add: der_correctness Der_def)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1277
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1278
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1279
(* interesting case *)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1280
apply(clarify)
102
7f589bfecffa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 101
diff changeset
  1281
apply(clarify)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1282
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1283
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
  1284
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
  1285
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1286
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
  1287
apply(rule PMatch.intros)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1288
apply (metis PMatch_mkeps)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1289
apply metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1290
apply(auto)
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1291
apply(simp only: L_flat_NPrf)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1292
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1293
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1294
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
  1295
apply(drule mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1296
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1297
apply (metis append_Cons butlast_snoc list.sel(1) neq_Nil_conv rotate1.simps(2) v4_proj2)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1298
apply(subgoal_tac "\<turnstile> projval r1 c v : der c r1")
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1299
apply (metis NPrf_imp_Prf Prf.intros(1))
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1300
apply(rule NPrf_imp_Prf)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1301
apply(rule v3_proj)
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1302
apply(simp)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1303
apply (metis Cons_eq_append_conv)
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1304
(* Stars case *)
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1305
apply(erule PMatch.cases)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1306
apply(simp_all)[7]
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1307
apply(clarify)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1308
apply(rotate_tac 2)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1309
apply(frule_tac PMatch1)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1310
apply(erule PMatch.cases)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1311
apply(simp_all)[7]
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1312
apply(subst append.simps(2)[symmetric])
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1313
apply(rule PMatch.intros)
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1314
apply metis
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1315
apply(auto)[1]
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1316
apply(rule PMatch.intros)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1317
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1318
apply(simp)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1319
apply(simp)
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1320
apply (metis L.simps(6))
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1321
apply(subst v4)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1322
apply (metis NPrf_imp_Prf PMatch1N)
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1323
apply(simp)
100
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1324
apply(auto)[1]
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1325
apply(drule_tac x="s\<^sub>3" in spec)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1326
apply(drule mp)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1327
defer
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1328
apply metis
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1329
apply(clarify)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1330
apply(drule_tac x="s1" in meta_spec)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1331
apply(drule_tac x="v1" in meta_spec)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1332
apply(simp)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1333
apply(rotate_tac 2)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1334
apply(drule PMatch.intros(6))
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1335
apply(rule PMatch.intros(7))
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1336
apply (metis PMatch1(1) list.distinct(1) v4)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1337
apply (metis Nil_is_append_conv)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1338
apply(simp)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1339
apply(subst der_correctness)
8b919b3d753e strengthened PMatch to get determ
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 99
diff changeset
  1340
apply(simp add: Der_def)
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1341
done
91
f067e59b58d9 more lemmas for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 90
diff changeset
  1342
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1343
lemma lex_correct1:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1344
  assumes "s \<notin> L r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1345
  shows "lex r s = None"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1346
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1347
apply(induct s arbitrary: r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1348
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1349
apply (metis nullable_correctness)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1350
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1351
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
  1352
apply(drule meta_mp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1353
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1354
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
  1355
by (metis v3 v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1356
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1357
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1358
lemma lex_correct2:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1359
  assumes "s \<in> L r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1360
  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
  1361
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1362
apply(induct s arbitrary: r)
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 (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
  1365
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
  1366
apply(drule meta_mp)
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1367
apply(simp add: L_flat_NPrf)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1368
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1369
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
  1370
apply (metis v3)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1371
apply(rule v4)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1372
by metis
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1373
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1374
lemma lex_correct3:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1375
  assumes "s \<in> L r"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1376
  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
  1377
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1378
apply(induct s arbitrary: r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1379
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1380
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
  1381
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
  1382
apply(drule meta_mp)
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1383
apply(simp add: L_flat_NPrf)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1384
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1385
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
  1386
apply(rule PMatch2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1387
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1388
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1389
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1390
lemma lex_correct4:
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1391
  assumes "s \<in> L r"
95
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1392
  shows "\<exists>v. lex r s = Some(v) \<and> \<Turnstile> v : r \<and> flat v = s"
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1393
using lex_correct3[OF assms]
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1394
apply(auto)
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1395
apply (metis PMatch1N)
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1396
by (metis PMatch1(2))
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1397
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1398
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1399
lemma lex_correct5:
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1400
  assumes "s \<in> L r"
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1401
  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
  1402
using assms
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1403
apply(induct s arbitrary: r)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1404
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1405
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
  1406
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1407
apply(rule PMatch2)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1408
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
  1409
apply(drule meta_mp)
93
37e3f1174974 extended all proofs that worked before to the Star case...required a stronger notion of non-problematic values |=
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 92
diff changeset
  1410
apply(simp add: L_flat_NPrf)
89
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1411
apply(auto)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1412
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
  1413
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1414
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1415
lemma 
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1416
  "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
  1417
apply(simp)
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1418
done
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1419
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1420
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
  1421
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1422
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
  1423
where
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1424
  "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
  1425
| "\<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
  1426
| "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
  1427
| "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
  1428
| "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
  1429
| "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
  1430
| "Void \<succ>EMPTY Void"
9613e6ace30f added theory for star
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1431
| "(Char c) \<succ>(CHAR c) (Char c)"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1432
| "flat (Stars (v # vs)) = [] \<Longrightarrow> (Stars []) \<succ>(STAR r) (Stars (v # vs))"
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1433
| "flat (Stars (v # vs)) \<noteq> [] \<Longrightarrow> (Stars (v # vs)) \<succ>(STAR r) (Stars [])"
101
7f4f8c34da95 fixed inj function
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 100
diff changeset
  1434
| "\<lbrakk>v1 \<succ>r v2; v1 \<noteq> v2\<rbrakk> \<Longrightarrow> (Stars (v1 # vs1)) \<succ>(STAR r) (Stars (v2 # vs2))"
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1435
| "(Stars vs1) \<succ>(STAR r) (Stars vs2) \<Longrightarrow> (Stars (v # vs1)) \<succ>(STAR r) (Stars (v # vs2))"
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1436
| "(Stars []) \<succ>(STAR r) (Stars [])"
95
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1437
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1438
97
38696f516c6b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 95
diff changeset
  1439
95
a33d3040bf7e started a paper and moved cruft to Attic
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 94
diff changeset
  1440
end