1 | (**************************************************************************) |
---|
2 | (* ___ *) |
---|
3 | (* ||M|| *) |
---|
4 | (* ||A|| A project by Andrea Asperti *) |
---|
5 | (* ||T|| *) |
---|
6 | (* ||I|| Developers: *) |
---|
7 | (* ||T|| The HELM team. *) |
---|
8 | (* ||A|| http://helm.cs.unibo.it *) |
---|
9 | (* \ / *) |
---|
10 | (* \ / This file is distributed under the terms of the *) |
---|
11 | (* v GNU General Public License Version 2 *) |
---|
12 | (* *) |
---|
13 | (**************************************************************************) |
---|
14 | |
---|
15 | include "arithmetics/nat.ma". |
---|
16 | include "basics/types.ma". |
---|
17 | include "basics/deqsets.ma". |
---|
18 | include "../src/ASM/Util.ma". |
---|
19 | |
---|
20 | inductive FunctionName : Type[0] ≝ |
---|
21 | | a_function_id : ℕ → FunctionName. |
---|
22 | |
---|
23 | inductive CallCostLabel : Type[0] ≝ |
---|
24 | | a_call_label : ℕ → CallCostLabel. |
---|
25 | |
---|
26 | inductive ReturnPostCostLabel : Type[0] ≝ |
---|
27 | | a_return_cost_label : ℕ → ReturnPostCostLabel. |
---|
28 | |
---|
29 | inductive NonFunctionalLabel : Type[0] ≝ |
---|
30 | | a_non_functional_label : ℕ → NonFunctionalLabel. |
---|
31 | |
---|
32 | inductive CostLabel : Type[0] ≝ |
---|
33 | | a_call : CallCostLabel → CostLabel |
---|
34 | | a_return_post : ReturnPostCostLabel → CostLabel |
---|
35 | | a_non_functional_label : NonFunctionalLabel → CostLabel |
---|
36 | | i_act : CostLabel. |
---|
37 | |
---|
38 | coercion a_call. |
---|
39 | coercion a_return_post. |
---|
40 | coercion a_non_functional_label. |
---|
41 | |
---|
42 | (* |
---|
43 | definition ret_act_label_to_cost_label : |
---|
44 | (ReturnPostCostLabel + NonFunctionalLabel) → CostLabel ≝ |
---|
45 | λx.match x with [inl a ⇒ a_return_post a | inr b ⇒ a_non_functional_label b]. |
---|
46 | |
---|
47 | coercion ret_act_label_to_cost_label. |
---|
48 | |
---|
49 | definition call_act_label_to_cost_label : |
---|
50 | (CallCostLabel + NonFunctionalLabel) → CostLabel ≝ |
---|
51 | λx.match x with [inl a ⇒ a_call a | inr b ⇒ a_non_functional_label b]. |
---|
52 | |
---|
53 | coercion call_act_label_to_cost_label. |
---|
54 | *) |
---|
55 | |
---|
56 | definition eq_nf_label : NonFunctionalLabel → NonFunctionalLabel → bool ≝ |
---|
57 | λx,y.match x with [ a_non_functional_label n ⇒ |
---|
58 | match y with [a_non_functional_label m ⇒ eqb n m ] ]. |
---|
59 | |
---|
60 | lemma eq_fn_label_elim : ∀P : bool → Prop.∀l1,l2 : NonFunctionalLabel. |
---|
61 | (l1 = l2 → P true) → (l1 ≠ l2 → P false) → P (eq_nf_label l1 l2). |
---|
62 | #P * #l1 * #l2 #H1 #H2 normalize @eqb_elim /3/ * #H3 @H2 % #EQ destruct @H3 % qed. |
---|
63 | |
---|
64 | definition DEQNonFunctionalLabel ≝ mk_DeqSet NonFunctionalLabel eq_nf_label ?. |
---|
65 | #x #y @eq_fn_label_elim [ #EQ destruct /2/] * #H % [ #EQ destruct] #H1 @⊥ @H |
---|
66 | assumption |
---|
67 | qed. |
---|
68 | |
---|
69 | unification hint 0 ≔ ; |
---|
70 | X ≟ DEQNonFunctionalLabel |
---|
71 | (* ---------------------------------------- *) ⊢ |
---|
72 | NonFunctionalLabel ≡ carr X. |
---|
73 | |
---|
74 | unification hint 0 ≔ p1,p2; |
---|
75 | X ≟ DEQNonFunctionalLabel |
---|
76 | (* ---------------------------------------- *) ⊢ |
---|
77 | eq_nf_label p1 p2 ≡ eqb X p1 p2. |
---|
78 | |
---|
79 | definition eq_function_name : FunctionName → FunctionName → bool ≝ |
---|
80 | λf1,f2.match f1 with [ a_function_id n ⇒ match f2 with [a_function_id m ⇒ eqb n m ] ]. |
---|
81 | |
---|
82 | lemma eq_function_name_elim : ∀P : bool → Prop.∀f1,f2. |
---|
83 | (f1 = f2 → P true) → (f1 ≠ f2 → P false) → P (eq_function_name f1 f2). |
---|
84 | #P * #f1 * #f2 #H1 #H2 normalize @eqb_elim /2/ * #H3 @H2 % #EQ destruct @H3 % qed. |
---|
85 | |
---|
86 | definition DEQFunctionName ≝ mk_DeqSet FunctionName eq_function_name ?. |
---|
87 | #x #y @eq_function_name_elim [ #EQ destruct /2/] * #H % [ #EQ destruct] #H1 @⊥ @H |
---|
88 | assumption |
---|
89 | qed. |
---|
90 | |
---|
91 | unification hint 0 ≔ ; |
---|
92 | X ≟ DEQFunctionName |
---|
93 | (* ---------------------------------------- *) ⊢ |
---|
94 | FunctionName ≡ carr X. |
---|
95 | |
---|
96 | unification hint 0 ≔ p1,p2; |
---|
97 | X ≟ DEQFunctionName |
---|
98 | (* ---------------------------------------- *) ⊢ |
---|
99 | eq_function_name p1 p2 ≡ eqb X p1 p2. |
---|
100 | |
---|
101 | definition eq_return_cost_lab : ReturnPostCostLabel → ReturnPostCostLabel → bool ≝ |
---|
102 | λc1,c2.match c1 with [a_return_cost_label n ⇒ match c2 with [ a_return_cost_label m ⇒ eqb n m]]. |
---|
103 | |
---|
104 | lemma eq_return_cost_lab_elim : ∀P : bool → Prop.∀c1,c2.(c1 = c2 → P true) → |
---|
105 | (c1 ≠ c2 → P false) → P (eq_return_cost_lab c1 c2). |
---|
106 | #P * #c1 * #c2 #H1 #H2 normalize @eqb_elim /2/ * #H @H2 % #EQ destruct @H % qed. |
---|
107 | |
---|
108 | definition DEQReturnPostCostLabel ≝ mk_DeqSet ReturnPostCostLabel eq_return_cost_lab ?. |
---|
109 | #x #y @eq_return_cost_lab_elim [ #EQ destruct /2/] * #H % [ #EQ destruct] #H1 @⊥ @H |
---|
110 | assumption |
---|
111 | qed. |
---|
112 | |
---|
113 | unification hint 0 ≔ ; |
---|
114 | X ≟ DEQReturnPostCostLabel |
---|
115 | (* ---------------------------------------- *) ⊢ |
---|
116 | ReturnPostCostLabel ≡ carr X. |
---|
117 | |
---|
118 | unification hint 0 ≔ p1,p2; |
---|
119 | X ≟ DEQReturnPostCostLabel |
---|
120 | (* ---------------------------------------- *) ⊢ |
---|
121 | eq_return_cost_lab p1 p2 ≡ eqb X p1 p2. |
---|
122 | |
---|
123 | definition eq_call_cost_lab : CallCostLabel → CallCostLabel → bool ≝ |
---|
124 | λc1,c2.match c1 with [a_call_label x ⇒ match c2 with [a_call_label y ⇒ eqb x y ]]. |
---|
125 | |
---|
126 | lemma eq_call_cost_lab_elim : ∀P : bool → Prop.∀c1,c2.(c1 = c2 → P true) → |
---|
127 | (c1 ≠ c2 → P false) → P (eq_call_cost_lab c1 c2). |
---|
128 | #P * #c1 * #c2 #H1 #H2 normalize @eqb_elim /2/ * #H @H2 % #EQ destruct @H % qed. |
---|
129 | |
---|
130 | definition DEQCallCostLabel ≝ mk_DeqSet CallCostLabel eq_call_cost_lab ?. |
---|
131 | #x #y @eq_call_cost_lab_elim [ #EQ destruct /2/] * #H % [ #EQ destruct] #H1 @⊥ @H |
---|
132 | assumption |
---|
133 | qed. |
---|
134 | |
---|
135 | unification hint 0 ≔ ; |
---|
136 | X ≟ DEQCallCostLabel |
---|
137 | (* ---------------------------------------- *) ⊢ |
---|
138 | CallCostLabel ≡ carr X. |
---|
139 | |
---|
140 | unification hint 0 ≔ p1,p2; |
---|
141 | X ≟ DEQCallCostLabel |
---|
142 | (* ---------------------------------------- *) ⊢ |
---|
143 | eq_call_cost_lab p1 p2 ≡ eqb X p1 p2. |
---|
144 | |
---|
145 | definition eq_costlabel : CostLabel → CostLabel → bool ≝ |
---|
146 | λc1.match c1 with |
---|
147 | [ a_call x1 ⇒ λc2.match c2 with [a_call y1 ⇒ x1 == y1 | _ ⇒ false ] |
---|
148 | | a_return_post x1 ⇒ |
---|
149 | λc2.match c2 with [ a_return_post y1 ⇒ x1 == y1 | _ ⇒ false ] |
---|
150 | | a_non_functional_label x1 ⇒ |
---|
151 | λc2.match c2 with [a_non_functional_label y1 ⇒ x1 == y1 | _ ⇒ false ] |
---|
152 | | i_act ⇒ λc2.match c2 with [i_act ⇒ true | _ ⇒ false ] |
---|
153 | ]. |
---|
154 | |
---|
155 | lemma eq_costlabel_elim : ∀P : bool → Prop.∀c1,c2.(c1 = c2 → P true) → |
---|
156 | (c1 ≠ c2 → P false) → P (eq_costlabel c1 c2). |
---|
157 | #P * [1,2,3: #c1 |] * [1,2,3,5,6,7,9,10,11,13,14,15: #c2 |*:] |
---|
158 | #H1 #H2 whd in match (eq_costlabel ??); |
---|
159 | try (@H2 % #EQ destruct) |
---|
160 | [ change with (eq_call_cost_lab ??) in ⊢ (?%); @eq_call_cost_lab_elim |
---|
161 | [ #EQ destruct @H1 % | * #H @H2 % #EQ destruct @H % ] |
---|
162 | | change with (eq_return_cost_lab ??) in ⊢ (?%); |
---|
163 | @eq_return_cost_lab_elim |
---|
164 | [ #EQ destruct @H1 % | * #H @H2 % #EQ destruct @H % ] |
---|
165 | | change with (eq_nf_label ??) in ⊢ (?%); @eq_fn_label_elim |
---|
166 | [ #EQ destruct @H1 % | * #H @H2 % #EQ destruct @H % ] |
---|
167 | | @H1 % |
---|
168 | ] |
---|
169 | qed. |
---|
170 | |
---|
171 | |
---|
172 | definition DEQCostLabel ≝ mk_DeqSet CostLabel eq_costlabel ?. |
---|
173 | #x #y @eq_costlabel_elim [ #EQ destruct /2/] * #H % [ #EQ destruct] #H1 @⊥ @H |
---|
174 | assumption |
---|
175 | qed. |
---|
176 | |
---|
177 | unification hint 0 ≔ ; |
---|
178 | X ≟ DEQCostLabel |
---|
179 | (* ---------------------------------------- *) ⊢ |
---|
180 | CostLabel ≡ carr X. |
---|
181 | |
---|
182 | unification hint 0 ≔ p1,p2; |
---|
183 | X ≟ DEQCostLabel |
---|
184 | (* ---------------------------------------- *) ⊢ |
---|
185 | eq_costlabel p1 p2 ≡ eqb X p1 p2. |
---|
186 | |
---|
187 | |
---|
188 | |
---|
189 | |
---|
190 | inductive ActionLabel : Type[0] ≝ |
---|
191 | | call_act : FunctionName → CallCostLabel → ActionLabel |
---|
192 | | ret_act : option(ReturnPostCostLabel) → ActionLabel |
---|
193 | | cost_act : option NonFunctionalLabel → ActionLabel. |
---|
194 | |
---|
195 | definition is_cost_label : ActionLabel → Prop ≝ |
---|
196 | λact.match act with [ cost_act nf ⇒ True | _ ⇒ False ]. |
---|
197 | |
---|
198 | inductive status_class : Type[0] ≝ |
---|
199 | | cl_jump : status_class |
---|
200 | | cl_io : status_class |
---|
201 | | cl_other : status_class. |
---|
202 | |
---|
203 | definition is_non_silent_cost_act : ActionLabel → Prop ≝ |
---|
204 | λact. ∃l. act = cost_act (Some ? l). |
---|
205 | |
---|
206 | record abstract_status : Type[2] ≝ |
---|
207 | { as_status :> Type[0] |
---|
208 | ; as_execute : ActionLabel → relation as_status |
---|
209 | ; as_syntactical_succ : relation as_status |
---|
210 | ; as_classify : as_status → status_class |
---|
211 | ; is_call_post_label : as_status → bool |
---|
212 | ; as_initial : as_status → bool |
---|
213 | ; as_final : as_status → bool |
---|
214 | ; jump_emits : ∀s1,s2,l. |
---|
215 | as_classify … s1 = cl_jump → |
---|
216 | as_execute l s1 s2 → is_non_silent_cost_act l |
---|
217 | ; io_entering : ∀s1,s2,l.as_classify … s2 = cl_io → |
---|
218 | as_execute l s1 s2 → is_non_silent_cost_act l |
---|
219 | ; io_exiting : ∀s1,s2,l.as_classify … s1 = cl_io → |
---|
220 | as_execute l s1 s2 → is_non_silent_cost_act l |
---|
221 | }. |
---|
222 | (* |
---|
223 | definition is_act_io_entering : abstract_status → ActionLabel → bool ≝ |
---|
224 | λS,l.match l with |
---|
225 | [ call_act f c ⇒ match c with [ inl _ ⇒ false | inr c' ⇒ is_io_entering S c' ] |
---|
226 | | ret_act x ⇒ match x with [ Some c ⇒ match c with [inl _ ⇒ false |
---|
227 | | inr c' ⇒ is_io_entering S c'] |
---|
228 | | None ⇒ false |
---|
229 | ] |
---|
230 | | cost_act x ⇒ match x with [ Some c ⇒ is_io_entering S c | None ⇒ false ] |
---|
231 | | init_act ⇒ false |
---|
232 | ]. |
---|
233 | |
---|
234 | definition is_act_io_exiting : abstract_status → ActionLabel → bool ≝ |
---|
235 | λS,l.match l with |
---|
236 | [ call_act f c ⇒ match c with [ inl _ ⇒ false | inr c' ⇒ is_io_exiting S c' ] |
---|
237 | | ret_act x ⇒ match x with [ Some c ⇒ match c with [inl _ ⇒ false |
---|
238 | | inr c' ⇒ is_io_exiting S c'] |
---|
239 | | None ⇒ false |
---|
240 | ] |
---|
241 | | cost_act x ⇒ match x with [ Some c ⇒ is_io_exiting S c | None ⇒ false ] |
---|
242 | | init_act ⇒ false |
---|
243 | ]. |
---|
244 | *) |
---|
245 | |
---|
246 | inductive raw_trace (S : abstract_status) : S → S → Type[0] ≝ |
---|
247 | | t_base : ∀st : S.raw_trace S st st |
---|
248 | | t_ind : ∀st1,st2,st3 : S.∀l : ActionLabel. |
---|
249 | as_execute S l st1 st2 → raw_trace S st2 st3 → |
---|
250 | raw_trace S st1 st3. |
---|
251 | |
---|
252 | definition is_cost_act : ActionLabel → Prop ≝ |
---|
253 | λact.∃l.act = cost_act l. |
---|
254 | |
---|
255 | definition is_call_act : ActionLabel → Prop ≝ |
---|
256 | λact.∃f,l.act = call_act f l. |
---|
257 | |
---|
258 | definition is_labelled_ret_act : ActionLabel → Prop ≝ |
---|
259 | λact.∃l.act = ret_act (Some ? l). |
---|
260 | |
---|
261 | definition is_unlabelled_ret_act : ActionLabel → Prop ≝ |
---|
262 | λact.act = ret_act (None ?). |
---|
263 | |
---|
264 | definition is_costlabelled_act : ActionLabel → Prop ≝ |
---|
265 | λact.match act with [ call_act _ _ ⇒ True |
---|
266 | | ret_act x ⇒ match x with [ Some _ ⇒ True | None ⇒ False ] |
---|
267 | | cost_act x ⇒ match x with [ Some _ ⇒ True | None ⇒ False ] |
---|
268 | ]. |
---|
269 | (* |
---|
270 | lemma well_formed_trace_inv : |
---|
271 | ∀S : abstract_status.∀st1,st2 : S.∀t : raw_trace S st1 st2. |
---|
272 | well_formed_trace … t → |
---|
273 | (st1 = st2 ∧ t ≃ t_base S st1) ∨ |
---|
274 | (∃st1'.∃l.∃prf : as_execute S l st1 st1'.∃tl : raw_trace S st1' st2. |
---|
275 | well_formed_trace … tl ∧ as_classify … st1 ≠ cl_jump ∧ |
---|
276 | t ≃ t_ind … prf … tl) ∨ |
---|
277 | (∃st1'.∃l.∃ prf : as_execute S l st1 st1'.∃ tl : raw_trace S st1' st2. |
---|
278 | well_formed_trace … tl ∧ is_non_silent_cost_act l ∧ t ≃ t_ind … prf … tl). (* ∨ |
---|
279 | (∃st1'.∃l.∃prf : as_execute S l st1 st1'.∃tl : raw_trace S st1' st2. |
---|
280 | well_formed_trace … tl ∧ as_classify … st1 = cl_io ∧ |
---|
281 | is_non_silent_cost_act l ∧ t ≃ t_ind … prf … tl).*) |
---|
282 | #S #st1 #st2 #t #H inversion H |
---|
283 | [ #st #EQ1 #EQ2 destruct(EQ1 EQ2) #EQ destruct(EQ) #_ /5 by refl_jmeq, or_introl, conj/ |
---|
284 | | #st1' #st2' #st3' #l #prf' #tl' #Htl #Hclass #_ #EQ2 #EQ3 #EQ4 destruct #_ |
---|
285 | % %2 %{st2'} %{l} %{prf'} %{tl'} /4 by conj/ |
---|
286 | | #st1' #st2' #st3' #l #prf #tl #Htl #Hl #_ #EQ2 #EQ3 #EQ4 destruct #_ %2 %{st2'} |
---|
287 | %{l} %{prf} %{tl} % // % // |
---|
288 | (*| #st1' #st2' #st3' #l #prf #tl #Htl #Hclass #is_non_silent #_ #EQ1 #EQ2 #EQ3 |
---|
289 | destruct #_ %2 %{st2'} %{l} %{prf} %{tl} /5 by conj/ *) |
---|
290 | ] |
---|
291 | qed. |
---|
292 | |
---|
293 | *) |
---|
294 | |
---|
295 | let rec append_on_trace (S : abstract_status) (st1 : S) (st2 : S) (st3 : S) |
---|
296 | (t1 : raw_trace S st1 st2) on t1 : raw_trace S st2 st3 → raw_trace S st1 st3 ≝ |
---|
297 | match t1 |
---|
298 | return λst1,st2,tr.raw_trace S st2 st3 → raw_trace S st1 st3 |
---|
299 | with |
---|
300 | [ t_base st ⇒ λt2.t2 |
---|
301 | | t_ind st1' st2' st3' l prf tl ⇒ λt2.t_ind … prf … (append_on_trace … tl t2) |
---|
302 | ]. |
---|
303 | |
---|
304 | interpretation "trace_append" 'append t1 t2 = (append_on_trace ???? t1 t2). |
---|
305 | |
---|
306 | lemma append_associative : ∀S,st1,st2,st3,st4. |
---|
307 | ∀t1 : raw_trace S st1 st2.∀t2 : raw_trace S st2 st3. |
---|
308 | ∀t3 : raw_trace S st3 st4.(t1 @ t2) @ t3 = t1 @ (t2 @ t3). |
---|
309 | #S #st1 #st2 #st3 #st4 #t1 elim t1 -t1 |
---|
310 | [ #st #t2 #t3 %] #st1' #st2' #st3' #l #prf #tl #IH #t2 #t3 whd in ⊢ (??%%); >IH % |
---|
311 | qed. |
---|
312 | |
---|
313 | definition trace_prefix: ∀S : abstract_status.∀st1,st2,st3 : S.raw_trace … st1 st2 → |
---|
314 | raw_trace … st1 st3 → Prop≝ |
---|
315 | λS,st1,st2,st3,t1,t2.∃t3 : raw_trace … st2 st3.t2 = t1 @ t3. |
---|
316 | |
---|
317 | definition trace_suffix : ∀S : abstract_status.∀st1,st2,st3 : S.raw_trace … st2 st3 → |
---|
318 | raw_trace … st1 st3 → Prop≝ |
---|
319 | λS,st1,st2,st3,t1,t2.∃t3 : raw_trace … st1 st2.t2 = t3 @ t1. |
---|
320 | |
---|
321 | inductive pre_silent_trace (S : abstract_status) : |
---|
322 | ∀st1,st2 : S.raw_trace S st1 st2 → Prop ≝ |
---|
323 | | silent_empty : ∀st : S.as_classify … st ≠ cl_io → pre_silent_trace … (t_base S st) |
---|
324 | | silent_cons : ∀st1,st2,st3 : S.∀prf : as_execute S (cost_act (None ?)) st1 st2. |
---|
325 | ∀tl : raw_trace S st2 st3. as_classify … st1 ≠ cl_io → pre_silent_trace … tl → |
---|
326 | pre_silent_trace … (t_ind … prf … tl). |
---|
327 | |
---|
328 | definition is_trace_non_empty : ∀S : abstract_status.∀st1,st2. |
---|
329 | raw_trace S st1 st2 → bool ≝ |
---|
330 | λS,st1,st2,t.match t with [ t_base _ ⇒ false | _ ⇒ true ]. |
---|
331 | |
---|
332 | definition silent_trace : ∀S:abstract_status.∀s1,s2 : S. |
---|
333 | raw_trace S s1 s2 → Prop ≝ λS,s1,s2,t.pre_silent_trace … t ∨ |
---|
334 | ¬ (bool_to_Prop (is_trace_non_empty … t)). |
---|
335 | |
---|
336 | lemma pre_silent_io : ∀S : abstract_status. |
---|
337 | ∀s1,s2 : S. ∀t : raw_trace … s1 s2. pre_silent_trace … t → |
---|
338 | as_classify … s2 ≠ cl_io. |
---|
339 | #S #s1 #s2 #t elim t [ #st #H inversion H // #st1 #st2 #st3 #prf #tl #H1 #sil_tl #_ #EQ1 #EQ2 #EQ3 destruct] |
---|
340 | #st1 #st2 #st3 #l #prf #tl #IH #H inversion H // |
---|
341 | #st1' #st2' #st3' #prf' #tl' #Hclass #silent_tl' #_ #EQ1 #EQ2 destruct |
---|
342 | #EQ destruct #_ @IH assumption |
---|
343 | qed. |
---|
344 | |
---|
345 | (* |
---|
346 | definition silent_trace : ∀S : abstract_status.∀st1,st2 : S. |
---|
347 | raw_trace S st1 st2 → Prop ≝ λS,st1,st2,t.pre_silent_trace … t ∧ |
---|
348 | well_formed_trace … t. |
---|
349 | |
---|
350 | lemma silent_is_well_formed : ∀S : abstract_status.∀st1,st2 : S. |
---|
351 | ∀t : raw_trace S st1 st2. silent_trace … t → well_formed_trace … t. |
---|
352 | #S #st1 #st2 #t * // |
---|
353 | qed. *) |
---|
354 | (* elim t -t |
---|
355 | [ #st #_ %] |
---|
356 | #st1' #st2' #st3' #l #prf #tl #IH * #H #cl %2 |
---|
357 | [2: >cl % #EQ destruct] |
---|
358 | @IH inversion H in ⊢ ?; [ #st #EQ1 #EQ2 #EQ3 destruct] |
---|
359 | #st1'' #st2'' #st3'' #prf' #tl' #H1 #Htl' #_ #EQ1 #EQ2 #EQ3 destruct #_ |
---|
360 | % [ assumption | #_ assumption] |
---|
361 | qed.*) |
---|
362 | |
---|
363 | inductive pre_measurable_trace (S : abstract_status) : |
---|
364 | ∀st1,st2 : S.raw_trace ? st1 st2 → Prop ≝ |
---|
365 | | pm_empty : ∀st : S. as_classify … st ≠ cl_io → pre_measurable_trace … (t_base ? st) |
---|
366 | | pm_cons_cost_act : ∀st1,st2,st3 : S.∀l : ActionLabel. |
---|
367 | ∀prf : as_execute S l st1 st2.∀tl : raw_trace S st2 st3. |
---|
368 | as_classify … st1 ≠ cl_io → is_cost_act l → pre_measurable_trace … tl → |
---|
369 | pre_measurable_trace … (t_ind … prf … tl) |
---|
370 | | pm_cons_lab_ret : ∀st1,st2,st3 : S.∀l : ActionLabel. |
---|
371 | as_classify … st1 ≠ cl_io → |
---|
372 | ∀prf : as_execute S l st1 st2.∀tl : raw_trace S st2 st3. |
---|
373 | is_labelled_ret_act l → pre_measurable_trace … tl → |
---|
374 | pre_measurable_trace … (t_ind … prf … tl) |
---|
375 | | pm_cons_post_call : ∀st1,st2,st3 : S.∀l : ActionLabel. |
---|
376 | ∀prf : as_execute S l st1 st2.∀tl : raw_trace S st2 st3. |
---|
377 | as_classify … st1 ≠ cl_io → is_call_act l → is_call_post_label … st1 → |
---|
378 | pre_measurable_trace … tl → |
---|
379 | pre_measurable_trace … (t_ind … prf … tl) |
---|
380 | | pm_balanced_call : ∀st1,st2,st3,st4,st5.∀l1,l2. |
---|
381 | ∀prf : as_execute S l1 st1 st2.∀t1 : raw_trace S st2 st3. |
---|
382 | ∀t2 : raw_trace S st4 st5.∀prf' : as_execute S l2 st3 st4. |
---|
383 | as_classify … st1 ≠ cl_io → as_classify … st3 ≠ cl_io |
---|
384 | → is_call_act l1 → ¬ is_call_post_label … st1 → |
---|
385 | pre_measurable_trace … t1 → pre_measurable_trace … t2 → |
---|
386 | as_syntactical_succ S st1 st4 → |
---|
387 | is_unlabelled_ret_act l2 → |
---|
388 | pre_measurable_trace … (t_ind … prf … (t1 @ (t_ind … prf' … t2))). |
---|
389 | |
---|
390 | lemma pre_measurable_trace_inv : ∀S : abstract_status. |
---|
391 | ∀st1,st2 : S.∀t : raw_trace … st1 st2. pre_measurable_trace … t → |
---|
392 | (st1 = st2 ∧ as_classify … st1 ≠ cl_io ∧ t ≃ t_base … st1) ∨ |
---|
393 | (∃st1' : S.∃l.∃prf : as_execute S l st1 st1'.∃tl. |
---|
394 | t = t_ind … prf … tl ∧ as_classify … st1 ≠ cl_io ∧ is_cost_act l ∧ |
---|
395 | pre_measurable_trace … tl) ∨ |
---|
396 | (∃st1' : S.∃l.∃prf : as_execute S l st1 st1'.∃tl. |
---|
397 | t = t_ind … prf … tl ∧ |
---|
398 | as_classify … st1 ≠ cl_io ∧ is_labelled_ret_act l ∧ pre_measurable_trace … tl) ∨ |
---|
399 | (∃st1' : S .∃l.∃prf : as_execute S l st1 st1'.∃tl. |
---|
400 | t = t_ind … prf … tl ∧ as_classify … st1 ≠ cl_io ∧ is_call_act l ∧ |
---|
401 | (bool_to_Prop (is_call_post_label … st1)) ∧ pre_measurable_trace … tl) ∨ |
---|
402 | (∃st1',st1'',st1''' : S.∃l1,l2.∃prf : as_execute S l1 st1 st1'. |
---|
403 | ∃t1 : raw_trace S st1' st1''.∃t2 : raw_trace S st1''' st2. |
---|
404 | ∃prf' : as_execute S l2 st1'' st1'''. |
---|
405 | t = t_ind … prf … (t1 @ (t_ind … prf' … t2)) ∧ as_classify … st1 ≠cl_io ∧ |
---|
406 | as_classify … st1'' ≠ cl_io ∧ is_call_act l1 ∧ |
---|
407 | bool_to_Prop (¬ is_call_post_label … st1) ∧ |
---|
408 | pre_measurable_trace … t1 ∧ pre_measurable_trace … t2 ∧ |
---|
409 | as_syntactical_succ S st1 st1''' ∧ is_unlabelled_ret_act l2). |
---|
410 | #S #st1 #st2 #t #H inversion H |
---|
411 | [ #st #Hclass #EQ1 #EQ2 destruct #EQ destruct #_ %%%%% // % // |
---|
412 | | #st1' #st2' #st3' #l #prf #tl #Hst1' #Hl #Htl #_ #EQ1 #EQ2 #EQ3 destruct #_ |
---|
413 | %%%%2 %{st2'} %{l} %{prf} %{tl} % // % // % // |
---|
414 | | #st1' #st2' #st3' #l #Hst1 #prf #tl #Hl #Htl #_ #EQ1 #EQ2 #EQ3 destruct #_ |
---|
415 | %%%2 %{st2'} %{l} %{prf} %{tl} % // % // % // |
---|
416 | | #st1' #st2' #st3' #l #prf #tl #Hst1 #Hl #H1st1 #Htl #_ #EQ1 #EQ2 #EQ3 destruct #_ |
---|
417 | % %2 %{st2'} %{l} %{prf} %{tl} % // % // % // % // |
---|
418 | | #st1' #st2' #st3' #st4' #st5' #l1 #l2 #prf #t1 #t2 #prf' #Hst1' #Hst3' #Hl1 |
---|
419 | #H1st1' #Ht1 #Ht2 #succ #Hl2 #_ #_ #EQ1 #EQ2 #EQ3 destruct #_ %2 |
---|
420 | %{st2'} %{st3'} %{st4'} %{l1} %{(ret_act (None ?))} %{prf} %{t1} %{t2} |
---|
421 | %{prf'} /12 by conj/ |
---|
422 | ] |
---|
423 | qed. |
---|
424 | |
---|