aboutsummaryrefslogtreecommitdiff
path: root/pretyping/evarsolve.ml
AgeCommit message (Collapse)Author
2015-02-21Removing need for ensure_evar_independent by passing a force flag to ↵Hugo Herbelin
is_constrainable_in to do the job of ensuring that ?p does not belong to the ti while solving ?p[...]:=?n[t1..tn].
2015-02-19When looking for restrictions in ?n=?p problems, keep the type of let-bindings.Hugo Herbelin
Bindings of the form [let x:T := M] are unfolded into [(M:T)], so that occur-check is done in [T] as well as in [M] (except when [M] is a variable, where it is hopefully not necessary). This is a way to fix #4062 (evars with type depending on themselves). The fix modifies the alias map (make_alias_map) but it should behave the same at all places using alias maps other than has_constrainable_free_vars.
2015-02-14Univs: fix bug #3755. We were missing refreshements of universes inMatthieu Sozeau
unifications ?X ~= ?Y foo not catched by solve_evar_evar.
2015-02-12Fixing #3997 (occur-check in the presence of primitive projections, patchHugo Herbelin
from Matthieu).
2015-01-12Update headers.Maxime Dénès
2015-01-12Not "Setting ?n=?p order to ?p:=?n to see if it solves someHugo Herbelin
incompatibilities wrt 8.4.", as it creates other problems (in Ergo and Compcert). This reverts commit bf388dfec041ab0fa74ae5d484600f6fcf515e4f.
2015-01-08Setting ?n=?p order to ?p:=?n to see if it solves some incompatibilities wrt ↵Hugo Herbelin
8.4.
2015-01-03Fixing 48509b61 which improved unification as expected but actuallyHugo Herbelin
not using the intended test. By fixing the intended test, the need for a delta-expansion resulting from this commit in PFsection6.v (line 1255) of ssreflect disappears.
2015-01-03Fixing #3895 (thanks to PMP for diagnosis).Hugo Herbelin
2014-12-19Back to the preferred ?n1:=?n2 order of evar-evar unification which got ↵Hugo Herbelin
accidentally mixed up in 9aa416c0c6.
2014-12-15Tentatively starting to use heuristics for evar-evar resolution: firstHugo Herbelin
step, prefer QuestionMark's to other evars, to comply with the filtering made on VarInstance, GoalEvar and QuestionMark for type class resolution. Maybe evars to be resolved by type class instances should eventually be marked with a specific tag. At least, this solves the current problem with compiling cancel2.v in LemmaOverloading.
2014-12-15Documenting check_record + changing a possibly undefined int into int option.Hugo Herbelin
2014-12-11Added a CannotSolveConstraint unification error and made experimentsHugo Herbelin
in reporting the chain of causes when unification fails.
2014-12-11Tentatively more informative report of failure when inferringHugo Herbelin
pattern-matching predicate.
2014-12-10Fixing orientation of postponed subtyping problems.Hugo Herbelin
In the case of conversion, postponing by preserving the initial orientation. Was wrong from its initial version in Jan 2014, but was not visible because evar-evar subtyping was approximated by evar-evar conversion. Thanks to Enrico for a very short example highlighting the problem. In particular, this fixes Ergo.
2014-12-10Using a more aggressive test for resolving pattern equations ?n = ?p:Hugo Herbelin
test pattern-unification after restriction of the evars so as to succeed earlier (no observational changes however in the examples at my disposal).
2014-12-08Improved criterion for evar restriction in the configurationHugo Herbelin
?n[...] = ?p[...;x:=?n[...];...]. Indeed, x could be a solution for ?p.
2014-12-07Improving evar restriction (this is a risky change, as I remember aHugo Herbelin
similar optimization broke at some time some ssreflect code; we now treat the easy case of a let-in to a rel - a pattern common in pattern-matching compilation -; later on, we shall want to investigate whether any let-in found to refer to out of scope rels or vars can be filtered out).
2014-12-07Improved tracking of the origin of evars.Hugo Herbelin
2014-12-07Had forgotten some debugging printer.Hugo Herbelin
2014-12-04New approach to deal with evar-evar unification problems in differentHugo Herbelin
types: we downcast the evar in the higher type to the lower type. Then, we have the freedom to choose the order of instantiation according to the instances of the evars (e.g. choosing the instantiation for which pattern-unification is possible, if ever it is possible in only one way - as shown by an example in contribution Paco). This still does not preserve compatibility because it happens that type classes resolution is crucially dependent on the order of presentation of the ?n=?p problems. Consider e.g. an example taken from Containers. Both now and before e2fa65fccb9, one has this asymmetry: Context `{Helt : OrderedType elt}. Check forall x y r l h, @Equivalence.equiv _ _ _ x y -> In x (Node l x r h). --> @Equivalence.equiv QArith_base.Q QArith_base.Qeq QArith_base.Q_Setoid x y Context `{Helt : OrderedType elt}. Check forall x y r l h, In x (Node l x r h) -> @Equivalence.equiv _ _ _ x y. --> @Equivalence.equiv elt (@_eq elt Helt) (@OT_Equivalence elt Helt) Then, embedding this example within a bigger one which relies on the ?n=?n' resolution order, one can get two incompatible resolution of the same problem. To be continued...
2014-12-03In solve_evar_evar, orient the heuristic over arities with differentHugo Herbelin
types as it was before commit 710bae2a8c81a44. There is still at least one problem with bug #3392 to solve.
2014-12-02When solving ?id{args} = ?id'{args'}, give preference to ?id:=?id' ifHugo Herbelin
possible, which is the "natural" way to orient an equation. At least it matters for matching subterms against patterns, so that it is the pattern variables which are substituted if ever the subterm has itself existential variables, as in: Goal exists x, S x = x. eexists. destruct (S _).
2014-12-02Postponing the "evar <= evar" problems instead of solving them in anHugo Herbelin
arbitrary direction as if it were an "evar = evar" problem.
2014-12-02Being more scrupulous on preserving subtyping in evar-evar problems.Hugo Herbelin
Incidentally, this allows to make earlier the collapse of CUMUL to CONV when force is true.
2014-12-02Being consistent in making arbitrary choices in recursive calls toHugo Herbelin
evar_define. Interestingly, the added choose in evarconv.ml allows solve_evar_evar to be observationally commutative, in the sense of not either fail or succeed in compiling the stdlib whether problems are given in the left-to-right or right-to-left order.
2014-12-02Resolution of evar/evar problems: removed a test which should beHugo Herbelin
subsumed by the call to project_evar_on_evar.
2014-10-03Fixing #3634 (wrong env in "cannot instantiate because not in itsHugo Herbelin
scope" error message).
2014-10-02Work around issues with FO unification trying to unify terms ofMatthieu Sozeau
potentially different types, resulting in ill-typed terms due to eta. Projection expansion now fails gracefully on retyping errors. The proper fix to unification, checking that the heads for FO have unifiable types, is currently too strong, adding unnecessary universe constraints, so it is disabled for now. It might be quite expensive too also it's not noticeable on the stdlib.
2014-09-24Rename eq_constr functions in Evd to not break backward compatibilityMatthieu Sozeau
with existing ML code.
2014-09-19Move the specific map_constr_with_binders_left_to_rightMatthieu Sozeau
for e_contextually where it is used. Bug #3648 is fixed.
2014-09-18Fix constrMatching as well as change/e_contextually to allowMatthieu Sozeau
matching partial applications of primitive projections. Fixes bug #3637.
2014-09-17Be more conservative and keep the use of eq_constr in pretyping/ functions.Matthieu Sozeau
2014-09-17Fix bug #3593, making constr_eq and progress work up toMatthieu Sozeau
equality of universes, along with a few other functions in evd.
2014-09-13Providing a -type-in-type option for collapsing the universe hierarchy.Hugo Herbelin
2014-09-12Uniformisation of the order of arguments env and sigma.Hugo Herbelin
2014-09-12Referring to evars by names. Added a parser for evars (but parsing ofHugo Herbelin
instances still to do). Using heuristics to name after the quantifier name it comes. Also added a "sigma" to almost all printing functions.
2014-08-26Make evarconv and unification able to handle eta for records in presenceMatthieu Sozeau
of metas/evars
2014-08-25Fixing bug #3377 by giving env and sigma to constrMathching. Now it's possibleMatthieu Sozeau
to match on a primitive projection application c.(p) using "?f _", binding f to (fun x => x.(p)) with the correct typing.
2014-07-30Avoid introducing additional universes when doing pruning in evarsolve.Matthieu Sozeau
2014-07-07Missing check of evar instantiation, resulting in missing constraints (bug ↵Matthieu Sozeau
from MathClasses).
2014-07-02Fix a Not_found anomaly raised by solve_evar_evar, we were breaking theMatthieu Sozeau
invariant that the evar arguments to that function always have to be undefined.
2014-06-26Change interface of refresh universes to get a pbty argument instead ofMatthieu Sozeau
the computed direction argument. In case pbty is conv, no refreshing is done as the evar body must be convertible with the given term, however refreshing of template application evar arguments can still happen. (Re)-Closing bug #2966.
2014-06-21- Add an option to refresh only algebraic universes, for e_type_of. The goalMatthieu Sozeau
there is not the same as in Evd.define. - Fixed bugs #3330 and #3331.
2014-06-20Cleanup treatment of template universe polymorphism (thanks to E. TassiMatthieu Sozeau
for helping fixing this). Now the issue is handled solely through refreshing of the terms assigned to evars during unification. If ?X = list ?Y, then Y's type is refreshed so that it doesn't mention a template universe and in turn, ?X won't. Same goes when typechecking (nil ?X, nil ?Y), the pair constructor levels will be set higher than fresh universes for the lists carriers. This also handles user-defined functions on template polymorphic inductives, which was fragile before. Pretyping and Evd are now uncluttered from template-specific code.
2014-06-17Removing dead code.Pierre-Marie Pédrot
2014-06-16Unification in HoTT_coq_061.v was looping with previous commit (whileHugo Herbelin
it was failing with Not_found before previous commit). This "fixes" the loop by expanding local defs in "imitate" rather than keeping them explicit. The example is otherwise too large for me to be able to understand where does the loop come from.
2014-06-16Fixing part of HoTT bug #61 (in declare_evar_from_virtual_equation,Hugo Herbelin
fix the type of the term which has to be in the signature of the evar to declare); some problems remain though (see next commit).
2014-05-06Find a more efficient fix for dealing with template universes:Matthieu Sozeau
eagerly solve l <= k constraints as k := l when k is a fresh variable coming from a template type. This has the effect of fixing the variable at the first instantiation of the parameters of template polymorphic inductive and avoiding to generate useless <= constraints that need to be minimized afterwards.
2014-05-06Try a new way of handling template universe levelsMatthieu Sozeau