author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Thu, 14 Mar 2013 18:24:06 +0000 | |
changeset 224 | 68324a8566c1 |
parent 223 | db6ba2232945 |
child 230 | 49dcc0b9b0b3 |
permissions | -rw-r--r-- |
223
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
header {* |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
{\em abacus} a kind of register machine |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
*} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
theory abacus |
224
68324a8566c1
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
6 |
imports Main |
223
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
begin |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
text {* |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
{\em Abacus} instructions: |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
*} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
datatype abc_inst = |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
-- {* @{text "Inc n"} increments the memory cell (or register) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
with address @{text "n"} by one. |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
*} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
Inc nat |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
18 |
-- {* |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |
@{text "Dec n label"} decrements the memory cell with address @{text "n"} by one. |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
If cell @{text "n"} is already zero, no decrements happens and the executio jumps to |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
21 |
the instruction labeled by @{text "label"}. |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
*} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
| Dec nat nat |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
24 |
-- {* |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
25 |
@{text "Goto label"} unconditionally jumps to the instruction labeled by @{text "label"}. |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
26 |
*} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
27 |
| Goto nat |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
28 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
29 |
definition "stimes p q = {s . \<exists> u v. u \<in> p \<and> v \<in> q \<and> (u \<union> v = s) \<and> (u \<inter> v = {})}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
30 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
31 |
no_notation times (infixl "*" 70) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
32 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
33 |
notation stimes (infixl "*" 70) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
34 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
35 |
lemma stimes_comm: "p * q = q * p" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
36 |
by (unfold stimes_def, auto) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
37 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
38 |
lemma stimes_assoc: "(p * q) * r = p * (q * r)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
39 |
by (unfold stimes_def, blast) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
40 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
41 |
definition |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
42 |
"emp = {{}}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
43 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
44 |
lemma emp_unit_r [simp]: "p * emp = p" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
45 |
by (unfold stimes_def emp_def, auto) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
46 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
47 |
lemma emp_unit_l [simp]: "emp * p = p" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
48 |
by (metis emp_unit_r stimes_comm) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
49 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
50 |
lemma stimes_mono: "p \<subseteq> q \<Longrightarrow> p * r \<subseteq> q * r" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
51 |
by (unfold stimes_def, auto) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
52 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
53 |
thm mult_cancel_left |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
54 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
55 |
lemma stimes_left_commute: |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
56 |
"(p * (q * r)) = (q * (p * r))" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
57 |
by (metis stimes_assoc stimes_comm) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
58 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
59 |
lemmas stimes_ac = stimes_comm stimes_assoc stimes_left_commute |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
60 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
61 |
definition pasrt :: "bool \<Rightarrow> ('a set set)" ("<_>" [71] 71) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
62 |
where "pasrt b = {s . s = {} \<and> b}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
63 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
64 |
datatype apg = |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
65 |
Instr abc_inst |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
66 |
| Label nat |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
67 |
| Seq apg apg |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
68 |
| Local "(nat \<Rightarrow> apg)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
69 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
70 |
abbreviation prog_instr :: "abc_inst \<Rightarrow> apg" ("\<guillemotright>_" [61] 61) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
71 |
where "\<guillemotright>i \<equiv> Instr i" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
72 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
73 |
abbreviation prog_seq :: "apg \<Rightarrow> apg \<Rightarrow> apg" (infixl ";" 52) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
74 |
where "c1 ; c2 \<equiv> Seq c1 c2" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
75 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
76 |
type_synonym aconf = "((nat \<rightharpoonup> abc_inst) \<times> nat \<times> (nat \<rightharpoonup> nat) \<times> nat)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
77 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
78 |
fun astep :: "aconf \<Rightarrow> aconf" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
79 |
where "astep (prog, pc, m, faults) = |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
80 |
(case (prog pc) of |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
81 |
Some (Inc i) \<Rightarrow> |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
82 |
case m(i) of |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
83 |
Some n \<Rightarrow> (prog, pc + 1, m(i:= Some (n + 1)), faults) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
84 |
| None \<Rightarrow> (prog, pc, m, faults + 1) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
85 |
| Some (Dec i e) \<Rightarrow> |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
86 |
case m(i) of |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
87 |
Some n \<Rightarrow> if (n = 0) then (prog, e, m, faults) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
88 |
else (prog, pc + 1, m(i:= Some (n - 1)), faults) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
89 |
| None \<Rightarrow> (prog, pc, m, faults + 1) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
90 |
| Some (Goto pc') \<Rightarrow> (prog, pc', m, faults) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
91 |
| None \<Rightarrow> (prog, pc, m, faults + 1))" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
92 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
93 |
definition "run n = astep ^^ n" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
94 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
95 |
datatype aresource = |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
96 |
M nat nat |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
97 |
| C nat abc_inst |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
98 |
| At nat |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
99 |
| Faults nat |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
100 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
101 |
fun rset_of :: "aconf \<Rightarrow> aresource set" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
102 |
where "rset_of (prog, pc, m, faults) = |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
103 |
{M i n | i n. m (i) = Some n} \<union> {At pc} \<union> |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
104 |
{C i inst | i inst. prog i = Some inst} \<union> {Faults faults}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
105 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
106 |
type_synonym assert = "aresource set set" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
107 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
108 |
primrec assemble_to :: "apg \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> assert" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
109 |
where |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
110 |
"assemble_to (Instr ai) i j = ({{C i ai}} * <(j = i + 1)>)" | |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
111 |
"assemble_to (Seq p1 p2) i j = (\<Union> j'. (assemble_to p1 i j') * (assemble_to p2 j' j))" | |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
112 |
"assemble_to (Local fp) i j = (\<Union> l. (assemble_to (fp l) i j))" | |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
113 |
"assemble_to (Label l) i j = <(i = j \<and> j = l)>" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
114 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
115 |
abbreviation asmb_to :: "nat \<Rightarrow> apg \<Rightarrow> nat \<Rightarrow> assert" ("_ :[ _ ]: _" [60, 60, 60] 60) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
116 |
where "i :[ apg ]: j \<equiv> assemble_to apg i j" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
117 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
118 |
definition |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
119 |
Hoare_abc :: "assert \<Rightarrow> assert \<Rightarrow> assert \<Rightarrow> bool" ("({(1_)}/ (_)/ {(1_)})" 50) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
120 |
where |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
121 |
"{p} c {q} \<equiv> (\<forall> s r. (rset_of s) \<in> (p*c*r) \<longrightarrow> (\<exists> k. ((rset_of (run k s)) \<in> (q*c*r))))" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
122 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
123 |
definition "pc l = {{At l}}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
124 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
125 |
definition "m a v = {{M a v}}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
126 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
127 |
lemma hoare_dec_suc: "{pc i * m a v * <(v > 0)>} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
128 |
i:[ \<guillemotright>(Dec a e) ]:j |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
129 |
{pc (i+1) * m a (v - 1)}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
130 |
sorry |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
131 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
132 |
lemma hoare_dec_fail: "{pc i * m a 0} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
133 |
i:[ \<guillemotright>(Dec a e) ]:j |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
134 |
{pc e * m a 0}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
135 |
sorry |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
136 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
137 |
lemma hoare_inc: "{pc i * m a v} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
138 |
i:[ \<guillemotright>(Inc a) ]:j |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
139 |
{pc (i+1) * m a (v + 1)}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
140 |
sorry |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
141 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
142 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
143 |
interpretation foo: comm_monoid_mult "op * :: 'a set set => 'a set set => 'a set set" "{{}}::'a set set" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
144 |
apply(default) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
145 |
apply(simp add: stimes_assoc) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
146 |
apply(simp add: stimes_comm) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
147 |
apply(simp add: emp_def[symmetric]) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
148 |
done |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
149 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
150 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
151 |
(*used by simplifier for numbers *) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
152 |
thm mult_cancel_left |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
153 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
154 |
(* |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
155 |
interpretation foo: comm_ring_1 "op * :: 'a set set => 'a set set => 'a set set" "{{}}::'a set set" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
156 |
apply(default) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
157 |
*) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
158 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
159 |
lemma frame: "{p} c {q} \<Longrightarrow> \<forall> r. {p * r} c {q * r}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
160 |
apply (unfold Hoare_abc_def, clarify) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
161 |
apply (erule_tac x = "(a, aa, ab, b)" in allE) |
224
68324a8566c1
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
223
diff
changeset
|
162 |
apply (erule_tac x = "r * ra" in allE) |
223
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
163 |
apply(simp add: stimes_ac) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
164 |
done |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
165 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
166 |
lemma code_extension: "\<lbrakk>{p} c {q}\<rbrakk> \<Longrightarrow> (\<forall> e. {p} c * e {q})" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
167 |
apply (unfold Hoare_abc_def, clarify) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
168 |
apply (erule_tac x = "(a, aa, ab, b)" in allE) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
169 |
apply (erule_tac x = "e * r" in allE) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
170 |
apply(simp add: stimes_ac) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
171 |
done |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
172 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
173 |
lemma run_add: "run (n1 + n2) s = run n1 (run n2 s)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
174 |
apply (unfold run_def) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
175 |
by (metis funpow_add o_apply) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
176 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
177 |
lemma composition: "\<lbrakk>{p} c1 {q}; {q} c2 {r}\<rbrakk> \<Longrightarrow> {p} c1 * c2 {r}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
178 |
proof - |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
179 |
assume h: "{p} c1 {q}" "{q} c2 {r}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
180 |
from code_extension [OF h(1), rule_format, of "c2"] |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
181 |
have "{p} c1 * c2 {q}" . |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
182 |
moreover from code_extension [OF h(2), rule_format, of "c1"] and stimes_comm |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
183 |
have "{q} c1 * c2 {r}" by metis |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
184 |
ultimately show "{p} c1 * c2 {r}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
185 |
apply (unfold Hoare_abc_def, clarify) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
186 |
proof - |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
187 |
fix a aa ab b ra |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
188 |
assume h1: "\<forall>s r. rset_of s \<in> p * (c1 * c2) * r \<longrightarrow> |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
189 |
(\<exists>k. rset_of (run k s) \<in> q * (c1 * c2) * r)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
190 |
and h2: "\<forall>s ra. rset_of s \<in> q * (c1 * c2) * ra \<longrightarrow> |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
191 |
(\<exists>k. rset_of (run k s) \<in> r * (c1 * c2) * ra)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
192 |
and h3: "rset_of (a, aa, ab, b) \<in> p * (c1 * c2) * ra" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
193 |
show "\<exists>k. rset_of (run k (a, aa, ab, b)) \<in> r * (c1 * c2) * ra" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
194 |
proof - |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
195 |
let ?s = "(a, aa, ab, b)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
196 |
from h1 [rule_format, of ?s, OF h3] |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
197 |
obtain n1 where "rset_of (run n1 ?s) \<in> q * (c1 * c2) * ra" by blast |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
198 |
from h2 [rule_format, OF this] |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
199 |
obtain n2 where "rset_of (run n2 (run n1 ?s)) \<in> r * (c1 * c2) * ra" by blast |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
200 |
with run_add show ?thesis by metis |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
201 |
qed |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
202 |
qed |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
203 |
qed |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
204 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
205 |
lemma asm_end_unique: "\<lbrakk>s \<in> (i:[c]:j1); s' \<in> (i:[c]:j2)\<rbrakk> \<Longrightarrow> j1 = j2" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
206 |
(* proof(induct c arbitrary:i j1 j2 s s') *) sorry |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
207 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
208 |
lemma union_unique: "(\<forall> j. j \<noteq> i \<longrightarrow> c(j) = {}) \<Longrightarrow> (\<Union> j. c(j)) = (c i)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
209 |
by auto |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
210 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
211 |
lemma asm_consist: "i:[c1]:j \<noteq> {}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
212 |
sorry |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
213 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
214 |
lemma seq_comp: "\<lbrakk>{p} i:[c1]:j {q}; |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
215 |
{q} j:[c2]:k {r}\<rbrakk> \<Longrightarrow> {p} i:[(c1 ; c2)]:k {r}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
216 |
apply (unfold assemble_to.simps) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
217 |
proof - |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
218 |
assume h: "{p} i :[ c1 ]: j {q}" "{q} j :[ c2 ]: k {r}" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
219 |
have " (\<Union>j'. (i :[ c1 ]: j') * (j' :[ c2 ]: k)) = |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
220 |
(i :[ c1 ]: j) * (j :[ c2 ]: k)" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
221 |
proof - |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
222 |
{ fix j' |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
223 |
assume "j' \<noteq> j" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
224 |
have "(i :[ c1 ]: j') * (j' :[ c2 ]: k) = {}" (is "?X * ?Y = {}") |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
225 |
proof - |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
226 |
{ fix s |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
227 |
assume "s \<in> ?X*?Y" |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
228 |
then obtain s1 s2 where h1: "s1 \<in> ?X" by (unfold stimes_def, auto) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
229 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
230 |
} |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
231 |
qed |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
232 |
} thus ?thesis by (auto intro!:union_unique) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
233 |
qed |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
234 |
moreover have "{p} \<dots> {r}" by (rule composition [OF h]) |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
235 |
ultimately show "{p} \<Union>j'. (i :[ c1 ]: j') * (j' :[ c2 ]: k) {r}" by metis |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
236 |
qed |
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
237 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
238 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
239 |
|
db6ba2232945
added a stimes_ac lemma for Xingyuan
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
240 |
end |