@@ -119,14 +119,19 @@ let pure_stack lfts stk =
119119(* Conversion *)
120120(* *******************************************************************)
121121
122+ type firstorder_mode =
123+ | Eager
124+ | L2R
125+ | R2L
126+
122127(* Conversion utility functions *)
123128
124129(* functions of this type are called from the kernel *)
125130type 'a kernel_conversion_function = env -> 'a -> 'a -> (unit , unit ) result
126131
127132(* functions of this type can be called from outside the kernel *)
128133type 'a extended_conversion_function =
129- ?l2r:bool -> ?reds:TransparentState .t -> env ->
134+ ?l2r:firstorder_mode -> ?reds:TransparentState .t -> env ->
130135 ?evars:evar_handler ->
131136 'a -> 'a -> (unit , unit ) result
132137
@@ -385,7 +390,12 @@ let rec ccnv cv_pb l2r infos lft1 lft2 term1 term2 cuniv =
385390and eqappr cv_pb l2r infos (lft1 ,st1 ) (lft2 ,st2 ) cuniv =
386391 Control. check_for_interrupt () ;
387392 (* First head reduce both terms *)
388- let ninfos = infos_with_reds infos.cnv_inf RedFlags. betaiotazeta in
393+ let ninfos = match l2r with
394+ | Eager ->
395+ let all = RedFlags. (red_add_transparent all (red_transparent (info_flags infos.cnv_inf))) in
396+ infos_with_reds infos.cnv_inf all
397+ | L2R | R2L -> infos_with_reds infos.cnv_inf RedFlags. betaiotazeta
398+ in
389399 let appr1 = whd_stack ninfos infos.lft_tab (fst st1) (snd st1) in
390400 let appr2 = whd_stack ninfos infos.rgt_tab (fst st2) (snd st2) in
391401 eqwhnf cv_pb l2r infos (lft1, appr1) (lft2, appr2) cuniv
@@ -467,6 +477,11 @@ and eqwhnf cv_pb l2r infos (lft1, (hd1, v1) as appr1) (lft2, (hd2, v2) as appr2)
467477 let () = Control. check_for_interrupt () in
468478 (* Determine which constant to unfold first *)
469479 let unfold_left =
480+ let l2r = match l2r with
481+ | L2R -> true
482+ | R2L -> false
483+ | Eager -> assert false
484+ in
470485 let order = Conv_oracle. oracle_compare oracle (to_er fl1) (to_er fl2) in
471486 match order with
472487 | Conv_oracle. Left -> true
@@ -1010,7 +1025,7 @@ let () =
10101025 let state = info_univs infos in
10111026 let qual_equal q1 q2 = CClosure. eq_quality infos q1 q2 in
10121027 let infos = { cnv_inf = infos; cnv_typ = true ; lft_tab = tab; rgt_tab = tab; err_ret = box; } in
1013- let state', _ = ccnv CONV false infos el_id el_id a b (state, checked_universes_gen qual_equal) in
1028+ let state', _ = ccnv CONV R2L infos el_id el_id a b (state, checked_universes_gen qual_equal) in
10141029 assert (state== state');
10151030 true
10161031 with
@@ -1019,7 +1034,7 @@ let () =
10191034 in
10201035 CClosure. set_conv conv
10211036
1022- let gen_conv ~typed cv_pb ?(l2r =false ) ?(reds =TransparentState. full) env ?(evars =default_evar_handler env) t1 t2 =
1037+ let gen_conv ~typed cv_pb ?(l2r =R2L ) ?(reds =TransparentState. full) env ?(evars =default_evar_handler env) t1 t2 =
10231038 let univs = Environ. universes env in
10241039 let state = univs in
10251040 let b =
0 commit comments