source: LTS/Simulation.ma @ 3531

Last change on this file since 3531 was 3531, checked in by piccolo, 5 years ago

new notion of measurable: some lemmas are still broken

File size: 21.5 KB
Line 
1include "Traces.ma".
2include "basics/jmeq.ma".
3
4discriminator option.
5
6record relations (S1,S2 : abstract_status) : Type[0] ≝
7 { Srel: S1 → S2 → Prop
8 ; Crel: S1 → S2 → Prop
9 }.
10
11definition Rrel ≝ λS1,S2 : abstract_status.λrel : relations S1 S2.λs,s'.
12 ∀s1,s1'. as_syntactical_succ S1 s1 s → Crel … rel s1 s1' → as_syntactical_succ S2 s1' s'.
13
14record simulation_conditions (S1,S2 : abstract_status) (rel : relations S1 S2) : Prop ≝
15 { initial_is_initial :
16   ∀s1,s2.Srel … rel s1 s2 → (bool_to_Prop (as_initial … s1) →  bool_to_Prop (as_initial … s2))
17 ; final_is_final :
18   ∀s1,s2.Srel … rel s1 s2 → (bool_to_Prop(as_final … s1) → bool_to_Prop (as_final … s2))
19 ; io_is_io :
20   ∀s1,s2.Srel … rel s1 s2 → as_classify … s2 = cl_io → as_classify … s1 = cl_io
21 ; simulate_tau:
22     ∀s1:S1.∀s2:S2.∀s1':S1.
23      as_execute … (cost_act (None ?))  s1 s1'→
24      Srel … rel s1 s2 → as_classify … s1 ≠ cl_io → as_classify … s1' ≠ cl_io →
25      ∃s2'. ∃t: raw_trace S2 s2 s2'.
26        Srel … rel s1' s2' ∧ silent_trace … t
27 ; simulate_label:
28     ∀s1:S1.∀s2:S2.∀l.∀s1':S1.
29      as_execute S1 (cost_act (Some ? l)) s1 s1' →
30      as_classify … s1 ≠ cl_io → as_classify … s1' ≠ cl_io →
31      Srel … rel s1 s2 →
32      ∃s2',s2'',s2'''.
33       ∃t1: raw_trace S2 s2 s2'.
34       as_execute … (cost_act (Some ? l)) s2' s2'' ∧
35       ∃t3: raw_trace … s2'' s2'''.
36        Srel … rel  s1' s2''' ∧ silent_trace … t1 ∧ pre_silent_trace … t3
37 ; simulate_call_pl:
38     ∀s1:S1.∀s2:S2.∀s1':S1.∀f,l.
39      is_call_post_label … s1 →
40      as_execute … (call_act f l) s1 s1' →
41      as_classify … s1 ≠ cl_io → as_classify … s1' ≠ cl_io →
42      Srel … rel s1 s2 →
43      ∃s2',s2'',s2'''.
44       ∃t1: raw_trace S2 s2 s2'.
45       as_execute … (call_act f l) s2' s2'' ∧
46       bool_to_Prop(is_call_post_label … s2') ∧
47       ∃t3: raw_trace S2 s2'' s2'''.
48        Srel … rel s1' s2''' ∧ silent_trace … t1 ∧ pre_silent_trace … t3
49 ; simulate_ret_l:
50     ∀s1:S1.∀s2:S2.∀s1':S1.∀l.
51      as_execute S1 (ret_act (Some ? l)) s1 s1' →
52      as_classify … s1 ≠ cl_io → as_classify … s1' ≠ cl_io →
53      Srel  … rel s1 s2 →
54      ∃s2',s2'',s2'''.
55       ∃t1: raw_trace S2 s2 s2'.
56       as_execute … (ret_act (Some ? l)) s2' s2'' ∧
57       ∃t3: raw_trace S2 s2'' s2'''.
58        Srel … rel s1' s2''' ∧ silent_trace … t1 ∧ pre_silent_trace … t3
59 ; simulate_call_n:
60     ∀s1:S1.∀s2:S2.∀s1':S1.∀f,l.
61      as_execute … (call_act f l) s1 s1' →
62      ¬ is_call_post_label … s1 →
63      as_classify … s1 ≠ cl_io → as_classify … s1' ≠ cl_io →
64      Srel … rel s1 s2 →
65      ∃s2',s2'',s2'''.
66       ∃t1: raw_trace S2 s2 s2'.
67       bool_to_Prop (¬ is_call_post_label … s2') ∧
68       as_execute … (call_act f l) s2' s2'' ∧
69       ∃t3: raw_trace S2 s2'' s2'''.
70        Srel … rel s1' s2''' ∧ silent_trace … t1 ∧ pre_silent_trace … t3
71        ∧ Crel … rel s1 s2'
72 ; simulate_ret_n:
73     ∀s1:S1.∀s2:S2.∀s1':S1.
74      as_execute … (ret_act (None ?)) s1 s1' →
75      as_classify … s1 ≠ cl_io → as_classify … s1' ≠ cl_io →
76      Srel … rel s1 s2 →
77      ∃s2',s2'',s2''': S2.
78       ∃t1: raw_trace S2 s2 s2'.
79       as_execute … (ret_act (None ?)) s2' s2''  ∧
80       ∃t3: raw_trace S2 s2'' s2'''.
81        Srel … rel s1' s2''' ∧ pre_silent_trace … t1 ∧ pre_silent_trace … t3
82        ∧ Rrel … rel s1' s2''
83 ; simulate_io_in :
84   ∀s1:S1.∀s2:S2.∀s1':S1.∀l.
85   as_execute … (cost_act … (Some ? l)) s1 s1' →
86   as_classify … s1 ≠ cl_io → as_classify … s1' = cl_io →
87   Srel … rel s1 s2 →
88   ∃s2',s2''.∃t: raw_trace … s2 s2'.
89   pre_silent_trace … t ∧ as_execute … (cost_act … (Some ? l)) s2' s2'' ∧
90   as_classify … s2'' = cl_io ∧ Srel … rel s1' s2''
91; simulate_io_out :
92   ∀s1:S1.∀s2:S2.∀s1':S1.∀l.
93   as_execute … (cost_act … (Some ? l)) s1 s1' →
94   as_classify … s1 = cl_io → as_classify … s1' ≠ cl_io →
95   Srel … rel s1 s2 →
96   ∃s2',s2''.∃t : raw_trace … s2' s2''.
97   pre_silent_trace … t ∧ as_execute … (cost_act … (Some ? l)) s2 s2' ∧
98   as_classify … s2 = cl_io ∧ Srel … rel s1' s2''
99 }.
100 
101lemma io_state_case : ∀P : status_class → Prop.∀s.
102(s = cl_io → P s) → (s ≠ cl_io → P s) → P s.
103#P * #H1 #H2 [2: @H1 %] @H2 % #EQ destruct
104qed.
105
106lemma simulate_labelled_action : ∀S1,S2 : abstract_status.
107∀rel : relations S1 S2.
108∀s1,s2 : S1.∀s1' : S2.
109∀l : ActionLabel.
110simulation_conditions … rel →
111is_costlabelled_act l →
112(is_call_act l → is_call_post_label … s1) →
113as_execute … l s1 s2 →
114Srel … rel s1 s1' →
115¬ (as_classify … s1 = cl_io ∧ as_classify … s2 = cl_io) →
116∃pre_em,post_em,s2' : S2.
117∃t_pre : raw_trace … s1' pre_em.
118∃t_post : raw_trace … post_em s2'.
119silent_trace … t_pre ∧ silent_trace … t_post ∧
120as_execute … l pre_em post_em ∧
121(is_call_act l → is_call_post_label … pre_em) ∧
122Srel … rel s2 s2'.
123#S1 #S2 #rel #s1 #s2 #s1' *
124[ #f #c | * [|#lbl] | * [|#lbl]]
125#sim * #Hcall #prf #REL * #Hio
126[ cases(simulate_call_pl … sim … prf … REL)
127  [2: @Hcall %{f} %{c} %
128  |3: % #ABS lapply(io_exiting … S1 … ABS … prf) * #lbl #EQ destruct
129  |4: % #ABS lapply(io_entering … S1 … ABS … prf) * #lbl #EQ destruct
130  ]
131  #pre_em * #post_em * #s2' * #t_pre ** #prf' #call * #t_post ** #REL' #sil_tpre #sil_tpost
132  %{pre_em} %{post_em} %{s2'} %{t_pre} %{t_post} % // % // % // % // %1 //
133| cases(simulate_ret_l … sim … prf … REL)
134  [2: % #ABS lapply(io_exiting … S1 … ABS … prf) * #lbl #EQ destruct
135  |3: % #ABS lapply(io_entering … S1 … ABS … prf) * #lbl #EQ destruct
136  ]
137  #pre_em * #post_em * #s2' * #t_pre * #prf' * #t_post ** #REL' #sil_tpre #sil_tpost
138  %{pre_em} %{post_em} %{s2'} %{t_pre} %{t_post} % // % [2: * #f * #c #EQ destruct]
139  % // % // %1 //
140| @(io_state_case … (as_classify … s1)) @(io_state_case … (as_classify … s2))
141  #class_s2 #class_s1
142  [ cases(Hio ?) /2/
143  | cases(simulate_io_out … sim … prf … REL) //
144    #post_em * #s2' * #t_post *** #sil_tpost #prf' #Hclass #REL'
145    %{s1'} %{post_em} %{s2'} %{(t_base …)} %{t_post} % // % [2: * #f * #c #EQ destruct]
146    % // % [%2 %*] % assumption
147  | cases(simulate_io_in … sim … prf … REL) //
148    #pre_em * #s2' * #t_pre *** #sil_tpre #prf' #Hclass #REL'
149    %{pre_em} %{s2'} %{s2'} %{t_pre} %{(t_base …)} % // % [2: * #f * #c #EQ destruct]
150    % // % [% assumption]  %2 % *
151  | cases(simulate_label … sim … prf … REL) //
152    #pre_em * #post_em * #s2' * #t_pre * #prf' * #t_post ** #REL' #sil_tpre #sil_tpost
153    %{pre_em} %{post_em} %{s2'} %{t_pre} %{t_post} % // % [2: * #f * #c #EQ destruct]
154    % // % // %1 //
155  ]
156]
157qed. 
158   
159 
160 
161(* silente simula in silente *)
162
163
164theorem simulates_pre_mesurable:
165 ∀S1,S2 : abstract_status.∀rel : relations S1 S2.
166 ∀s1,s1' : S1. ∀t1: raw_trace S1 s1 s1'.
167  simulation_conditions … rel →
168  pre_measurable_trace … t1 →
169  ∀s2 : S2.
170 as_classify … s2 ≠ cl_io →   Srel … rel s1 s2 →
171  ∃s2'. ∃t2: raw_trace … s2 s2'.
172    pre_measurable_trace … t2 ∧
173    get_costlabels_of_trace … t1 = get_costlabels_of_trace … t2 ∧
174    Srel … rel s1' s2' ∧
175    (measurable_suffix … t1 → measurable_suffix … t2) ∧
176    (silent_trace … t1 → silent_trace … t2).
177#S1 #S2 #rel #s1 #s1' #t1 #sim #H elim H -t1 -s1 -s1'
178[ #st #Hst #s2 #Hs2 #Rsts2 %{s2} %{(t_base …)} %
179 [ % [ % // % // % //] * #s_em ** [ #sx | #x1 #x2 #x3 #l1 #prf1 #tl1] * #t_pre * #s_post * #t_post * #sil_tpost
180  * #prf1 ** normalize #EQ  lapply(eq_to_jmeq ??? EQ) -EQ #EQ destruct
181 | #_ %2 % *
182 ]
183| #st1 #st2 #st3 #l #prf #tl #Hclass **
184  [ #EQ destruct #pre_tl #IH #s2 #Hclass2 #R_st1_s2
185    cases(simulate_tau … sim … prf … R_st1_s2) [2,3: /2 by head_of_premeasurable_is_not_io/]
186    #s2' * #t2_init * #R_st2_s2' #silent_t2_init cases(IH … R_st2_s2')
187    [2: cases silent_t2_init /2 by pre_silent_io/ cases t2_init in Hclass2; // 
188        #H12 #H13 #H14 #H15 #H16 #H17 #H18 * #H19 cases(H19 I) ]
189    #s2_fin * #t2_fin **** #pre_t2_fin #EQcost #R_st3_s2_fin #Hm #Hs %{s2_fin} %{(t2_init @ t2_fin)}
190    cut(? : Prop)
191      [3: #Hpre %
192         [ %
193             [ %
194                 [ %{Hpre} >get_cost_label_invariant_for_append_silent_trace_l // assumption
195                 | assumption
196                 ]
197             |  #meas_suff cases(Hm ?)
198                [ #s_pre' * #t_pre' * #s_post' * #t_post' * #sil_tpost' * #l_em * #ex_em ** #EQ
199                  destruct #Hcall #lem_cost %{s_pre'} %{(t2_init @ t_pre')} %{s_post'} %{t_post'}
200                  %{sil_tpost'} %{l_em} %{ex_em} /4 by conj/
201                | cases meas_suff -meas_suff #s_em * #t_pre inversion t_pre in ⊢ ?;
202                  [ #st #EQ1 #EQ2 #EQ3 destruct * #s1_post * #t_post * #sil_tpost * #l_em * #ex_em
203                    ** #EQ normalize in EQ; lapply(eq_to_jmeq ??? EQ) -EQ #EQ destruct #_ *
204                  | #st1' #st2' #st3' #lbl #prf' #tl' #_ #EQ1 #EQ2 #EQ3 destruct * #s_post * #t_post * #sil_tpost
205                    * #l_em * #ex_em ** #EQ normalize in EQ; lapply(eq_to_jmeq ??? EQ) -EQ #EQ destruct #Hcall #cost_lem
206                    %{st3'} %{tl'} %{s_post} %{t_post} %{sil_tpost} %{l_em} %{ex_em} /4 by conj/
207                  ]
208                ]
209             ]
210        | * [2: * #H cases(H I)] #H inversion H [ #H9 #H10 #H11 #H12 #H13 #H14 destruct]
211          #x1 #x2 #x3 #prf3 #tl'' #Hclass' #pre_siltl'' #_ #EQ1 #EQ2 #EQ3 #EQ4 destruct
212          /4 by append_silent,or_introl/
213        ]
214     |
215     ]
216    @append_premeasurable_silent //
217  | #lbl #EQ destruct #pre_tl #IH #s2 #Hs2 #REL
218    cases(simulate_label … sim … prf … REL)
219    [2,3: /2/]
220    #s2'' * #s2''' * #s2'''' * #t_s2'' * #exe_s2''' * #t_s2'''' ** #RELst2_s2''''
221    #sil_ts2'' #sil_t_s2'''' cases(IH … RELst2_s2'''')  /2 by pre_silent_io/
222    #s3 * #t_s3 **** #pre_s3 #EQcost #RElst3s3 #Hm #Hs %{s3}
223    %{(t_s2'' @ (t_ind … exe_s2''' …))}  [ @(t_s2'''' @ t_s3) ] %
224    [2: * [ #H inversion H
225            [ #H22 #H23 #H24 #H25 #H26 #H27 destruct
226            | #H29 #H30 #H31 #H32 #H33 #H34 #H35 #H36 #H37 #H38 #H39 #H40 destruct
227            ]
228          | * #H cases(H I)
229          ]
230     ]
231    %
232    [ % [2: assumption] %
233      [ @append_premeasurable_silent // %2 /2 by ex_intro/
234       [ cases sil_ts2'' [/2 by pre_silent_io/ ] inversion t_s2''
235         [ #H31 #H32 #H33 #H34 #H35 destruct assumption ]
236         #H37 #H38 #H39 #H40 #H41 #H42 #H43 #H44 #H45 #H46 #H47 destruct
237         cases H47 #ABS @⊥ @ABS % ]
238       @append_premeasurable_silent // % //
239    | whd in ⊢ (??%?); >EQcost >get_cost_label_invariant_for_append_silent_trace_l
240      [2: assumption] whd in ⊢ (???%);
241      >get_cost_label_invariant_for_append_silent_trace_l //
242    ] % assumption
243    | #Hsuff cases(measurable_suffix_tind … Hsuff)
244      [ * #_ #sil_tl lapply(Hs sil_tl) #sil_ts3 %{s2''} %{t_s2''} %{s2'''} %{(t_s2'''' @ t_s3)}
245      % [ /3 by or_introl, append_silent/ ] %{(cost_act (Some ? lbl))} %{(exe_s2''')} % // % // * #f * #c #EQ destruct
246      | #H @measurable_suffix_append change with ((t_ind ?????? t_s2'''')@t_s3) in ⊢ (????%);
247        @measurable_suffix_append /2/
248      ]
249  ]
250  ]
251| #s2 #s2' #s2'' #l #class_s2 #exe_s2_s2' #tl whd in ⊢ (% → ?); * #ret_lab #EQ destruct(EQ)
252  #pre_meas_tl #IH #s1 #class_s2 #RELst1s2
253  cases(simulate_ret_l … sim … exe_s2_s2' … RELst1s2) [2,3: /2/ ]
254  #st1 * #st2 * #st3 * #t1 * #exe_s2'' * #t2 ** #rel_s2_s2'''
255  #sil_t1 #sil_t2 cases(IH … rel_s2_s2''')
256  [2: @(pre_silent_io … sil_t2) assumption]
257  #s2_fin * #t_fin **** #pre_t_fin #EQcost #REL #Hm #Hs
258  %{s2_fin} %{(t1 @ (t_ind … exe_s2'' … t2) @ t_fin)} %
259  [2: * [ #H inversion H
260            [ #H22 #H23 #H24 #H25 #H26 #H27 destruct
261            | #H29 #H30 #H31 #H32 #H33 #H34 #H35 #H36 #H37 #H38 #H39 #H40 destruct
262            ]
263          | * #H cases(H I)
264          ]
265  ]
266  %
267    [ % [2: assumption]
268      % [2: whd in ⊢ (??%?);
269        >(get_cost_label_invariant_for_append_silent_trace_l … sil_t1)
270        whd in ⊢ (???%);
271        >(get_cost_label_invariant_for_append_silent_trace_l … (or_introl … sil_t2))
272        @eq_f assumption ]
273  @append_premeasurable_silent [2: //] %3
274  [2,3: /3 by append_premeasurable_silent, ex_intro, or_introl/ ]
275  cases sil_t1 [ /2 by pre_silent_io/ ] inversion t1
276  [ #H49 #H50 #H51 #H52 #H53 destruct //]
277  #H55 #H56 #H57 #H58 #H59 #H60 #H61 #H62 #H63 #H64 #H65 destruct cases H65
278  #ABS @⊥ @ABS %
279 |  #Hsuff cases(measurable_suffix_tind … Hsuff)
280      [ * #_ #sil_tl lapply(Hs sil_tl) #sil_ts3 %{st1} %{t1} %{st2} %{(t2 @ t_fin)}
281      % [ /3 by or_introl, append_silent/ ] %{(ret_act (Some ? ret_lab))} %{(exe_s2'')} % // % // * #f * #c #EQ destruct
282      | #H @measurable_suffix_append change with ((t_ind ?????? t2)@t_fin) in ⊢ (????%);
283        @measurable_suffix_append /2/
284      ]
285  ]
286| #s1 #s2 #s3 #l #exe_s1_s2 #tl #class_s1 * #f * #lab #EQ destruct
287  #post #pre_tl #IH #s2' #io_s2' #REL_s1_s2'
288   cases(simulate_call_pl … sim … post … exe_s1_s2 … REL_s1_s2')
289   [2,3: /2 by head_of_premeasurable_is_not_io/ ]
290   #s' * #s2'' * #s2''' * #t1 ** #exe_s2'' #post' * #t2 ** #REL #sil_t1 #sil_t2
291   cases(IH  … REL)
292   [2: /2 by pre_silent_io/ ]
293   #s2_fin * #t_fin **** #pre_t_fin #EQcost #REL1 #Hm #Hs %{s2_fin}
294   %{(t1 @ (t_ind … exe_s2'' … t2) @ t_fin)} %
295   [2: * [ #H inversion H
296            [ #H22 #H23 #H24 #H25 #H26 #H27 destruct
297            | #H29 #H30 #H31 #H32 #H33 #H34 #H35 #H36 #H37 #H38 #H39 #H40 destruct
298            ]
299          | * #H cases(H I)
300          ]
301  ]
302  %
303   [ % [2: assumption] %
304   [2: whd in ⊢ (??%?);
305        >(get_cost_label_invariant_for_append_silent_trace_l … sil_t1)
306        whd in ⊢ (???%);
307        >(get_cost_label_invariant_for_append_silent_trace_l …  (or_introl … sil_t2))
308        @eq_f assumption ]
309   @append_premeasurable_silent try assumption
310     %4 try assumption
311     [ cases sil_t1 [/2 by pre_silent_io/ ] inversion t1 [#H67 #H68 #H69 #H70 #H71 destruct //]
312       #H73 #H74 #H75 #H76 #H77 #H78 #H79 #H80 #H81 #H82 #H83 destruct cases H83
313       #ABS @⊥ @ABS %
314     | whd %{f} %{lab} %
315     | @append_premeasurable_silent // % assumption
316     ]
317   | #Hsuff cases(measurable_suffix_tind … Hsuff)
318      [ * #_ #sil_tl lapply(Hs sil_tl) #sil_ts3 %{s'} %{t1} %{s2''} %{(t2 @ t_fin)}
319      % [ /3 by or_introl, append_silent/ ] %{(call_act f lab)} %{(exe_s2'')} % // % //
320      | #H @measurable_suffix_append change with ((t_ind ?????? t2)@t_fin) in ⊢ (????%);
321        @measurable_suffix_append /2/
322      ]
323  ]
324|  #st1 #st2 #st3 #st4 #st5 #l1 #l2 #exe_12 #t1 #t2 #exe_34 #class_1 #class_3 *
325  #f * #l #EQ destruct #Hst1 #pre_t1 #pre_t2 #succ_14 whd in ⊢ (% → ?); #EQ destruct
326  #IH1 #IH2 #st1' #Hst1' #REL cases(simulate_call_n … sim … exe_12 … Hst1 … REL) [2,3: /2/ ]
327  #st1'' * #st1''' * #st2' * #tr1 ** #nps_st1'' #exe_12' * #tr2 *** #REL1 #sil_tr1
328  #sil_tr2 #call_rel cases(IH1 … REL1)
329  [2: /2 by pre_silent_io/ ]
330  #st3' * #tr3 **** #pre_tr3 #EQcost_tr3 #REL2 #Hm1 #Hs1
331  cases(simulate_ret_n … sim … exe_34 … REL2) [2,3: /2 by head_of_premeasurable_is_not_io/ ]
332  #st3'' * #st4' * #st4'' *
333  #tr4 * #exe_34' * #tr5 *** #REL3 #sil_tr4 #sil_tr5 #RET_REL cases(IH2 … REL3) [2: /2 by pre_silent_io/ ]
334  #st5' * #tr6 **** #pre_tr6 #EQcost_tr6 #REL4 #Hm2 #Hs2 %{st5'}
335  %{(tr1 @ (t_ind … exe_12' …  ((tr2 @ tr3 @ tr4) @ (t_ind … exe_34' … (tr5 @tr6)))))}
336  %
337  [2: * [ #H inversion H
338            [ #H22 #H23 #H24 #H25 #H26 #H27 destruct
339            | #H29 #H30 #H31 #H32 #H33 #H34 #H35 #H36 #H37 #H38 #H39 #H40 destruct
340            ]
341          | * #H cases(H I)
342          ]
343  ]
344  %
345  [ % [2: assumption] %
346  [ @append_premeasurable_silent try assumption %5
347       [1,2: /2 by pre_silent_io/
348             cases sil_tr1 /2 by pre_silent_io/ inversion tr1
349             [ #H85 #H86 #H87 #H88 #H89 destruct // ]
350             #H97 #H98 #H99 #H100 #H101 #H102 #H103 #H104 #H105 #H106 #H107 destruct
351             cases H107 #ABS @⊥ @ABS %
352       | whd %{f} %{l} %
353       | assumption
354       | @append_premeasurable_silent try assumption [2: % //]
355         @append_silent_premeasurable // % //
356       | @append_premeasurable_silent try assumption
357       | @(RET_REL … call_rel) assumption
358       | %
359       ]
360  | >get_cost_label_invariant_for_append_silent_trace_l [2: // ]
361    whd in ⊢ (??%%); @eq_f >append_associative
362    >get_cost_label_invariant_for_append_silent_trace_l in ⊢ (???%);
363    [2: % // ] >append_associative
364    >get_cost_label_append in ⊢ (???%);
365    >get_cost_label_invariant_for_append_silent_trace_l in ⊢ (???%);
366    [2: % //] normalize
367    >get_cost_label_invariant_for_append_silent_trace_l in ⊢ (???%);
368    [2: % // ] >get_cost_label_append in ⊢ (??%?); @eq_f2
369    assumption
370  ]
371  % //
372 | #Hsuff cases(measurable_suffix_tind … Hsuff)
373   [ * #_ #ABS @⊥ cases Hsuff #s_em * #t_pre * #s_post * #t_post * #sil_tpost * #l_em
374     * #ex_em ** inversion t_pre in ⊢ ?;
375     [2: #z1 #z2 #z3 #lb #exec #tail #_ #EQ1 #EQ2 #EQ3 destruct #EQ normalize in EQ; lapply(eq_to_jmeq ??? EQ) -EQ
376         #EQ destruct >e0 in ABS; #ABS lapply(silent_append_l2 … ABS) -ABS * [2: * #H cases(H I)] -IH1 -IH2
377         -Hsuff -e0 -EQ #H inversion H
378         [ #H101 #H102 #H103 #H104 #H105 #H106 #H107 #H108 destruct]
379         #y1 #y2 #y3 #exec #tail1 #Hclass1 #sil_tail #_ #EQ1 #EQ2 #EQ3 #EQ4 destruct #_ *
380     ]
381     #st #EQ1 #EQ2 #EQ3 destruct normalize in ⊢ (% → ?); #EQ lapply(eq_to_jmeq ??? EQ) -EQ #EQ destruct
382     #ABS1 >ABS1 in Hst1; [2: /3 by ex_intro/] *
383   | #Hsuff @measurable_suffix_append change with (t_ind ??????? @ ?) in ⊢ (????%); @measurable_suffix_append
384     change with (t_ind ??????? @ ?) in ⊢ (????%); @measurable_suffix_append @Hm2
385     cases(measurable_suffix_append_case … Hsuff)
386     [ * #_ * [2: * #H cases(H I)] #H inversion H in ⊢ ?;
387       [ #H137 #H138 #H139 #H140 #H141 #H142 @⊥
388         -H142 lapply H141 -H141 lapply H138 -H138 lapply H140 -H140 <H139 #EQ lapply t2 -t2 >EQ -EQ
389         #st2 #_ #EQ destruct(EQ)
390       | #H144 #H145 #H146 #H147 #H148 #H149 #H150 #H151 #H152 #H153 #H154 #H155 @⊥ -Hsuff destruct
391       ]
392     | -Hsuff * #s_em * #t_pre inversion t_pre in ⊢ ?;
393       [ #st #EQ1 #EQ2 #EQ3 destruct * #s_post * #t_post * #sil_tpost * #l_em * #ex_em ** #EQ normalize in EQ;
394         lapply(eq_to_jmeq ??? EQ) -EQ #EQ destruct #_ *
395       | #a1 #a2#a3 #lbl #exe #tl1 #_ #EQ1 #EQ2 #EQ3 destruct * #s1_post * #t_post * #sil_tpost * #l_em
396         * #ex_em ** #EQ normalize in EQ; lapply(eq_to_jmeq ??? EQ) -EQ #EQ destruct #Hcall #Hcost
397         %{a3} %{tl1} %{s1_post} %{t_post} %{sil_tpost} %{l_em} %{ex_em} /5 by conj/
398       ]
399     ]
400   ]
401 ]
402]
403qed.
404
405lemma silent_in_silent : ∀S1,S2 : abstract_status.∀rel : relations S1 S2.
406 ∀s1,s1' : S1. ∀t1: raw_trace S1 s1 s1'.
407  simulation_conditions … rel →
408  ∀s2 : S2.Srel … rel s1 s2 →
409  silent_trace … t1 →
410  ∃s2'. ∃t2: raw_trace … s2 s2'.
411    silent_trace … t2 ∧
412    Srel … rel s1' s2'.
413#S1 #S2 #rel #s1 #s1' #t1 #sim #s2 #REL *
414[ #pre_sil_ti0 cases(simulates_pre_mesurable … sim … (pre_silent_is_premeasurable … pre_sil_ti0) … REL)
415  [2: % #H
416      lapply(head_of_premeasurable_is_not_io … (pre_silent_is_premeasurable … pre_sil_ti0))
417      >(io_is_io … sim … H) // * /2/
418  ]
419  #s2' * #t2 *** * #H1 #H2 #H3 #H4 #H5 %{s2'} %{t2} % /3 by or_introl/
420| cases t1 in REL; [ #st #H #_ %{s2} %{(t_base …)} % [%2 % * ] // ]
421  #H7 #H8 #H9 #H10 #H11 #H12 #H13 #H14 cases H14 #H cases(H I)
422]
423qed.
424
425lemma tail_of_premeasurable_is_not_io : ∀S : abstract_status.
426∀s1,s2 : S.∀t : raw_trace … s1 s2.
427pre_measurable_trace … t →
428as_classify … s2 ≠ cl_io.
429#S #s1 #s2 #t #H elim H //
430qed.
431
432theorem simulates_measurable:
433 ∀S1,S2: abstract_status.
434 
435 ∀rel: relations S1 S2. simulation_conditions … rel →
436 
437 ∀si,sn: S1. ∀t: raw_trace … si sn.
438 
439 ∀s1,s2. measurable … s1 s2 … t →
440 
441 ∀si': S2.
442 (as_classify … si' = cl_io →  as_classify … si = cl_io) → 
443 
444 Srel … rel si si' →
445 
446 ∃sn'. ∃t': raw_trace … si' sn'.
447
448 Srel … rel sn sn' ∧
449
450 get_costlabels_of_trace … t = get_costlabels_of_trace … t' ∧
451 
452 ∃s1',s2'. measurable … s1' s2' … t'.
453#S1 #S2 #rel #sim_rel #si #sn #t #s1 #s3 #Hmeas #s1' #Hclass #Rsi_si'
454cases Hmeas -Hmeas #s0 * #s2 * #ti0 * #t12 * #t3n * #l1 * #l2 * #prf1 * #prf2 *******
455#pre_t12 #EQ destruct #Hl1 #Hl2 #Hcall_fin #sil_ti0 #sil_t3n #Hcall_init
456cases(silent_in_silent … sim_rel … Rsi_si' sil_ti0)
457#s0' * #ti0' * #sil_ti0' #Rs0_s0'
458cases(simulate_labelled_action … prf1 … Rs0_s0') /2/
459     [2: % * #H1 #H2 lapply(head_of_premeasurable_is_not_io … pre_t12) >H2 * /2/ ]
460#s0'' * #s1'' * #s1' * #t_s0'' * #t_s1'' **** #sil_ts0'' #sil_ts1'' #prf1' #Hcall_init'
461#Rs1_s1'
462cases(simulates_pre_mesurable … sim_rel … pre_t12 … Rs1_s1')
463[2: % #H lapply(head_of_premeasurable_is_not_io … pre_t12) >(io_is_io … sim_rel … H) // * /2/ ]
464#s2' * #t12' **** #pre_t12' #EQcost #Rs2_s2' #_ #_
465cases(simulate_labelled_action … prf2 … Rs2_s2') /2/
466  [2: % * #H1 #H2 lapply(tail_of_premeasurable_is_not_io … pre_t12) >H1 * /2/]
467#s2'' * #s3'' * #s3' * #t_s2'' * #t_s3'' **** #sil_ts2'' #sil_ts3'' #prf2' #Hcall_fin' #Rs3_s3'
468cases(silent_in_silent … sim_rel … Rs3_s3' sil_t3n)
469#sn' * #t_3n' * #sil_t3n' #Rsn_sn' %{sn'}
470%{(ti0'@ t_s0'' @ (t_ind … prf1' (t_s1''@t12' @ t_s2'' @ (t_ind … prf2' (t_s3'' @ t_3n')))))}
471% [ % // cases daemon (*TODO*) ]
472%{s1''} %{s3''} whd %{s0''} %{s2''} %{(ti0' @t_s0'')} %{(t_s1'' @ t12' @ t_s2'')}
473%{(t_s3'' @ t_3n')} %{l1} %{l2} %{prf1'} %{prf2'} % [2: /2/]
474% [2: /2 by append_silent/] % [2: /2 by append_silent/] % [2: /2/] % // % // % //
475@append_premeasurable_silent /2/
476qed.
477
478
Note: See TracBrowser for help on using the repository browser.