thys/Re1.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Thu, 29 Jan 2015 23:39:08 +0000
changeset 55 c33cfa1e813a
parent 53 38cde0214ad5
child 56 5bc72d6d633d
permissions -rw-r--r--
added some notes (still incomplete)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
11
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
     2
theory Re1
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
  imports "Main" 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
begin
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
section {* Sequential Composition of Sets *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
definition
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
  Sequ :: "string set \<Rightarrow> string set \<Rightarrow> string set" ("_ ;; _" [100,100] 100)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
where 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
  "A ;; B = {s1 @ s2 | s1 s2. s1 \<in> A \<and> s2 \<in> B}"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
text {* Two Simple Properties about Sequential Composition *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
lemma seq_empty [simp]:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
  shows "A ;; {[]} = A"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
  and   "{[]} ;; A = A"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
by (simp_all add: Sequ_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
lemma seq_null [simp]:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
  shows "A ;; {} = {}"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
  and   "{} ;; A = {}"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
by (simp_all add: Sequ_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
section {* Regular Expressions *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
datatype rexp =
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
  NULL
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
| EMPTY
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
| CHAR char
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
| SEQ rexp rexp
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
| ALT rexp rexp
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
section {* Semantics of Regular Expressions *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
fun
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
  L :: "rexp \<Rightarrow> string set"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
  "L (NULL) = {}"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
| "L (EMPTY) = {[]}"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
| "L (CHAR c) = {[c]}"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
| "L (SEQ r1 r2) = (L r1) ;; (L r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    43
| "L (ALT r1 r2) = (L r1) \<union> (L r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
section {* Values *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
datatype val = 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
  Void
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
| Char char
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
| Seq val val
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    52
| Right val
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
| Left val
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    54
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    55
section {* Relation between values and regular expressions *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
inductive Prf :: "val \<Rightarrow> rexp \<Rightarrow> bool" ("\<turnstile> _ : _" [100, 100] 100)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
 "\<lbrakk>\<turnstile> v1 : r1; \<turnstile> v2 : r2\<rbrakk> \<Longrightarrow> \<turnstile> Seq v1 v2 : SEQ r1 r2"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    60
| "\<turnstile> v1 : r1 \<Longrightarrow> \<turnstile> Left v1 : ALT r1 r2"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
| "\<turnstile> v2 : r2 \<Longrightarrow> \<turnstile> Right v2 : ALT r1 r2"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    62
| "\<turnstile> Void : EMPTY"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
| "\<turnstile> Char c : CHAR c"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    65
section {* The string behind a value *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
fun flat :: "val \<Rightarrow> string"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    69
  "flat(Void) = []"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    70
| "flat(Char c) = [c]"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    71
| "flat(Left v) = flat(v)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    72
| "flat(Right v) = flat(v)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
| "flat(Seq v1 v2) = flat(v1) @ flat(v2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    74
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
    75
fun flats :: "val \<Rightarrow> string list"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
    76
where
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
    77
  "flats(Void) = [[]]"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
    78
| "flats(Char c) = [[c]]"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
    79
| "flats(Left v) = flats(v)"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
    80
| "flats(Right v) = flats(v)"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
    81
| "flats(Seq v1 v2) = (flats v1) @ (flats v2)"
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    82
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    83
lemma Prf_flat_L:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    84
  assumes "\<turnstile> v : r" shows "flat v \<in> L r"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    85
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    86
apply(induct)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    87
apply(auto simp add: Sequ_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    88
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    89
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    90
lemma L_flat_Prf:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    91
  "L(r) = {flat v | v. \<turnstile> v : r}"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    92
apply(induct r)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    93
apply(auto dest: Prf_flat_L simp add: Sequ_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    94
apply (metis Prf.intros(4) flat.simps(1))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    95
apply (metis Prf.intros(5) flat.simps(2))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    96
apply (metis Prf.intros(1) flat.simps(5))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    97
apply (metis Prf.intros(2) flat.simps(3))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    98
apply (metis Prf.intros(3) flat.simps(4))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    99
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   100
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   101
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   102
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   103
definition prefix :: "string \<Rightarrow> string \<Rightarrow> bool" ("_ \<sqsubset> _" [100, 100] 100)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   104
where
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   105
  "s1 \<sqsubset> s2 \<equiv> \<exists>s3. s1 @ s3 = s2"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   106
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   107
section {* Ordering of values *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   108
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   109
inductive ValOrd :: "val \<Rightarrow> rexp \<Rightarrow> val \<Rightarrow> bool" ("_ \<succ>_ _" [100, 100, 100] 100)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   110
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   111
  "\<lbrakk>v1 = v1'; v2 \<succ>r2 v2'\<rbrakk> \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1' v2')" 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   112
| "v1  \<succ>r1 v1' \<Longrightarrow> (Seq v1 v2) \<succ>(SEQ r1 r2) (Seq v1' v2')" 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   113
| "length (flat v1) \<ge> length (flat v2) \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Right v2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   114
| "length (flat v2) > length (flat v1) \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Left v1)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   115
| "v2 \<succ>r2 v2' \<Longrightarrow> (Right v2) \<succ>(ALT r1 r2) (Right v2')"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   116
| "v1 \<succ>r1 v1' \<Longrightarrow> (Left v1) \<succ>(ALT r1 r2) (Left v1')"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   117
| "Void \<succ>EMPTY Void"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   118
| "(Char c) \<succ>(CHAR c) (Char c)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   119
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   120
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   121
section {* The ordering is reflexive *}
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   122
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   123
lemma ValOrd_refl:
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   124
  assumes "\<turnstile> v : r"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   125
  shows "v \<succ>r v"
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   126
using assms
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   127
apply(induct)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   128
apply(auto intro: ValOrd.intros)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   129
done
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   130
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   131
lemma ValOrd_flats:
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   132
  assumes "v1 \<succ>r v2"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   133
  shows "hd (flats v2) = hd (flats v1)"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   134
using assms
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   135
apply(induct)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   136
apply(auto)
49
c616ec6b1e3c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 48
diff changeset
   137
oops
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   138
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   139
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   140
section {* Posix definition *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   141
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
definition POSIX :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   144
  "POSIX v r \<equiv> (\<forall>v'. (\<turnstile> v' : r \<and> flat v = flat v') \<longrightarrow> v \<succ>r v')"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   145
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   146
(*
11
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   147
an alternative definition: might cause problems
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   148
with theorem mkeps_POSIX
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   149
*)
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   150
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   151
definition POSIX2 :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   152
where
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   153
  "POSIX2 v r \<equiv> \<turnstile> v : r \<and> (\<forall>v'. \<turnstile> v' : r \<longrightarrow> v \<succ>r v')"
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   154
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   155
definition POSIX3 :: "val \<Rightarrow> rexp \<Rightarrow> bool" 
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   156
where
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   157
  "POSIX3 v r \<equiv> \<turnstile> v : r \<and> (\<forall>v'. (\<turnstile> v' : r \<and> length (flat v') \<le> length(flat v)) \<longrightarrow> v \<succ>r v')"
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   158
11
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   159
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   160
lemma POSIX_SEQ:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   161
  assumes "POSIX (Seq v1 v2) (SEQ r1 r2)" "\<turnstile> v1 : r1" "\<turnstile> v2 : r2"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   162
  shows "POSIX v1 r1 \<and> POSIX v2 r2"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   163
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   164
unfolding POSIX_def
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   165
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   166
apply(drule_tac x="Seq v' v2" in spec)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   167
apply(simp)
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   168
apply(erule impE)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   169
apply(rule Prf.intros)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   170
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   171
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   172
apply(erule ValOrd.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   173
apply(simp_all)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   174
apply(clarify)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   175
defer
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   176
apply(drule_tac x="Seq v1 v'" in spec)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   177
apply(simp)
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   178
apply(erule impE)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   179
apply(rule Prf.intros)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   180
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   181
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   182
apply(erule ValOrd.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   183
apply(simp_all)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   184
apply(clarify)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   185
oops (*not true*)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   186
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   187
lemma POSIX_SEQ_I:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   188
  assumes "POSIX v1 r1" "POSIX v2 r2" 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   189
  shows "POSIX (Seq v1 v2) (SEQ r1 r2)" 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   190
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   191
unfolding POSIX_def
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   192
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   193
apply(rotate_tac 2)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   194
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   195
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   196
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   197
apply(rule ValOrd.intros)
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   198
oops (* maybe also not true *)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   199
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   200
lemma POSIX3_SEQ_I:
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   201
  assumes "POSIX3 v1 r1" "POSIX3 v2 r2" 
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   202
  shows "POSIX3 (Seq v1 v2) (SEQ r1 r2)" 
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   203
using assms
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   204
unfolding POSIX3_def
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   205
apply(auto)
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   206
apply (metis Prf.intros(1))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   207
apply(rotate_tac 4)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   208
apply(erule Prf.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   209
apply(simp_all)[5]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   210
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   211
apply(case_tac "v1 = v1a")
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   212
apply(auto)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   213
apply (metis ValOrd.intros(1))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   214
apply (rule ValOrd.intros(2))
49
c616ec6b1e3c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 48
diff changeset
   215
oops
12
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   216
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   217
lemma POSIX_ALT2:
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   218
  assumes "POSIX (Left v1) (ALT r1 r2)"
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   219
  shows "POSIX v1 r1"
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   220
using assms
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   221
unfolding POSIX_def
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   222
apply(auto)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   223
apply(drule_tac x="Left v'" in spec)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   224
apply(simp)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   225
apply(drule mp)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   226
apply(rule Prf.intros)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   227
apply(auto)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   228
apply(erule ValOrd.cases)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   229
apply(simp_all)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   230
done
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   231
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   232
lemma POSIX2_ALT:
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   233
  assumes "POSIX2 (Left v1) (ALT r1 r2)"
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   234
  shows "POSIX2 v1 r1"
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   235
using assms
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   236
unfolding POSIX2_def
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   237
apply(auto)
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   238
oops
12
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   239
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   240
lemma POSIX_ALT:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   241
  assumes "POSIX (Left v1) (ALT r1 r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   242
  shows "POSIX v1 r1"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   243
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   244
unfolding POSIX_def
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   245
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   246
apply(drule_tac x="Left v'" in spec)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   247
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   248
apply(drule mp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   249
apply(rule Prf.intros)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   250
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   251
apply(erule ValOrd.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   252
apply(simp_all)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   253
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   254
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   255
lemma POSIX2_ALT:
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   256
  assumes "POSIX2 (Left v1) (ALT r1 r2)"
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   257
  shows "POSIX2 v1 r1"
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   258
using assms
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   259
apply(simp add: POSIX2_def)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   260
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   261
apply(erule Prf.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   262
apply(simp_all)[5]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   263
apply(drule_tac x="Left v'" in spec)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   264
apply(drule mp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   265
apply(rule Prf.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   266
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   267
apply(erule ValOrd.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   268
apply(simp_all)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   269
done
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   270
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   271
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   272
lemma POSIX_ALT1a:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   273
  assumes "POSIX (Right v2) (ALT r1 r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   274
  shows "POSIX v2 r2"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   275
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   276
unfolding POSIX_def
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   277
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   278
apply(drule_tac x="Right v'" in spec)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   279
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   280
apply(drule mp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   281
apply(rule Prf.intros)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   282
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   283
apply(erule ValOrd.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   284
apply(simp_all)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   285
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   286
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   287
lemma POSIX2_ALT1a:
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   288
  assumes "POSIX2 (Right v2) (ALT r1 r2)"
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   289
  shows "POSIX2 v2 r2"
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   290
using assms
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   291
unfolding POSIX2_def
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   292
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   293
apply(erule Prf.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   294
apply(simp_all)[5]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   295
apply(drule_tac x="Right v'" in spec)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   296
apply(drule mp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   297
apply(rule Prf.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   298
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   299
apply(erule ValOrd.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   300
apply(simp_all)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   301
done
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   302
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   303
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   304
lemma POSIX_ALT1b:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   305
  assumes "POSIX (Right v2) (ALT r1 r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   306
  shows "(\<forall>v'. (\<turnstile> v' : r2 \<and> flat v' = flat v2) \<longrightarrow> v2 \<succ>r2 v')"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   307
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   308
apply(drule_tac POSIX_ALT1a)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   309
unfolding POSIX_def
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   310
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   311
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   312
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   313
lemma POSIX_ALT_I1:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   314
  assumes "POSIX v1 r1" 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   315
  shows "POSIX (Left v1) (ALT r1 r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   316
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   317
unfolding POSIX_def
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   318
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   319
apply(rotate_tac 3)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   320
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   321
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   322
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   323
apply(rule ValOrd.intros)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   324
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   325
apply(rule ValOrd.intros)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   326
by simp
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   327
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   328
lemma POSIX2_ALT_I1:
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   329
  assumes "POSIX2 v1 r1" 
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   330
  shows "POSIX2 (Left v1) (ALT r1 r2)"
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   331
using assms
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   332
unfolding POSIX2_def
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   333
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   334
apply(rule Prf.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   335
apply(simp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   336
apply(rotate_tac 2)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   337
apply(erule Prf.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   338
apply(simp_all)[5]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   339
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   340
apply(rule ValOrd.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   341
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   342
apply(rule ValOrd.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   343
oops
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   344
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   345
lemma POSIX_ALT_I2:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   346
  assumes "POSIX v2 r2" "\<forall>v'. \<turnstile> v' : r1 \<longrightarrow> length (flat v2) > length (flat v')"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   347
  shows "POSIX (Right v2) (ALT r1 r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   348
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   349
unfolding POSIX_def
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   350
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   351
apply(rotate_tac 3)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   352
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   353
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   354
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   355
apply(rule ValOrd.intros)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   356
apply metis
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   357
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   358
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   359
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   360
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   361
section {* The Matcher *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   362
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   363
fun
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   364
 nullable :: "rexp \<Rightarrow> bool"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   365
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   366
  "nullable (NULL) = False"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   367
| "nullable (EMPTY) = True"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   368
| "nullable (CHAR c) = False"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   369
| "nullable (ALT r1 r2) = (nullable r1 \<or> nullable r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   370
| "nullable (SEQ r1 r2) = (nullable r1 \<and> nullable r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   371
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   372
lemma nullable_correctness:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   373
  shows "nullable r  \<longleftrightarrow> [] \<in> (L r)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   374
apply (induct r) 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   375
apply(auto simp add: Sequ_def) 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   376
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   377
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   378
fun mkeps :: "rexp \<Rightarrow> val"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   379
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   380
  "mkeps(EMPTY) = Void"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   381
| "mkeps(SEQ r1 r2) = Seq (mkeps r1) (mkeps r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   382
| "mkeps(ALT r1 r2) = (if nullable(r1) then Left (mkeps r1) else Right (mkeps r2))"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   383
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   384
lemma mkeps_nullable:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   385
  assumes "nullable(r)" shows "\<turnstile> mkeps r : r"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   386
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   387
apply(induct rule: nullable.induct)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   388
apply(auto intro: Prf.intros)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   389
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   390
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   391
lemma mkeps_flat:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   392
  assumes "nullable(r)" shows "flat (mkeps r) = []"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   393
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   394
apply(induct rule: nullable.induct)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   395
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   396
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   397
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   398
text {*
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   399
  The value mkeps returns is always the correct POSIX
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   400
  value.
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   401
*}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   402
12
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   403
lemma mkeps_POSIX2:
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   404
  assumes "nullable r"
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   405
  shows "POSIX2 (mkeps r) r"
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   406
using assms
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   407
apply(induct r)
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   408
apply(auto)[1]
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   409
apply(simp add: POSIX2_def)
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   410
oops
12
232ea10bed6f Delete POSIX_ALT2
fahadausaf <fahad.ausaf@icloud.com>
parents: 11
diff changeset
   411
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   412
lemma mkeps_POSIX3:
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   413
  assumes "nullable r"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   414
  shows "POSIX3 (mkeps r) r"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   415
using assms
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   416
apply(induct r)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   417
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   418
apply(simp add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   419
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   420
apply (metis Prf.intros(4))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   421
apply(erule Prf.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   422
apply(simp_all)[5]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   423
apply (metis ValOrd.intros)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   424
apply(simp add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   425
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   426
apply(simp add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   427
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   428
apply (metis mkeps.simps(2) mkeps_nullable nullable.simps(5))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   429
apply(rotate_tac 6)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   430
apply(erule Prf.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   431
apply(simp_all)[5]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   432
apply (metis ValOrd.intros(2) add_leE gen_length_code(1) gen_length_def mkeps_flat)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   433
apply(auto)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   434
apply(simp add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   435
apply(auto)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   436
apply (metis Prf.intros(2))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   437
apply(rotate_tac 4)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   438
apply(erule Prf.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   439
apply(simp_all)[5]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   440
apply (metis ValOrd.intros(6))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   441
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   442
apply (metis ValOrd.intros(3))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   443
apply(simp add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   444
apply(auto)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   445
apply (metis Prf.intros(2))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   446
apply(rotate_tac 6)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   447
apply(erule Prf.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   448
apply(simp_all)[5]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   449
apply (metis ValOrd.intros(6))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   450
apply (metis ValOrd.intros(3))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   451
apply(simp add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   452
apply(auto)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   453
apply (metis Prf.intros(3))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   454
apply(rotate_tac 5)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   455
apply(erule Prf.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   456
apply(simp_all)[5]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   457
apply (metis Prf_flat_L drop_0 drop_all list.size(3) mkeps_flat nullable_correctness)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   458
by (metis ValOrd.intros(5))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   459
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   460
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   461
lemma mkeps_POSIX:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   462
  assumes "nullable r"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   463
  shows "POSIX (mkeps r) r"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   464
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   465
apply(induct r)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   466
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   467
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   468
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   469
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   470
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   471
apply (metis ValOrd.intros)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   472
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   473
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   474
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   475
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   476
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   477
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   478
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   479
apply (simp add: ValOrd.intros(2) mkeps_flat)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   480
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   481
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   482
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   483
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   484
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   485
apply (simp add: ValOrd.intros(6))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   486
apply (simp add: ValOrd.intros(3))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   487
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   488
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   489
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   490
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   491
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   492
apply (simp add: ValOrd.intros(6))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   493
apply (simp add: ValOrd.intros(3))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   494
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   495
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   496
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   497
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   498
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   499
apply (metis Prf_flat_L mkeps_flat nullable_correctness)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   500
by (simp add: ValOrd.intros(5))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   501
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   502
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   503
lemma mkeps_POSIX2:
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   504
  assumes "nullable r"
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   505
  shows "POSIX2 (mkeps r) r"
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   506
using assms
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   507
apply(induct r)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   508
apply(simp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   509
apply(simp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   510
apply(simp add: POSIX2_def)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   511
apply(rule conjI)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   512
apply(rule Prf.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   513
apply(auto)[1]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   514
apply(erule Prf.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   515
apply(simp_all)[5]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   516
apply(rule ValOrd.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   517
apply(simp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   518
apply(simp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   519
apply(simp add: POSIX2_def)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   520
apply(rule conjI)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   521
apply(rule Prf.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   522
apply(simp add: mkeps_nullable)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   523
apply(simp add: mkeps_nullable)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   524
apply(auto)[1]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   525
apply(rotate_tac 6)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   526
apply(erule Prf.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   527
apply(simp_all)[5]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   528
apply(rule ValOrd.intros(2))
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   529
apply(simp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   530
apply(simp only: nullable.simps)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   531
apply(erule disjE)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   532
apply(simp)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   533
thm POSIX2_ALT1a
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   534
apply(rule POSIX2_ALT)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   535
apply(simp add: POSIX2_def)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   536
apply(rule conjI)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   537
apply(rule Prf.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   538
apply(simp add: mkeps_nullable)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   539
oops
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   540
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   541
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   542
section {* Derivatives *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   543
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   544
fun
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   545
 der :: "char \<Rightarrow> rexp \<Rightarrow> rexp"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   546
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   547
  "der c (NULL) = NULL"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   548
| "der c (EMPTY) = NULL"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   549
| "der c (CHAR c') = (if c = c' then EMPTY else NULL)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   550
| "der c (ALT r1 r2) = ALT (der c r1) (der c r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   551
| "der c (SEQ r1 r2) = 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   552
     (if nullable r1
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   553
      then ALT (SEQ (der c r1) r2) (der c r2)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   554
      else SEQ (der c r1) r2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   555
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   556
fun 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   557
 ders :: "string \<Rightarrow> rexp \<Rightarrow> rexp"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   558
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   559
  "ders [] r = r"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   560
| "ders (c # s) r = ders s (der c r)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   561
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   562
section {* Injection function *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   563
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   564
fun injval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   565
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   566
  "injval (CHAR d) c Void = Char d"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   567
| "injval (ALT r1 r2) c (Left v1) = Left(injval r1 c v1)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   568
| "injval (ALT r1 r2) c (Right v2) = Right(injval r2 c v2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   569
| "injval (SEQ r1 r2) c (Seq v1 v2) = Seq (injval r1 c v1) v2"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   570
| "injval (SEQ r1 r2) c (Left (Seq v1 v2)) = Seq (injval r1 c v1) v2"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   571
| "injval (SEQ r1 r2) c (Right v2) = Seq (mkeps r1) (injval r2 c v2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   572
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   573
section {* Projection function *}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   574
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   575
fun projval :: "rexp \<Rightarrow> char \<Rightarrow> val \<Rightarrow> val"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   576
where
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   577
  "projval (CHAR d) c _ = Void"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   578
| "projval (ALT r1 r2) c (Left v1) = Left(projval r1 c v1)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   579
| "projval (ALT r1 r2) c (Right v2) = Right(projval r2 c v2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   580
| "projval (SEQ r1 r2) c (Seq v1 v2) = 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   581
     (if flat v1 = [] then Right(projval r2 c v2) 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   582
      else if nullable r1 then Left (Seq (projval r1 c v1) v2)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   583
                          else Seq (projval r1 c v1) v2)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   584
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   585
text {*
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   586
  Injection value is related to r
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   587
*}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   588
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   589
lemma v3:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   590
  assumes "\<turnstile> v : der c r" shows "\<turnstile> (injval r c v) : r"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   591
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   592
apply(induct arbitrary: v rule: der.induct)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   593
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   594
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   595
apply(simp_all)[5]
49
c616ec6b1e3c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 48
diff changeset
   596
apply(simp)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   597
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   598
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   599
apply(case_tac "c = c'")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   600
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   601
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   602
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   603
apply (metis Prf.intros(5))
49
c616ec6b1e3c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 48
diff changeset
   604
apply(simp)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   605
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   606
apply(simp_all)[5]
49
c616ec6b1e3c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 48
diff changeset
   607
apply(simp)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   608
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   609
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   610
apply (metis Prf.intros(2))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   611
apply (metis Prf.intros(3))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   612
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   613
apply(case_tac "nullable r1")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   614
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   615
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   616
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   617
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   618
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   619
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   620
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   621
apply (metis Prf.intros(1))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   622
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   623
apply (metis Prf.intros(1) mkeps_nullable)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   624
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   625
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   626
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   627
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   628
apply(rule Prf.intros)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   629
apply(auto)[2]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   630
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   631
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   632
lemma v3_proj:
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   633
  assumes "\<turnstile> v : r" and "\<exists>s. (flat v) = c # s"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   634
  shows "\<turnstile> (projval r c v) : der c r"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   635
using assms
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   636
apply(induct rule: Prf.induct)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   637
prefer 4
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   638
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   639
prefer 4
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   640
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   641
apply (metis Prf.intros(4))
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   642
prefer 2
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   643
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   644
apply (metis Prf.intros(2))
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   645
prefer 2
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   646
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   647
apply (metis Prf.intros(3))
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   648
apply(auto)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   649
apply(rule Prf.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   650
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   651
apply (metis Prf_flat_L nullable_correctness)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   652
apply(rule Prf.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   653
apply(rule Prf.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   654
apply (metis Cons_eq_append_conv)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   655
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   656
apply(rule Prf.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   657
apply (metis Cons_eq_append_conv)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   658
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   659
done
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   660
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   661
text {*
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   662
  The string behind the injection value is an added c
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   663
*}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   664
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   665
lemma v4:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   666
  assumes "\<turnstile> v : der c r" shows "flat (injval r c v) = c # (flat v)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   667
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   668
apply(induct arbitrary: v rule: der.induct)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   669
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   670
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   671
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   672
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   673
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   674
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   675
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   676
apply(case_tac "c = c'")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   677
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   678
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   679
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   680
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   681
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   682
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   683
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   684
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   685
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   686
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   687
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   688
apply(case_tac "nullable r1")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   689
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   690
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   691
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   692
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   693
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   694
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   695
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   696
apply (metis mkeps_flat)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   697
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   698
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   699
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   700
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   701
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   702
lemma v4_proj:
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   703
  assumes "\<turnstile> v : r" and "\<exists>s. (flat v) = c # s"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   704
  shows "c # flat (projval r c v) = flat v"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   705
using assms
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   706
apply(induct rule: Prf.induct)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   707
prefer 4
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   708
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   709
prefer 4
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   710
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   711
prefer 2
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   712
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   713
prefer 2
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   714
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   715
apply(auto)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   716
by (metis Cons_eq_append_conv)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   717
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   718
lemma v4_proj2:
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   719
  assumes "\<turnstile> v : r" and "(flat v) = c # s"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   720
  shows "flat (projval r c v) = s"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   721
using assms
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   722
by (metis list.inject v4_proj)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   723
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   724
lemma t: "(c#xs = c#ys) \<Longrightarrow> xs = ys"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   725
by (metis list.sel(3))
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   726
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   727
lemma Prf_inj:
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   728
  assumes "v1 \<succ>(der c r) v2" "\<turnstile> v1 : der c r" "\<turnstile> v2 : der c r"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   729
  shows "(injval r c v1) \<succ>r (injval r c v2)"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   730
using assms
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   731
apply(induct arbitrary: v1 v2 rule: der.induct)
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   732
(* NULL case *)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   733
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   734
apply(erule ValOrd.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   735
apply(simp_all)[8]
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   736
(* EMPTY case *)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   737
apply(erule ValOrd.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   738
apply(simp_all)[8]
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   739
(* CHAR case *)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   740
apply(case_tac "c = c'")
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   741
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   742
apply(erule ValOrd.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   743
apply(simp_all)[8]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   744
apply(rule ValOrd.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   745
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   746
apply(erule ValOrd.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   747
apply(simp_all)[8]
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   748
(* ALT case *)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   749
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   750
apply(erule ValOrd.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   751
apply(simp_all)[8]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   752
apply(rule ValOrd.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   753
apply(subst v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   754
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   755
apply(rotate_tac 3)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   756
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   757
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   758
apply(subst v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   759
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   760
apply(rotate_tac 2)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   761
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   762
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   763
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   764
apply(rule ValOrd.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   765
apply(subst v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   766
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   767
apply(rotate_tac 3)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   768
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   769
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   770
apply(subst v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   771
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   772
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   773
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   774
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   775
apply(rule ValOrd.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   776
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   777
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   778
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   779
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   780
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   781
apply(rule ValOrd.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   782
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   783
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   784
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   785
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   786
apply(simp_all)[5]
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   787
(* SEQ case*)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   788
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   789
apply(case_tac "nullable r1")
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   790
defer
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   791
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   792
apply(erule ValOrd.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   793
apply(simp_all)[8]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   794
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   795
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   796
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   797
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   798
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   799
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   800
apply(rule ValOrd.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   801
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   802
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   803
apply(rule ValOrd.intros(2))
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   804
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   805
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   806
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   807
apply(simp_all)[5]
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   808
(* nullable case - unfinished *)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   809
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   810
apply(erule ValOrd.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   811
apply(simp_all)[8]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   812
apply(clarify)
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   813
apply(simp)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   814
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   815
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   816
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   817
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   818
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   819
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   820
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   821
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   822
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   823
apply(case_tac "injval r1 c v1 = mkeps r1") 
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   824
apply(rule ValOrd.intros(1))
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   825
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   826
apply (metis impossible_Cons le_add2 list.size(3) mkeps_flat monoid_add_class.add.right_neutral v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   827
apply(rule ValOrd.intros(2))
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   828
apply(drule_tac x="proj r1 c" in spec)
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   829
oops
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   830
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   831
lemma POSIX_der:
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   832
  assumes "POSIX v (der c r)" "\<turnstile> v : der c r"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   833
  shows "POSIX (injval r c v) r"
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   834
using assms
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   835
unfolding POSIX_def
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   836
apply(auto)
55
c33cfa1e813a added some notes (still incomplete)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 53
diff changeset
   837
thm v4
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   838
apply(subst (asm) v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   839
apply(assumption)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   840
apply(drule_tac x="projval r c v'" in spec)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   841
apply(auto)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   842
apply(rule v3_proj)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   843
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   844
apply(rule_tac x="flat v" in exI)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   845
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   846
apply(rule_tac c="c" in  t)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   847
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   848
apply(subst v4_proj)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   849
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   850
apply(rule_tac x="flat v" in exI)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   851
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   852
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   853
apply(simp add: Cons_eq_append_conv)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   854
apply(auto)[1]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   855
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   856
text {*
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   857
  Injection followed by projection is the identity.
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   858
*}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   859
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   860
lemma proj_inj_id:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   861
  assumes "\<turnstile> v : der c r" 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   862
  shows "projval r c (injval r c v) = v"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   863
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   864
apply(induct r arbitrary: c v rule: rexp.induct)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   865
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   866
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   867
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   868
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   869
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   870
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   871
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   872
apply(case_tac "c = char")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   873
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   874
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   875
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   876
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   877
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   878
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   879
defer
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   880
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   881
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   882
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   883
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   884
apply(case_tac "nullable rexp1")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   885
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   886
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   887
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   888
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   889
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   890
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   891
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   892
apply (metis list.distinct(1) v4)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   893
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   894
apply (metis mkeps_flat)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   895
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   896
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   897
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   898
apply(auto)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   899
apply(simp add: v4)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   900
done
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   901
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   902
lemma "L r \<noteq> {} \<Longrightarrow> \<exists>v. POSIX3 v r"
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   903
apply(induct r)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   904
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   905
apply(simp add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   906
apply(rule_tac x="Void" in exI)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   907
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   908
apply (metis Prf.intros(4))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   909
apply (metis POSIX3_def flat.simps(1) mkeps.simps(1) mkeps_POSIX3 nullable.simps(2) order_refl)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   910
apply(simp add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   911
apply(rule_tac x="Char char" in exI)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   912
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   913
apply (metis Prf.intros(5))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   914
apply(erule Prf.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   915
apply(simp_all)[5]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   916
apply (metis ValOrd.intros(8))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   917
apply(simp add: Sequ_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   918
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   919
apply(drule meta_mp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   920
apply(auto)[2]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   921
apply(drule meta_mp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   922
apply(auto)[2]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   923
apply(rule_tac x="Seq v va" in exI)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   924
apply(simp (no_asm) add: POSIX3_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   925
apply(auto)[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   926
apply (metis POSIX3_def Prf.intros(1))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   927
apply(erule Prf.cases)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   928
apply(simp_all)[5]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   929
apply(clarify)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   930
apply(case_tac "v  \<succ>r1a v1")
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   931
apply(rule ValOrd.intros(2))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   932
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   933
apply(case_tac "v = v1")
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   934
apply(rule ValOrd.intros(1))
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   935
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   936
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   937
apply (metis ValOrd_refl)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   938
apply(simp add: POSIX3_def)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
   939
oops
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   940
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   941
lemma "\<exists>v. POSIX v r"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   942
apply(induct r)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   943
apply(rule exI)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   944
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   945
apply (metis (full_types) Prf_flat_L der.simps(1) der.simps(2) der.simps(3) flat.simps(1) nullable.simps(1) nullable_correctness proj_inj_id projval.simps(1) v3 v4)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   946
apply(rule_tac x = "Void" in exI)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   947
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   948
apply (metis POSIX_def flat.simps(1) mkeps.simps(1) mkeps_POSIX nullable.simps(2))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   949
apply(rule_tac x = "Char char" in exI)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   950
apply(simp add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   951
apply(auto) [1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   952
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   953
apply(simp_all) [5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   954
apply (metis ValOrd.intros(8))
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   955
defer
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   956
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   957
apply (metis POSIX_ALT_I1)
11
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   958
(* maybe it is too early to instantiate this existential quantifier *)
26b8a5213355 changed theory name
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 10
diff changeset
   959
(* potentially this is the wrong POSIX value *)
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   960
apply(case_tac "r1 = NULL")
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   961
apply(simp add: POSIX_def)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   962
apply(auto)[1]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   963
apply (metis L.simps(1) L.simps(4) Prf_flat_L mkeps_flat nullable.simps(1) nullable.simps(2) nullable_correctness seq_null(2))
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   964
apply(case_tac "r1 = EMPTY")
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   965
apply(rule_tac x = "Seq Void va" in exI )
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   966
apply(simp (no_asm) add: POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   967
apply(auto)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   968
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   969
apply(simp_all)
20
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   970
apply(auto)[1]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   971
apply(erule Prf.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   972
apply(simp_all)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   973
apply(rule ValOrd.intros(2))
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   974
apply(rule ValOrd.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   975
apply(case_tac "\<exists>c. r1 = CHAR c")
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   976
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   977
apply(rule_tac x = "Seq (Char c) va" in exI )
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   978
apply(simp (no_asm) add: POSIX_def)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   979
apply(auto)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   980
apply(erule Prf.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   981
apply(simp_all)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   982
apply(auto)[1]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   983
apply(erule Prf.cases)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   984
apply(simp_all)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   985
apply(auto)[1]
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   986
apply(rule ValOrd.intros(2))
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   987
apply(rule ValOrd.intros)
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   988
apply(case_tac "\<exists>r1a r1b. r1 = ALT r1a r1b")
c11651bbebf5 some small changes
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 12
diff changeset
   989
apply(auto)
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
   990
oops (* not sure if this can be proved by induction *)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   991
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   992
text {* 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   993
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   994
  HERE: Crucial lemma that does not go through in the sequence case. 
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   995
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   996
*}
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   997
lemma v5:
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   998
  assumes "\<turnstile> v : der c r" "POSIX v (der c r)"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   999
  shows "POSIX (injval r c v) r"
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1000
using assms
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1001
apply(induct arbitrary: v rule: der.induct)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1002
(* NULL case *)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1003
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1004
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1005
apply(simp_all)[5]
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1006
(* EMPTY case *)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1007
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1008
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1009
apply(simp_all)[5]
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1010
(* CHAR case *)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1011
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1012
apply(case_tac "c = c'")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1013
apply(auto simp add: POSIX_def)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1014
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1015
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1016
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1017
apply(simp_all)[5]
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1018
apply(rule ValOrd.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1019
apply(auto)[1]
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1020
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1021
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1022
(* base cases done *)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1023
(* ALT case *)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1024
apply(erule Prf.cases)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1025
apply(simp_all)[5]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1026
using POSIX_ALT POSIX_ALT_I1 apply blast
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1027
apply(clarify)
53
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1028
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1029
apply(rule POSIX_ALT_I2)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1030
apply(drule POSIX_ALT1a)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1031
apply metis
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1032
apply(auto)[1]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1033
apply(subst v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1034
apply(assumption)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1035
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1036
apply(drule POSIX_ALT1a)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1037
apply(rotate_tac 1)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1038
apply(drule_tac x="v2" in meta_spec)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1039
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1040
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1041
apply(rotate_tac 4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1042
apply(erule Prf.cases)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1043
apply(simp_all)[5]
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1044
apply(rule ValOrd.intros)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1045
apply(simp)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1046
apply(subst (asm) v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1047
apply(assumption)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1048
apply(clarify)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1049
thm POSIX_ALT1a POSIX_ALT1b POSIX_ALT_I2
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1050
apply(subst (asm) v4)
38cde0214ad5 added some lemmas, attempted others
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 49
diff changeset
  1051
apply(auto simp add: POSIX_def)[1]
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1052
apply(subgoal_tac "POSIX v2 (der c r2)")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1053
prefer 2
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1054
apply(auto simp add: POSIX_def)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1055
apply (metis POSIX_ALT1a POSIX_def flat.simps(4))
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1056
apply(frule POSIX_ALT1a)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1057
apply(drule POSIX_ALT1b)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1058
apply(rule POSIX_ALT_I2)
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1059
apply(rotate_tac 1)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1060
apply(drule_tac x="v2" in meta_spec)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1061
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1062
apply(subgoal_tac "\<turnstile> Right (injval r2 c v2) : (ALT r1 r2)")
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1063
prefer 2
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1064
apply (metis Prf.intros(3) v3)
48
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1065
apply auto[1]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1066
apply(subst v4)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1067
apply(auto)[2]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1068
apply(subst (asm) (4) POSIX_def)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1069
apply(subst (asm) v4)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1070
apply(drule_tac x="v2" in meta_spec)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1071
apply(simp)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1072
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1073
apply(auto)[2]
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1074
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1075
thm POSIX_ALT_I2
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1076
apply(rule POSIX_ALT_I2)
652861c9473f added a function for calculating values
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 20
diff changeset
  1077
10
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1078
apply(rule ccontr)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1079
apply(auto simp add: POSIX_def)[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1080
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1081
apply(rule allI)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1082
apply(rule impI)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1083
apply(erule conjE)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1084
thm POSIX_ALT_I2
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1085
apply(frule POSIX_ALT1a)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1086
apply(drule POSIX_ALT1b)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1087
apply(rule POSIX_ALT_I2)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1088
apply auto[1]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1089
apply(subst v4)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1090
apply(auto)[2]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1091
apply(rotate_tac 1)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1092
apply(drule_tac x="v2" in meta_spec)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1093
apply(simp)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1094
apply(subst (asm) (4) POSIX_def)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1095
apply(subst (asm) v4)
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1096
apply(auto)[2]
14d41b5b57b3 added test version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1097
(* stuck in the ALT case *)