@@ -176,6 +176,7 @@ let post_hint_from_comp_typing #g #c ct =
176176 in
177177 p
178178
179+ # push - options " --z3rlimit_factor 4"
179180let comp_typing_from_post_hint
180181 (# g : env )
181182 ( c : comp_st )
@@ -297,7 +298,7 @@ let comp_with_pre (c:comp_st) (pre:term) =
297298 | C_STGhost i st -> C_STGhost i { st with pre }
298299 | C_STAtomic i obs st -> C_STAtomic i obs { st with pre }
299300
300-
301+ # push - options " --fuel 0 --ifuel 0 "
301302let st_equiv_pre (# g : env ) (# t : st_term ) (# c : comp_st ) ( d : st_typing g t c )
302303 ( pre : term )
303304 ( veq : slprop_equiv g ( comp_pre c ) pre )
@@ -312,8 +313,6 @@ let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
312313 in
313314 t_equiv d st_equiv
314315
315-
316- # push - options " --z3rlimit_factor 4 --ifuel 2 --fuel 0"
317316let k_elab_equiv_continuation (# g1 : env ) (# g2 : env { g2 ` env_extends ` g1 }) (# ctxt # ctxt1 # ctxt2 : term )
318317 ( k : continuation_elaborator g1 ctxt g2 ctxt1 )
319318 ( d : slprop_equiv g2 ctxt1 ctxt2 )
@@ -324,15 +323,13 @@ let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt
324323 assert ( comp_pre c == ctxt2 );
325324 let st_d' : st_typing g2 st ( comp_with_pre c ctxt1 ) = st_equiv_pre st_d _ ( VE_Sym _ _ _ d ) in
326325 k post_hint (| st , _ , st_d' |)
327- # pop - options
328326
329327let slprop_equiv_typing_fwd (# g : env ) (# ctxt : _ ) ( ctxt_typing : tot_typing g ctxt tm_slprop )
330328 (# p : _ ) ( d : slprop_equiv g ctxt p )
331329 : tot_typing g p tm_slprop
332330 = let fwd , _ = slprop_equiv_typing d in
333331 fwd ctxt_typing
334332
335- # push - options " --z3rlimit_factor 4 --ifuel 1 --fuel 0"
336333let k_elab_equiv_prefix
337334 (# g1 : env ) (# g2 : env { g2 ` env_extends ` g1 }) (# ctxt1 # ctxt2 # ctxt : term )
338335 ( k : continuation_elaborator g1 ctxt1 g2 ctxt )
@@ -347,7 +344,6 @@ let k_elab_equiv_prefix
347344 let (| st , c , st_d |) = res in
348345 assert ( comp_pre c == ctxt1 );
349346 (| _ , _ , st_equiv_pre st_d _ d |)
350- # pop - options
351347
352348let k_elab_equiv
353349 (# g1 : env ) (# g2 : env { g2 ` env_extends ` g1 }) (# ctxt1 # ctxt1' # ctxt2 # ctxt2' : term )
@@ -362,7 +358,7 @@ let k_elab_equiv
362358 k_elab_equiv_prefix k d1 in
363359 k
364360
365- # push - options " --fuel 3 --ifuel 2 --split_queries no --z3rlimit_factor 20"
361+ # push - options " --fuel 3 --ifuel 1 --split_queries no --z3rlimit_factor 20"
366362open Pulse.PP
367363let continuation_elaborator_with_bind' (# g : env ) ( ctxt : term )
368364 (# c1 : comp { stateful_comp c1 })
@@ -571,6 +567,7 @@ let emp_inames_included (g:env) (i:term) (_:tot_typing g i tm_inames)
571567: prop_validity g ( tm_inames_subset tm_emp_inames i )
572568= RU. magic ()
573569
570+ # push - options " --ifuel 1"
574571let return_in_ctxt ( g : env ) ( y : var ) ( y_ppname : ppname ) ( u : universe ) ( ty : term ) ( ctxt : slprop )
575572 ( ty_typing : universe_of g ty u )
576573 ( post_hint0 : post_hint_opt g { PostHint ? post_hint0 /\ checker_res_matches_post_hint g post_hint0 y ty ctxt })
@@ -614,8 +611,9 @@ let return_in_ctxt (g:env) (y:var) (y_ppname:ppname) (u:universe) (ty:term) (ctx
614611 | _ ->
615612 (| _ , _ , d |)
616613
617- # push - options " --z3rlimit_factor 2 "
614+ # push - options " --z3rlimit_factor 4 --ifuel 1 --split_queries always "
618615# restart - solver
616+ # show - options
619617let match_comp_res_with_post_hint (# g : env ) (# t : st_term ) (# c : comp_st )
620618 ( d : st_typing g t c )
621619 ( post_hint : post_hint_opt g )
@@ -651,6 +649,7 @@ let match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st)
651649
652650 (| t , c' , Pulse.Typing.Combinators. t_equiv d d_stequiv |)
653651# pop - options
652+ # pop - options
654653
655654let apply_checker_result_k (# g : env ) (# ctxt : slprop ) (# post_hint : post_hint_for_env g )
656655 ( r : checker_result_t g ctxt ( PostHint post_hint ))
@@ -667,7 +666,7 @@ let apply_checker_result_k (#g:env) (#ctxt:slprop) (#post_hint:post_hint_for_env
667666
668667 k ( PostHint post_hint ) d
669668
670- # push - options " --z3rlimit_factor 4 --fuel 0 --ifuel 1 "
669+ # push - options " --z3rlimit_factor 4 --fuel 0 --ifuel 0 "
671670//TODO: refactor and merge with continuation_elaborator_with_bind
672671let checker_result_for_st_typing (# g : env ) (# ctxt : slprop ) (# post_hint : post_hint_opt g )
673672 ( d : st_typing_in_ctxt g ctxt post_hint )
@@ -723,6 +722,7 @@ let readback_comp_res_as_comp (c:T.comp) : option comp =
723722 )
724723 | _ -> None
725724
725+ # push - options " --ifuel 1"
726726let rec is_stateful_arrow ( g : env ) ( c : option comp ) ( args : list T. argv ) ( out : list T. argv )
727727 : T. Tac ( option ( list T. argv & T. argv ))
728728 = let open R in
@@ -779,6 +779,7 @@ let rec is_stateful_arrow (g:env) (c:option comp) (args:list T.argv) (out:list T
779779 )
780780 else None
781781 )
782+ # pop - options
782783
783784let checker_result_t_equiv_ctxt ( g : env ) ( ctxt ctxt' : slprop )
784785 ( post_hint : post_hint_opt g )
@@ -796,14 +797,17 @@ let is_stateful_application (g:env) (e:term)
796797: T. Tac ( option st_term ) =
797798 RU. record_stats " Pulse.is_stateful_application" fun _ ->
798799 let head , args = T. collect_app_ln e in
799- if Nil ? args then None else
800- match RU. tc_term_phase1 ( elab_env g ) head false with
801- | None , _ -> None
802- | Some ( _ , ht , _ ), _ ->
803- let head_t = wr ht ( T. range_of_term ht ) in
804- match is_stateful_arrow g ( Some ( C_Tot head_t )) args [] with
805- | None -> None
806- | Some _ -> Some ( as_stateful_application e head args )
800+ match args with
801+ | _ :: _ -> (
802+ match RU. tc_term_phase1 ( elab_env g ) head false with
803+ | None , _ -> None
804+ | Some ( _ , ht , _ ), _ ->
805+ let head_t = wr ht ( T. range_of_term ht ) in
806+ match is_stateful_arrow g ( Some ( C_Tot head_t )) args [] with
807+ | None -> None
808+ | Some _ -> Some ( as_stateful_application e head args )
809+ )
810+ | _ -> None
807811
808812let apply_conversion
809813 (# g : env ) (# e : term ) (# eff : _ ) (# t0 : term )
@@ -888,6 +892,7 @@ let norm_st_typing_inverse
888892
889893open FStar.List.Tot
890894module RT = FStar.Reflection.Typing
895+ # push - options " --ifuel 1"
891896let decompose_app ( g : env ) ( tt : either term st_term )
892897: T. Tac ( option ( term & list T. argv & ( args : list T. argv { Cons ? args } -> T. Tac ( res : either term st_term { Inr ? tt ==> Inr ? res }))))
893898= let decompose_st_app ( t : st_term )
@@ -919,6 +924,7 @@ let decompose_app (g:env) (tt:either term st_term)
919924 Some ( head , args , rebuild )
920925 )
921926 | Inr st -> decompose_st_app st
927+ # pop - options
922928
923929let anf_binder name = T. pack ( T. Tv_FVar ( T. pack_fv ( Pulse.Reflection.Util. mk_pulse_lib_core_lid ( Printf. sprintf " __%s_binder__" name ))))
924930
@@ -958,11 +964,14 @@ let rec maybe_hoist (g:env) (arg:T.argv)
958964 )
959965 | Some _ -> (
960966 let g , binders , args = maybe_hoist_args g args in
961- if Nil ? args then T. fail " Impossible" ;
962- let st_app = as_stateful_application t head args in
963- let g , b , x , t = bind_st_term g st_app in
964- let arg = t , q in
965- g , binders @[ b , x , st_app ], arg
967+ if Cons ? args
968+ then (
969+ let st_app = as_stateful_application t head args in
970+ let g , b , x , t = bind_st_term g st_app in
971+ let arg = t , q in
972+ g , binders @[ b , x , st_app ], arg
973+ )
974+ else T. fail " Impossible: is_stateful_application returned true but no args to hoist"
966975 )
967976
968977and maybe_hoist_args ( g : env ) ( args : list T. argv )
@@ -975,6 +984,7 @@ and maybe_hoist_args (g:env) (args:list T.argv)
975984 args
976985 ( g , [], [])
977986
987+ # push - options " --ifuel 1"
978988let maybe_hoist_top
979989 ( hoist_top_level :bool)
980990 ( g : env )
0 commit comments