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

Next master #565

Merged
merged 48 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b21d4a3
Adapt to https://github.com/coq/coq/pull/17823
proux01 Jul 7, 2023
38d0528
Merge pull request #479 from proux01/coq_17823
gares Jul 9, 2023
a9eb74d
Adapt to coq/coq#17818 (APIs moved to `Vernactypes`)
SkySkimmer Jul 10, 2023
2d4c43a
Adapt to https://github.com/coq/coq/pull/17827
proux01 Aug 4, 2023
0ab62d5
Merge pull request #490 from proux01/coq_17827
gares Aug 5, 2023
5c23e96
Adapt w.r.t. coq/coq#17955.
ppedrot Aug 11, 2023
fbb68b1
Merge remote-tracking branch 'origin/master' into coq-master
proux01 Aug 29, 2023
a0d0eef
Merge pull request #498 from proux01/coq-master_merge
gares Aug 31, 2023
2aeae2e
Merge pull request #494 from ppedrot/hint-cut-static-globref
SkySkimmer Sep 5, 2023
4a1c8ae
Adapt to coq/coq#17795 (ComInductive API and glob_sort changes)
SkySkimmer Jul 4, 2023
a713f87
Merge pull request #474 from SkySkimmer/comind-level-compute
ppedrot Sep 6, 2023
b8e9df2
Adapt to coq/coq#17667 (Genintern.register_subst0 moved to Gensubst)
SkySkimmer Sep 8, 2023
d010b5a
Adapt to coq/coq#18023 (RedFlags moving out of CClosure)
rlepigre Sep 14, 2023
b1f7d4a
Merge pull request #481 from SkySkimmer/vernactypes
SkySkimmer Sep 15, 2023
bc38f3f
Merge pull request #502 from rlepigre/br/cleanup-cclosure
SkySkimmer Sep 19, 2023
f0ca80b
Automatic change in elpi-builtin
SkySkimmer Sep 19, 2023
6f5614b
Merge pull request #504 from SkySkimmer/elpi-builtin
gares Sep 19, 2023
6b90934
Adapt to coq/coq#17836 (sort poly)
SkySkimmer Sep 19, 2023
040cd23
Adapt to Coq PR #18007: Proof_using.definition_using takes names of r…
herbelin Oct 8, 2023
f494235
Merge pull request #513 from herbelin/coq-master+adapt-coq-pr18007-ex…
ppedrot Oct 18, 2023
fdcce15
Adapt to coq/coq#18187 (reductionbehaviour is on constant not gref)
SkySkimmer Oct 23, 2023
7075a45
Merge pull request #526 from SkySkimmer/redbehaviour-pred
ppedrot Oct 26, 2023
9bb2338
Removing superfluous poly flag for try_add_new_coercion and declare_a…
herbelin Nov 3, 2023
fca6a37
Merge pull request #503 from SkySkimmer/sort-poly
SkySkimmer Nov 6, 2023
1a81969
Adapt w.r.t. coq/coq#17136.
ppedrot Nov 6, 2023
f0b4b9c
Merge pull request #534 from ppedrot/stream_error_to_gramlib
ppedrot Nov 9, 2023
bb9c54d
Adapt to coq/coq#18280 (case relevance outside case info)
SkySkimmer Nov 9, 2023
9ad9c44
Adapt w.r.t. coq/coq#18294.
ppedrot Nov 10, 2023
4b050c6
Merge pull request #542 from ppedrot/glob-evar-kinds
SkySkimmer Nov 13, 2023
f6bed81
Merge pull request #541 from SkySkimmer/ci-relevance
SkySkimmer Nov 13, 2023
4587e02
Merge pull request #500 from SkySkimmer/pattern-quotations
ppedrot Nov 15, 2023
71a82a5
Adapt w.r.t. coq/coq#18312.
ppedrot Nov 15, 2023
3c08a3c
This is to adapt to coq/coq#8190.
herbelin Oct 27, 2023
4a1a6d9
Merge pull request #547 from ppedrot/detuplify-impargs
SkySkimmer Nov 16, 2023
131853c
Adapt to coq/coq#18331 (mind_kelim -> mind_squashed)
SkySkimmer Nov 20, 2023
9e23b0f
Merge pull request #528 from herbelin/coq-master+adapt-coq-pr18190-wh…
SkySkimmer Nov 21, 2023
41c5fd3
Adapt w.r.t. coq/coq#18345.
ppedrot Nov 23, 2023
b8752c6
Merge pull request #533 from herbelin/coq-master+adapt-coq-pr18253-no…
ppedrot Nov 25, 2023
d85ca2d
Merge pull request #548 from SkySkimmer/sort-poly-ind
ppedrot Nov 29, 2023
b753aa4
Merge pull request #550 from ppedrot/harden-vernacextend-naming
SkySkimmer Dec 4, 2023
d17285e
Merge branch 'coq-master'
gares Dec 23, 2023
0ef2f9b
master on 8.19
gares Dec 23, 2023
b525f72
nix
gares Dec 23, 2023
e8f64e8
import classes from 8.19
gares Dec 23, 2023
feb3c84
nix
gares Dec 23, 2023
6f5bcd5
removing explicit test of master
CohenCyril Dec 23, 2023
35e2530
check no module in section at synterp time
gares Dec 24, 2023
fb1ecf0
update changelog
gares Dec 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
coq_version:
- '8.18'
- '8.19'
ocaml_version:
- '4.14-flambda'
steps:
Expand Down

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions .nix/config.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
format = "1.0.0";
attribute = "coq-elpi";
default-bundle = "coq-8.18";
default-bundle = "coq-8.19";
bundles = {

"coq-8.18".coqPackages = {
coq.override.version = "8.18";
"coq-8.19".coqPackages = {
coq.override.version = "8.19+rc1";

hierarchy-builder.override.version = "coq-elpi-2";
hierarchy-builder-shim.job = false;

coq-elpi.override.version = "master";
gares marked this conversation as resolved.
Show resolved Hide resolved

mathcomp.override.version = "master";
mathcomp.job = true;

Expand Down
2 changes: 1 addition & 1 deletion .nix/coq-nix-toolbox.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"68a4a68e689dca0d9c081a0f1b9a454379522d78"
"4e48948fa8252a2fc755182abdd4b199f4798724"
1 change: 1 addition & 0 deletions .nix/coq-overlays/coq-elpi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ with builtins; with lib; let
{ case = "8.16"; out = { version = "1.17.0"; };}
{ case = "8.17"; out = { version = "1.17.0"; };}
{ case = "8.18"; out = { version = "v1.18.1"; };}
{ case = "8.19"; out = { version = "v1.18.1"; };}
] {} );
in mkCoqDerivation {
pname = "elpi";
Expand Down
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [2.0.1] - 24/12/2023

Requires Elpi 1.18.1 and Coq 8.19.

This minor release adds compatibility with Coq 8.19.

## [2.0.0] - 23/12/2023

Requires Elpi 1.18.1 and Coq 8.18.
Expand Down
109 changes: 65 additions & 44 deletions apps/tc/src/coq_elpi_class_tactics_hacked.ml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ let e_give_exact flags h =
let sigma, c = Hints.fresh_hint env sigma h in
let (sigma, t1) = Typing.type_of (pf_env gl) sigma c in
Proofview.Unsafe.tclEVARS sigma <*>
Clenv.unify ~flags t1 <*> exact_no_check c
Clenv.unify ~flags ~cv_pb:CUMUL t1 <*> exact_no_check c
end

let unify_resolve ~with_evars flags h diff = match diff with
Expand Down Expand Up @@ -257,20 +257,18 @@ and e_my_find_search db_list local_db secvars hdc complete only_classes env sigm
let nprods = List.length prods in
let allowed_evars =
let all = Evarsolve.AllowedEvars.all in
try
match hdc with
| Some (hd,_) when only_classes ->
begin match Typeclasses.class_info hd with
| Some cl ->
if cl.cl_strict then
let undefined = lazy (Evarutil.undefined_evars_of_term sigma concl) in
let allowed evk = not (Evar.Set.mem evk (Lazy.force undefined)) in
Evarsolve.AllowedEvars.from_pred allowed
else all
| None -> all
end
| _ -> all
with e when CErrors.noncritical e -> all
match hdc with
| Some (hd,_) when only_classes ->
begin match Typeclasses.class_info hd with
| Some cl ->
if cl.cl_strict then
let undefined = lazy (Evarutil.undefined_evars_of_term sigma concl) in
let allowed evk = not (Evar.Set.mem evk (Lazy.force undefined)) in
Evarsolve.AllowedEvars.from_pred allowed
else all
| None -> all
end
| _ -> all
in
let tac_of_hint =
fun (flags, h) ->
Expand Down Expand Up @@ -414,16 +412,12 @@ let evars_to_goals p evm =
let make_resolve_hyp env sigma st only_classes decl db =
let id = NamedDecl.get_id decl in
let cty = Evarutil.nf_evar sigma (NamedDecl.get_type decl) in
let rec iscl env ty =
let iscl env ty =
let ctx, ar = decompose_prod_decls sigma ty in
match EConstr.kind sigma (fst (decompose_app sigma ar)) with
| Const (c,_) -> is_class (GlobRef.ConstRef c)
| Ind (i,_) -> is_class (GlobRef.IndRef i)
| _ ->
let env' = push_rel_context ctx env in
let ty' = Reductionops.whd_all env' sigma ar in
if not (EConstr.eq_constr sigma ty' ar) then iscl env' ty'
else false
| _ -> false
in
let is_class = iscl env cty in
let keep = not only_classes || is_class in
Expand Down Expand Up @@ -504,11 +498,18 @@ module Search = struct
| _, _ -> e

(** Determine if backtracking is needed for this goal.
If the type class is unique or in Prop
and there are no evars in the goal then we do
NOT backtrack. *)
let needs_backtrack env evd unique concl =
if unique || is_Prop env evd concl then
We generally backtrack except in the following (possibly
overlapping) cases:
- [unique_instances] is [true].
This is the case when the goal's class has [Unique Instances].
- [indep] is [true] and the current goal has no evars.
[indep] is generally [true] and only gets set to [false] if the
current goal's evar is mentioned in other goals.
([indep] is the negation of [search_dep].)
- The current goal is a [Prop] and has no evars. *)
let needs_backtrack env evd ~unique_instances ~indep concl =
if unique_instances then false else
if indep || is_Prop env evd concl then
occur_existential evd concl
else true

Expand All @@ -530,7 +531,15 @@ module Search = struct
else
tclUNIT ()

let _ = CErrors.register_handler begin function
let pr_internal_exception ie =
match fst ie with
| ReachedLimit -> str "Proof-search reached its limit."
| NoApplicableHint -> str "Proof-search failed."
| StuckGoal | NonStuckFailure -> str "Proof-search got stuck."
| e -> CErrors.iprint ie

(* XXX Is this handler needed for something? *)
let () = CErrors.register_handler begin function
| NonStuckFailure -> Some (str "NonStuckFailure")
| NoApplicableHint -> Some (str "NoApplicableHint")
| _ -> None
Expand Down Expand Up @@ -583,12 +592,12 @@ module Search = struct
in
cycle 1 (* Puts the first goal last *) <*>
fixpoint progress tacs ((glid, ev, status, tac) :: stuck) fk (* Launches the search on the rest of the goals *)
| Fail (e, info) ->
| Fail ie ->
let () = ppdebug 1 (fun () ->
str "Goal " ++ int glid ++ str" has no more solutions, returning exception: "
++ CErrors.iprint (e, info))
++ pr_internal_exception ie)
in
fk (e, info)
fk ie
| Next (res, fk') ->
let () = ppdebug 1 (fun () ->
str "Goal " ++ int glid ++ str" has a success, continuing resolution")
Expand Down Expand Up @@ -677,8 +686,9 @@ module Search = struct
let env = Goal.env gl in
let concl = Goal.concl gl in
let sigma = Goal.sigma gl in
let unique = not info.search_dep || is_unique env sigma concl in
let backtrack = needs_backtrack env sigma unique concl in
let unique_instances = is_unique env sigma concl in
let indep = not info.search_dep in
let backtrack = needs_backtrack env sigma ~unique_instances ~indep concl in
let () = ppdebug 0 (fun () ->
pr_depth info.search_depth ++ str": looking for " ++
Printer.pr_econstr_env (Goal.env gl) sigma concl ++
Expand All @@ -700,7 +710,11 @@ module Search = struct
let idx = ref 1 in
let foundone = ref false in
let rec onetac e (tac, pat, b, name, pp) tl =
let derivs = path_derivate info.search_cut name in
let path = match name with
| None -> PathAny
| Some gr -> PathHints [gr]
in
let derivs = path_derivate info.search_cut path in
let pr_error ie =
ppdebug 1 (fun () ->
let idx = if fst ie == NoApplicableHint then pred !idx else !idx in
Expand All @@ -711,14 +725,7 @@ module Search = struct
str" on" ++ spc () ++ pr_ev sigma (Proofview.Goal.goal gl)
else mt ())
in
let msg =
match fst ie with
| ReachedLimit -> str "Proof-search reached its limit."
| NoApplicableHint -> str "Proof-search failed."
| StuckGoal | NonStuckFailure -> str "Proof-search got stuck."
| e -> CErrors.iprint ie
in
(header ++ str " failed with: " ++ msg))
(header ++ str " failed with: " ++ pr_internal_exception ie))
in
let tac_of gls i j = Goal.enter begin fun gl' ->
let sigma' = Goal.sigma gl' in
Expand Down Expand Up @@ -1029,7 +1036,7 @@ module Search = struct
in
let nongoals' =
Evar.Set.fold (fun ev acc -> match Evarutil.advance evm' ev with
| Some ev' -> Evar.Set.add ev acc
| Some ev -> Evar.Set.add ev acc
| None -> acc) (Evar.Set.union goals nongoals) (Evd.get_typeclass_evars evm')
in
(* FIXME: the need to merge metas seems to come from this being called
Expand All @@ -1053,11 +1060,13 @@ module Search = struct
~depth ~dep:(unique || dep) hints in
run_on_evars env evd p eauto_tac

let typeclasses_eauto env evd ?depth unique ~best_effort st hints p =
evars_eauto env evd depth true ~best_effort unique false st hints p
(** Typeclasses eauto is an eauto which tries to resolve only
goals of typeclass type, and assumes that the initially selected
evars in evd are independent of the rest of the evars *)
let typeclasses_eauto env evd ?depth unique ~best_effort st hints p =
NewProfile.profile "typeclass search" (fun () ->
evars_eauto env evd depth true ~best_effort unique false st hints p)
()

let typeclasses_resolve env evd depth unique ~best_effort p =
let db = searchtable_map typeclasses_db in
Expand Down Expand Up @@ -1317,3 +1326,15 @@ let autoapply c i =
let sigma = Typeclasses.make_unresolvables
(fun ev -> Typeclasses.all_goals ev (Lazy.from_val (snd (Evd.evar_source (Evd.find_undefined sigma ev))))) sigma in
Proofview.Unsafe.tclEVARS sigma) end

let resolve_tc c =
let open Proofview.Notations in
Proofview.tclENV >>= fun env ->
Proofview.tclEVARMAP >>= fun sigma ->
let depth = get_typeclasses_depth () in
let unique = get_typeclasses_unique_solutions () in
let evars = Evarutil.undefined_evars_of_term sigma c in
let filter = (fun ev _ -> Evar.Set.mem ev evars) in
let fail = true in
let sigma = resolve_all_evars depth unique env (initial_select_evars filter) sigma fail in
Proofview.Unsafe.tclEVARS sigma
2 changes: 1 addition & 1 deletion coq-builtin.elpi
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ external pred coq.univ.variable.of-term i:term, o:coq.univ.variable.set.
% crafts a fresh, appropriate, universe instance and possibly unify that
% term (of the instance it contains) with another one.

% Universes level instance for a universe-polymoprhic constant
% Universes level instance for a universe-polymorphic constant
typeabbrev univ-instance (ctype "univ-instance").


Expand Down
2 changes: 1 addition & 1 deletion coq-elpi.opam
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ depends: [
"ocaml" {>= "4.09.0" }
"stdlib-shims"
"elpi" {>= "1.18.1" & < "1.19.0~"}
"coq" {>= "8.18" & < "8.19~" }
"coq" {>= "8.19" & < "8.20~" }
"dot-merlin-reader" {with-dev}
"ocaml-lsp-server" {with-dev}
]
Expand Down
Loading
Loading