thys/Re.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 18 Dec 2015 14:25:22 +0000
changeset 85 53d5f9a5bbd3
parent 84 f89372781a4c
child 86 56dd3d1d479b
permissions -rw-r--r--
updated
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 *}
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
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
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   327
lemma rest_Suffixes:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   328
  "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
   329
unfolding rest_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   330
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
   331
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   332
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   333
lemma Values_recs:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   334
  "Values (NULL) s = {}"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   335
  "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
   336
  "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
   337
  "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
   338
  "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
   339
unfolding Values_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   340
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   341
(*NULL*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   342
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
   343
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
   344
(*EMPTY*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   345
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
   346
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
   347
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
   348
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
   349
(*CHAR*)
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
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
   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
(*ALT*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   356
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
   357
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
   358
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
   359
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
   360
(*SEQ*)
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
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
   364
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
   365
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
   366
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   367
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   368
lemma Values_finite:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   369
  "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
   370
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
   371
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
   372
thm finite_surj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   373
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
   374
               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
   375
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   376
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   377
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
   378
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   379
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
   380
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
   381
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
   382
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   383
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   384
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   385
section {* Sulzmann functions *}
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   386
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   387
fun 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   388
  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
   389
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   390
  "mkeps(EMPTY) = Void"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   391
| "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
   392
| "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
   393
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
   394
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
   395
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   396
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
   397
 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
   398
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
   399
  "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
   400
| "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
   401
| "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
   402
| "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
   403
| "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
   404
     (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
   405
      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
   406
      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
   407
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
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
   409
 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
   410
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
   411
  "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
   412
| "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
   413
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
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
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
   416
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
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
   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
  "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
   420
| "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
   421
| "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
   422
| "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
   423
| "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
   424
| "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
   425
| "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
   426
| "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
   427
| "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
   428
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   429
fun 
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   430
  lex :: "rexp \<Rightarrow> string \<Rightarrow> val option"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   431
where
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   432
  "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
   433
| "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
   434
                    None \<Rightarrow> None
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   435
                  | 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
   436
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
   437
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   438
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
   439
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   440
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
   441
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
   442
  "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
   443
| "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
   444
| "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
   445
| "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
   446
     (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
   447
      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
   448
                          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
   449
a8bcb5a0f9b9 added POSIX relation from the Type-Inference paper
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   450
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
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   452
lemma mkeps_nullable:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   453
  assumes "nullable(r)" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   454
  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
   455
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   456
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
   457
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
   458
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   459
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   460
lemma mkeps_flat:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   461
  assumes "nullable(r)" 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   462
  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
   463
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   464
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
   465
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   466
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   467
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
   468
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
   469
  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
   470
  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
   471
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
   472
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
   473
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
   474
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
   475
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
   476
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
   477
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
   478
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
   479
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
   480
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
   481
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
   482
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
   483
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
   484
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
   485
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
   486
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
   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 (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
   491
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
   492
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
   493
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
   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(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
   498
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
   499
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
   500
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
   501
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
   502
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
   503
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
   504
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
   505
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
   506
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
   507
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
   508
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
   509
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
   510
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
   511
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
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
   513
  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
   514
  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
   515
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
   516
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
   517
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
   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
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
   520
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
   521
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
   522
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
   523
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
   524
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
   525
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
   526
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
   527
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
   528
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
   529
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
   530
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
   531
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
   532
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
   533
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
   534
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
   535
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
   536
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
   537
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
   538
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
   539
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
   540
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
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
   542
  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
   543
  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
   544
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
   545
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
   546
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
   547
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
   548
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
   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(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
   551
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
   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
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
   554
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
   555
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
   556
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
   557
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
   558
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
   559
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
   560
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
   561
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
   562
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
   563
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
   564
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
   565
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
   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(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
   568
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
   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(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
   573
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
   574
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
   575
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
   576
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
   577
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
   578
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
   579
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
   580
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
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
   582
  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
   583
  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
   584
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
   585
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
   586
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
   587
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
   588
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
   589
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
   590
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
   591
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
   592
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
   593
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
   594
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
   595
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
   596
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
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
   598
  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
   599
  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
   600
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
   601
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
   602
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
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
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
   605
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
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
   607
  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
   608
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
   609
  "[] \<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
   610
| "[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
   611
| "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
   612
| "\<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
   613
| "\<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
   614
    \<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
   615
    (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
   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
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
   618
  assumes "nullable r"
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   619
  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
   620
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
   621
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
   622
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
   623
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
   624
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
   625
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
   626
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
   627
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
   628
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
   629
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
   630
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
   631
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
   632
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
   633
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
   634
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
   635
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
   636
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
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
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
   639
  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
   640
  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
   641
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
   642
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
   643
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
   644
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
   645
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
   646
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
   647
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
   648
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
   649
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
   650
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
lemma PMAtch2:
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
  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
   653
  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
   654
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
   655
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
   656
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
   657
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
   658
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
   659
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
   660
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
   661
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
   662
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
   663
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
   664
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
   665
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
   666
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
   667
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
   668
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
   669
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
   670
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
   671
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
   672
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
   673
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
   674
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
   675
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
   676
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
   677
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
   678
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
   679
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
   680
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
   681
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
   682
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
   683
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
   684
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
   685
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
   686
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
   687
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
   688
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
   689
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
   690
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
   691
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
   692
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
   693
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
   694
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
   695
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
   696
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
   697
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
   698
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
   699
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
   700
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
   701
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
   702
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
   703
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
   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)
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
   706
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
   707
(* 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
   708
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
   709
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
   710
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
   711
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
   712
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
   713
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
   714
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
   715
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
   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 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
   718
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
   719
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
   720
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
   721
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
   722
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
   723
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
   724
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
   725
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
   726
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
   727
(* 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
   728
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
   729
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
   730
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
   731
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
   732
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
   733
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
   734
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
   735
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
   736
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
   737
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
   738
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
   739
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
   740
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
   741
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
   742
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
   743
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
   744
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
   745
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
   746
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
   747
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
   748
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
   749
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
   750
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
   751
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   752
lemma lex_correct:
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   753
  assumes "s \<in> L r"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   754
  shows "\<exists>v. lex r s = Some(v) \<and> flat v = s"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   755
using assms
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   756
apply(induct s arbitrary: r)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   757
apply(simp)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   758
apply (metis mkeps_flat nullable_correctness)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   759
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
   760
apply(drule meta_mp)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   761
defer
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   762
apply(auto)[1]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   763
oops
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   764
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   765
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
   766
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   767
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
   768
where
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   769
  "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
   770
| "\<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
   771
| "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
   772
| "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
   773
| "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
   774
| "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
   775
| "Void \<succ>EMPTY Void"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   776
| "(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
   777
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   778
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
   779
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   780
  "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
   781
| "\<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
   782
| "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
   783
| "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
   784
| "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
   785
| "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
   786
| "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
   787
| "(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
   788
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   789
lemma Ord1:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   790
  "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
   791
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
   792
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
   793
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   794
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   795
lemma Ord2:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   796
  "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
   797
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
   798
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
   799
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   800
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   801
lemma Ord3:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   802
  "\<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
   803
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
   804
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
   805
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   806
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   807
lemma ValOrd_refl:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   808
  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
   809
  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
   810
using assms
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   811
apply(induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   812
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
   813
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   814
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   815
lemma ValOrd_total:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   816
  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
   817
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
   818
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   819
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
   820
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
   821
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
   822
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
   823
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
   824
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
   825
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
   826
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
   827
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
   828
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
   829
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
   830
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
   831
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
   832
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
   833
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
   834
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
   835
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   836
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
   837
apply(simp)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   838
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
   839
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
   840
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
   841
apply(auto)[2]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   842
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
   843
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
   844
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   845
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
   846
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
   847
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
   848
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
   849
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
   850
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
   851
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
   852
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
   853
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
   854
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
   855
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
   856
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
   857
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
   858
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
   859
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
   860
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
   861
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
   862
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
   863
by metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   864
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   865
lemma ValOrd_anti:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   866
  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
   867
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
   868
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
   869
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
   870
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
   871
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
   872
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
   873
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
   874
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
   875
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
   876
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
   877
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
   878
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
   879
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
   880
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
   881
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
   882
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
   883
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
   884
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
   885
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
   886
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
   887
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
   888
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
   889
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
   890
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
   891
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
   892
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
   893
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
   894
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
   895
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
   896
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
   897
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
   898
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
   899
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
   900
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
   901
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
   902
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
   903
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
   904
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
   905
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
   906
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
   907
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
   908
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
   909
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
   910
done
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   911
85
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   912
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   913
lemma ValOrd_PMatch:
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   914
  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
   915
  shows "v1 \<succ>r v2"
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   916
using assms
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   917
apply(induct arbitrary: v2 rule: PMatch.induct)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   918
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   919
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   920
apply (metis ValOrd.intros(7))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   921
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   922
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   923
apply (metis ValOrd.intros(8))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   924
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   925
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   926
apply(clarify)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   927
apply (metis ValOrd.intros(6))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   928
apply(clarify)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   929
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
   930
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   931
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   932
apply(clarify)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   933
apply (metis Prf_flat_L)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   934
apply (metis ValOrd.intros(5))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   935
apply(erule Prf.cases)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   936
apply(simp_all)[5]
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   937
apply(auto)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   938
apply(case_tac "v1 = v1a")
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   939
apply(auto)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   940
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
   941
apply(rule ValOrd.intros(2))
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   942
apply(auto)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   943
thm L_flat_Prf
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   944
apply(simp add: L_flat_Prf)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   945
thm append_eq_append_conv2
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   946
apply(simp add: append_eq_append_conv2)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   947
apply(auto)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   948
apply(drule_tac x="us" in spec)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   949
apply(drule mp)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   950
apply metis
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   951
apply (metis append_Nil2)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   952
apply(case_tac "us = []")
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   953
apply(auto)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   954
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
   955
apply(simp)
53d5f9a5bbd3 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 84
diff changeset
   956
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   957
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
   958
  "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
   959
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
   960
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   961
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
   962
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
   963
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   964
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   965
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
   966
section {* Posix definition *}
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
   967
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   968
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
   969
where
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   970
  "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
   971
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   972
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
   973
where
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   974
  "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
   975
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   976
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
   977
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
   978
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   979
apply(rule Ord1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   980
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   981
apply(rule Ord3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   982
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   983
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   984
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   985
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
   986
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   987
lemma POSIX_SEQ1:
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   988
  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
   989
  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
   990
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   991
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   992
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   993
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
   994
apply(simp)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   995
apply(erule impE)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   996
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
   997
apply(simp)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   998
apply(simp)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   999
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
  1000
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1001
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1002
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
  1003
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1004
lemma POSIX_SEQ2:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1005
  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
  1006
  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
  1007
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1008
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1009
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1010
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
  1011
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1012
apply(erule impE)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1013
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
  1014
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1015
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1016
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
  1017
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1018
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
  1019
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1020
lemma POSIX_ALT2:
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1021
  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
  1022
  shows "POSIX v1 r1"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1023
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1024
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1025
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1026
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
  1027
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
  1028
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
  1029
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1030
apply(drule mp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1031
apply(rule Prf.intros)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1032
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1033
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
  1034
apply(simp_all)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1035
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1036
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1037
lemma POSIX_ALT1a:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1038
  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
  1039
  shows "POSIX v2 r2"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1040
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1041
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1042
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1043
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
  1044
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
  1045
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
  1046
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1047
apply(drule mp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1048
apply(rule Prf.intros)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1049
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1050
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
  1051
apply(simp_all)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1052
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1053
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1054
lemma POSIX_ALT1b:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1055
  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
  1056
  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
  1057
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1058
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
  1059
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1060
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1061
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1062
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1063
lemma POSIX_ALT_I1:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1064
  assumes "POSIX v1 r1" 
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1065
  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
  1066
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1067
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1068
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1069
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
  1070
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
  1071
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1072
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1073
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1074
apply(rule ValOrd.intros)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1075
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1076
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
  1077
by simp
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1078
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1079
lemma POSIX_ALT_I2:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1080
  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
  1081
  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
  1082
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1083
unfolding POSIX_def
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1084
apply(auto)
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1085
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
  1086
apply(rotate_tac 3)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1087
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1088
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1089
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1090
apply(rule ValOrd.intros)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1091
apply metis
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1092
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
  1093
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1094
lemma mkeps_POSIX:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1095
  assumes "nullable r"
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1096
  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
  1097
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1098
apply(induct r)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1099
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1100
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
  1101
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
  1102
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
  1103
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1104
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
  1105
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
  1106
apply(simp)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1107
apply(auto)[1]
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  1108
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
  1109
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
  1110
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
  1111
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
  1112
apply(erule Prf.cases)
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  1113
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
  1114
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
  1115
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
  1116
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1117
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
  1118
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
  1119
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1120
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1121
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1122
thm mkeps.simps
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1123
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1124
apply(erule disjE)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1125
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1126
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
  1127
(* *)
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  1128
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
  1129
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
  1130
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
  1131
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
  1132
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1133
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
  1134
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
  1135
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
  1136
apply(erule Prf.cases)
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  1137
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
  1138
thm mkeps_flat
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1139
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
  1140
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
  1141
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
  1142
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
  1143
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
  1144
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
  1145
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1146
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
  1147
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
  1148
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1149
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1150
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  1151
text {*
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  1152
  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
  1153
*}
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  1154
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1155
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1156
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  1157
text {*
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1158
  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
  1159
*}
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1160
82
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1161
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1162
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
  1163
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
  1164
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
  1165
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1166
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
  1167
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
  1168
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1169
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
  1170
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
  1171
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1172
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
  1173
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
  1174
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
  1175
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
  1176
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
  1177
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
  1178
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1179
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
  1180
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
  1181
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
  1182
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
  1183
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
  1184
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
  1185
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1186
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
  1187
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
  1188
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
  1189
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
  1190
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1191
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
  1192
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
  1193
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
  1194
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
  1195
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1196
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
  1197
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
  1198
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1199
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
  1200
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
  1201
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
  1202
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1203
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
  1204
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
  1205
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
  1206
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
  1207
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
  1208
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
  1209
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
  1210
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
  1211
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1212
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1213
lemma Values_nullable:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1214
  assumes "nullable r1"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1215
  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
  1216
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1217
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
  1218
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1219
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
  1220
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
  1221
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
  1222
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1223
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1224
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1225
lemma Values_injval:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1226
  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
  1227
  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
  1228
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1229
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
  1230
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
  1231
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
  1232
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
  1233
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1234
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
  1235
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
  1236
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1237
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
  1238
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1239
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
  1240
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1241
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
  1242
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1243
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
  1244
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1245
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
  1246
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1247
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
  1248
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
  1249
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
  1250
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1251
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
  1252
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
  1253
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1254
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1255
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1256
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
  1257
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1258
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
  1259
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1260
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
  1261
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
  1262
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1263
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1264
lemma Values_projval:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1265
  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
  1266
  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
  1267
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1268
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
  1269
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
  1270
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
  1271
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
  1272
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1273
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
  1274
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1275
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
  1276
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
  1277
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
  1278
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1279
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
  1280
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1281
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
  1282
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
  1283
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
  1284
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
  1285
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1286
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
  1287
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
  1288
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1289
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1290
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1291
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
  1292
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1293
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
  1294
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
  1295
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1296
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
  1297
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1298
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
  1299
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
  1300
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
  1301
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1302
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1303
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
  1304
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1305
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1306
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1307
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1308
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
  1309
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1310
lemma MValue_ALTE:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1311
  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
  1312
  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
  1313
         (\<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
  1314
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1315
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
  1316
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
  1317
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1318
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
  1319
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1320
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
  1321
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1322
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
  1323
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1324
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
  1325
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1326
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
  1327
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1328
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
  1329
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1330
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
  1331
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1332
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
  1333
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1334
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1335
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1336
lemma MValue_ALTI1:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1337
  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
  1338
  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
  1339
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1340
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
  1341
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
  1342
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1343
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
  1344
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1345
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
  1346
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1347
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1348
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1349
lemma MValue_ALTI2:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1350
  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
  1351
  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
  1352
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1353
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
  1354
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
  1355
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1356
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
  1357
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1358
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
  1359
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1360
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1361
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1362
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
  1363
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
  1364
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1365
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
  1366
by (metis)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1367
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1368
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
  1369
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
  1370
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1371
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1372
lemma LeftRight:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1373
  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
  1374
  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
  1375
  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
  1376
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1377
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1378
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
  1379
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
  1380
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
  1381
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1382
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1383
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1384
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1385
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1386
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1387
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1388
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1389
lemma RightLeft:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1390
  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
  1391
  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
  1392
  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
  1393
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1394
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1395
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
  1396
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
  1397
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
  1398
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1399
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1400
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1401
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1402
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1403
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1404
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1405
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1406
lemma h: 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1407
  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
  1408
  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
  1409
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1410
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
  1411
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1412
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1413
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
  1414
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
  1415
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1416
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1417
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
  1418
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
  1419
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1420
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1421
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
  1422
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
  1423
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
  1424
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1425
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
  1426
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
  1427
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
  1428
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1429
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
  1430
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
  1431
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1432
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
  1433
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
  1434
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1435
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
  1436
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1437
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
  1438
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1439
lemma LeftRightSeq:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1440
  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
  1441
  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
  1442
  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
  1443
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1444
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1445
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
  1446
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
  1447
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1448
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1449
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
  1450
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1451
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
  1452
by (metis h)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1453
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1454
lemma rr1: 
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1455
  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
  1456
  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
  1457
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1458
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
  1459
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1460
(* HERE *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1461
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1462
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
  1463
  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
  1464
          "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
  1465
          "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
  1466
          "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
  1467
          "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
  1468
  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
  1469
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1470
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
  1471
(* NULL case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1472
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
  1473
(* EMPTY case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1474
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
  1475
(* CHAR case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1476
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
  1477
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1478
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
  1479
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
  1480
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
  1481
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1482
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1483
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
  1484
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1485
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
  1486
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
  1487
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
  1488
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
  1489
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
  1490
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
  1491
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1492
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
  1493
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1494
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
  1495
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1496
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
  1497
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
  1498
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
  1499
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1500
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
  1501
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1502
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
  1503
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1504
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
  1505
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
  1506
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
  1507
(* SEQ case*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1508
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1509
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
  1510
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1511
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1512
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1513
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
  1514
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1515
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
  1516
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
  1517
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1518
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
  1519
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1520
apply (metis Ord1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1521
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1522
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
  1523
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
  1524
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1525
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
  1526
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1527
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1528
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1529
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
  1530
  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
  1531
          "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
  1532
          "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
  1533
          "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
  1534
          "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
  1535
  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
  1536
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1537
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
  1538
(* NULL case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1539
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
  1540
(* EMPTY case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1541
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
  1542
(* CHAR case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1543
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
  1544
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1545
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
  1546
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
  1547
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
  1548
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1549
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1550
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
  1551
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1552
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
  1553
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
  1554
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
  1555
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
  1556
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
  1557
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
  1558
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1559
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
  1560
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1561
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
  1562
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1563
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
  1564
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
  1565
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
  1566
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1567
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
  1568
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1569
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
  1570
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1571
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
  1572
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
  1573
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
  1574
(* SEQ case*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1575
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1576
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
  1577
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1578
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1579
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1580
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
  1581
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1582
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
  1583
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
  1584
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1585
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
  1586
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1587
apply (metis Ord1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1588
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1589
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
  1590
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1591
using injval_inj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1592
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
  1593
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1594
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
  1595
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1596
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
  1597
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
  1598
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1599
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
  1600
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
  1601
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1602
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
  1603
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1604
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
  1605
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1606
using injval_inj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1607
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
  1608
apply metis
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1609
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
  1610
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
  1611
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
  1612
thm h
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1613
apply(rule Ord1)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1614
apply(rule h)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1615
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1616
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
  1617
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
  1618
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
  1619
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
  1620
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
  1621
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1622
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
  1623
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1624
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
  1625
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
  1626
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1627
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
  1628
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
  1629
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
  1630
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
  1631
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
  1632
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
  1633
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1634
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1635
lemma POSIX_der:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1636
  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
  1637
  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
  1638
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1639
unfolding POSIX_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1640
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1641
thm v3
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1642
apply (erule v3)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1643
thm v4
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1644
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
  1645
apply(assumption)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1646
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
  1647
apply(drule mp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1648
apply(rule conjI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1649
thm v3_proj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1650
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
  1651
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1652
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
  1653
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1654
thm t
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1655
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
  1656
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1657
thm v4_proj
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1658
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
  1659
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1660
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
  1661
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1662
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1663
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1664
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1665
lemma POSIX_der:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1666
  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
  1667
  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
  1668
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1669
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
  1670
(* null case*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1671
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
  1672
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1673
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
  1674
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
  1675
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
  1676
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
  1677
(* empty case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1678
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
  1679
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1680
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
  1681
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
  1682
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
  1683
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
  1684
(* char case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1685
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
  1686
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
  1687
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1688
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
  1689
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
  1690
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
  1691
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
  1692
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
  1693
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
  1694
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
  1695
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
  1696
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1697
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
  1698
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
  1699
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
  1700
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
  1701
(* alt case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1702
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
  1703
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
  1704
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1705
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
  1706
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1707
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
  1708
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
  1709
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
  1710
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
  1711
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
  1712
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
  1713
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
  1714
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1715
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
  1716
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
  1717
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
  1718
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
  1719
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1720
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
  1721
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1722
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
  1723
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1724
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
  1725
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
  1726
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
  1727
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
  1728
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
  1729
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1730
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
  1731
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1732
apply(drule mp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1733
apply(rule conjI)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1734
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
  1735
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1736
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
  1737
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
  1738
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
  1739
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
  1740
(* seq case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1741
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
  1742
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1743
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
  1744
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1745
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
  1746
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
  1747
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
  1748
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
  1749
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
  1750
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
  1751
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
  1752
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1753
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
  1754
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1755
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1756
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
  1757
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1758
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
  1759
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
  1760
prefer 2
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1761
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
  1762
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1763
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1764
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1765
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1766
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
  1767
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
  1768
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
  1769
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
  1770
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
  1771
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
  1772
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
  1773
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
  1774
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1775
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
  1776
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
  1777
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
  1778
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
  1779
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
  1780
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
  1781
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
  1782
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
  1783
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1784
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
  1785
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
  1786
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
  1787
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
  1788
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
  1789
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
  1790
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1791
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
  1792
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
  1793
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1794
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1795
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
  1796
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
  1797
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1798
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
  1799
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
  1800
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
  1801
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
  1802
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
  1803
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
  1804
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
  1805
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
  1806
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
  1807
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
  1808
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
  1809
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1810
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
  1811
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
  1812
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
  1813
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
  1814
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
  1815
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1816
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1817
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
  1818
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
  1819
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
  1820
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
  1821
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
  1822
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
  1823
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
  1824
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
  1825
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1826
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1827
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1828
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
  1829
  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
  1830
  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
  1831
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1832
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
  1833
apply(simp_all)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1834
unfolding POSIX_def
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1835
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1836
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
  1837
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
  1838
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1839
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
  1840
  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
  1841
  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
  1842
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
  1843
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1844
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
  1845
  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
  1846
  shows "nullable r"
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1847
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1848
apply(induct)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1849
apply(auto)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1850
done
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1851
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1852
lemma POSIX_proj:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1853
  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
  1854
  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
  1855
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1856
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
  1857
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1858
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1859
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1860
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1861
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
  1862
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
  1863
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
  1864
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
  1865
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
  1866
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
  1867
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
  1868
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
  1869
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
  1870
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
  1871
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
  1872
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
  1873
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
  1874
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
  1875
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
  1876
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
  1877
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
  1878
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
  1879
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
  1880
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
  1881
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
  1882
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1883
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
  1884
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
  1885
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1886
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1887
lemma POSIX_proj:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1888
  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
  1889
  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
  1890
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1891
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
  1892
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
  1893
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
  1894
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
  1895
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
  1896
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
  1897
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
  1898
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
  1899
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1900
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
  1901
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
  1902
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1903
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1904
lemma POSIX_proj:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1905
  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
  1906
  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
  1907
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1908
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
  1909
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1910
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1911
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1912
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1913
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
  1914
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
  1915
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
  1916
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
  1917
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
  1918
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
  1919
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
  1920
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
  1921
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
  1922
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
  1923
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
  1924
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
  1925
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
  1926
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
  1927
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
  1928
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
  1929
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
  1930
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
  1931
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
  1932
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
  1933
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
  1934
apply(auto)[1]
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1935
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
  1936
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
  1937
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1938
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1939
lemma Prf_inj:
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1940
  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
  1941
  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
  1942
using assms
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1943
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
  1944
(* NULL case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1945
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1946
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
  1947
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
  1948
(* EMPTY case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1949
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
  1950
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
  1951
(* CHAR case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1952
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
  1953
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1954
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
  1955
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
  1956
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
  1957
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1958
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
  1959
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
  1960
(* ALT case *)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1961
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1962
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
  1963
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
  1964
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
  1965
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1966
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1967
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
  1968
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
  1969
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
  1970
apply(subst v4)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1971
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1972
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
  1973
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
  1974
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
  1975
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1976
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
  1977
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1978
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
  1979
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
  1980
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
  1981
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1982
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
  1983
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
  1984
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
  1985
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1986
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
  1987
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
  1988
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
  1989
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
  1990
(* SEQ case*)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1991
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1992
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
  1993
defer
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1994
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1995
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
  1996
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
  1997
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  1998
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
  1999
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
  2000
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
  2001
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
  2002
apply(clarify)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2003
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
  2004
apply(simp)
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2005
oops
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2006
26202889f829 cleaned up version of Re1
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
  2007
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2008
text {*
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2009
  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
  2010
*}
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2011
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2012
lemma proj_inj_id:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2013
  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
  2014
  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
  2015
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2016
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
  2017
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2018
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2019
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2020
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2021
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2022
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2023
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2024
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
  2025
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2026
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2027
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2028
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2029
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2030
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2031
defer
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2032
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2033
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2034
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2035
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2036
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
  2037
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2038
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2039
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2040
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2041
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2042
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2043
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2044
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
  2045
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2046
apply (metis mkeps_flat)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2047
apply(auto)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2048
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2049
apply(simp_all)[5]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2050
apply(auto)[1]
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2051
apply(simp add: v4)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2052
done
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2053
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2054
text {* 
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2055
7
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2056
  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
  2057
b409ecf47f64 cleaned up the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 6
diff changeset
  2058
*}
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2059
lemma v5:
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2060
  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
  2061
  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
  2062
using assms
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2063
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
  2064
(* NULL case *)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2065
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2066
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2067
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
  2068
(* EMPTY case *)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2069
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2070
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2071
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
  2072
(* CHAR case *)
5
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2073
apply(simp)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2074
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
  2075
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
  2076
apply(erule Prf.cases)
fe177dfc4697 initial version of the theory
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  2077
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
  2078
oops