@@ -35,52 +35,52 @@ let t_ehoare_app_r i f tc =
3535let t_ehoare_app = FApi. t_low2 " hoare-app" t_ehoare_app_r
3636
3737(* -------------------------------------------------------------------- *)
38- let t_bdhoare_app_r_low _i ( _phi , _pR , _f1 , _f2 , _g1 , _g2 ) _tc = assert false
39- (* let env = FApi.tc1_env tc in *)
40- (* let bhs = tc1_as_bdhoareS tc in *)
41- (* let s1, s2 = s_split env i bhs.bhs_s in *)
42- (* let s1, s2 = stmt s1, stmt s2 in *)
43- (* let nR = f_not pR in *)
44- (* let cond_phi = f_hoareS bhs.bhs_m bhs.bhs_pr s1 phi in *)
45- (* let condf1 = f_bdHoareS_r { bhs with bhs_s = s1; bhs_po = pR; bhs_bd = f1; } in *)
46- (* let condg1 = f_bdHoareS_r { bhs with bhs_s = s1; bhs_po = nR; bhs_bd = g1; } in *)
47- (* let condf2 = f_bdHoareS_r *)
48- (* { bhs with bhs_s = s2; bhs_pr = f_and_simpl phi pR; bhs_bd = f2; } in *)
49- (* let condg2 = f_bdHoareS_r *)
50- (* { bhs with bhs_s = s2; bhs_pr = f_and_simpl phi nR; bhs_bd = g2; } in *)
51- (* let bd = *)
52- (* (f_real_add_simpl (f_real_mul_simpl f1 f2) (f_real_mul_simpl g1 g2)) in *)
53- (* let condbd = *)
54- (* match bhs.bhs_cmp with *)
55- (* | FHle -> f_real_le bd bhs.bhs_bd *)
56- (* | FHeq -> f_eq bd bhs.bhs_bd *)
57- (* | FHge -> f_real_le bhs.bhs_bd bd in *)
58- (* let condbd = f_imp bhs.bhs_pr condbd in *)
59- (* let (ir1, ir2) = EcIdent.create "r", EcIdent.create "r" in *)
60- (* let (r1 , r2 ) = f_local ir1 treal, f_local ir2 treal in *)
61- (* let condnm = *)
62- (* let eqs = f_and (f_eq f2 r1) (f_eq g2 r2) in *)
63- (* f_forall *)
64- (* [(ir1, GTty treal); (ir2, GTty treal)] *)
65- (* (f_hoareS bhs.bhs_m (f_and bhs.bhs_pr eqs) s1 eqs) in *)
66- (* let conds = [f_forall_mems [bhs.bhs_m] condbd; condnm] in *)
67- (* let conds = *)
68- (* if f_equal g1 f_r0 *)
69- (* then condg1 :: conds *)
70- (* else if f_equal g2 f_r0 *)
71- (* then condg2 :: conds *)
72- (* else condg1 :: condg2 :: conds in *)
73-
74- (* let conds = *)
75- (* if f_equal f1 f_r0 *)
76- (* then condf1 :: conds *)
77- (* else if f_equal f2 f_r0 *)
78- (* then condf2 :: conds *)
79- (* else condf1 :: condf2 :: conds in *)
80-
81- (* let conds = cond_phi :: conds in *)
82-
83- (* FApi.xmutate1 tc `HlApp conds *)
38+ let t_bdhoare_app_r_low i ( phi , pR , f1 , f2 , g1 , g2 ) tc =
39+ let env = FApi. tc1_env tc in
40+ let bhs = tc1_as_bdhoareS tc in
41+ let s1, s2 = s_split env i bhs.bhs_s in
42+ let s1, s2 = stmt s1, stmt s2 in
43+ let nR = f_not pR in
44+ let cond_phi = f_hoareS bhs.bhs_m bhs.bhs_pr s1 phi [] in
45+ let condf1 = f_bdHoareS_r { bhs with bhs_s = s1; bhs_po = pR; bhs_bd = f1; } in
46+ let condg1 = f_bdHoareS_r { bhs with bhs_s = s1; bhs_po = nR; bhs_bd = g1; } in
47+ let condf2 = f_bdHoareS_r
48+ { bhs with bhs_s = s2; bhs_pr = f_and_simpl phi pR; bhs_bd = f2; } in
49+ let condg2 = f_bdHoareS_r
50+ { bhs with bhs_s = s2; bhs_pr = f_and_simpl phi nR; bhs_bd = g2; } in
51+ let bd =
52+ (f_real_add_simpl (f_real_mul_simpl f1 f2) (f_real_mul_simpl g1 g2)) in
53+ let condbd =
54+ match bhs.bhs_cmp with
55+ | FHle -> f_real_le bd bhs.bhs_bd
56+ | FHeq -> f_eq bd bhs.bhs_bd
57+ | FHge -> f_real_le bhs.bhs_bd bd in
58+ let condbd = f_imp bhs.bhs_pr condbd in
59+ let (ir1, ir2) = EcIdent. create " r" , EcIdent. create " r" in
60+ let (r1 , r2 ) = f_local ir1 treal, f_local ir2 treal in
61+ let condnm =
62+ let eqs = f_and (f_eq f2 r1) (f_eq g2 r2) in
63+ f_forall
64+ [(ir1, GTty treal); (ir2, GTty treal)]
65+ (f_hoareS bhs.bhs_m (f_and bhs.bhs_pr eqs) s1 eqs [] ) in
66+ let conds = [f_forall_mems [bhs.bhs_m] condbd; condnm] in
67+ let conds =
68+ if f_equal g1 f_r0
69+ then condg1 :: conds
70+ else if f_equal g2 f_r0
71+ then condg2 :: conds
72+ else condg1 :: condg2 :: conds in
73+
74+ let conds =
75+ if f_equal f1 f_r0
76+ then condf1 :: conds
77+ else if f_equal f2 f_r0
78+ then condf2 :: conds
79+ else condf1 :: condf2 :: conds in
80+
81+ let conds = cond_phi :: conds in
82+
83+ FApi. xmutate1 tc `HlApp conds
8484
8585(* -------------------------------------------------------------------- *)
8686let t_bdhoare_app_r i info tc =
0 commit comments