Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[econstr] Continue consolidation of EConstr API under interp. #6511

Merged
merged 1 commit into from
Mar 4, 2018

Conversation

ejgallego
Copy link
Member

@ejgallego ejgallego commented Dec 27, 2017

This commit was motivated by true spurious conversions arising in my
to_constr debug branch.

The changes here need careful review as the tradeoffs are subtle and
still a lot of clean up remains to be done in vernac/*.

We have opted for penalize [minimally] the few users coming from true
Constr-land, but I am sure we can tweak code in a much better way.

In particular, it is not clear if internalization should take an
evar_map even in the cases where it is not triggered, see the
changes under plugins for a good example.

Also, the new return type of Pretyping.understand should undergo
careful review.

We don't touch Impargs as it is not clear how to proceed, however,
the current type of compute_implicits_gen looks very suspicious as
it is called often with free evars.

@ejgallego ejgallego added kind: cleanup Code removal, deprecation, refactorings, etc. kind: redesign The same functionality is being re-implemented in a different way. needs: benchmarking Performance testing is required. needs: review labels Dec 27, 2017
@ejgallego ejgallego force-pushed the econstr+more_fix branch 3 times, most recently from 292d844 to 4f3d2dd Compare December 27, 2017 20:57
@ejgallego
Copy link
Member Author

ejgallego commented Dec 27, 2017

https://ci.inria.fr/coq/job/benchmark-part-of-the-branch/267/console


┌──────────────────────────┬─────────────────────────┬─────────────────────────────────────┬───────────────────────────────────────┬─────────────────────────┬─────────────────┐
│                          │      user time [s]      │             CPU cycles              │           CPU instructions            │  max resident mem [KB]  │   mem faults    │
│                          │                         │                                     │                                       │                         │                 │
│             package_name │     NEW     OLD PDIFF   │           NEW           OLD PDIFF   │            NEW            OLD PDIFF   │     NEW     OLD PDIFF   │ NEW OLD PDIFF   │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│               coq-geocoq │ 3063.70 3109.62 -1.48 % │ 8549795977323 8671949965148 -1.41 % │ 14329482319015 14333681566872 -0.03 % │ 1210352 1217228 -0.56 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│   coq-mathcomp-odd_order │ 1365.05 1377.80 -0.93 % │ 3802308045192 3835244935699 -0.86 % │  6725305220168  6725333113686 -0.00 % │ 1088964 1089016 -0.00 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│           coq-coquelicot │   75.28   75.67 -0.52 % │  207813357856  207740910787 +0.03 % │   261648037441   261249289812 +0.15 % │  658340  658276 +0.01 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│       coq-mathcomp-field │  450.67  452.95 -0.50 % │ 1254614371399 1261561083963 -0.55 % │  2101019879400  2101586473268 -0.03 % │  724868  724172 +0.10 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│   coq-mathcomp-character │  266.05  267.30 -0.47 % │  740089840424  743588110112 -0.47 % │  1099120100564  1099419471921 -0.03 % │  982704  982832 -0.01 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│          coq-fiat-crypto │ 3549.62 3565.63 -0.45 % │ 9888063668573 9921092313979 -0.33 % │ 16796910800231 16768928812553 +0.17 % │ 3330824 3341340 -0.31 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│    coq-mathcomp-solvable │  192.23  193.09 -0.45 % │  533857516628  536186295941 -0.43 % │   778100218777   778269033481 -0.02 % │  712736  712920 -0.03 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│              coq-unimath │ 1287.37 1292.92 -0.43 % │ 3588857449087 3607503156299 -0.52 % │  6264011069272  6265918446257 -0.03 % │ 1077664 1075296 +0.22 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│ coq-mathcomp-real_closed │  167.74  168.30 -0.33 % │  466332104372  467479392032 -0.25 % │   717059683336   717266930824 -0.03 % │  729100  728928 +0.02 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                coq-flocq │   58.50   58.66 -0.27 % │  160653468133  161598376949 -0.58 % │   207677842462   208911091316 -0.59 % │  644288  644488 -0.03 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│    coq-mathcomp-fingroup │   60.36   60.50 -0.23 % │  166493189387  167097811336 -0.36 % │   233389762583   233462817455 -0.03 % │  532284  532136 +0.03 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│         coq-fiat-parsers │  652.55  654.02 -0.22 % │ 1827219275821 1829953535784 -0.15 % │  2974016709553  2972099192486 +0.06 % │ 3527152 3523052 +0.12 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│            coq-fiat-core │   99.84   99.98 -0.14 % │  284503817864  285137674864 -0.22 % │   372951918210   372527813314 +0.11 % │  501108  501088 +0.00 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│     coq-mathcomp-algebra │  171.03  171.22 -0.11 % │  475003171866  475733430381 -0.15 % │   676393429768   676071196259 +0.05 % │  588972  589160 -0.03 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                coq-color │  561.75  561.34 +0.07 % │ 1569324915849 1570932236918 -0.10 % │  1982616510953  1981747405244 +0.04 % │ 1439564 1439772 -0.01 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│             coq-compcert │  810.62  809.74 +0.11 % │ 2262143799692 2255530866490 +0.29 % │  3419224120627  3421463487777 -0.07 % │ 1346712 1346784 -0.01 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│              coq-bignums │   74.47   74.37 +0.13 % │  207185535761  207086308272 +0.05 % │   281693787429   281809552641 -0.04 % │  526520  527108 -0.11 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│               coq-sf-plf │   42.20   42.11 +0.21 % │  117472703636  117676194692 -0.17 % │   155305351505   155231627989 +0.05 % │  517732  517700 +0.01 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│                coq-sf-lf │   15.68   15.62 +0.38 % │   43338462488   43463770742 -0.29 % │    60961305180    60828770164 +0.22 % │  418048  418336 -0.07 % │   0   0  +nan % │
├──────────────────────────┼─────────────────────────┼─────────────────────────────────────┼───────────────────────────────────────┼─────────────────────────┼─────────────────┤
│   coq-mathcomp-ssreflect │   39.83   39.57 +0.66 % │  109071800467  109223190922 -0.14 % │   135425370623   135501636016 -0.06 % │  477112  477204 -0.02 % │   0   0  +nan % │
└──────────────────────────┴─────────────────────────┴─────────────────────────────────────┴───────────────────────────────────────┴─────────────────────────┴─────────────────┘

@ejgallego ejgallego force-pushed the econstr+more_fix branch 2 times, most recently from c0d6836 to dc137ee Compare December 27, 2017 21:03
@gares
Copy link
Member

gares commented Dec 27, 2017

I think you should get rid of Evd.empty and use Evd.from_env. The former should really disappear, right @ppedrot ?

@ejgallego
Copy link
Member Author

I think you should get rid of Evd.empty and use Evd.from_env. The former should really disappear, right @ppedrot ?

That's a good point, even if I think in most cases this patch addresses the universe part doesn't matter. It looks like the current granularity is not the best.

@ppedrot
Copy link
Member

ppedrot commented Dec 28, 2017

I think that indeed Evd.empty is wrong most of the time.

@ejgallego
Copy link
Member Author

I think that indeed Evd.empty is wrong most of the time.

So what do you propose? Previously there was no evar_map but however open terms were fed [and matched in the corresponding path]

Copy link
Member

@herbelin herbelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to me like a courageous PR, which we had to do at some time, whether it is for scability (e.g. eventually supporting features such as implicit arguments on goal variables even if they contain evars), for a better control of the flow of execution.

I don't feel fully competent to tell what is best to do though, considering that I don't have so much expertise on the econstr issue.

I made some comments, but more as questions or suggestions than as certainties. In particular, even if I read the whole patch, there are places where I'm unable to evaluate if the compromise made should be pushed one step further now or if it is the right one at the current time. I'm thinking e.g. to tacintern where,
probably, the evar_map should eventually logically become part of the ist (wondering about the opinion of @ppedrot though).

let compute_implicits_with_manual env typ enriching l =
let compute_implicits_with_manual env _sigma typ enriching l =
(* XXX: FIXME *)
let typ = EConstr.Unsafe.to_constr typ in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not to move sigma towards compute_implicits_gen?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a good idea @herbelin, what should be done with the whd_all there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done, I used reductionops.whd_all, but I added a comment to the commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC @maximedenes I believe this PR introduced the performance issue Damien showed us yesterday. I'll try to undo this change and use kernel's whd_all (that is by need) instead of Reductionops.whd_all that is by name, and see how it goes.

CC @ppedrot @ejgallego note that the sigma threaded there is an empty one, created with from_env... #6511 (comment)

@@ -2052,19 +2052,17 @@ let empty_ltac_sign = {
ltac_extra = Genintern.Store.empty;
}

let intern_gen kind env
let intern_gen kind env sigma
?(impls=empty_internalization_env) ?(pattern_mode=false) ?(ltacvars=empty_ltac_sign)
c =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the moment intern_gen knows the sigma, it should be possible to statically check that CHole nodes (representing a ?x) refer to existing evars, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a question for @ppedrot but I think so.

let l',cls = compute_arguments_scope_full sigma typ in
let l1 = List.firstn n l' in
let cls1 = List.firstn n cls in
(req,r,0,l1@l,cls1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would pass the env and sigma one step above to rebuild_arguments_scope in anticipation of a purely functional rebuild method (or otherwise replace the FIXME by a comment saying that no evars are expected here).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@herbelin I have done so, however note that inArgumentsScope doesn't keep track of this properly, we may rethink.

let (scs,cls as o) = compute_arguments_scope_full t in
let sigma, env = Evd.empty, Global.env () in (* FIXME? *)
let typ = EConstr.of_constr @@ fst @@ Global.type_of_global_in_context env ref in
let (scs,cls as o) = compute_arguments_scope_full sigma typ in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem, I would pass env and sigma to declare_ref_arguments_scope, and further. Then, the day we want to support implicit arguments or scopes on goal variables (which could be useful with big proofs), this will almost be ready, even if the goal variable mentions an evar.

Or, alternatively, to replace the FIXME by a comment telling that terms with evars are not (yet) supported here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, but see the mess that we get on interp/declare.ml

@@ -1614,7 +1617,7 @@ let recursive_definition is_mes function_name rec_impls type_of_f r rec_arg_num
tcc_lemma_constr
is_mes functional_ref
(EConstr.of_constr rec_arg_type)
(EConstr.of_constr relation) rec_arg_num
relation rec_arg_num
term_id
using_lemmas
(List.length res_vars)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What to do in funind would require the opinion of an expert. Maintaining the status quo as done here seems otherwise the reasonable thing to do.

Copy link
Contributor

@SkySkimmer SkySkimmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evd.from_env should be better than Evd.empty essentially always (in the context of this PR it might not be strictly better ^^).

I strongly feel we need some system to be able to use functions both with econstr+evar map and just constr when it makes sense. I don't know how to make it work exactly though.

@@ -2078,8 +2076,8 @@ let intern_pattern globalenv patt =

(* All evars resolved *)

let interp_gen kind env sigma ?(impls=empty_internalization_env) c =
let c = intern_gen kind ~impls env c in
let interp_gen kind env sigma ?(impls=empty_internalization_env) c : EConstr.t * UState.t =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the annotation?

open Constrexpr
open Notation_term
open Pretyping
open Misctypes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did open Misctypes move?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to do the opens in "hierarchy" order.

let c, ectx = interp_constr env (Evd.from_env env) c in
let sigma = Evd.from_env env in
let c, ectx = interp_constr env sigma c in
let c = EConstr.to_constr sigma c in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't to_constr (Evd.from_env env) the same as unsafe to_constr except slower?
I think we should merge the ectx into sigma before doing to_constr so that we normalise any temporary universe variables used by interp_constr (although not doing that seems not to have been a problem in the past).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the proper way to merge this?

let sigma, env = Evd.empty, Global.env () in (*FIXME?*)
let typ = EConstr.of_constr @@ fst (Global.type_of_global_in_context env r) in
let scs,cls = compute_arguments_scope_full sigma typ in
(req,r,List.length scs,scs,cls)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we only use the evar map to pass it to Reductionops.whd_betaiotazeta as that works on econstr only. Shouldn't we instead define some Reductionops.NoEvars.whd_... which would operate on constr and take no evar map?
Also I think the FIXME is about discarding the universe context from type_of_global.

of the manually given scopes to avoid further re-computations. *)
let sigma, env = Evd.empty, Global.env () in (*FIXME?*)
let typ = EConstr.of_constr @@ fst (Global.type_of_global_in_context env r) in
let l',cls = compute_arguments_scope_full sigma typ in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branches do the same thing up to this point, ie the function is equivalent to

let rebuild_arguments_scope (req,r,n,l,_) =
  let sigma, env = Evd.empty, Global.env () in
  (*FIXME?*)
  let typ = EConstr.of_constr @@ fst (Global.type_of_global_in_context env r) in
  let scs,cls = compute_arguments_scope_full sigma typ in
  match req with
  | ArgsScopeNoDischarge -> assert false
  | ArgsScopeAuto ->
    (req,r,List.length scs,scs,cls)
  | ArgsScopeManual ->
    (* Add to the manually given scopes the one found automatically
       for the extra parameters of the section. Discard the classes
       of the manually given scopes to avoid further re-computations. *)
    let l1 = List.firstn n scs in
    let cls1 = List.firstn n cls in
    (req,r,0,l1@l,cls1)

Shall we do this combination?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If @herbelin is OK I'm all for it.

@@ -153,7 +153,7 @@ let do_assumptions kind nl l =
let env =
push_named_context (List.map (fun (_,id) -> LocalAssum (id,t)) idl) env in
let ienv = List.fold_right (fun (_,id) ienv ->
let impls = compute_internalization_data env Variable t imps in
let impls = compute_internalization_data env sigma Variable EConstr.(of_constr t) imps in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make interp_assumption return an econstr instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@@ -229,7 +228,7 @@ let interp_recursive ~program_mode ~cofix fixl notations =
let sigma, nf = nf_evars_and_universes sigma in
let fixdefs = List.map (fun c -> Option.map EConstr.Unsafe.to_constr c) fixdefs in
let fixdefs = List.map (Option.map nf) fixdefs in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use to_constr instead of successive maps for fixdefs.

@@ -283,15 +283,16 @@ let interp_mutual_inductive (paramsl,indl) notations cum poly prv finite =
let sigma, arities = List.fold_left_map (fun sigma -> interp_ind_arity env_params sigma) sigma indl in

let fullarities = List.map (fun (c, _, _) -> Term.it_mkProd_or_LetIn c ctx_params) arities in
let fullearities = List.map EConstr.of_constr fullarities in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove the EConstr.Unsafe.to_constr in interp_ind_arity (and use econstr it_mkProd_or_LetIn and modify push_types to be econstr) this should disappear.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, but futher cleanup with arities seems to be needed.

@@ -1776,7 +1777,7 @@ let vernac_search ~atts s gopt r =
(* if goal selector is given and wrong, then let exceptions be raised. *)
| Some g -> snd (Pfedit.get_goal_context g) , Some g
in
let get_pattern c = snd (intern_constr_pattern env c) in
let get_pattern c = snd (intern_constr_pattern env Evd.empty c) in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At line 1775 keep the evar map from Pfedit.get_goal_context and at line 1776 use from_env.

@@ -1795,7 +1796,7 @@ let vernac_search ~atts s gopt r =
| SearchHead c ->
(Search.search_by_head gopt (get_pattern c) r |> Search.prioritize_search) pr_search
| SearchAbout sl ->
(Search.search_about gopt (List.map (on_snd (interp_search_about_item env)) sl) r |> Search.prioritize_search) pr_search
(Search.search_about gopt (List.map (on_snd (interp_search_about_item env Evd.empty)) sl) r |> Search.prioritize_search) pr_search
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from_env

@ejgallego
Copy link
Member Author

Thanks for the review Gaëtan (@SkySkimmer) I have scheduled a revision in my TODO list.

@ejgallego
Copy link
Member Author

Ok, I've done a pass, still this PR is quite complicated but let's see how it goes. IMHO we should try to keep pushing stuff like this.

@ejgallego
Copy link
Member Author

Ok so the PR works well in Travis, it needs a bit more of review thou and then I'll need to do overlays for equations and ltac. [should be easy].

I'd like to get this and #6454 in 8.8 if possible.

@ejgallego ejgallego added this to the 8.8 milestone Feb 13, 2018
ejgallego added a commit to ejgallego/ltac2 that referenced this pull request Feb 14, 2018
coq/coq#6511 contains EConstr-related changes.
ejgallego added a commit to ejgallego/Coq-Equations that referenced this pull request Feb 14, 2018
coq/coq#6511 contains EConstr-related changes. This change seems
indeed positive.
@ejgallego ejgallego removed the needs: benchmarking Performance testing is required. label Feb 19, 2018
@ejgallego
Copy link
Member Author

Approved by @SkySkimmer , but certainly this change could use another round of reviews. Prior comments were very effective at improving the PR.

@ejgallego
Copy link
Member Author

Rebasing, keeping the needs: review for now, but IMHO if no more reviews come up I shall remove it the day of the deadline.

See you in a few days 🤖

@ejgallego ejgallego force-pushed the econstr+more_fix branch 3 times, most recently from 171e8a3 to 0c95af5 Compare February 25, 2018 00:50
@maximedenes
Copy link
Member

@ppedrot Can you have one last look?

@maximedenes
Copy link
Member

@herbelin During the WG, @ejgallego asked if you could have a quick look to check the way he took your comments into account.

@herbelin
Copy link
Member

I just had a quick look. That's ok to me.

@maximedenes
Copy link
Member

@ppedrot any final words on this PR?

Copy link
Member

@ppedrot ppedrot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Six Final Words on this PR.

@maximedenes
Copy link
Member

tsssss...

Copy link
Contributor

@SkySkimmer SkySkimmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple comments about unnecessary unsafe to_constr that have not been corrected.

@maximedenes
Copy link
Member

Oh! I was about to push the merge!

@SkySkimmer
Copy link
Contributor

Feel free to decide to leave it to a followup PR if you prefer.

@ejgallego
Copy link
Member Author

I have a couple comments about unnecessary unsafe to_constr that have not been corrected.

Oh I guess I missed them due to the github interface collapsing. Will take care of them.

This commit was motivated by true spurious conversions arising in my
`to_constr` debug branch.

The changes here need careful review as the tradeoffs are subtle and
still a lot of clean up remains to be done in `vernac/*`.

We have opted for penalize [minimally] the few users coming from true
`Constr`-land, but I am sure we can tweak code in a much better way.

In particular, it is not clear if internalization should take an
`evar_map` even in the cases where it is not triggered, see the
changes under `plugins` for a good example.

Also, the new return type of `Pretyping.understand` should undergo
careful review.

We don't touch `Impargs` as it is not clear how to proceed, however,
the current type of `compute_implicits_gen` looks very suspicious as
it is called often with free evars.

Some TODOs are:

- impargs was calling whd_all, the Econstr equivalent can be either
  + Reductionops.whd_all [which does refolding and no sharing]
  + Reductionops.clos_whd_flags with all as a flag.
@ejgallego
Copy link
Member Author

ejgallego commented Feb 28, 2018

Ok, all comments should be addressed now, thanks.

ejgallego added a commit to ejgallego/Coq-Equations that referenced this pull request Mar 1, 2018
coq/coq#6511 contains EConstr-related changes. This change seems
indeed positive.
ejgallego added a commit to ejgallego/Coq-Equations that referenced this pull request Mar 1, 2018
coq/coq#6511 contains EConstr-related changes. This change seems
indeed positive.
ejgallego added a commit to ejgallego/ltac2 that referenced this pull request Mar 1, 2018
coq/coq#6511 contains EConstr-related changes.
@maximedenes maximedenes merged commit 886a9c2 into coq:master Mar 4, 2018
maximedenes added a commit that referenced this pull request Mar 4, 2018
mattam82 added a commit to mattam82/Coq-Equations that referenced this pull request Mar 4, 2018
@ejgallego ejgallego deleted the econstr+more_fix branch March 4, 2018 18:50
maximedenes pushed a commit to maximedenes/coq that referenced this pull request May 6, 2019
coq#6511 contains EConstr-related changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: cleanup Code removal, deprecation, refactorings, etc. kind: redesign The same functionality is being re-implemented in a different way.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants