Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f77743c
[declare] Stronger typing for start_proof
ejgallego May 25, 2020
43d381a
[declare] Move proof information to declare.
ejgallego May 25, 2020
2ac5353
[declare] Remove mutual internals from Info.t structure.
ejgallego May 25, 2020
671004a
[declare] Remove Lemmas module
ejgallego May 25, 2020
1f121eb
[declare] Refactor constant information into a record.
ejgallego May 15, 2020
7d183d8
[declare] Make ProgramDecl.t abstract
ejgallego May 19, 2020
d83e95c
[declare] [api] Removal of deprecated functions
ejgallego May 19, 2020
a6d663c
[declare] [api] Removal of duplicated type aliases.
ejgallego May 25, 2020
b143d12
[declare] Move udecl to Info structure.
ejgallego May 25, 2020
030bb57
[declare] Reify Proof.t API into the Proof module.
ejgallego May 25, 2020
c09871d
[declare] [api] Modify logical presentation of declare interfaces
ejgallego May 25, 2020
6291e5b
[declare] [compat] Remove exception alias.
ejgallego May 25, 2020
9c58cd6
[declare] Documentation on obligations
ejgallego May 29, 2020
ba8db3c
[declare] Nit on interface
ejgallego Jun 3, 2020
22bb101
[declare] Nit on hook call.
ejgallego Jun 9, 2020
c7a62d0
[declare] Refactor analysis and construction of mutual lemmas
ejgallego Jun 18, 2020
e622379
[declare] Use Recthm.t in mutual analysis functions
ejgallego Jun 18, 2020
f72efb3
[declare] Nit on regular lemma init.
ejgallego Jun 18, 2020
862e5a0
[vernac] Nit refatoring on lemma command interpretation
ejgallego Jun 18, 2020
ea8b9e0
[declare] Improve organization of proof/constant information.
ejgallego Jun 22, 2020
bf31fad
[declare] Improve logical code order
ejgallego Jun 23, 2020
06159c5
[obligation] Switch to new declare info API.
ejgallego Jun 23, 2020
4a2c865
[declare] Merge remaining obligations bits into Declare
ejgallego Jun 23, 2020
d9dca86
[declare] Remove Proof_ending from the public API
ejgallego Jun 23, 2020
4ad9fa2
[declare] Some more cleanup on unused functions after the last commits.
ejgallego Jun 23, 2020
a5a65dd
[declare] Return list of declared global in Proof.save
ejgallego Jun 24, 2020
eb950df
[recLemmas] Nit on naming consistency.
ejgallego Jun 24, 2020
c62aa0e
[ci] Add overlays for PR #12372
ejgallego Jun 24, 2020
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: 0 additions & 2 deletions dev/base_include
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ open Search
open Evar_refiner
open Goal
open Logic
open Pfedit
open Proof
open Proof_using
open Proof_global
open Redexpr
open Refiner
open Tacmach
Expand Down
24 changes: 24 additions & 0 deletions dev/ci/user-overlays/12372-ejgallego-proof+info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
if [ "$CI_PULL_REQUEST" = "12372" ] || [ "$CI_BRANCH" = "proof+info" ]; then

rewriter_CI_REF=proof+info
rewriter_CI_GITURL=https://github.com/ejgallego/rewriter

paramcoq_CI_REF=proof+info
paramcoq_CI_GITURL=https://github.com/ejgallego/paramcoq

mtac2_CI_REF=proof+info
mtac2_CI_GITURL=https://github.com/ejgallego/Mtac2

equations_CI_REF=proof+info
equations_CI_GITURL=https://github.com/ejgallego/Coq-Equations

elpi_CI_REF=proof+info
elpi_CI_GITURL=https://github.com/ejgallego/coq-elpi

aac_tactics_CI_REF=proof+info
aac_tactics_CI_GITURL=https://github.com/ejgallego/aac-tactics

metacoq_CI_REF=proof+info
metacoq_CI_GITURL=https://github.com/ejgallego/metacoq

fi
4 changes: 2 additions & 2 deletions doc/plugin_tutorial/tuto1/src/g_tuto1.mlg
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ END
VERNAC COMMAND EXTEND ExploreProof CLASSIFIED AS QUERY
| ![ proof_query ] [ "ExploreProof" ] ->
{ fun ~pstate ->
let sigma, env = Declare.get_current_context pstate in
let pprf = Proof.partial_proof (Declare.Proof.get_proof pstate) in
let sigma, env = Declare.Proof.get_current_context pstate in
let pprf = Proof.partial_proof (Declare.Proof.get pstate) in
Feedback.msg_notice
(Pp.prlist_with_sep Pp.fnl (Printer.pr_econstr_env env sigma) pprf)
}
Expand Down
7 changes: 4 additions & 3 deletions doc/plugin_tutorial/tuto1/src/simple_declare.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
let declare_definition ~poly name sigma body =
let udecl = UState.default_univ_decl in
let scope = Declare.Global Declare.ImportDefaultBehavior in
let scope = Locality.Global Locality.ImportDefaultBehavior in
let kind = Decls.(IsDefinition Definition) in
Declare.declare_definition ~name ~scope ~kind ~impargs:[] ~udecl
~opaque:false ~poly ~types:None ~body sigma
let cinfo = Declare.CInfo.make ~name ~typ:None () in
let info = Declare.Info.make ~scope ~kind ~udecl ~poly () in
Declare.declare_definition ~info ~cinfo ~opaque:false ~body sigma
2 changes: 1 addition & 1 deletion ide/coqide/idetop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ let search flags =
let pstate = Vernacstate.Declare.get_pstate () in
let sigma, env = match pstate with
| None -> let env = Global.env () in Evd.(from_env env, env)
| Some p -> Declare.get_goal_context p 1 in
| Some p -> Declare.Proof.get_goal_context p 1 in
List.map export_coq_object (Search.interface_search env sigma (
List.map (fun (c, b) -> (import_search_constraint c, b)) flags)
)
Expand Down
11 changes: 5 additions & 6 deletions plugins/derive/derive.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ open Context.Named.Declaration
(which can contain references to [f]) in the context extended by
[f:=?x]. When the proof ends, [f] is defined as the value of [?x]
and [lemma] as the proof. *)
let start_deriving f suchthat name : Lemmas.t =
let start_deriving f suchthat name : Declare.Proof.t =

let env = Global.env () in
let sigma = Evd.from_env env in
Expand All @@ -40,8 +40,7 @@ let start_deriving f suchthat name : Lemmas.t =
TNil sigma))))))
in

let info = Lemmas.Info.make ~proof_ending:(Declare.Proof_ending.(End_derive {f; name})) ~kind () in
let lemma = Lemmas.start_dependent_lemma ~name ~poly ~info goals in
Lemmas.pf_map (Declare.Proof.map_proof begin fun p ->
Util.pi1 @@ Proof.run_tactic env Proofview.(tclFOCUS 1 2 shelve) p
end) lemma
let info = Declare.Info.make ~poly ~kind () in
let lemma = Declare.Proof.start_derive ~name ~f ~info goals in
Declare.Proof.map lemma ~f:(fun p ->
Util.pi1 @@ Proof.run_tactic env Proofview.(tclFOCUS 1 2 shelve) p)
2 changes: 1 addition & 1 deletion plugins/derive/derive.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ val start_deriving
: Names.Id.t
-> Constrexpr.constr_expr
-> Names.Id.t
-> Lemmas.t
-> Declare.Proof.t
6 changes: 3 additions & 3 deletions plugins/extraction/extract_env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,13 @@ let extract_and_compile l =
(* Show the extraction of the current ongoing proof *)
let show_extraction ~pstate =
init ~inner:true false false;
let prf = Declare.Proof.get_proof pstate in
let sigma, env = Declare.get_current_context pstate in
let prf = Declare.Proof.get pstate in
let sigma, env = Declare.Proof.get_current_context pstate in
let trms = Proof.partial_proof prf in
let extr_term t =
let ast, ty = extract_constr env sigma t in
let mp = Lib.current_mp () in
let l = Label.of_id (Declare.Proof.get_proof_name pstate) in
let l = Label.of_id (Declare.Proof.get_name pstate) in
let fake_ref = GlobRef.ConstRef (Constant.make2 mp l) in
let decl = Dterm (fake_ref, ast, ty) in
print_one_decl [] mp decl
Expand Down
14 changes: 9 additions & 5 deletions plugins/funind/functional_principles_proofs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -853,12 +853,16 @@ let generate_equation_lemma evd fnames f fun_num nb_params nb_args rec_args_num

(*i The next call to mk_equation_id is valid since we are
constructing the lemma Ensures by: obvious i*)
let lemma =
Lemmas.start_lemma ~name:(mk_equation_id f_id) ~poly:false evd lemma_type
let info = Declare.Info.make () in
let cinfo =
Declare.CInfo.make ~name:(mk_equation_id f_id) ~typ:lemma_type ()
in
let lemma = Declare.Proof.start ~cinfo ~info evd in
let lemma, _ =
Declare.Proof.by (Proofview.V82.tactic prove_replacement) lemma
in
let lemma, _ = Lemmas.by (Proofview.V82.tactic prove_replacement) lemma in
let () =
Lemmas.save_lemma_proved ~lemma ~opaque:Declare.Transparent ~idopt:None
let (_ : _ list) =
Declare.Proof.save ~proof:lemma ~opaque:Vernacexpr.Transparent ~idopt:None
in
evd

Expand Down
43 changes: 23 additions & 20 deletions plugins/funind/gen_principle.ml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ let generate_functional_principle (evd : Evd.evar_map ref) old_princ_type sorts
let entry = Declare.definition_entry ~univs ?types body in
let (_ : Names.GlobRef.t) =
Declare.declare_entry ~name:new_princ_name ~hook
~scope:(Declare.Global Declare.ImportDefaultBehavior)
~scope:(Locality.Global Locality.ImportDefaultBehavior)
~kind:Decls.(IsProof Theorem)
~impargs:[] ~uctx entry
in
Expand Down Expand Up @@ -400,7 +400,7 @@ let register_struct is_rec fixpoint_exprl =
Pp.(str "Body of Function must be given")
in
ComDefinition.do_definition ~name:fname.CAst.v ~poly:false
~scope:(Declare.Global Declare.ImportDefaultBehavior)
~scope:(Locality.Global Locality.ImportDefaultBehavior)
~kind:Decls.Definition univs binders None body (Some rtype);
let evd, rev_pconstants =
List.fold_left
Expand All @@ -419,7 +419,7 @@ let register_struct is_rec fixpoint_exprl =
(None, evd, List.rev rev_pconstants)
| _ ->
ComFixpoint.do_fixpoint
~scope:(Declare.Global Declare.ImportDefaultBehavior) ~poly:false
~scope:(Locality.Global Locality.ImportDefaultBehavior) ~poly:false
fixpoint_exprl;
let evd, rev_pconstants =
List.fold_left
Expand Down Expand Up @@ -1370,12 +1370,12 @@ let make_scheme evd (fas : (Constr.pconstant * Sorts.family) list) : _ list =
| None -> raise Not_found
| Some finfos -> finfos
in
let open Declare in
match finfos.equation_lemma with
| None -> Transparent (* non recursive definition *)
| None -> Vernacexpr.Transparent (* non recursive definition *)
| Some equation ->
if Declareops.is_opaque (Global.lookup_constant equation) then Opaque
else Transparent
if Declareops.is_opaque (Global.lookup_constant equation) then
Vernacexpr.Opaque
else Vernacexpr.Transparent
in
let body, typ, univs, _hook, sigma0 =
try
Expand Down Expand Up @@ -1518,12 +1518,14 @@ let derive_correctness (funs : Constr.pconstant list) (graphs : inductive list)
i*)
let lem_id = mk_correct_id f_id in
let typ, _ = lemmas_types_infos.(i) in
let lemma = Lemmas.start_lemma ~name:lem_id ~poly:false !evd typ in
let info = Declare.Info.make () in
let cinfo = Declare.CInfo.make ~name:lem_id ~typ () in
let lemma = Declare.Proof.start ~cinfo ~info !evd in
let lemma =
fst @@ Lemmas.by (Proofview.V82.tactic (proving_tac i)) lemma
fst @@ Declare.Proof.by (Proofview.V82.tactic (proving_tac i)) lemma
in
let () =
Lemmas.save_lemma_proved ~lemma ~opaque:Declare.Transparent
let (_ : GlobRef.t list) =
Comment thread
ejgallego marked this conversation as resolved.
Declare.Proof.save ~proof:lemma ~opaque:Vernacexpr.Transparent
~idopt:None
in
let finfo =
Expand Down Expand Up @@ -1580,21 +1582,22 @@ let derive_correctness (funs : Constr.pconstant list) (graphs : inductive list)
Ensures by: obvious
i*)
let lem_id = mk_complete_id f_id in
let lemma =
Lemmas.start_lemma ~name:lem_id ~poly:false sigma
(fst lemmas_types_infos.(i))
let info = Declare.Info.make () in
let cinfo =
Declare.CInfo.make ~name:lem_id ~typ:(fst lemmas_types_infos.(i)) ()
in
let lemma = Declare.Proof.start ~cinfo sigma ~info in
let lemma =
fst
(Lemmas.by
(Declare.Proof.by
(Proofview.V82.tactic
(observe_tac
("prove completeness (" ^ Id.to_string f_id ^ ")")
(proving_tac i)))
lemma)
in
let () =
Lemmas.save_lemma_proved ~lemma ~opaque:Declare.Transparent
let (_ : _ list) =
Declare.Proof.save ~proof:lemma ~opaque:Vernacexpr.Transparent
~idopt:None
in
let finfo =
Expand Down Expand Up @@ -1769,7 +1772,7 @@ let register_mes interactive_proof fname rec_impls wf_mes_expr wf_rel_expr_opt
using_lemmas args ret_type body

let do_generate_principle_aux pconstants on_error register_built
interactive_proof fixpoint_exprl : Lemmas.t option =
interactive_proof fixpoint_exprl : Declare.Proof.t option =
List.iter
(fun {Vernacexpr.notations} ->
if not (List.is_empty notations) then
Expand Down Expand Up @@ -2155,7 +2158,7 @@ let make_graph (f_ref : GlobRef.t) =

(* *************** statically typed entrypoints ************************* *)

let do_generate_principle_interactive fixl : Lemmas.t =
let do_generate_principle_interactive fixl : Declare.Proof.t =
match do_generate_principle_aux [] warning_error true true fixl with
| Some lemma -> lemma
| None ->
Expand Down Expand Up @@ -2199,7 +2202,7 @@ let build_scheme fas =
List.iter2
(fun (princ_id, _, _) (body, types, univs, opaque) ->
let (_ : Constant.t) =
let opaque = if opaque = Declare.Opaque then true else false in
let opaque = if opaque = Vernacexpr.Opaque then true else false in
let def_entry = Declare.definition_entry ~univs ~opaque ?types body in
Declare.declare_constant ~name:princ_id
~kind:Decls.(IsProof Theorem)
Expand Down
2 changes: 1 addition & 1 deletion plugins/funind/gen_principle.mli
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ val warn_cannot_define_graph : ?loc:Loc.t -> Pp.t * Pp.t -> unit
val warn_cannot_define_principle : ?loc:Loc.t -> Pp.t * Pp.t -> unit

val do_generate_principle_interactive :
Vernacexpr.fixpoint_expr list -> Lemmas.t
Vernacexpr.fixpoint_expr list -> Declare.Proof.t

val do_generate_principle : Vernacexpr.fixpoint_expr list -> unit
val make_graph : Names.GlobRef.t -> unit
Expand Down
Loading