thys/Re.thy
author Christian Urban <urbanc@in.tum.de>
Mon, 26 Jun 2017 18:40:58 +0100
changeset 250 8927b737936f
parent 212 9fd41f224e8d
child 311 8b8db9558ecf
permissions -rw-r--r--
polished
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
     1
   
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
     2
theory Re
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
  imports "Main" 
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
begin
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
     6
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
section {* Sequential Composition of Sets *}
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
     8
m
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
definition
fe177dfc4697 initial version of the theory
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)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
where 
fe177dfc4697 initial version of the theory
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}"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
text {* Two Simple Properties about Sequential Composition *}
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
lemma seq_empty [simp]:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
  shows "A ;; {[]} = A"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
  and   "{[]} ;; A = A"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
by (simp_all add: Sequ_def)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
lemma seq_null [simp]:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
  shows "A ;; {} = {}"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
  and   "{} ;; A = {}"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
by (simp_all add: Sequ_def)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
section {* Regular Expressions *}
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
datatype rexp =
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
  NULL
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
| EMPTY
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
| CHAR char
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
| SEQ rexp rexp
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
| ALT rexp rexp
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
section {* Semantics of Regular Expressions *}
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
 
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
fun
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
  L :: "rexp \<Rightarrow> string set"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
where
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
  "L (NULL) = {}"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
| "L (EMPTY) = {[]}"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
| "L (CHAR c) = {[c]}"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    43
| "L (SEQ r1 r2) = (L r1) ;; (L r2)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
| "L (ALT r1 r2) = (L r1) \<union> (L r2)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    46
fun
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    47
 nullable :: "rexp \<Rightarrow> bool"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    48
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    49
  "nullable (NULL) = False"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    50
| "nullable (EMPTY) = True"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    51
| "nullable (CHAR c) = False"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    52
| "nullable (ALT r1 r2) = (nullable r1 \<or> nullable r2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    53
| "nullable (SEQ r1 r2) = (nullable r1 \<and> nullable r2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    54
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    55
lemma nullable_correctness:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    56
  shows "nullable r  \<longleftrightarrow> [] \<in> (L r)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    57
apply (induct r) 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    58
apply(auto simp add: Sequ_def) 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    59
done
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
    60
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
    61
section {* Values *}
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
    62
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
datatype val = 
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
  Void
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    65
| Char char
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
| Seq val val
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
| Right val
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
| Left val
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    69
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    70
section {* The string behind a value *}
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    71
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    72
fun 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    73
  flat :: "val \<Rightarrow> string"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    74
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    75
  "flat(Void) = []"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    76
| "flat(Char c) = [c]"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    77
| "flat(Left v) = flat(v)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    78
| "flat(Right v) = flat(v)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    79
| "flat(Seq v1 v2) = flat(v1) @ flat(v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    80
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
    81
section {* Relation between values and regular expressions *}
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
    82
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    83
inductive 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    84
  Prf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<turnstile> _ : _" [100, 100] 100)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    85
where
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    86
 "\<lbrakk>\<turnstile> v1 : r1; \<turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<turnstile> Seq v1 v2 : SEQ r1 r2"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    87
| "\<turnstile> v1 : r1 \<Longrightarrow> \<turnstile> Left v1 : ALT r1 r2"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    88
| "\<turnstile> v2 : r2 \<Longrightarrow> \<turnstile> Right v2 : ALT r1 r2"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    89
| "\<turnstile> Void : EMPTY"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    90
| "\<turnstile> Char c : CHAR c"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    91
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    92
lemma not_nullable_flat:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    93
  assumes "\<turnstile> v : r" "\<not>nullable r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    94
  shows "flat v \<noteq> []"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    95
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    96
apply(induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    97
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
    98
done
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    99
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   100
lemma Prf_flat_L:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   101
  assumes "\<turnstile> v : r" shows "flat v \<in> L r"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   102
using assms
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   103
apply(induct v r rule: Prf.induct)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   104
apply(auto simp add: Sequ_def)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   105
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   106
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   107
lemma L_flat_Prf:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   108
  "L(r) = {flat v | v. \<turnstile> v : r}"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   109
apply(induct r)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   110
apply(auto dest: Prf_flat_L simp add: Sequ_def)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   111
apply (metis Prf.intros(4) flat.simps(1))
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   112
apply (metis Prf.intros(5) flat.simps(2))
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   113
apply (metis Prf.intros(1) flat.simps(5))
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   114
apply (metis Prf.intros(2) flat.simps(3))
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   115
apply (metis Prf.intros(3) flat.simps(4))
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
   116
apply(erule Prf.cases)
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
   117
apply(auto)
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
   118
done
6
87618dae0e04 getting back the original version by Sulzmann
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 5
diff changeset
   119
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   120
section {* Greedy Ordering according to Frisch/Cardelli *}
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   121
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   122
inductive 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   123
  GrOrd :: "val \<Rightarrow> val \<Rightarrow> bool" ("_ gr\<succ> _")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   124
where 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   125
  "v1 gr\<succ> v1' \<Longrightarrow> (Seq v1 v2) gr\<succ> (Seq v1' v2')"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   126
| "v2 gr\<succ> v2' \<Longrightarrow> (Seq v1 v2) gr\<succ> (Seq v1 v2')"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   127
| "v1 gr\<succ> v2 \<Longrightarrow> (Left v1) gr\<succ> (Left v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   128
| "v1 gr\<succ> v2 \<Longrightarrow> (Right v1) gr\<succ> (Right v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   129
| "(Left v2) gr\<succ>(Right v1)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   130
| "(Char c) gr\<succ> (Char c)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   131
| "(Void) gr\<succ> (Void)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   132
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   133
lemma Gr_refl:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   134
  assumes "\<turnstile> v : r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   135
  shows "v gr\<succ> v"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   136
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   137
apply(induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   138
apply(auto intro: GrOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   139
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   140
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   141
lemma Gr_total:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   142
  assumes "\<turnstile> v1 : r" "\<turnstile> v2 : r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   143
  shows "v1 gr\<succ> v2 \<or> v2 gr\<succ> v1"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   144
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   145
apply(induct v1 r arbitrary: v2 rule: Prf.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   146
apply(rotate_tac 4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   147
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   148
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   149
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   150
apply (metis GrOrd.intros(1) GrOrd.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   151
apply(rotate_tac 2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   152
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   153
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   154
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   155
apply (metis GrOrd.intros(3))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   156
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   157
apply (metis GrOrd.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   158
apply(rotate_tac 2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   159
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   160
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   161
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   162
apply (metis GrOrd.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   163
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   164
apply (metis GrOrd.intros(4))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   165
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   166
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   167
apply (metis GrOrd.intros(7))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   168
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   169
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   170
apply (metis GrOrd.intros(6))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   171
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   172
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   173
lemma Gr_trans: 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   174
  assumes "v1 gr\<succ> v2" "v2 gr\<succ> v3" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   175
  and     "\<turnstile> v1 : r" "\<turnstile> v2 : r" "\<turnstile> v3 : r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   176
  shows "v1 gr\<succ> v3"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   177
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   178
apply(induct r arbitrary: v1 v2 v3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   179
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   180
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   181
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   182
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   183
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   184
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   185
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   186
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   187
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   188
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   189
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   190
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   191
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   192
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   193
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   194
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   195
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   196
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   197
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   198
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   199
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   200
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   201
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   202
apply (metis GrOrd.intros(3))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   203
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   204
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   205
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   206
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   207
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   208
apply (metis GrOrd.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   209
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   210
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   211
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   212
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   213
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   214
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   215
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   216
apply (metis GrOrd.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   217
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   218
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   219
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   220
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   221
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   222
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   223
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   224
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   225
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   226
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   227
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   228
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   229
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   230
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   231
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   232
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   233
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   234
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   235
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   236
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   237
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   238
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   239
apply (metis GrOrd.intros(4))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   240
(* SEQ case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   241
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   242
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   243
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   244
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   245
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   246
apply(simp_all (no_asm_use))[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   247
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   248
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   249
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   250
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   251
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   252
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   253
apply (metis GrOrd.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   254
apply (metis GrOrd.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   255
apply(erule GrOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   256
apply(simp_all (no_asm_use))[7]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   257
apply (metis GrOrd.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   258
by (metis GrOrd.intros(1) Gr_refl)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   259
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   260
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   261
section {* Values Sets *}
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   262
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   263
definition prefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubseteq> _" [100, 100] 100)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   264
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   265
  "s1 \<sqsubseteq> s2 \<equiv> \<exists>s3. s1 @ s3 = s2"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   266
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   267
definition sprefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubset> _" [100, 100] 100)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   268
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   269
  "s1 \<sqsubset> s2 \<equiv> (s1 \<sqsubseteq> s2 \<and> s1 \<noteq> s2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   270
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   271
lemma length_sprefix:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   272
  "s1 \<sqsubset> s2 \<Longrightarrow> length s1 < length s2"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   273
unfolding sprefix_def prefix_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   274
by (auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   275
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   276
definition Prefixes :: "string \<Rightarrow> string set" where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   277
  "Prefixes s \<equiv> {sp. sp \<sqsubseteq> s}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   278
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   279
definition Suffixes :: "string \<Rightarrow> string set" where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   280
  "Suffixes s \<equiv> rev ` (Prefixes (rev s))"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   281
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   282
lemma Suffixes_in: 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   283
  "\<exists>s1. s1 @ s2 = s3 \<Longrightarrow> s2 \<in> Suffixes s3"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   284
unfolding Suffixes_def Prefixes_def prefix_def image_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   285
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   286
by (metis rev_rev_ident)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   287
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   288
lemma Prefixes_Cons:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   289
  "Prefixes (c # s) = {[]} \<union> {c # sp | sp. sp \<in> Prefixes s}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   290
unfolding Prefixes_def prefix_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   291
apply(auto simp add: append_eq_Cons_conv) 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   292
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   293
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   294
lemma finite_Prefixes:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   295
  "finite (Prefixes s)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   296
apply(induct s)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   297
apply(auto simp add: Prefixes_def prefix_def)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   298
apply(simp add: Prefixes_Cons)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   299
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   300
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   301
lemma finite_Suffixes:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   302
  "finite (Suffixes s)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   303
unfolding Suffixes_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   304
apply(rule finite_imageI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   305
apply(rule finite_Prefixes)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   306
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   307
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   308
lemma prefix_Cons:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   309
  "((c # s1) \<sqsubseteq> (c # s2)) = (s1 \<sqsubseteq> s2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   310
apply(auto simp add: prefix_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   311
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   312
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   313
lemma prefix_append:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   314
  "((s @ s1) \<sqsubseteq> (s @ s2)) = (s1 \<sqsubseteq> s2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   315
apply(induct s)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   316
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   317
apply(simp add: prefix_Cons)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   318
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   319
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   320
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   321
definition Values :: "rexp \<Rightarrow> string \<Rightarrow> val set" where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   322
  "Values r s \<equiv> {v. \<turnstile> v : r \<and> flat v \<sqsubseteq> s}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   323
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   324
definition rest :: "val \<Rightarrow> string \<Rightarrow> string" where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   325
  "rest v s \<equiv> drop (length (flat v)) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   326
88
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   327
lemma rest_flat:
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   328
  assumes "flat v1 \<sqsubseteq> s"
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   329
  shows "flat v1 @ rest v1 s = s"
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   330
using assms
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   331
apply(auto simp add: rest_def prefix_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   332
done
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   333
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   334
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   335
lemma rest_Suffixes:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   336
  "rest v s \<in> Suffixes s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   337
unfolding rest_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   338
by (metis Suffixes_in append_take_drop_id)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   339
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   340
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   341
lemma Values_recs:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   342
  "Values (NULL) s = {}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   343
  "Values (EMPTY) s = {Void}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   344
  "Values (CHAR c) s = (if [c] \<sqsubseteq> s then {Char c} else {})" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   345
  "Values (ALT r1 r2) s = {Left v | v. v \<in> Values r1 s} \<union> {Right v | v. v \<in> Values r2 s}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   346
  "Values (SEQ r1 r2) s = {Seq v1 v2 | v1 v2. v1 \<in> Values r1 s \<and> v2 \<in> Values r2 (rest v1 s)}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   347
unfolding Values_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   348
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   349
(*NULL*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   350
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   351
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   352
(*EMPTY*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   353
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   354
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   355
apply(rule Prf.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   356
apply (metis append_Nil prefix_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   357
(*CHAR*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   358
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   359
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   360
apply(rule Prf.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   361
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   362
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   363
(*ALT*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   364
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   365
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   366
apply (metis Prf.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   367
apply (metis Prf.intros(3))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   368
(*SEQ*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   369
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   370
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   371
apply (simp add: append_eq_conv_conj prefix_def rest_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   372
apply (metis Prf.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   373
apply (simp add: append_eq_conv_conj prefix_def rest_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   374
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   375
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   376
lemma Values_finite:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   377
  "finite (Values r s)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   378
apply(induct r arbitrary: s)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   379
apply(simp_all add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   380
thm finite_surj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   381
apply(rule_tac f="\<lambda>(x, y). Seq x y" and 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   382
               A="{(v1, v2) | v1 v2. v1 \<in> Values r1 s \<and> v2 \<in> Values r2 (rest v1 s)}" in finite_surj)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   383
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   384
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   385
apply(rule_tac B="\<Union>sp \<in> Suffixes s. {(v1, v2). v1 \<in> Values r1 s \<and> v2 \<in> Values r2 sp}" in finite_subset)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   386
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   387
apply (metis rest_Suffixes)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   388
apply(rule finite_UN_I)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   389
apply(rule finite_Suffixes)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   390
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   391
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   392
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   393
section {* Sulzmann functions *}
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   394
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   395
fun 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   396
  mkeps :: "rexp \<Rightarrow> val"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   397
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   398
  "mkeps(EMPTY) = Void"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   399
| "mkeps(SEQ r1 r2) = Seq (mkeps r1) (mkeps r2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   400
| "mkeps(ALT r1 r2) = (if nullable(r1) then Left (mkeps r1) else Right (mkeps r2))"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   401
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   402
section {* Derivatives *}
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   403
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   404
fun
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   405
 der :: "char \<Rightarrow> rexp \<Rightarrow> rexp"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   406
where
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   407
  "der c (NULL) = NULL"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   408
| "der c (EMPTY) = NULL"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   409
| "der c (CHAR c') = (if c = c' then EMPTY else NULL)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   410
| "der c (ALT r1 r2) = ALT (der c r1) (der c r2)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   411
| "der c (SEQ r1 r2) = 
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   412
     (if nullable r1
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   413
      then ALT (SEQ (der c r1) r2) (der c r2)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   414
      else SEQ (der c r1) r2)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   415
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   416
fun 
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   417
 ders :: "string \<Rightarrow> rexp \<Rightarrow> rexp"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   418
where
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   419
  "ders [] r = r"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   420
| "ders (c # s) r = ders s (der c r)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   421
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   422
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   423
section {* Injection function *}
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   424
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   425
fun injval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   426
where
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   427
  "injval (EMPTY) c Void = Char c"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   428
| "injval (CHAR d) c Void = Char d"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   429
| "injval (CHAR d) c (Char c') = Seq (Char d) (Char c')"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   430
| "injval (ALT r1 r2) c (Left v1) = Left(injval r1 c v1)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   431
| "injval (ALT r1 r2) c (Right v2) = Right(injval r2 c v2)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   432
| "injval (SEQ r1 r2) c (Char c') = Seq (Char c) (Char c')"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   433
| "injval (SEQ r1 r2) c (Seq v1 v2) = Seq (injval r1 c v1) v2"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   434
| "injval (SEQ r1 r2) c (Left (Seq v1 v2)) = Seq (injval r1 c v1) v2"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   435
| "injval (SEQ r1 r2) c (Right v2) = Seq (mkeps r1) (injval r2 c v2)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   436
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   437
fun 
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   438
  lex :: "rexp \<Rightarrow> string \<Rightarrow> val option"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   439
where
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   440
  "lex r [] = (if nullable r then Some(mkeps r) else None)"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   441
| "lex r (c#s) = (case (lex (der c r) s) of  
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   442
                    None \<Rightarrow> None
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   443
                  | Some(v) \<Rightarrow> Some(injval r c v))"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   444
86
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   445
fun 
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   446
  lex2 :: "rexp \<Rightarrow> string \<Rightarrow> val"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   447
where
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   448
  "lex2 r [] = mkeps r"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   449
| "lex2 r (c#s) = injval r c (lex2 (der c r) s)"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   450
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   451
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   452
section {* Projection function *}
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   453
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   454
fun projval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   455
where
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   456
  "projval (CHAR d) c _ = Void"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   457
| "projval (ALT r1 r2) c (Left v1) = Left (projval r1 c v1)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   458
| "projval (ALT r1 r2) c (Right v2) = Right (projval r2 c v2)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   459
| "projval (SEQ r1 r2) c (Seq v1 v2) = 
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   460
     (if flat v1 = [] then Right(projval r2 c v2) 
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   461
      else if nullable r1 then Left (Seq (projval r1 c v1) v2)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   462
                          else Seq (projval r1 c v1) v2)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   463
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   464
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   465
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   466
lemma mkeps_nullable:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   467
  assumes "nullable(r)" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   468
  shows "\<turnstile> mkeps r : r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   469
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   470
apply(induct rule: nullable.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   471
apply(auto intro: Prf.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   472
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   473
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   474
lemma mkeps_flat:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   475
  assumes "nullable(r)" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   476
  shows "flat (mkeps r) = []"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   477
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   478
apply(induct rule: nullable.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   479
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   480
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   481
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   482
lemma v3:
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   483
  assumes "\<turnstile> v : der c r" 
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   484
  shows "\<turnstile> (injval r c v) : r"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   485
using assms
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   486
apply(induct arbitrary: v rule: der.induct)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   487
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   488
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   489
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   490
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   491
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   492
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   493
apply(case_tac "c = c'")
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   494
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   495
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   496
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   497
apply (metis Prf.intros(5))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   498
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   499
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   500
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   501
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   502
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   503
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   504
apply (metis Prf.intros(2))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   505
apply (metis Prf.intros(3))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   506
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   507
apply(case_tac "nullable r1")
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   508
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   509
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   510
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   511
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   512
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   513
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   514
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   515
apply (metis Prf.intros(1))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   516
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   517
apply (metis Prf.intros(1) mkeps_nullable)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   518
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   519
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   520
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   521
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   522
apply(rule Prf.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   523
apply(auto)[2]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   524
done
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   525
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   526
lemma v3_proj:
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   527
  assumes "\<turnstile> v : r" and "\<exists>s. (flat v) = c # s"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   528
  shows "\<turnstile> (projval r c v) : der c r"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   529
using assms
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   530
apply(induct rule: Prf.induct)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   531
prefer 4
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   532
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   533
prefer 4
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   534
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   535
apply (metis Prf.intros(4))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   536
prefer 2
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   537
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   538
apply (metis Prf.intros(2))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   539
prefer 2
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   540
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   541
apply (metis Prf.intros(3))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   542
apply(auto)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   543
apply(rule Prf.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   544
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   545
apply (metis Prf_flat_L nullable_correctness)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   546
apply(rule Prf.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   547
apply(rule Prf.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   548
apply (metis Cons_eq_append_conv)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   549
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   550
apply(rule Prf.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   551
apply (metis Cons_eq_append_conv)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   552
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   553
done
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   554
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   555
lemma v4:
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   556
  assumes "\<turnstile> v : der c r" 
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   557
  shows "flat (injval r c v) = c # (flat v)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   558
using assms
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   559
apply(induct arbitrary: v rule: der.induct)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   560
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   561
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   562
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   563
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   564
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   565
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   566
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   567
apply(case_tac "c = c'")
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   568
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   569
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   570
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   571
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   572
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   573
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   574
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   575
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   576
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   577
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   578
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   579
apply(case_tac "nullable r1")
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   580
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   581
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   582
apply(simp_all (no_asm_use))[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   583
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   584
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   585
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   586
apply(clarify)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   587
apply(simp only: injval.simps flat.simps)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   588
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   589
apply (metis mkeps_flat)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   590
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   591
apply(erule Prf.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   592
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   593
done
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   594
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   595
lemma v4_proj:
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   596
  assumes "\<turnstile> v : r" and "\<exists>s. (flat v) = c # s"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   597
  shows "c # flat (projval r c v) = flat v"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   598
using assms
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   599
apply(induct rule: Prf.induct)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   600
prefer 4
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   601
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   602
prefer 4
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   603
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   604
prefer 2
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   605
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   606
prefer 2
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   607
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   608
apply(auto)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   609
by (metis Cons_eq_append_conv)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   610
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   611
lemma v4_proj2:
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   612
  assumes "\<turnstile> v : r" and "(flat v) = c # s"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   613
  shows "flat (projval r c v) = s"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   614
using assms
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   615
by (metis list.inject v4_proj)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   616
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   617
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   618
section {* Alternative Posix definition *}
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   619
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   620
inductive 
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   621
  PMatch :: "string \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<in> _ \<rightarrow> _" [100, 100, 100] 100)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   622
where
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   623
  "[] \<in> EMPTY \<rightarrow> Void"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   624
| "[c] \<in> (CHAR c) \<rightarrow> (Char c)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   625
| "s \<in> r1 \<rightarrow> v \<Longrightarrow> s \<in> (ALT r1 r2) \<rightarrow> (Left v)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   626
| "\<lbrakk>s \<in> r2 \<rightarrow> v; s \<notin> L(r1)\<rbrakk> \<Longrightarrow> s \<in> (ALT r1 r2) \<rightarrow> (Right v)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   627
| "\<lbrakk>s1 \<in> r1 \<rightarrow> v1; s2 \<in> r2 \<rightarrow> v2;
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   628
    \<not>(\<exists>s3 s4. s3 \<noteq> [] \<and> s3 @ s4 = s2 \<and> (s1 @ s3) \<in> L r1 \<and> s4 \<in> L r2)\<rbrakk> \<Longrightarrow> 
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   629
    (s1 @ s2) \<in> (SEQ r1 r2) \<rightarrow> (Seq v1 v2)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   630
86
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   631
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   632
lemma PMatch_mkeps:
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   633
  assumes "nullable r"
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   634
  shows "[] \<in> r \<rightarrow> mkeps r"
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   635
using assms
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   636
apply(induct r)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   637
apply(auto)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   638
apply (metis PMatch.intros(1))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   639
apply(subst append.simps(1)[symmetric])
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   640
apply (rule PMatch.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   641
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   642
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   643
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   644
apply (rule PMatch.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   645
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   646
apply (rule PMatch.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   647
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   648
apply (rule PMatch.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   649
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   650
by (metis nullable_correctness)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   651
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   652
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   653
lemma PMatch1:
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   654
  assumes "s \<in> r \<rightarrow> v"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   655
  shows "\<turnstile> v : r" "flat v = s"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   656
using assms
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   657
apply(induct s r v rule: PMatch.induct)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   658
apply(auto)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   659
apply (metis Prf.intros(4))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   660
apply (metis Prf.intros(5))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   661
apply (metis Prf.intros(2))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   662
apply (metis Prf.intros(3))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   663
apply (metis Prf.intros(1))
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   664
done
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   665
86
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   666
lemma PMatch_Values:
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   667
  assumes "s \<in> r \<rightarrow> v"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   668
  shows "v \<in> Values r s"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   669
using assms
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   670
apply(simp add: Values_def PMatch1)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   671
by (metis append_Nil2 prefix_def)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   672
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   673
lemma PMatch2:
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   674
  assumes "s \<in> (der c r) \<rightarrow> v"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   675
  shows "(c#s) \<in> r \<rightarrow> (injval r c v)"
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   676
using assms
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   677
apply(induct c r arbitrary: s v rule: der.induct)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   678
apply(auto)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   679
apply(erule PMatch.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   680
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   681
apply(erule PMatch.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   682
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   683
apply(case_tac "c = c'")
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   684
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   685
apply(erule PMatch.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   686
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   687
apply (metis PMatch.intros(2))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   688
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   689
apply(erule PMatch.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   690
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   691
apply(erule PMatch.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   692
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   693
apply (metis PMatch.intros(3))
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   694
apply(clarify)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   695
apply(rule PMatch.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   696
apply metis
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   697
apply(simp add: L_flat_Prf)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   698
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   699
thm v3_proj
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   700
apply(frule_tac c="c" in v3_proj)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   701
apply metis
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   702
apply(drule_tac x="projval r1 c v" in spec)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   703
apply(drule mp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   704
apply (metis v4_proj2)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   705
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   706
apply(case_tac "nullable r1")
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   707
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   708
defer
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   709
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   710
apply(erule PMatch.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   711
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   712
apply(clarify)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   713
apply(subst append.simps(2)[symmetric])
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   714
apply(rule PMatch.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   715
apply metis
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   716
apply metis
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   717
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   718
apply(simp add: L_flat_Prf)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   719
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   720
apply(frule_tac c="c" in v3_proj)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   721
apply metis
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   722
apply(drule_tac x="s3" in spec)
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   723
apply(drule mp)
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   724
apply(rule_tac x="projval r1 c v" in exI)
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   725
apply(rule conjI)
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   726
apply (metis v4_proj2)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   727
apply(simp)
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   728
apply metis
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   729
(* nullable case *)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   730
apply(erule PMatch.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   731
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   732
apply(clarify)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   733
apply(erule PMatch.cases)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   734
apply(simp_all)[5]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   735
apply(clarify)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   736
apply(subst append.simps(2)[symmetric])
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   737
apply(rule PMatch.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   738
apply metis
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   739
apply metis
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   740
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   741
apply(simp add: L_flat_Prf)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   742
apply(auto)[1]
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   743
apply(frule_tac c="c" in v3_proj)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   744
apply metis
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   745
apply(drule_tac x="s3" in spec)
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   746
apply(drule mp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   747
apply (metis v4_proj2)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   748
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   749
(* interesting case *)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   750
apply(clarify)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   751
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   752
thm L.simps
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   753
apply(subst (asm) L.simps(4)[symmetric])
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   754
apply(simp only: L_flat_Prf)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   755
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   756
apply(subst append.simps(1)[symmetric])
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   757
apply(rule PMatch.intros)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   758
apply (metis PMatch_mkeps)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   759
apply metis
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   760
apply(auto)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   761
apply(simp only: L_flat_Prf)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   762
apply(simp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   763
apply(auto)
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   764
apply(drule_tac x="Seq (projval r1 c v) vb" in spec)
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   765
apply(drule mp)
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   766
apply(simp)
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   767
apply (metis append_Cons butlast_snoc last_snoc neq_Nil_conv rotate1.simps(2) v4_proj2)
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   768
apply(subgoal_tac "\<turnstile> projval r1 c v : der c r1")
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   769
apply (metis Prf.intros(1))
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   770
apply(rule v3_proj)
84
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   771
apply(simp)
f89372781a4c the algorithm is correct according to the Type Inference definition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 83
diff changeset
   772
by (metis Cons_eq_append_conv)
83
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   773
86
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   774
lemma lex_correct1:
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   775
  assumes "s \<notin> L r"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   776
  shows "lex r s = None"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   777
using assms
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   778
apply(induct s arbitrary: r)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   779
apply(simp)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   780
apply (metis nullable_correctness)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   781
apply(auto)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   782
apply(drule_tac x="der a r" in meta_spec)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   783
apply(drule meta_mp)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   784
apply(auto)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   785
apply(simp add: L_flat_Prf)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   786
by (metis v3 v4)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   787
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   788
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   789
lemma lex_correct2:
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   790
  assumes "s \<in> L r"
86
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   791
  shows "\<exists>v. lex r s = Some(v) \<and> \<turnstile> v : r \<and> flat v = s"
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   792
using assms
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   793
apply(induct s arbitrary: r)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   794
apply(simp)
86
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   795
apply (metis mkeps_flat mkeps_nullable nullable_correctness)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   796
apply(drule_tac x="der a r" in meta_spec)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   797
apply(drule meta_mp)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   798
apply(simp add: L_flat_Prf)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   799
apply(auto)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   800
apply (metis v3_proj v4_proj2)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   801
apply (metis v3)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   802
apply(rule v4)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   803
by metis
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   804
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   805
lemma lex_correct3:
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   806
  assumes "s \<in> L r"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   807
  shows "\<exists>v. lex r s = Some(v) \<and> s \<in> r \<rightarrow> v"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   808
using assms
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   809
apply(induct s arbitrary: r)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   810
apply(simp)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   811
apply (metis PMatch_mkeps nullable_correctness)
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   812
apply(drule_tac x="der a r" in meta_spec)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   813
apply(drule meta_mp)
86
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   814
apply(simp add: L_flat_Prf)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   815
apply(auto)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   816
apply (metis v3_proj v4_proj2)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   817
apply(rule PMatch2)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   818
apply(simp)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   819
done
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   820
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   821
lemma lex_correct4:
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   822
  assumes "s \<in> L r"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   823
  shows "s \<in> r \<rightarrow> (lex2 r s)"
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   824
using assms
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   825
apply(induct s arbitrary: r)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   826
apply(simp)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   827
apply (metis PMatch_mkeps nullable_correctness)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   828
apply(simp)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   829
apply(rule PMatch2)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   830
apply(drule_tac x="der a r" in meta_spec)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   831
apply(drule meta_mp)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   832
apply(simp add: L_flat_Prf)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   833
apply(auto)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   834
apply (metis v3_proj v4_proj2)
56dd3d1d479b added a proof about Values and PMatch
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 85
diff changeset
   835
done
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   836
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   837
lemma 
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   838
  "lex2 (ALT (CHAR a) (ALT (CHAR b) (SEQ (CHAR a) (CHAR b)))) [a,b] = Right (Right (Seq (Char a) (Char b)))"
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   839
apply(simp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   840
done
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   841
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   842
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   843
section {* Sulzmann's Ordering of values *}
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   844
88
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
   845
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   846
inductive ValOrd :: "val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<succ>_ _" [100, 100, 100] 100)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   847
where
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   848
  "v2 \<succ>r2 v2' \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1 v2')" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   849
| "\<lbrakk>v1 \<succ>r1 v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1' v2')" 
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   850
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Right v2)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   851
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Left v1)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   852
| "v2 \<succ>r2 v2' \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Right v2')"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   853
| "v1 \<succ>r1 v1' \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Left v1')"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   854
| "Void \<succ>EMPTY Void"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   855
| "(Char c) \<succ>(CHAR c) (Char c)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   856
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   857
inductive ValOrd2 :: "val \<Rightarrow> val \<Rightarrow> bool" ("_ 2\<succ> _" [100, 100] 100)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   858
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   859
  "v2 2\<succ> v2' \<Longrightarrow> (Seq v1 v2) 2\<succ> (Seq v1 v2')" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   860
| "\<lbrakk>v1 2\<succ> v1'; v1 \<noteq> v1'\<rbrakk> \<Longrightarrow> (Seq v1 v2) 2\<succ> (Seq v1' v2')" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   861
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) 2\<succ> (Right v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   862
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) 2\<succ> (Left v1)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   863
| "v2 2\<succ> v2' \<Longrightarrow> (Right v2) 2\<succ> (Right v2')"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   864
| "v1 2\<succ> v1' \<Longrightarrow> (Left v1) 2\<succ> (Left v1')"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   865
| "Void 2\<succ> Void"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   866
| "(Char c) 2\<succ> (Char c)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   867
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   868
lemma Ord1:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   869
  "v1 \<succ>r v2 \<Longrightarrow> v1 2\<succ> v2"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   870
apply(induct rule: ValOrd.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   871
apply(auto intro: ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   872
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   873
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   874
lemma Ord2:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   875
  "v1 2\<succ> v2 \<Longrightarrow> \<exists>r. v1 \<succ>r v2"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   876
apply(induct v1 v2 rule: ValOrd2.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   877
apply(auto intro: ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   878
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   879
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   880
lemma Ord3:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   881
  "\<lbrakk>v1 2\<succ> v2; \<turnstile> v1 : r\<rbrakk> \<Longrightarrow> v1 \<succ>r v2"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   882
apply(induct v1 v2 arbitrary: r rule: ValOrd2.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   883
apply(auto intro: ValOrd.intros elim: Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   884
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   885
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   886
section {* Posix definition *}
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   887
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   888
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   889
where
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   890
  "POSIX v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v' \<sqsubseteq> flat v) \<longrightarrow> v \<succ>r v'))"
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   891
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   892
lemma ValOrd_refl:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   893
  assumes "\<turnstile> v : r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   894
  shows "v \<succ>r v"
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   895
using assms
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   896
apply(induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   897
apply(auto intro: ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   898
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   899
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   900
lemma ValOrd_total:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   901
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r\<rbrakk>  \<Longrightarrow> v1 \<succ>r v2 \<or> v2 \<succ>r v1"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   902
apply(induct r arbitrary: v1 v2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   903
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   904
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   905
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   906
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   907
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   908
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   909
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   910
apply (metis ValOrd.intros(7))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   911
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   912
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   913
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   914
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   915
apply (metis ValOrd.intros(8))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   916
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   917
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   918
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   919
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   920
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   921
apply(case_tac "v1a = v1b")
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   922
apply(simp)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   923
apply(rule ValOrd.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   924
apply (metis ValOrd.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   925
apply(rule ValOrd.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   926
apply(auto)[2]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   927
apply(erule contrapos_np)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   928
apply(rule ValOrd.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   929
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   930
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   931
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   932
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   933
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   934
apply (metis Ord1 Ord3 Prf.intros(2) ValOrd2.intros(6))
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   935
apply(rule ValOrd.intros)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   936
apply(erule contrapos_np)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   937
apply(rule ValOrd.intros)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   938
apply (metis le_eq_less_or_eq neq_iff)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   939
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   940
apply(simp_all)[5]
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   941
apply(rule ValOrd.intros)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   942
apply(erule contrapos_np)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   943
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   944
apply (metis le_eq_less_or_eq neq_iff)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   945
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   946
apply(erule contrapos_np)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   947
apply(rule ValOrd.intros)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   948
by metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   949
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   950
lemma ValOrd_anti:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   951
  shows "\<lbrakk>\<turnstile> v1 : r; \<turnstile> v2 : r; v1 \<succ>r v2; v2 \<succ>r v1\<rbrakk> \<Longrightarrow> v1 = v2"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   952
apply(induct r arbitrary: v1 v2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   953
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   954
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   955
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   956
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   957
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   958
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   959
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   960
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   961
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   962
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   963
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   964
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   965
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   966
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   967
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   968
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   969
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   970
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   971
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   972
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   973
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   974
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   975
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   976
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   977
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   978
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   979
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   980
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   981
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   982
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   983
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   984
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   985
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   986
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   987
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   988
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   989
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   990
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   991
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   992
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   993
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   994
apply(simp_all)[8]
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   995
done
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   996
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   997
lemma POSIX_ALT_I1:
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   998
  assumes "POSIX v1 r1" 
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   999
  shows "POSIX (Left v1) (ALT r1 r2)"
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1000
using assms
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1001
unfolding POSIX_def
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1002
apply(auto)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1003
apply (metis Prf.intros(2))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1004
apply(rotate_tac 2)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1005
apply(erule Prf.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1006
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1007
apply(auto)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1008
apply(rule ValOrd.intros)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1009
apply(auto)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1010
apply(rule ValOrd.intros)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1011
by (metis le_eq_less_or_eq length_sprefix sprefix_def)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1012
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1013
lemma POSIX_ALT_I2:
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1014
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1015
  shows "POSIX (Right v2) (ALT r1 r2)"
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1016
using assms
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1017
unfolding POSIX_def
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1018
apply(auto)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1019
apply (metis Prf.intros)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1020
apply(rotate_tac 3)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1021
apply(erule Prf.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1022
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1023
apply(auto)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1024
apply(rule ValOrd.intros)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1025
apply metis
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1026
apply(rule ValOrd.intros)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1027
apply metis
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1028
done
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  1029
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1030
section {* tryout with all-mkeps *}
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1031
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1032
fun 
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1033
  alleps :: "rexp \<Rightarrow> val set"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1034
where
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1035
  "alleps(NULL) = {}"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1036
| "alleps(EMPTY) = {Void}"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1037
| "alleps(CHAR c) = {}"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1038
| "alleps(SEQ r1 r2) = {Seq v1 v2 | v1 v2. v1 \<in> alleps r1 \<and> v2 \<in> alleps r2}"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1039
| "alleps(ALT r1 r2) = {Left v1 | v1. v1 \<in> alleps r1} \<union> {Right v2 | v2. v2 \<in> alleps r2}"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1040
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1041
fun injall :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val set"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1042
where
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1043
  "injall (EMPTY) c Void = {}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1044
| "injall (CHAR d) c Void = (if c = d then {Char d} else {})"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1045
| "injall (ALT r1 r2) c (Left v1) = {Left v | v. v \<in> injall r1 c v1}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1046
| "injall (ALT r1 r2) c (Right v2) = {Right v | v. v \<in> injall r2 c v2}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1047
| "injall (SEQ r1 r2) c (Seq v1 v2) = {Seq v v2 | v. v \<in> injall r1 c v1}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1048
| "injall (SEQ r1 r2) c (Left (Seq v1 v2)) = {Seq v v2 | v. v \<in> injall r1 c v1}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1049
| "injall (SEQ r1 r2) c (Right v2) = {Seq v v' | v v'. v \<in> alleps r1 \<and> v' \<in> injall r2 c v2}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1050
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1051
fun 
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1052
  allvals :: "rexp \<Rightarrow> string \<Rightarrow> val set"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1053
where
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1054
  "allvals r [] = alleps r"
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1055
| "allvals r (c#s) = {v | v v'. v \<in> injall r c v' \<and> v' \<in> allvals (der c r) s}"
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1056
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1057
lemma q1: 
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1058
  assumes "v \<in> alleps r"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1059
  shows "\<turnstile> v : r \<and> flat v = []"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1060
using assms
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1061
apply(induct r arbitrary: v)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1062
apply(auto intro: Prf.intros)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1063
done
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1064
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1065
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1066
lemma allvals_NULL:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1067
  shows "allvals (NULL) s = {}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1068
apply(induct_tac s)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1069
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1070
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1071
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1072
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1073
lemma allvals_EMPTY:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1074
  shows "allvals (EMPTY) [] = {Void}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1075
  and   "s \<noteq> [] \<Longrightarrow> allvals (EMPTY) s = {}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1076
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1077
apply(case_tac s)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1078
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1079
apply(simp add: allvals_NULL)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1080
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1081
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1082
lemma allvals_CHAR:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1083
  shows "allvals (CHAR c) [c] = {Char c}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1084
  and   "s \<noteq> [c] \<Longrightarrow> allvals (CHAR c) s = {}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1085
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1086
apply(case_tac s)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1087
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1088
apply(case_tac "c = a")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1089
apply(simp add: allvals_EMPTY)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1090
apply(simp add: allvals_NULL)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1091
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1092
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1093
lemma allvals_ALT:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1094
  shows "allvals (ALT r1 r2) s = {Left v1 | v1. v1 \<in> allvals r1 s} \<union>
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1095
                                 {Right v2 | v2. v2 \<in> allvals r2 s}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1096
apply(induct s arbitrary: r1 r2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1097
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1098
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1099
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1100
apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1101
apply(rule_tac x="Left v'" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1102
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1103
apply(rule_tac x="Right v'" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1104
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1105
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1106
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1107
lemma allvals_SEQ_Nil:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1108
  "allvals (SEQ r1 r2) [] = {Seq v1 v2 | v1 v2. v1 \<in> allvals r1 [] \<and> v2 \<in> allvals r2 []}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1109
by simp
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1110
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1111
lemma allvals_SEQ:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1112
  shows "allvals (SEQ r1 r2) s = {Seq v1 v2 | v1 v2 s1 s2. 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1113
      s = s1 @ s2 \<and> v1 \<in> allvals r1 s1 \<and> v2 \<in> allvals r2 s2}"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1114
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1115
apply(induct s arbitrary: r1 r2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1116
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1117
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1118
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1119
apply(simp_all add: allvals_ALT)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1120
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1121
apply (metis (mono_tags, lifting) allvals.simps(2) append_Cons mem_Collect_eq)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1122
apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1123
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1124
apply(rule_tac x="a#s1" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1125
apply(rule_tac x="s2" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1126
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1127
apply(fastforce)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1128
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1129
apply(subst (asm) Cons_eq_append_conv)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1130
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1131
using Prf_flat_L nullable_correctness q1 apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1132
apply(rule_tac x="Seq v' v2" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1133
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1134
apply(rule_tac x="ys'" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1135
apply(rule_tac x="s2" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1136
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1137
apply(subst (asm) Cons_eq_append_conv)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1138
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1139
apply(rule_tac x="Right v'" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1140
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1141
apply(rule_tac x="Left (Seq v' v2)" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1142
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1143
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1144
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1145
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1146
lemma q11:
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1147
  assumes "nullable r" "\<turnstile> v : r" "flat v = []"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1148
  shows "v \<in> alleps r"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1149
using assms
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1150
apply(induct r arbitrary: v)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1151
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1152
apply(erule Prf.cases)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1153
apply(simp_all)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1154
apply(erule Prf.cases)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1155
apply(simp_all)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1156
apply(erule Prf.cases)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1157
apply(simp_all)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1158
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1159
apply(subgoal_tac "nullable r2a")
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1160
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1161
using not_nullable_flat apply auto[1]
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1162
 apply(erule Prf.cases)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1163
apply(simp_all)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1164
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1165
apply(subgoal_tac "nullable r1a")
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1166
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1167
using not_nullable_flat apply auto[1]
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1168
done
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1169
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1170
lemma q33:
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1171
  assumes "nullable r"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1172
  shows "alleps r = {v. \<turnstile> v : r \<and> flat v = []}"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1173
using assms
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1174
apply(auto) 
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1175
apply (simp_all add: q1)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1176
by (simp add: q11)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1177
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1178
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1179
lemma k0:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1180
  assumes "\<turnstile> v : der a r" "v' \<in> injall r a v"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1181
  shows "flat v' = a # flat v"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1182
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1183
apply(induct a r arbitrary: v v' rule: der.induct)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1184
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1185
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1186
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1187
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1188
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1189
apply(case_tac "c = c'")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1190
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1191
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1192
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1193
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1194
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1195
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1196
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1197
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1198
apply(case_tac "nullable r1")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1199
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1200
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1201
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1202
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1203
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1204
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1205
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1206
using q1 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1207
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1208
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1209
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1210
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1211
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1212
lemma k:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1213
  assumes "\<turnstile> v' : der a r" "v \<in> injall r a v'"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1214
  shows "\<turnstile> v : r"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1215
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1216
apply(induct a r arbitrary: v v' rule: der.induct)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1217
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1218
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1219
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1220
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1221
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1222
apply(case_tac "c = c'")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1223
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1224
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1225
apply(rule Prf.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1226
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1227
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1228
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1229
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1230
apply(auto intro: Prf.intros)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1231
apply(auto intro: Prf.intros)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1232
apply(case_tac "nullable r1")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1233
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1234
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1235
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1236
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1237
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1238
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1239
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1240
apply(auto intro: Prf.intros)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1241
using Prf.intros(1) q1 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1242
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1243
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1244
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1245
using Prf.intros(1) by auto
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1246
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1247
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1248
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1249
lemma q22: 
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1250
  assumes "v \<in> allvals r s"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1251
  shows "\<turnstile> v : r \<and> s \<in> L (r) \<and> flat v = s"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1252
using assms
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1253
apply(induct s arbitrary: v r)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1254
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1255
apply(simp_all add: q1)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1256
using Prf_flat_L q1 apply fastforce
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1257
apply(drule_tac x="v'" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1258
apply(drule_tac x="der a r" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1259
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1260
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1261
apply(rule k)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1262
apply(assumption)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1263
apply(assumption)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1264
apply(drule_tac x="v'" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1265
apply(drule_tac x="der a r" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1266
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1267
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1268
using Prf_flat_L v3 v4 apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1269
apply(drule_tac x="v'" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1270
apply(drule_tac x="der a r" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1271
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1272
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1273
using k0 by blast
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1274
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1275
lemma ra:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1276
  assumes "v \<in> allvals r1 s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1277
  shows "Left v \<in> allvals (ALT r1 r2) s"
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1278
using assms
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1279
apply(induct s arbitrary: r1 r2 v)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1280
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1281
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1282
apply(rule_tac x="Left v'" in exI)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1283
apply(simp)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1284
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1285
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1286
lemma rb:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1287
  assumes "v \<in> allvals r2 s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1288
  shows "Right v \<in> allvals (ALT r1 r2) s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1289
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1290
apply(induct s arbitrary: r1 r2 v)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1291
apply(simp)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1292
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1293
apply(rule_tac x="Right v'" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1294
apply(simp)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1295
done
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1296
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1297
lemma r1:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1298
  assumes "v1 \<in> alleps r1" "v2 \<in> allvals r2 s2"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1299
  shows "Seq v1 v2 \<in> allvals (SEQ r1 r2) s2"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1300
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1301
apply(induct s2 arbitrary: r1 r2 v1 v2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1302
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1303
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1304
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1305
apply(rule_tac x="Right v'" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1306
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1307
apply(rule rb)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1308
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1309
using not_nullable_flat q1 by blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1310
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1311
lemma r2:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1312
  assumes "v1 \<in> allvals r1 s1" "v2 \<in> allvals r2 s2"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1313
  shows "Seq v1 v2 \<in> allvals (SEQ r1 r2) (s1 @ s2)"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1314
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1315
apply(induct s1 arbitrary: r1 r2 v1 v2 s2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1316
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1317
apply(rule r1) 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1318
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1319
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1320
apply(simp)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1321
apply(auto)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1322
apply(drule_tac x="der a r1" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1323
apply(drule_tac x="r2" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1324
apply(drule_tac x="v'" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1325
apply(drule_tac x="v2" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1326
apply(drule_tac x="s2" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1327
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1328
apply(rule_tac x="Left (Seq v' v2)" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1329
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1330
apply(rule ra)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1331
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1332
apply(drule_tac x="der a r1" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1333
apply(drule_tac x="r2" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1334
apply(drule_tac x="v'" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1335
apply(drule_tac x="v2" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1336
apply(drule_tac x="s2" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1337
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1338
apply(rule_tac x="Seq v' v2" in exI)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1339
apply(simp)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1340
done
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1341
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1342
lemma q22a: 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1343
  assumes " s \<in> L (r)"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1344
  shows "\<exists>v. v \<in> allvals r s \<and> flat v = s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1345
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1346
apply(induct r arbitrary: s)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1347
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1348
apply(simp add: Sequ_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1349
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1350
apply(drule_tac x="s1" in meta_spec) 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1351
apply(drule_tac x="s2" in meta_spec) 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1352
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1353
apply(rule_tac x="Seq v va" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1354
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1355
apply(rule r2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1356
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1357
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1358
apply(drule_tac x="s" in meta_spec) 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1359
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1360
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1361
apply(rule_tac x="Left v" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1362
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1363
apply(rule ra)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1364
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1365
apply(drule_tac x="s" in meta_spec) 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1366
apply(drule_tac x="s" in meta_spec) 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1367
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1368
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1369
apply(rule_tac x="Right v" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1370
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1371
apply(rule rb)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1372
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1373
done
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1374
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1375
lemma q22b: 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1376
  assumes " s \<in> L (r)" "\<turnstile> v : r" "flat v = s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1377
  shows "v \<in> allvals r s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1378
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1379
apply(induct r arbitrary: s v)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1380
apply(auto)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1381
apply(erule Prf.cases)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1382
apply(simp_all)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1383
apply(erule Prf.cases)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1384
apply(simp_all)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1385
apply(simp add: Sequ_def)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1386
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1387
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1388
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1389
apply(simp add: append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1390
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1391
apply (metis Prf_flat_L append_assoc r2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1392
apply (metis Prf_flat_L r2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1393
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1394
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1395
apply(auto intro: ra rb)[2]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1396
apply(rule rb)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1397
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1398
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1399
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1400
apply(auto intro: ra rb)[2]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1401
apply(rule ra)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1402
by (simp add: Prf_flat_L)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1403
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1404
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1405
lemma q2:
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1406
  assumes "s \<in> L(r)" 
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1407
  shows "allvals r s = {v. \<turnstile> v : r \<and> s \<in> L (r) \<and> flat v = s}"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1408
using assms
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1409
apply(auto)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1410
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1411
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1412
by (simp add: q22b)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1413
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1414
lemma r3a:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1415
  assumes "v' \<in> allvals (SEQ r1 r2) (s1 @ s2)" 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1416
          "(s1 @ s2) \<in> L (SEQ r1 r2)"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1417
  shows "\<exists>v1 v2. v' = Seq v1 v2 \<and> v1 \<in> allvals r1 s1 \<and> v2 \<in> allvals r2 s2" 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1418
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1419
apply(subst (asm) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1420
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1421
apply(erule_tac Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1422
apply(simp_all)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1423
apply(rule conjI)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1424
apply(simp add: append_eq_append_conv2)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1425
apply(auto)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1426
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1427
oops
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1428
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1429
lemma r3:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1430
  assumes "Seq v1 v2 \<in> allvals (SEQ r1 r2) (s1 @ s2)" 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1431
          "flat v1 = s1" "flat v2 = s2"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1432
          "(s1 @ s2) \<in> L (SEQ r1 r2)"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1433
  shows "v1 \<in> allvals r1 s1"  "v2 \<in> allvals r2 s2" 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1434
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1435
apply(subst (asm) q2)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1436
apply(auto)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1437
apply(erule_tac Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1438
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1439
apply(subst q2)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1440
apply(auto)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1441
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1442
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1443
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1444
apply(subst (asm) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1445
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1446
apply(erule_tac Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1447
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1448
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1449
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1450
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1451
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1452
done
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1453
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1454
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1455
definition POSIX2 :: "val \<Rightarrow> rexp \<Rightarrow> string \<Rightarrow> bool" 
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1456
where
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1457
  "POSIX2 v r s \<equiv> (\<turnstile> v : r \<and> flat v = s \<and> (\<forall>v'\<in>allvals r s. v \<succ>r v'))"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1458
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1459
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1460
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1461
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1462
lemma k1:
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1463
  assumes "nullable r"
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1464
  shows "POSIX2 v r [] \<Longrightarrow> \<forall>v' \<in> alleps r. v \<succ>r v'"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1465
using assms
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1466
apply(induct r arbitrary: v)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1467
apply(simp_all)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1468
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1469
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1470
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1471
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1472
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1473
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1474
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1475
done
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1476
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1477
lemma k2:
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1478
  assumes "s \<in> L r"
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1479
  shows "POSIX2 v r s \<Longrightarrow> \<forall>v' \<in> allvals r s. v \<succ>r v'"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1480
using assms
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1481
apply(induct s arbitrary: r v)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1482
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1483
apply(rule k1)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1484
apply (simp add: nullable_correctness)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1485
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1486
apply(simp)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1487
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1488
apply(simp only: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1489
apply(simp)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1490
apply(clarify)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1491
apply(drule_tac x="x" in spec)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1492
apply(drule mp)
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1493
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1494
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1495
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1496
lemma pos:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1497
  assumes "s \<in> r \<rightarrow> v" 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1498
  shows "v \<in> allvals r s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1499
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1500
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1501
using PMatch1(1) PMatch1(2) Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1502
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1503
using PMatch1(1) PMatch1(2) Prf_flat_L by blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1504
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1505
lemma mkeps_val:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1506
  assumes "nullable r"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1507
  shows "mkeps r \<in> alleps r"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1508
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1509
apply(induct r)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1510
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1511
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1512
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1513
lemma injval_injall:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1514
  assumes "\<turnstile> v : der a r"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1515
  shows "injval r a v \<in> injall r a v"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1516
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1517
apply(induct a r arbitrary: v rule: der.induct)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1518
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1519
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1520
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1521
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1522
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1523
apply(case_tac "c = c'")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1524
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1525
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1526
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1527
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1528
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1529
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1530
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1531
apply(case_tac "nullable r1")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1532
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1533
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1534
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1535
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1536
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1537
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1538
using mkeps_val apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1539
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1540
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1541
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1542
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1543
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1544
lemma mkeps_val1:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1545
  assumes "nullable r" "v \<succ>r mkeps r" "flat v = []" "\<turnstile> v : r"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1546
  shows "v = mkeps r"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1547
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1548
apply(induct r arbitrary: v)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1549
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1550
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1551
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1552
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1553
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1554
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1555
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1556
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1557
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1558
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1559
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1560
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1561
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1562
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1563
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1564
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1565
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1566
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1567
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1568
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1569
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1570
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1571
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1572
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1573
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1574
apply (simp add: not_nullable_flat)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1575
apply(erule ValOrd.cases)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1576
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1577
done
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1578
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1579
lemma sulzmann_our:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1580
  assumes "v \<in> alleps r" "nullable r"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1581
  shows "mkeps r \<succ>r v"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1582
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1583
apply(induct r arbitrary: v)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1584
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1585
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1586
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1587
apply(case_tac "mkeps r1 = v1")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1588
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1589
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1590
apply(blast)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1591
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1592
apply(blast)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1593
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1594
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1595
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1596
apply(blast)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1597
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1598
apply(blast)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1599
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1600
using not_nullable_flat q1 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1601
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1602
using q1 apply auto[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1603
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1604
apply (simp add: q1)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1605
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1606
apply(blast)
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1607
done
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  1608
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1609
lemma destruct:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1610
  assumes "\<forall>s3. s1 @ s3 \<in> L r1 \<longrightarrow> s3 = [] \<or> (\<forall>s4. s3 @ s4 = s2 \<longrightarrow> s4 \<notin> L r2)"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1611
  and "s1 \<in> L r1" "s2 \<in> L r2" "(s1' @ s2') \<sqsubseteq> (s1 @ s2)"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1612
  and "s1'@ s2' \<in> L (SEQ r1 r2)"  "s1' \<in> L r1"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1613
  shows "s1' \<sqsubseteq> s1"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1614
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1615
apply(simp add: prefix_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1616
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1617
apply(simp add: append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1618
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1619
apply(simp add: Sequ_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1620
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1621
apply(drule_tac x="us" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1622
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1623
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1624
apply(simp add: append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1625
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1626
oops
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1627
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1628
lemma inj_ord:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1629
  assumes "v1 \<succ>(der a r) v2" "s \<in> (der a r) \<rightarrow> v1" "s' \<in> L (der a r)" 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1630
          "v1 \<in> allvals (der a r) s" "v2 \<in> allvals (der a r) s'" "s' \<sqsubseteq> s" 
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1631
  shows "injval r a v1 \<succ>r injval r a v2"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1632
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1633
apply(induct a r arbitrary: s s' v1 v2 rule: der.induct)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1634
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1635
(*apply(simp add: allvals_NULL)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1636
apply(simp add: allvals_NULL)*)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1637
apply(case_tac "c = c'")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1638
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1639
apply(case_tac "s = []")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1640
apply(subgoal_tac "s' = []")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1641
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1642
using allvals_EMPTY(2) apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1643
apply(simp add: allvals_EMPTY)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1644
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1645
apply(simp add: allvals_EMPTY)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1646
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1647
(*apply(simp add: allvals_NULL)*)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1648
(* ALT case *)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1649
apply(simp add: allvals_ALT)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1650
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1651
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1652
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1653
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1654
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1655
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1656
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1657
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1658
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1659
apply(subst v4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1660
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1661
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1662
apply(subst v4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1663
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1664
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1665
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1666
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1667
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1668
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1669
apply(subst v4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1670
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1671
apply(subst v4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1672
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1673
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1674
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1675
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1676
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1677
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1678
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1679
using q22 apply auto[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1680
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1681
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1682
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1683
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1684
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1685
using q22 apply auto[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1686
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1687
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1688
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1689
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1690
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1691
apply(subst v4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1692
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1693
apply(subst v4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1694
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1695
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1696
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1697
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1698
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1699
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1700
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1701
apply(subst v4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1702
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1703
apply(subst v4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1704
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1705
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1706
using q22 apply auto[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1707
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1708
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1709
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1710
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1711
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1712
using q22 apply auto[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1713
(* seq case *)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1714
apply(case_tac "nullable r1")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1715
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1716
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1717
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1718
apply(simp add: allvals_SEQ)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1719
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1720
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1721
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1722
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1723
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1724
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1725
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1726
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1727
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1728
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1729
apply(rotate_tac 1)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1730
apply(drule_tac x="s1b" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1731
apply(rotate_tac 13)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1732
apply(drule_tac x="s1a" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1733
apply(drule_tac x="v1c" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1734
apply(drule_tac x="v1'" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1735
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1736
apply(subgoal_tac "s1 = s1b")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1737
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1738
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1739
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1740
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1741
apply(drule destruct)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1742
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1743
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1744
apply(assumption)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1745
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1746
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1747
apply(subgoal_tac "s2a = s2b")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1748
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1749
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1750
apply(drule destruct)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1751
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1752
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1753
apply(assumption)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1754
back
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1755
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1756
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1757
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1758
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1759
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1760
apply(simp add: allvals_ALT)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1761
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1762
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1763
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1764
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1765
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1766
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1767
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1768
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1769
apply(blast)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1770
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1771
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1772
apply(simp add: allvals_SEQ)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1773
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1774
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1775
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1776
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1777
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1778
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1779
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1780
apply(drule_tac x="s1b" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1781
apply(drule_tac x="v1" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1782
apply(drule_tac x="v1'a" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1783
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1784
apply(drule_tac meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1785
apply(subgoal_tac "s1 = s1b")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1786
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1787
apply (metis PMatch1(2) q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1788
apply(drule_tac meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1789
apply(subgoal_tac "s1a = s1b")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1790
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1791
apply(simp add: append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1792
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1793
apply(subgoal_tac "s2 = s2a")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1794
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1795
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1796
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1797
using q22 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1798
using q22 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1799
using q22 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1800
apply(subgoal_tac "usa = []")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1801
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1802
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1803
using q22 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1804
prefer 3
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1805
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1806
prefer 4
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1807
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1808
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1809
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1810
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1811
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1812
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1813
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1814
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1815
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1816
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1817
prefer 5
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1818
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1819
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1820
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1821
apply(erule ValOrd.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1822
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1823
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1824
apply(simp add: allvals_SEQ)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1825
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1826
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1827
apply(simp add: allvals_SEQ)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1828
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1829
apply(simp add: append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1830
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1831
apply (simp add: q22)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1832
thm PMatch2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1833
apply(drule PMatch2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1834
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1835
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1836
lemma sulzmann_our:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1837
  assumes "\<forall>v' \<in> allvals r s. v \<succ>r v'" "s \<in> L r" "\<turnstile> v : r" "flat v = s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1838
  shows "s \<in> r \<rightarrow> v"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1839
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1840
apply(induct s arbitrary: r v)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1841
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1842
apply(subst (asm) q33)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1843
apply (simp add: nullable_correctness)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1844
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1845
apply(drule_tac x="mkeps r" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1846
apply(drule mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1847
apply(rule conjI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1848
using mkeps_val not_nullable_flat q1 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1849
using mkeps_flat not_nullable_flat apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1850
apply(subgoal_tac "nullable r")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1851
apply(drule mkeps_val1)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1852
apply(assumption)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1853
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1854
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1855
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1856
using PMatch_mkeps not_nullable_flat apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1857
using not_nullable_flat apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1858
apply(drule_tac x="der a r" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1859
apply(drule_tac x="projval r a v" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1860
apply(drule meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1861
defer
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1862
apply(drule meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1863
using Prf_flat_L v3_proj v4_proj2 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1864
apply(drule meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1865
using v3_proj apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1866
apply(drule meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1867
apply (simp add: v4_proj2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1868
defer
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1869
apply(rule ballI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1870
apply(drule_tac x="injval r a x" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1871
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1872
apply(drule_tac x="x" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1873
apply(drule mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1874
apply(rule injval_injall)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1875
using q22 apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1876
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1877
(* HERE *)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1878
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1879
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1880
lemma our_sulzmann:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1881
  assumes "s \<in> r \<rightarrow> v" "v' \<in> allvals r s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1882
  shows "v \<succ>r v'"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1883
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1884
apply(induct r arbitrary: s v v')
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1885
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1886
apply(simp_all)[5]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1887
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1888
apply(simp_all)[5]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1889
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1890
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1891
apply(simp_all)[5]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1892
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1893
(* SEQ - case *)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1894
apply(erule PMatch.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1895
apply(simp_all)[5]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1896
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1897
apply(subst (asm) (3) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1898
apply(simp add: Sequ_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1899
apply(rule_tac x="s1" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1900
apply(rule_tac x="s2" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1901
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1902
apply(rule conjI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1903
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1904
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1905
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1906
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1907
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1908
apply(simp_all)[5]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1909
apply(case_tac "v1 = v1a")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1910
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1911
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1912
apply(rotate_tac 1)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1913
apply(drule_tac x="s2" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1914
apply(drule_tac x="v2" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1915
apply(drule_tac x="v2a" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1916
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1917
apply(drule_tac meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1918
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1919
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1920
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1921
apply(rule conjI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1922
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1923
apply (simp add: PMatch1(2))
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1924
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1925
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1926
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1927
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1928
apply(drule_tac x="s1" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1929
apply(drule_tac x="v1" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1930
apply(drule_tac x="v1a" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1931
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1932
apply(drule_tac meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1933
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1934
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1935
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1936
apply(rule conjI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1937
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1938
apply(subst (asm) append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1939
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1940
using Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1941
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1942
apply(drule_tac x="us" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1943
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1944
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1945
using Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1946
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1947
apply(drule_tac meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1948
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1949
using Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1950
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1951
using Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1952
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1953
apply(drule_tac x="flat v1a" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1954
apply(drule_tac x="v1" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1955
apply(drule_tac x="v1a" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1956
apply(drule_tac meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1957
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1958
apply(drule meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1959
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1960
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1961
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1962
apply(rule conjI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1963
apply (metis PMatch1(1) PMatch1(2) Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1964
apply(drule_tac x="[]" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1965
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1966
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1967
using Prf_flat_L apply fast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1968
apply(drule_tac x="us" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1969
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1970
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1971
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1972
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1973
thm PMatch1
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1974
qed
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1975
done
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1976
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1977
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1978
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1979
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1980
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1981
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1982
apply(drule_tac x="v1" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1983
apply(drule meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1984
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1985
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1986
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1987
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1988
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1989
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1990
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1991
apply (simp add: PMatch1(2))
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1992
apply (simp add: PMatch1(2))
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1993
apply(subst (asm) (2) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1994
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1995
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1996
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1997
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1998
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  1999
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2000
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2001
using q22b apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2002
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2003
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2004
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2005
apply(subst (asm) (3) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2006
apply(simp add: Sequ_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2007
apply(rule_tac x="s1" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2008
apply(rule_tac x="s2" in exI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2009
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2010
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2011
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2012
apply(clarify)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2013
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2014
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2015
apply(auto simp add: Sequ_def)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2016
apply(case_tac "v1 = v1a")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2017
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2018
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2019
apply(rotate_tac 3)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2020
apply(drule_tac x="v2a" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2021
apply(drule_tac meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2022
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2023
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2024
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2025
apply(rule conjI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2026
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2027
apply (metis PMatch1(2) same_append_eq)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2028
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2029
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2030
apply(drule_tac x="v1a" in meta_spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2031
apply(drule_tac meta_mp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2032
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2033
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2034
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2035
apply(rule conjI)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2036
using PMatch1(1) PMatch1(2) Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2037
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2038
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2039
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2040
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2041
apply(rotate_tac 7)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2042
apply(drule sym)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2043
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2044
apply(subst (asm) (2) append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2045
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2046
apply(frule_tac x="us" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2047
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2048
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2049
apply(drule_tac x="flat v2a" in spec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2050
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2051
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2052
apply(subgoal_tac "flat v2a = s2")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2053
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2054
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2055
apply(simp add: append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2056
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2057
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2058
apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2059
prefer 2
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2060
apply (metis Prf_flat_L append_self_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2061
prefer 4
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2062
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2063
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2064
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2065
lemma our_sulzmann:
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2066
  assumes "s \<in> r \<rightarrow> v"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2067
  shows "POSIX2 v r s"
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2068
using assms
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2069
apply(induct s r v)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2070
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2071
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2072
using Prf.intros(4) ValOrd.intros(7) apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2073
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2074
apply (simp add: Prf.intros(5) ValOrd.intros(8))
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2075
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2076
apply(auto)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2077
apply(rule Prf.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2078
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2079
apply(subgoal_tac "(\<exists>x1. x = Left x1) \<or> (\<exists>x1. x = Right x1)")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2080
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2081
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2082
apply(drule_tac x="x1" in bspec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2083
apply(subst (asm) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2084
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2085
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2086
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2087
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2088
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2089
apply(rotate_tac 2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2090
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2091
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2092
apply(rotate_tac 2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2093
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2094
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2095
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2096
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2097
apply(subst (asm) (2) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2098
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2099
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2100
defer
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2101
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2102
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2103
apply(rule Prf.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2104
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2105
apply(subgoal_tac "(\<exists>x1. x = Left x1) \<or> (\<exists>x1. x = Right x1)")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2106
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2107
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2108
apply(subst (asm) (2) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2109
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2110
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2111
apply(rotate_tac 4)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2112
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2113
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2114
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2115
using Prf_flat_L apply force
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2116
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2117
apply(drule_tac x="x1" in bspec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2118
apply(subst (asm) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2119
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2120
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2121
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2122
apply(rotate_tac 3)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2123
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2124
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2125
apply(rotate_tac 3)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2126
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2127
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2128
defer
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2129
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2130
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2131
apply(auto intro: Prf.intros)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2132
apply(subgoal_tac "(\<exists>x1 x2. x = Seq x1 x2 \<and> flat v1 @ flat v2 = flat x1 @ flat x2)")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2133
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2134
apply(case_tac "v1 = x1")
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2135
apply(simp)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2136
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2137
apply(rotate_tac 6)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2138
apply(drule_tac x="x2" in bspec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2139
apply(subst (asm) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2140
apply (simp add: Sequ_def Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2141
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2142
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2143
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2144
apply(rotate_tac 6)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2145
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2146
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2147
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2148
apply (simp add: Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2149
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2150
apply(auto simp add: Sequ_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2151
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2152
apply(rule ValOrd.intros)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2153
apply(rotate_tac 5)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2154
apply(drule_tac x="x1" in bspec)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2155
apply(rotate_tac 1)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2156
apply(subst (asm) q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2157
apply (simp add: Sequ_def Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2158
using Prf_flat_L apply blast
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2159
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2160
apply(subst q2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2161
apply (simp add: Sequ_def Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2162
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2163
apply(rotate_tac 7)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2164
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2165
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2166
apply (simp add: Sequ_def Prf_flat_L)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2167
apply(rotate_tac 7)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2168
apply(erule Prf.cases)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2169
apply(simp_all)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2170
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2171
apply(simp add: append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2172
apply(auto simp add: Sequ_def)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2173
using Prf_flat_L apply fastforce
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2174
apply(simp add: append_eq_append_conv2)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2175
apply(auto simp add: Sequ_def)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2176
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2177
apply(auto)[1]
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2178
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2179
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2180
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2181
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2182
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2183
apply(simp add: POSIX2_def)
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2184
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2185
lemma "s \<in> L(r) \<Longrightarrow> \<exists>v. POSIX2 v r s"
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2186
apply(induct r arbitrary: s)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2187
apply(auto)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2188
apply(rule_tac x="Void" in exI)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2189
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2190
apply (simp add: Prf.intros(4) ValOrd.intros(7))
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2191
apply(rule_tac x="Char x" in exI)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2192
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2193
apply (simp add: Prf.intros(5) ValOrd.intros(8))
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2194
defer
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2195
apply(drule_tac x="s" in meta_spec)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2196
apply(auto)[1]
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2197
apply(rule_tac x="Left v" in exI)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2198
apply(simp add: POSIX2_def)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2199
apply(auto)[1]
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2200
using Prf.intros(2) apply blast
212
9fd41f224e8d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 211
diff changeset
  2201
211
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2202
apply(case_tac s)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2203
apply(simp)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2204
apply(auto)[1]
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2205
apply (simp add: ValOrd.intros(6))
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2206
apply(rule ValOrd.intros)
0fa636821349 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 88
diff changeset
  2207
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2208
thm PMatch.intros[no_vars]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2209
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2210
lemma POSIX_PMatch:
88
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2211
  assumes "s \<in> r \<rightarrow> v" "v' \<in> Values r s"
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2212
  shows "v \<succ>r v' \<or> length (flat v') < length (flat v)" 
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2213
using assms
88
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2214
apply(induct r arbitrary: s v v' rule: rexp.induct)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2215
apply(simp_all add: Values_recs)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2216
apply(erule PMatch.cases)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2217
apply(simp_all)[5]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2218
apply (metis ValOrd.intros(7))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2219
apply(erule PMatch.cases)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2220
apply(simp_all)[5]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2221
apply(simp add: prefix_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2222
apply (metis ValOrd.intros(8))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2223
apply(auto)[1]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2224
defer
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2225
apply(auto)[1]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2226
apply(erule PMatch.cases)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2227
apply(simp_all)[5]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2228
apply (metis ValOrd.intros(6))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2229
apply (metis (no_types, lifting) PMatch1(2) Prf_flat_L Values_def length_sprefix mem_Collect_eq sprefix_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2230
apply(erule PMatch.cases)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2231
apply(simp_all)[5]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2232
apply (metis (no_types, lifting) PMatch1(2) ValOrd.intros(3) Values_def length_sprefix mem_Collect_eq order_refl sprefix_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2233
apply (metis ValOrd.intros(5))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2234
apply(erule PMatch.cases)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2235
apply(simp_all)[5]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2236
apply(auto)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2237
apply(case_tac "v1a = v1")
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2238
apply(simp)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2239
apply(rule ValOrd.intros(1))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2240
apply (metis PMatch1(2) append_Nil comm_monoid_diff_class.diff_cancel drop_0 drop_all drop_append order_refl rest_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2241
apply(rule ValOrd.intros(2))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2242
apply(auto)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2243
apply(drule_tac x="s1" in meta_spec)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2244
apply(drule_tac x="v1a" in meta_spec)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2245
apply(drule_tac x="v1" in meta_spec)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2246
apply(auto)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2247
apply(drule meta_mp)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2248
defer
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2249
apply(auto)[1]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2250
apply(frule PMatch1)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2251
apply(drule PMatch1(2))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2252
apply(frule PMatch1)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2253
apply(drule PMatch1(2))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2254
apply(auto)[1]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2255
apply(simp add: Values_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2256
apply(simp add: prefix_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2257
apply(auto)[1]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2258
apply(simp add: append_eq_append_conv2)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2259
apply(auto)[1]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2260
apply(rotate_tac 10)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2261
apply(drule sym)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2262
apply(simp)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2263
apply(simp add: rest_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2264
apply(case_tac "s3a = []")
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2265
apply(auto)[1]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2266
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2267
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2268
apply (metis ValOrd.intros(6))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2269
apply (metis (no_types, lifting) PMatch1(2) ValOrd.intros(3) Values_def length_sprefix mem_Collect_eq order_refl sprefix_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2270
apply(auto)[1]
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2271
apply (metis (no_types, lifting) PMatch1(2) Prf_flat_L Values_def length_sprefix mem_Collect_eq sprefix_def)
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2272
apply (metis ValOrd.intros(5))
532bb9df225d updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 87
diff changeset
  2273
apply(auto)[1]
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2274
apply(erule Prf.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2275
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2276
apply(erule Prf.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2277
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2278
apply(erule Prf.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2279
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2280
apply(erule PMatch.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2281
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2282
defer
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2283
apply(erule Prf.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2284
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2285
apply(erule PMatch.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2286
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2287
apply(clarify)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2288
apply(simp add: L_flat_Prf)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2289
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2290
apply(clarify)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2291
apply (metis ValOrd.intros(8))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2292
apply (metis POSIX_ALT_I1)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2293
apply(rule POSIX_ALT_I2)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2294
apply(simp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2295
apply(auto)[1]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2296
apply(simp add: POSIX_def)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2297
apply(frule PMatch1(1))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2298
apply(frule PMatch1(2))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2299
apply(simp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2300
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2301
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2302
lemma POSIX_PMatch:
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2303
  assumes "s \<in> r \<rightarrow> v" 
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2304
  shows "POSIX v r" 
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2305
using assms
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2306
apply(induct arbitrary: rule: PMatch.induct)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2307
apply(auto)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2308
apply(simp add: POSIX_def)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2309
apply(auto)[1]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2310
apply (metis Prf.intros(4))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2311
apply(erule Prf.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2312
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2313
apply (metis ValOrd.intros(7))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2314
apply(simp add: POSIX_def)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2315
apply(auto)[1]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2316
apply (metis Prf.intros(5))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2317
apply(erule Prf.cases)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2318
apply(simp_all)[5]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2319
apply (metis ValOrd.intros(8))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2320
apply (metis POSIX_ALT_I1)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2321
apply(rule POSIX_ALT_I2)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2322
apply(simp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2323
apply(auto)[1]
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2324
apply(simp add: POSIX_def)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2325
apply(frule PMatch1(1))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2326
apply(frule PMatch1(2))
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2327
apply(simp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2328
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2329
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2330
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2331
lemma ValOrd_PMatch:
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2332
  assumes "s \<in> r \<rightarrow> v1" "\<turnstile> v2 : r" "flat v2 = s"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2333
  shows "v1 \<succ>r v2"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2334
using assms
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2335
apply(induct arbitrary: v2 rule: PMatch.induct)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2336
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2337
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2338
apply (metis ValOrd.intros(7))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2339
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2340
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2341
apply (metis ValOrd.intros(8))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2342
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2343
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2344
apply(clarify)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2345
apply (metis ValOrd.intros(6))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2346
apply(clarify)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2347
apply (metis PMatch1(2) ValOrd.intros(3) order_refl)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2348
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2349
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2350
apply(clarify)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2351
apply (metis Prf_flat_L)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2352
apply (metis ValOrd.intros(5))
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2353
(* Seq case *)
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2354
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2355
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2356
apply(auto)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2357
apply(case_tac "v1 = v1a")
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2358
apply(auto)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2359
apply (metis PMatch1(2) ValOrd.intros(1) same_append_eq)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2360
apply(rule ValOrd.intros(2))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2361
apply(auto)
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2362
apply(drule_tac x="v1a" in meta_spec)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2363
apply(drule_tac meta_mp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2364
apply(simp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2365
apply(drule_tac meta_mp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2366
prefer 2
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2367
apply(simp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2368
apply(simp add: append_eq_append_conv2)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2369
apply(auto)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2370
apply (metis Prf_flat_L)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2371
apply(case_tac "us = []")
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2372
apply(simp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2373
apply(drule_tac x="us" in spec)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2374
apply(drule mp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2375
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2376
thm L_flat_Prf
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2377
apply(simp add: L_flat_Prf)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2378
thm append_eq_append_conv2
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2379
apply(simp add: append_eq_append_conv2)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2380
apply(auto)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2381
apply(drule_tac x="us" in spec)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2382
apply(drule mp)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2383
apply metis
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2384
apply (metis append_Nil2)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2385
apply(case_tac "us = []")
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2386
apply(auto)
87
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2387
apply(drule_tac x="s2" in spec)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2388
apply(drule mp)
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2389
030939b7d475 added type inference paper and updated Re.thy
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
  2390
apply(auto)[1]
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2391
apply(drule_tac x="v1a" in meta_spec)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2392
apply(simp)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
  2393
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2394
lemma refl_on_ValOrd:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2395
  "refl_on (Values r s) {(v1, v2). v1 \<succ>r v2 \<and> v1 \<in> Values r s \<and> v2 \<in> Values r s}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2396
unfolding refl_on_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2397
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2398
apply(rule ValOrd_refl)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2399
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2400
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2401
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2402
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2403
section {* Posix definition *}
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2404
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2405
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2406
where
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2407
  "POSIX v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v \<succ>r v'))"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2408
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2409
definition POSIX2 :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2410
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2411
  "POSIX2 v r \<equiv> (\<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v 2\<succ> v'))"
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2412
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2413
lemma "POSIX v r = POSIX2 v r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2414
unfolding POSIX_def POSIX2_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2415
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2416
apply(rule Ord1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2417
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2418
apply(rule Ord3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2419
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2420
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2421
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2422
section {* POSIX for some constructors *}
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2423
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2424
lemma POSIX_SEQ1:
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2425
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2"
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2426
  shows "POSIX v1 r1"
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2427
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2428
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2429
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2430
apply(drule_tac x="Seq v' v2" in spec)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2431
apply(simp)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2432
apply(erule impE)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2433
apply(rule Prf.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2434
apply(simp)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2435
apply(simp)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2436
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2437
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2438
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2439
by (metis ValOrd_refl)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2440
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2441
lemma POSIX_SEQ2:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2442
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2443
  shows "POSIX v2 r2"
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2444
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2445
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2446
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2447
apply(drule_tac x="Seq v1 v'" in spec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2448
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2449
apply(erule impE)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2450
apply(rule Prf.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2451
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2452
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2453
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2454
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2455
done
8
a605dda64267 started a few arguments for the ALT case
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 7
diff changeset
  2456
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2457
lemma POSIX_ALT2:
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2458
  assumes "POSIX (Left v1) (ALT r1 r2)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2459
  shows "POSIX v1 r1"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2460
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2461
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2462
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2463
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2464
apply(simp_all)[5]
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2465
apply(drule_tac x="Left v'" in spec)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2466
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2467
apply(drule mp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2468
apply(rule Prf.intros)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2469
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2470
apply(erule ValOrd.cases)
8
a605dda64267 started a few arguments for the ALT case
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 7
diff changeset
  2471
apply(simp_all)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2472
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2473
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2474
lemma POSIX_ALT1a:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2475
  assumes "POSIX (Right v2) (ALT r1 r2)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2476
  shows "POSIX v2 r2"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2477
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2478
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2479
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2480
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2481
apply(simp_all)[5]
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2482
apply(drule_tac x="Right v'" in spec)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2483
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2484
apply(drule mp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2485
apply(rule Prf.intros)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2486
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2487
apply(erule ValOrd.cases)
8
a605dda64267 started a few arguments for the ALT case
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 7
diff changeset
  2488
apply(simp_all)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2489
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2490
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2491
lemma POSIX_ALT1b:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2492
  assumes "POSIX (Right v2) (ALT r1 r2)"
8
a605dda64267 started a few arguments for the ALT case
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 7
diff changeset
  2493
  shows "(\<forall>v'. (\<turnstile> v' : r2 \<and> flat v' = flat v2) \<longrightarrow> v2 \<succ>r2 v')"
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2494
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2495
apply(drule_tac POSIX_ALT1a)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2496
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2497
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2498
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2499
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2500
lemma POSIX_ALT_I1:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2501
  assumes "POSIX v1 r1" 
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2502
  shows "POSIX (Left v1) (ALT r1 r2)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2503
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2504
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2505
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2506
apply (metis Prf.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2507
apply(rotate_tac 2)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2508
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2509
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2510
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2511
apply(rule ValOrd.intros)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2512
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2513
apply(rule ValOrd.intros)
8
a605dda64267 started a few arguments for the ALT case
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 7
diff changeset
  2514
by simp
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2515
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2516
lemma POSIX_ALT_I2:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2517
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2518
  shows "POSIX (Right v2) (ALT r1 r2)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2519
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2520
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2521
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2522
apply (metis Prf.intros)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2523
apply(rotate_tac 3)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2524
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2525
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2526
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2527
apply(rule ValOrd.intros)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2528
apply metis
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2529
done
8
a605dda64267 started a few arguments for the ALT case
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 7
diff changeset
  2530
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2531
lemma mkeps_POSIX:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2532
  assumes "nullable r"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2533
  shows "POSIX (mkeps r) r"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2534
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2535
apply(induct r)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2536
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2537
apply(simp add: POSIX_def)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2538
apply(auto)[1]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2539
apply (metis Prf.intros(4))
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2540
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2541
apply(simp_all)[5]
6
87618dae0e04 getting back the original version by Sulzmann
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 5
diff changeset
  2542
apply (metis ValOrd.intros)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2543
apply(simp)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2544
apply(auto)[1]
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2545
apply(simp add: POSIX_def)
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2546
apply(auto)[1]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2547
apply (metis mkeps.simps(2) mkeps_nullable nullable.simps(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2548
apply(rotate_tac 6)
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2549
apply(erule Prf.cases)
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2550
apply(simp_all)[5]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2551
apply (simp add: mkeps_flat)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2552
apply(case_tac "mkeps r1a = v1")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2553
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2554
apply (metis ValOrd.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2555
apply (rule ValOrd.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2556
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2557
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2558
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2559
thm mkeps.simps
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2560
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2561
apply(erule disjE)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2562
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2563
apply (metis POSIX_ALT_I1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2564
(* *)
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2565
apply(auto)[1]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2566
thm  POSIX_ALT_I1
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2567
apply (metis POSIX_ALT_I1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2568
apply(simp (no_asm) add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2569
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2570
apply(rule Prf.intros(3))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2571
apply(simp only: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2572
apply(rotate_tac 4)
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2573
apply(erule Prf.cases)
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2574
apply(simp_all)[5]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2575
thm mkeps_flat
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2576
apply(simp add: mkeps_flat)
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2577
apply(auto)[1]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2578
thm Prf_flat_L nullable_correctness
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2579
apply (metis Prf_flat_L nullable_correctness)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2580
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2581
apply(subst (asm) POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2582
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2583
apply(drule_tac x="v2" in spec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2584
by simp
6
87618dae0e04 getting back the original version by Sulzmann
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 5
diff changeset
  2585
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2586
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2587
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2588
text {*
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2589
  Injection value is related to r
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2590
*}
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2591
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2592
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2593
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2594
text {*
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2595
  The string behind the injection value is an added c
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2596
*}
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2597
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2598
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2599
lemma injval_inj: "inj_on (injval r c) {v. \<turnstile> v : der c r}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2600
apply(induct c r rule: der.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2601
unfolding inj_on_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2602
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2603
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2604
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2605
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2606
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2607
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2608
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2609
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2610
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2611
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2612
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2613
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2614
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2615
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2616
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2617
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2618
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2619
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2620
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2621
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2622
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2623
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2624
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2625
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2626
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2627
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2628
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2629
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2630
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2631
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2632
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2633
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2634
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2635
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2636
apply (metis list.distinct(1) mkeps_flat v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2637
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2638
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2639
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2640
apply(rotate_tac 6)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2641
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2642
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2643
apply (metis list.distinct(1) mkeps_flat v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2644
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2645
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2646
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2647
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2648
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2649
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2650
lemma Values_nullable:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2651
  assumes "nullable r1"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2652
  shows "mkeps r1 \<in> Values r1 s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2653
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2654
apply(induct r1 arbitrary: s)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2655
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2656
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2657
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2658
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2659
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2660
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2661
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2662
lemma Values_injval:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2663
  assumes "v \<in> Values (der c r) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2664
  shows "injval r c v \<in> Values r (c#s)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2665
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2666
apply(induct c r arbitrary: v s rule: der.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2667
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2668
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2669
apply(case_tac "c = c'")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2670
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2671
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2672
apply(simp add: prefix_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2673
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2674
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2675
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2676
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2677
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2678
apply(case_tac "nullable r1")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2679
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2680
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2681
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2682
apply(simp add: rest_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2683
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2684
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2685
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2686
apply(rule Values_nullable)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2687
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2688
apply(simp add: rest_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2689
apply(subst mkeps_flat)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2690
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2691
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2692
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2693
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2694
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2695
apply(simp add: rest_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2696
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2697
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2698
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2699
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2700
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2701
lemma Values_projval:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2702
  assumes "v \<in> Values r (c#s)" "\<exists>s. flat v = c # s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2703
  shows "projval r c v \<in> Values (der c r) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2704
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2705
apply(induct r arbitrary: v s c rule: rexp.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2706
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2707
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2708
apply(case_tac "c = char")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2709
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2710
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2711
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2712
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2713
apply(simp add: prefix_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2714
apply(case_tac "nullable rexp1")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2715
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2716
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2717
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2718
apply(simp add: rest_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2719
apply (metis hd_Cons_tl hd_append2 list.sel(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2720
apply(simp add: rest_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2721
apply(simp add: append_eq_Cons_conv)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2722
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2723
apply(subst v4_proj2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2724
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2725
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2726
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2727
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2728
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2729
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2730
apply(auto simp add: Values_def not_nullable_flat)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2731
apply(simp add: append_eq_Cons_conv)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2732
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2733
apply(simp add: append_eq_Cons_conv)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2734
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2735
apply(simp add: rest_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2736
apply(subst v4_proj2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2737
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2738
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2739
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2740
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2741
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2742
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2743
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2744
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2745
definition "MValue v r s \<equiv> (v \<in> Values r s \<and> (\<forall>v' \<in> Values r s. v 2\<succ> v'))"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2746
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2747
lemma MValue_ALTE:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2748
  assumes "MValue v (ALT r1 r2) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2749
  shows "(\<exists>vl. v = Left vl \<and> MValue vl r1 s \<and> (\<forall>vr \<in> Values r2 s. length (flat vr) \<le> length (flat vl))) \<or> 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2750
         (\<exists>vr. v = Right vr \<and> MValue vr r2 s \<and> (\<forall>vl \<in> Values r1 s. length (flat vl) < length (flat vr)))"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2751
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2752
apply(simp add: MValue_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2753
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2754
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2755
apply(drule_tac x="Left x" in bspec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2756
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2757
apply(erule ValOrd2.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2758
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2759
apply(drule_tac x="Right vr" in bspec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2760
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2761
apply(erule ValOrd2.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2762
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2763
apply(drule_tac x="Right x" in bspec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2764
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2765
apply(erule ValOrd2.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2766
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2767
apply(drule_tac x="Left vl" in bspec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2768
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2769
apply(erule ValOrd2.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2770
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2771
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2772
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2773
lemma MValue_ALTI1:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2774
  assumes "MValue vl r1 s"  "\<forall>vr \<in> Values r2 s. length (flat vr) \<le> length (flat vl)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2775
  shows "MValue (Left vl) (ALT r1 r2) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2776
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2777
apply(simp add: MValue_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2778
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2779
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2780
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2781
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2782
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2783
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2784
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2785
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2786
lemma MValue_ALTI2:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2787
  assumes "MValue vr r2 s"  "\<forall>vl \<in> Values r1 s. length (flat vl) < length (flat vr)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2788
  shows "MValue (Right vr) (ALT r1 r2) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2789
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2790
apply(simp add: MValue_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2791
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2792
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2793
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2794
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2795
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2796
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2797
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2798
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2799
lemma t: "(c#xs = c#ys) \<Longrightarrow> xs = ys"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2800
by (metis list.sel(3))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2801
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2802
lemma t2: "(xs = ys) \<Longrightarrow> (c#xs) = (c#ys)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2803
by (metis)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2804
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2805
lemma "\<not>(nullable r) \<Longrightarrow> \<not>(\<exists>v. \<turnstile> v : r \<and> flat v = [])"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2806
by (metis Prf_flat_L nullable_correctness)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2807
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2808
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2809
lemma LeftRight:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2810
  assumes "(Left v1) \<succ>(der c (ALT r1 r2)) (Right v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2811
  and "\<turnstile> v1 : der c r1" "\<turnstile> v2 : der c r2" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2812
  shows "(injval (ALT r1 r2) c (Left v1)) \<succ>(ALT r1 r2) (injval (ALT r1 r2) c (Right v2))"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2813
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2814
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2815
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2816
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2817
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2818
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2819
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2820
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2821
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2822
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2823
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2824
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2825
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2826
lemma RightLeft:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2827
  assumes "(Right v1) \<succ>(der c (ALT r1 r2)) (Left v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2828
  and "\<turnstile> v1 : der c r2" "\<turnstile> v2 : der c r1" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2829
  shows "(injval (ALT r1 r2) c (Right v1)) \<succ>(ALT r1 r2) (injval (ALT r1 r2) c (Left v2))"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2830
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2831
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2832
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2833
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2834
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2835
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2836
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2837
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2838
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2839
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2840
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2841
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2842
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2843
lemma h: 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2844
  assumes "nullable r1" "\<turnstile> v1 : der c r1"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2845
  shows "injval r1 c v1 \<succ>r1 mkeps r1"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2846
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2847
apply(induct r1 arbitrary: v1 rule: der.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2848
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2849
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2850
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2851
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2852
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2853
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2854
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2855
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2856
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2857
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2858
apply (metis ValOrd.intros(6))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2859
apply (metis ValOrd.intros(6))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2860
apply (metis ValOrd.intros(3) le_add2 list.size(3) mkeps_flat monoid_add_class.add.right_neutral)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2861
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2862
apply (metis ValOrd.intros(4) length_greater_0_conv list.distinct(1) list.size(3) mkeps_flat v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2863
apply (metis ValOrd.intros(4) length_greater_0_conv list.distinct(1) list.size(3) mkeps_flat v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2864
apply (metis ValOrd.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2865
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2866
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2867
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2868
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2869
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2870
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2871
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2872
apply (metis ValOrd.intros(2) list.distinct(1) mkeps_flat v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2873
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2874
by (metis ValOrd.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2875
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2876
lemma LeftRightSeq:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2877
  assumes "(Left (Seq v1 v2)) \<succ>(der c (SEQ r1 r2)) (Right v3)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2878
  and "nullable r1" "\<turnstile> v1 : der c r1"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2879
  shows "(injval (SEQ r1 r2) c (Seq v1 v2)) \<succ>(SEQ r1 r2) (injval (SEQ r1 r2) c (Right v2))"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2880
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2881
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2882
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2883
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2884
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2885
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2886
apply(rule ValOrd.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2887
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2888
apply (metis list.distinct(1) mkeps_flat v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2889
by (metis h)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2890
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2891
lemma rr1: 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2892
  assumes "\<turnstile> v : r" "\<not>nullable r" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2893
  shows "flat v \<noteq> []"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2894
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2895
by (metis Prf_flat_L nullable_correctness)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2896
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2897
(* HERE *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2898
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2899
lemma Prf_inj_test:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2900
  assumes "v1 \<succ>(der c r) v2" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2901
          "v1 \<in> Values (der c r) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2902
          "v2 \<in> Values (der c r) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2903
          "injval r c v1 \<in> Values r (c#s)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2904
          "injval r c v2 \<in> Values r (c#s)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2905
  shows "(injval r c v1) 2\<succ>  (injval r c v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2906
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2907
apply(induct c r arbitrary: v1 v2 s rule: der.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2908
(* NULL case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2909
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2910
(* EMPTY case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2911
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2912
(* CHAR case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2913
apply(case_tac "c = c'")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2914
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2915
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2916
apply (metis ValOrd2.intros(8))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2917
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2918
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2919
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2920
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2921
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2922
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2923
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2924
apply (metis ValOrd2.intros(6))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2925
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2926
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2927
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2928
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2929
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2930
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2931
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2932
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2933
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2934
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2935
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2936
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2937
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2938
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2939
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2940
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2941
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2942
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2943
apply (metis ValOrd2.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2944
(* SEQ case*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2945
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2946
apply(case_tac "nullable r1")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2947
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2948
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2949
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2950
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2951
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2952
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2953
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2954
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2955
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2956
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2957
apply (metis Ord1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2958
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2959
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2960
apply(subgoal_tac "rest v1 (flat v1 @ flat v2) = flat v2")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2961
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2962
apply(subgoal_tac "rest (injval r1 c v1) (c # flat v1 @ flat v2) = flat v2")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2963
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2964
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2965
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2966
lemma Prf_inj_test:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2967
  assumes "v1 \<succ>(der c r) v2" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2968
          "v1 \<in> Values (der c r) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2969
          "v2 \<in> Values (der c r) s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2970
          "injval r c v1 \<in> Values r (c#s)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2971
          "injval r c v2 \<in> Values r (c#s)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2972
  shows "(injval r c v1) 2\<succ>  (injval r c v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2973
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2974
apply(induct c r arbitrary: v1 v2 s rule: der.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2975
(* NULL case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2976
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2977
(* EMPTY case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2978
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2979
(* CHAR case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2980
apply(case_tac "c = c'")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2981
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2982
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2983
apply (metis ValOrd2.intros(8))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2984
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2985
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2986
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2987
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2988
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2989
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2990
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2991
apply (metis ValOrd2.intros(6))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2992
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2993
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2994
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2995
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2996
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2997
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2998
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2999
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3000
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3001
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3002
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3003
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3004
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3005
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3006
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3007
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3008
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3009
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3010
apply (metis ValOrd2.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3011
(* SEQ case*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3012
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3013
apply(case_tac "nullable r1")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3014
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3015
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3016
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3017
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3018
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3019
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3020
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3021
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3022
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3023
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3024
apply (metis Ord1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3025
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3026
apply(rule ValOrd2.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3027
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3028
using injval_inj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3029
apply(simp add: Values_def inj_on_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3030
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3031
apply(simp add: Values_recs)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3032
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3033
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3034
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3035
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3036
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3037
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3038
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3039
apply (metis Ord1 ValOrd2.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3040
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3041
apply(rule ValOrd2.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3042
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3043
using injval_inj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3044
apply(simp add: Values_def inj_on_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3045
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3046
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3047
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3048
apply(rule ValOrd2.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3049
thm h
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3050
apply(rule Ord1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3051
apply(rule h)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3052
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3053
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3054
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3055
apply (metis list.distinct(1) mkeps_flat v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3056
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3057
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3058
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3059
apply(simp add: Values_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3060
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3061
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3062
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3063
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3064
apply(rule ValOrd2.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3065
apply(rotate_tac 1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3066
apply(drule_tac x="v2" in meta_spec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3067
apply(rotate_tac 8)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3068
apply(drule_tac x="v2'" in meta_spec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3069
apply(rotate_tac 8)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3070
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3071
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3072
lemma POSIX_der:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3073
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3074
  shows "POSIX (injval r c v) r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3075
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3076
unfolding POSIX_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3077
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3078
thm v3
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3079
apply (erule v3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3080
thm v4
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3081
apply(subst (asm) v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3082
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3083
apply(drule_tac x="projval r c v'" in spec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3084
apply(drule mp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3085
apply(rule conjI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3086
thm v3_proj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3087
apply(rule v3_proj)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3088
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3089
apply(rule_tac x="flat v" in exI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3090
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3091
thm t
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3092
apply(rule_tac c="c" in  t)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3093
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3094
thm v4_proj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3095
apply(subst v4_proj)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3096
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3097
apply(rule_tac x="flat v" in exI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3098
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3099
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3100
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3101
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3102
lemma POSIX_der:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3103
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3104
  shows "POSIX (injval r c v) r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3105
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3106
apply(induct c r arbitrary: v rule: der.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3107
(* null case*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3108
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3109
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3110
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3111
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3112
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3113
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3114
(* empty case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3115
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3116
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3117
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3118
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3119
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3120
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3121
(* char case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3122
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3123
apply(case_tac "c = c'")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3124
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3125
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3126
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3127
apply (metis Prf.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3128
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3129
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3130
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3131
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3132
apply (metis ValOrd.intros(8))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3133
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3134
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3135
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3136
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3137
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3138
(* alt case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3139
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3140
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3141
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3142
apply(simp (no_asm) add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3143
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3144
apply (metis Prf.intros(2) v3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3145
apply(rotate_tac 4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3146
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3147
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3148
apply (metis POSIX_ALT2 POSIX_def ValOrd.intros(6))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3149
apply (metis ValOrd.intros(3) order_refl)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3150
apply(simp (no_asm) add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3151
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3152
apply (metis Prf.intros(3) v3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3153
apply(rotate_tac 4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3154
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3155
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3156
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3157
apply (metis POSIX_ALT1a POSIX_def ValOrd.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3158
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3159
apply(subst (asm) (5) POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3160
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3161
apply(rotate_tac 5)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3162
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3163
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3164
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3165
apply(subst (asm) v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3166
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3167
apply(drule_tac x="Left (projval r1a c v1)" in spec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3168
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3169
apply(drule mp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3170
apply(rule conjI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3171
apply (metis Prf.intros(2) v3_proj)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3172
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3173
apply (metis v4_proj2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3174
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3175
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3176
apply (metis less_not_refl v4_proj2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3177
(* seq case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3178
apply(case_tac "nullable r1")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3179
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3180
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3181
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3182
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3183
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3184
apply (metis Prf.intros(1) v3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3185
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3186
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3187
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3188
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3189
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3190
apply(subst (asm) (3) v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3191
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3192
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3193
apply(subgoal_tac "flat v1a \<noteq> []")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3194
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3195
apply (metis Prf_flat_L nullable_correctness)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3196
apply(subgoal_tac "\<exists>s. flat v1a = c # s")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3197
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3198
apply (metis append_eq_Cons_conv)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3199
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3200
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3201
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3202
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3203
lemma POSIX_ex: "\<turnstile> v : r \<Longrightarrow> \<exists>v. POSIX v r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3204
apply(induct r arbitrary: v)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3205
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3206
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3207
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3208
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3209
apply(rule_tac x="Void" in exI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3210
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3211
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3212
apply (metis Prf.intros(4))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3213
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3214
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3215
apply (metis ValOrd.intros(7))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3216
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3217
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3218
apply(rule_tac x="Char c" in exI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3219
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3220
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3221
apply (metis Prf.intros(5))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3222
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3223
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3224
apply (metis ValOrd.intros(8))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3225
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3226
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3227
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3228
apply(drule_tac x="v1" in meta_spec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3229
apply(drule_tac x="v2" in meta_spec)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3230
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3231
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3232
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3233
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3234
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3235
apply (metis POSIX_ALT_I1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3236
apply (metis POSIX_ALT_I1 POSIX_ALT_I2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3237
apply(case_tac "nullable r1a")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3238
apply(rule_tac x="Seq (mkeps r1a) va" in exI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3239
apply(auto simp add: POSIX_def)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3240
apply (metis Prf.intros(1) mkeps_nullable)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3241
apply(simp add: mkeps_flat)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3242
apply(rotate_tac 7)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3243
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3244
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3245
apply(case_tac "mkeps r1 = v1a")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3246
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3247
apply (rule ValOrd.intros(1))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3248
apply (metis append_Nil mkeps_flat)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3249
apply (rule ValOrd.intros(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3250
apply(drule mkeps_POSIX)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3251
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3252
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3253
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3254
lemma POSIX_ex2: "\<turnstile> v : r \<Longrightarrow> \<exists>v. POSIX v r \<and> \<turnstile> v : r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3255
apply(induct r arbitrary: v)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3256
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3257
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3258
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3259
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3260
apply(rule_tac x="Void" in exI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3261
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3262
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3263
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3264
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3265
lemma POSIX_ALT_cases:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3266
  assumes "\<turnstile> v : (ALT r1 r2)" "POSIX v (ALT r1 r2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3267
  shows "(\<exists>v1. v = Left v1 \<and> POSIX v1 r1) \<or> (\<exists>v2. v = Right v2 \<and> POSIX v2 r2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3268
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3269
apply(erule_tac Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3270
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3271
unfolding POSIX_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3272
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3273
apply (metis POSIX_ALT2 POSIX_def assms(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3274
by (metis POSIX_ALT1b assms(2))
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3275
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3276
lemma POSIX_ALT_cases2:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3277
  assumes "POSIX v (ALT r1 r2)" "\<turnstile> v : (ALT r1 r2)" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3278
  shows "(\<exists>v1. v = Left v1 \<and> POSIX v1 r1) \<or> (\<exists>v2. v = Right v2 \<and> POSIX v2 r2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3279
using assms POSIX_ALT_cases by auto
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3280
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3281
lemma Prf_flat_empty:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3282
  assumes "\<turnstile> v : r" "flat v = []"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3283
  shows "nullable r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3284
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3285
apply(induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3286
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3287
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3288
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3289
lemma POSIX_proj:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3290
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3291
  shows "POSIX (projval r c v) (der c r)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3292
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3293
apply(induct r c v arbitrary: rule: projval.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3294
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3295
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3296
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3297
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3298
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3299
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3300
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3301
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3302
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3303
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3304
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3305
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3306
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3307
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3308
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3309
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3310
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3311
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3312
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3313
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3314
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3315
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3316
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3317
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3318
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3319
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3320
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3321
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3322
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3323
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3324
lemma POSIX_proj:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3325
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3326
  shows "POSIX (projval r c v) (der c r)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3327
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3328
apply(induct r arbitrary: c v rule: rexp.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3329
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3330
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3331
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3332
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3333
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3334
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3335
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3336
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3337
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3338
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3339
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3340
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3341
lemma POSIX_proj:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3342
  assumes "POSIX v r" "\<turnstile> v : r" "\<exists>s. flat v = c#s"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3343
  shows "POSIX (projval r c v) (der c r)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3344
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3345
apply(induct r c v arbitrary: rule: projval.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3346
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3347
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3348
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3349
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3350
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3351
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3352
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3353
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3354
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3355
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3356
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3357
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3358
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3359
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3360
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3361
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3362
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3363
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3364
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3365
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3366
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3367
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3368
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3369
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3370
apply(simp add: POSIX_def)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3371
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3372
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3373
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3374
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3375
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3376
lemma Prf_inj:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3377
  assumes "v1 \<succ>(der c r) v2" "\<turnstile> v1 : der c r" "\<turnstile> v2 : der c r" "flat v1 = flat v2"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3378
  shows "(injval r c v1) \<succ>r (injval r c v2)"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3379
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3380
apply(induct arbitrary: v1 v2 rule: der.induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3381
(* NULL case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3382
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3383
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3384
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3385
(* EMPTY case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3386
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3387
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3388
(* CHAR case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3389
apply(case_tac "c = c'")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3390
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3391
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3392
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3393
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3394
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3395
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3396
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3397
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3398
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3399
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3400
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3401
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3402
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3403
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3404
apply(rotate_tac 3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3405
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3406
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3407
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3408
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3409
apply(rotate_tac 2)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3410
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3411
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3412
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3413
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3414
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3415
apply(rotate_tac 3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3416
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3417
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3418
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3419
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3420
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3421
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3422
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3423
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3424
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3425
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3426
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3427
(* SEQ case*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3428
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3429
apply(case_tac "nullable r1")
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3430
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3431
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3432
apply(erule ValOrd.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3433
apply(simp_all)[8]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3434
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3435
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3436
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3437
apply(erule Prf.cases)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3438
apply(simp_all)[5]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3439
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3440
apply(rule ValOrd.intros)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3441
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3442
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3443
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3444
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  3445
text {*
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  3446
  Injection followed by projection is the identity.
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  3447
*}
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3448
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3449
lemma proj_inj_id:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3450
  assumes "\<turnstile> v : der c r" 
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3451
  shows "projval r c (injval r c v) = v"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3452
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3453
apply(induct r arbitrary: c v rule: rexp.induct)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3454
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3455
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3456
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3457
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3458
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3459
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3460
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3461
apply(case_tac "c = char")
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3462
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3463
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3464
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3465
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3466
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3467
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3468
defer
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3469
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3470
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3471
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3472
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3473
apply(case_tac "nullable rexp1")
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3474
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3475
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3476
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3477
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3478
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3479
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3480
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3481
apply (metis list.distinct(1) v4)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3482
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3483
apply (metis mkeps_flat)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3484
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3485
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3486
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3487
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3488
apply(simp add: v4)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3489
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3490
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  3491
text {* 
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3492
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  3493
  HERE: Crucial lemma that does not go through in the sequence case. 
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  3494
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  3495
*}
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3496
lemma v5:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3497
  assumes "\<turnstile> v : der c r" "POSIX v (der c r)"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3498
  shows "POSIX (injval r c v) r"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3499
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3500
apply(induct arbitrary: v rule: der.induct)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3501
(* NULL case *)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3502
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3503
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3504
apply(simp_all)[5]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3505
(* EMPTY case *)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3506
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3507
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3508
apply(simp_all)[5]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3509
(* CHAR case *)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3510
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3511
apply(case_tac "c = c'")
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3512
apply(auto simp add: POSIX_def)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3513
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  3514
apply(simp_all)[5]
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  3515
oops