31 goal Impl.thy |
31 goal Impl.thy |
32 "fst(x) = sen(x) & \ |
32 "fst(x) = sen(x) & \ |
33 \ fst(snd(x)) = rec(x) & \ |
33 \ fst(snd(x)) = rec(x) & \ |
34 \ fst(snd(snd(x))) = srch(x) & \ |
34 \ fst(snd(snd(x))) = srch(x) & \ |
35 \ snd(snd(snd(x))) = rsch(x)"; |
35 \ snd(snd(snd(x))) = rsch(x)"; |
36 by(simp_tac (simpset() addsimps |
36 by (simp_tac (simpset() addsimps |
37 [sen_def,rec_def,srch_def,rsch_def]) 1); |
37 [sen_def,rec_def,srch_def,rsch_def]) 1); |
38 Addsimps [result()]; |
38 Addsimps [result()]; |
39 |
39 |
40 goal Impl.thy "a:actions(sender_asig) \ |
40 goal Impl.thy "a:actions(sender_asig) \ |
41 \ | a:actions(receiver_asig) \ |
41 \ | a:actions(receiver_asig) \ |
42 \ | a:actions(srch_asig) \ |
42 \ | a:actions(srch_asig) \ |
43 \ | a:actions(rsch_asig)"; |
43 \ | a:actions(rsch_asig)"; |
44 by(Action.action.induct_tac "a" 1); |
44 by (Action.action.induct_tac "a" 1); |
45 by(ALLGOALS (Simp_tac)); |
45 by (ALLGOALS (Simp_tac)); |
46 Addsimps [result()]; |
46 Addsimps [result()]; |
47 |
47 |
48 Delsimps [split_paired_All]; |
48 Delsimps [split_paired_All]; |
49 |
49 |
50 |
50 |
71 |
71 |
72 (* INVARIANT 1 *) |
72 (* INVARIANT 1 *) |
73 |
73 |
74 goalw Impl.thy impl_ioas "invariant impl_ioa inv1"; |
74 goalw Impl.thy impl_ioas "invariant impl_ioa inv1"; |
75 by (rtac invariantI 1); |
75 by (rtac invariantI 1); |
76 by(asm_full_simp_tac (simpset() |
76 by (asm_full_simp_tac (simpset() |
77 addsimps [inv1_def, hdr_sum_def, Sender.srcvd_def, |
77 addsimps [inv1_def, hdr_sum_def, Sender.srcvd_def, |
78 Sender.ssent_def, Receiver.rsent_def,Receiver.rrcvd_def]) 1); |
78 Sender.ssent_def, Receiver.rsent_def,Receiver.rrcvd_def]) 1); |
79 |
79 |
80 by(simp_tac (simpset() delsimps [trans_of_par4] |
80 by (simp_tac (simpset() delsimps [trans_of_par4] |
81 addsimps [fork_lemma,inv1_def]) 1); |
81 addsimps [fork_lemma,inv1_def]) 1); |
82 |
82 |
83 (* Split proof in two *) |
83 (* Split proof in two *) |
84 by (rtac conjI 1); |
84 by (rtac conjI 1); |
85 |
85 |
86 (* First half *) |
86 (* First half *) |
87 by(asm_full_simp_tac (simpset() addsimps [Impl.inv1_def]) 1); |
87 by (asm_full_simp_tac (simpset() addsimps [Impl.inv1_def]) 1); |
88 by (rtac Action.action.induct 1); |
88 by (rtac Action.action.induct 1); |
89 |
89 |
90 by (EVERY1[tac, tac, tac, tac]); |
90 by (EVERY1[tac, tac, tac, tac]); |
91 by (tac 1); |
91 by (tac 1); |
92 by (tac_ren 1); |
92 by (tac_ren 1); |
95 |
95 |
96 by (tac 1); |
96 by (tac 1); |
97 by (tac_ren 1); |
97 by (tac_ren 1); |
98 |
98 |
99 (* 4 + 1 *) |
99 (* 4 + 1 *) |
100 by(EVERY1[tac, tac, tac, tac]); |
100 by (EVERY1[tac, tac, tac, tac]); |
101 |
101 |
102 |
102 |
103 (* Now the other half *) |
103 (* Now the other half *) |
104 by(asm_full_simp_tac (simpset() addsimps [Impl.inv1_def]) 1); |
104 by (asm_full_simp_tac (simpset() addsimps [Impl.inv1_def]) 1); |
105 by (rtac Action.action.induct 1); |
105 by (rtac Action.action.induct 1); |
106 by(EVERY1[tac, tac]); |
106 by (EVERY1[tac, tac]); |
107 |
107 |
108 (* detour 1 *) |
108 (* detour 1 *) |
109 by (tac 1); |
109 by (tac 1); |
110 by (tac_ren 1); |
110 by (tac_ren 1); |
111 by (rtac impI 1); |
111 by (rtac impI 1); |
169 val tac2 = asm_full_simp_tac (ss addsimps [inv2_def]); |
169 val tac2 = asm_full_simp_tac (ss addsimps [inv2_def]); |
170 |
170 |
171 (* 10 - 7 *) |
171 (* 10 - 7 *) |
172 by (EVERY1[tac2,tac2,tac2,tac2]); |
172 by (EVERY1[tac2,tac2,tac2,tac2]); |
173 (* 6 *) |
173 (* 6 *) |
174 by(forward_tac [rewrite_rule [Impl.inv1_def] |
174 by (forward_tac [rewrite_rule [Impl.inv1_def] |
175 (inv1 RS invariantE) RS conjunct1] 1); |
175 (inv1 RS invariantE) RS conjunct1] 1); |
176 (* 6 - 5 *) |
176 (* 6 - 5 *) |
177 by (EVERY1[tac2,tac2]); |
177 by (EVERY1[tac2,tac2]); |
178 |
178 |
179 (* 4 *) |
179 (* 4 *) |
189 by (fold_tac [rewrite_rule [Packet.hdr_def]Impl.hdr_sum_def]); |
189 by (fold_tac [rewrite_rule [Packet.hdr_def]Impl.hdr_sum_def]); |
190 by (fast_tac (claset() addDs [add_leD1,leD]) 1); |
190 by (fast_tac (claset() addDs [add_leD1,leD]) 1); |
191 |
191 |
192 (* 2 *) |
192 (* 2 *) |
193 by (tac2 1); |
193 by (tac2 1); |
194 by(forward_tac [rewrite_rule [Impl.inv1_def] |
194 by (forward_tac [rewrite_rule [Impl.inv1_def] |
195 (inv1 RS invariantE) RS conjunct1] 1); |
195 (inv1 RS invariantE) RS conjunct1] 1); |
196 by (rtac impI 1); |
196 by (rtac impI 1); |
197 by (rtac impI 1); |
197 by (rtac impI 1); |
198 by (REPEAT (etac conjE 1)); |
198 by (REPEAT (etac conjE 1)); |
199 by (dres_inst_tac [("k","count (rsch s) (~sbit(sen s))")] le_imp_add_le 1); |
199 by (dres_inst_tac [("k","count (rsch s) (~sbit(sen s))")] le_imp_add_le 1); |
200 by (Asm_full_simp_tac 1); |
200 by (Asm_full_simp_tac 1); |
201 |
201 |
202 (* 1 *) |
202 (* 1 *) |
203 by (tac2 1); |
203 by (tac2 1); |
204 by(forward_tac [rewrite_rule [Impl.inv1_def] |
204 by (forward_tac [rewrite_rule [Impl.inv1_def] |
205 (inv1 RS invariantE) RS conjunct2] 1); |
205 (inv1 RS invariantE) RS conjunct2] 1); |
206 by (rtac impI 1); |
206 by (rtac impI 1); |
207 by (rtac impI 1); |
207 by (rtac impI 1); |
208 by (REPEAT (etac conjE 1)); |
208 by (REPEAT (etac conjE 1)); |
209 by (fold_tac [rewrite_rule[Packet.hdr_def]Impl.hdr_sum_def]); |
209 by (fold_tac [rewrite_rule[Packet.hdr_def]Impl.hdr_sum_def]); |
308 by (EVERY1[tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4]); |
308 by (EVERY1[tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4]); |
309 |
309 |
310 (* 2 b *) |
310 (* 2 b *) |
311 |
311 |
312 by (strip_tac 1 THEN REPEAT (etac conjE 1)); |
312 by (strip_tac 1 THEN REPEAT (etac conjE 1)); |
313 by(forward_tac [rewrite_rule [Impl.inv2_def] |
313 by (forward_tac [rewrite_rule [Impl.inv2_def] |
314 (inv2 RS invariantE)] 1); |
314 (inv2 RS invariantE)] 1); |
315 by (tac4 1); |
315 by (tac4 1); |
316 by (Asm_full_simp_tac 1); |
316 by (Asm_full_simp_tac 1); |
317 |
317 |
318 (* 1 *) |
318 (* 1 *) |
319 by (tac4 1); |
319 by (tac4 1); |
320 by (strip_tac 1 THEN REPEAT (etac conjE 1)); |
320 by (strip_tac 1 THEN REPEAT (etac conjE 1)); |
321 by (rtac ccontr 1); |
321 by (rtac ccontr 1); |
322 by(forward_tac [rewrite_rule [Impl.inv2_def] |
322 by (forward_tac [rewrite_rule [Impl.inv2_def] |
323 (inv2 RS invariantE)] 1); |
323 (inv2 RS invariantE)] 1); |
324 by(forward_tac [rewrite_rule [Impl.inv3_def] |
324 by (forward_tac [rewrite_rule [Impl.inv3_def] |
325 (inv3 RS invariantE)] 1); |
325 (inv3 RS invariantE)] 1); |
326 by (Asm_full_simp_tac 1); |
326 by (Asm_full_simp_tac 1); |
327 by (eres_inst_tac [("x","m")] allE 1); |
327 by (eres_inst_tac [("x","m")] allE 1); |
328 by (dtac less_le_trans 1); |
328 by (dtac less_le_trans 1); |
329 by (dtac add_leD1 1); |
329 by (dtac add_leD1 1); |