@@ -206,6 +206,27 @@ let tc1_get_stmt side tc =
206206 | _ ->
207207 tc_error_noXhl ~kinds: (hlkinds_Xhl_r `Stmt ) !! tc
208208
209+ (* ------------------------------------------------------------------ *)
210+ let tc1_process_codepos_range tc (side , cpr ) =
211+ let me, _ = tc1_get_stmt side tc in
212+ let env = FApi. tc1_env tc in
213+ let env = EcEnv.Memory. push_active_ss me env in
214+ EcTyping. trans_codepos_range env cpr
215+
216+ (* ------------------------------------------------------------------ *)
217+ let tc1_process_codepos tc (side , cpos ) =
218+ let me, _ = tc1_get_stmt side tc in
219+ let env = FApi. tc1_env tc in
220+ let env = EcEnv.Memory. push_active_ss me env in
221+ EcTyping. trans_codepos env cpos
222+
223+ (* ------------------------------------------------------------------ *)
224+ let tc1_process_codepos1 tc (side , cpos ) =
225+ let me, _ = tc1_get_stmt side tc in
226+ let env = FApi. tc1_env tc in
227+ let env = EcEnv.Memory. push_active_ss me env in
228+ EcTyping. trans_codepos1 env cpos
229+
209230(* -------------------------------------------------------------------- *)
210231let hl_set_stmt (side : side option ) (f : form ) (s : stmt ) =
211232 match side, f.f_node with
@@ -256,28 +277,28 @@ let tc1_get_post tc =
256277(* -------------------------------------------------------------------- *)
257278let set_pre ~pre f =
258279 match f.f_node, pre with
259- | FhoareF hf , Inv_ss pre ->
280+ | FhoareF hf , Inv_ss pre ->
260281 let pre = ss_inv_rebind pre hf.hf_m in
261282 f_hoareF pre hf.hf_f (hf_po hf)
262- | FhoareS hs , Inv_ss pre ->
283+ | FhoareS hs , Inv_ss pre ->
263284 let pre = ss_inv_rebind pre (fst hs.hs_m) in
264285 f_hoareS (snd hs.hs_m) pre hs.hs_s (hs_po hs)
265- | FeHoareF hf , Inv_ss pre ->
286+ | FeHoareF hf , Inv_ss pre ->
266287 let pre = ss_inv_rebind pre hf.ehf_m in
267288 f_eHoareF pre hf.ehf_f (ehf_po hf)
268- | FeHoareS hs , Inv_ss pre ->
289+ | FeHoareS hs , Inv_ss pre ->
269290 let pre = ss_inv_rebind pre (fst hs.ehs_m) in
270291 f_eHoareS (snd hs.ehs_m) pre hs.ehs_s (ehs_po hs)
271292 | FbdHoareF hf , Inv_ss pre ->
272293 let pre = ss_inv_rebind pre hf.bhf_m in
273294 f_bdHoareF pre hf.bhf_f (bhf_po hf) hf.bhf_cmp (bhf_bd hf)
274- | FbdHoareS hs , Inv_ss pre ->
295+ | FbdHoareS hs , Inv_ss pre ->
275296 let pre = ss_inv_rebind pre (fst hs.bhs_m) in
276297 f_bdHoareS (snd hs.bhs_m) pre hs.bhs_s (bhs_po hs) hs.bhs_cmp (bhs_bd hs)
277- | FequivF ef , Inv_ts pre ->
298+ | FequivF ef , Inv_ts pre ->
278299 let pre = ts_inv_rebind pre ef.ef_ml ef.ef_mr in
279300 f_equivF pre ef.ef_fl ef.ef_fr (ef_po ef)
280- | FequivS es , Inv_ts pre ->
301+ | FequivS es , Inv_ts pre ->
281302 let pre = ts_inv_rebind pre (fst es.es_ml) (fst es.es_mr) in
282303 f_equivS (snd es.es_ml) (snd es.es_mr) pre es.es_sl es.es_sr (es_po es)
283304 | _ -> assert false
@@ -307,33 +328,33 @@ let t_hS_or_bhS_or_eS ?th ?teh ?tbh ?te tc =
307328 | FeHoareS _ when EcUtils. is_some teh -> (oget teh) tc
308329 | FbdHoareS _ when EcUtils. is_some tbh -> (oget tbh) tc
309330 | FequivS _ when EcUtils. is_some te -> (oget te ) tc
310-
311331 | _ ->
312332 let kinds = List. flatten [
313- if EcUtils. is_some th then [`Hoare `Stmt ] else [];
314- if EcUtils. is_some teh then [`EHoare `Stmt ] else [];
315- if EcUtils. is_some tbh then [`PHoare `Stmt ] else [];
316- if EcUtils. is_some te then [`Equiv `Stmt ] else []]
317-
333+ if EcUtils. is_some th then [`Hoare `Stmt ] else [];
334+ if EcUtils. is_some teh then [`EHoare `Stmt ] else [];
335+ if EcUtils. is_some tbh then [`PHoare `Stmt ] else [];
336+ if EcUtils. is_some te then [`Equiv `Stmt ] else []]
318337 in tc_error_noXhl ~kinds !! tc
319338
320339let t_hF_or_bhF_or_eF ?th ?teh ?tbh ?te ?teg tc =
321- match (FApi. tc1_goal tc).f_node with
322- | FhoareF _ when EcUtils. is_some th -> (oget th ) tc
323- | FeHoareF _ when EcUtils. is_some teh -> (oget teh) tc
324- | FbdHoareF _ when EcUtils. is_some tbh -> (oget tbh) tc
325- | FequivF _ when EcUtils. is_some te -> (oget te ) tc
326- | FeagerF _ when EcUtils. is_some teg -> (oget teg) tc
327-
328- | _ ->
340+ let texn tc =
329341 let kinds = List. flatten [
330342 if EcUtils. is_some th then [`Hoare `Pred ] else [];
331343 if EcUtils. is_some teh then [`EHoare `Pred ] else [];
332344 if EcUtils. is_some tbh then [`PHoare `Pred ] else [];
333345 if EcUtils. is_some te then [`Equiv `Pred ] else [];
334346 if EcUtils. is_some teg then [`Eager ] else []]
347+ in tc_error_noXhl ~kinds !! tc in
348+ let tx f tc =
349+ match f.f_node with
350+ | FhoareF _ when EcUtils. is_some th -> (oget th ) tc
351+ | FeHoareF _ when EcUtils. is_some teh -> (oget teh) tc
352+ | FbdHoareF _ when EcUtils. is_some tbh -> (oget tbh) tc
353+ | FequivF _ when EcUtils. is_some te -> (oget te ) tc
354+ | FeagerF _ when EcUtils. is_some teg -> (oget teg) tc
355+ | _ -> raise EcProofTyping. NoMatch in
356+ EcLowGoal. t_lazy_match ~texn tx tc
335357
336- in tc_error_noXhl ~kinds !! tc
337358
338359(* -------------------------------------------------------------------- *)
339360let tag_sym_with_side ?mc name m =
@@ -672,7 +693,7 @@ let t_code_transform (side : oside) ?(bdhoare = false) cpos tr tx tc =
672693 let pr, po = bhs_pr bhs, bhs_po bhs in
673694 let (me, stmt, cs) =
674695 tx (pf, hyps) cpos (pr.inv, po.inv) (bhs.bhs_m, bhs.bhs_s) in
675- let concl = f_bdHoareS (snd me) (bhs_pr bhs) stmt (bhs_po bhs)
696+ let concl = f_bdHoareS (snd me) (bhs_pr bhs) stmt (bhs_po bhs)
676697 bhs.bhs_cmp (bhs_bd bhs) in
677698 FApi. xmutate1 tc (tr None ) (cs @ [concl])
678699
0 commit comments