From 3fa2430e8c66408fa3a8fe95af54e53d20e5951b Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Tue, 10 Nov 2020 15:57:02 +0100 Subject: Add support for Proof using in -noinit mode. "Proof with" is Ltac-specific but there is no reason why it should be the same for "Proof using". --- plugins/ltac/g_ltac.mlg | 4 ++-- vernac/g_proofs.mlg | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/ltac/g_ltac.mlg b/plugins/ltac/g_ltac.mlg index c54f8ffa78..bd46e24a1c 100644 --- a/plugins/ltac/g_ltac.mlg +++ b/plugins/ltac/g_ltac.mlg @@ -332,8 +332,8 @@ GRAMMAR EXTEND Gram l = OPT [ "using"; l = G_vernac.section_subset_expr -> { l } ] -> { Vernacexpr.VernacProof (Some (in_tac ta), l) } | IDENT "Proof"; "using"; l = G_vernac.section_subset_expr; - ta = OPT [ "with"; ta = Pltac.tactic -> { in_tac ta } ] -> - { Vernacexpr.VernacProof (ta,Some l) } ] ] + "with"; ta = Pltac.tactic -> + { Vernacexpr.VernacProof (Some (in_tac ta),Some l) } ] ] ; hint: [ [ IDENT "Extern"; n = natural; c = OPT Constr.constr_pattern ; "=>"; diff --git a/vernac/g_proofs.mlg b/vernac/g_proofs.mlg index ebec720ce2..60ff9896bf 100644 --- a/vernac/g_proofs.mlg +++ b/vernac/g_proofs.mlg @@ -56,6 +56,8 @@ GRAMMAR EXTEND Gram [ [ IDENT "Goal"; c = lconstr -> { VernacDefinition (Decls.(NoDischarge, Definition), ((CAst.make ~loc Names.Anonymous), None), ProveBody ([], c)) } | IDENT "Proof" -> { VernacProof (None,None) } + | IDENT "Proof"; "using"; l = G_vernac.section_subset_expr -> + { VernacProof (None,Some l) } | IDENT "Proof" ; IDENT "Mode" ; mn = string -> { VernacProofMode mn } | IDENT "Proof"; c = lconstr -> { VernacExactProof c } | IDENT "Abort" -> { VernacAbort None } -- cgit v1.2.3 From 1117058b39603bb42591961f4b13faa6c58c6ee2 Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Tue, 10 Nov 2020 16:02:56 +0100 Subject: Revert to "using" not being a keyword in -noinit mode. The IDENT annotations in g_ltac.mlg are required to not break the parser. --- plugins/ltac/g_ltac.mlg | 4 ++-- vernac/g_proofs.mlg | 2 +- vernac/g_vernac.mlg | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/ltac/g_ltac.mlg b/plugins/ltac/g_ltac.mlg index bd46e24a1c..c2e95c45f9 100644 --- a/plugins/ltac/g_ltac.mlg +++ b/plugins/ltac/g_ltac.mlg @@ -329,9 +329,9 @@ GRAMMAR EXTEND Gram ; command: [ [ IDENT "Proof"; "with"; ta = Pltac.tactic; - l = OPT [ "using"; l = G_vernac.section_subset_expr -> { l } ] -> + l = OPT [ IDENT "using"; l = G_vernac.section_subset_expr -> { l } ] -> { Vernacexpr.VernacProof (Some (in_tac ta), l) } - | IDENT "Proof"; "using"; l = G_vernac.section_subset_expr; + | IDENT "Proof"; IDENT "using"; l = G_vernac.section_subset_expr; "with"; ta = Pltac.tactic -> { Vernacexpr.VernacProof (Some (in_tac ta),Some l) } ] ] ; diff --git a/vernac/g_proofs.mlg b/vernac/g_proofs.mlg index 60ff9896bf..5b80ed6794 100644 --- a/vernac/g_proofs.mlg +++ b/vernac/g_proofs.mlg @@ -56,7 +56,7 @@ GRAMMAR EXTEND Gram [ [ IDENT "Goal"; c = lconstr -> { VernacDefinition (Decls.(NoDischarge, Definition), ((CAst.make ~loc Names.Anonymous), None), ProveBody ([], c)) } | IDENT "Proof" -> { VernacProof (None,None) } - | IDENT "Proof"; "using"; l = G_vernac.section_subset_expr -> + | IDENT "Proof"; IDENT "using"; l = G_vernac.section_subset_expr -> { VernacProof (None,Some l) } | IDENT "Proof" ; IDENT "Mode" ; mn = string -> { VernacProofMode mn } | IDENT "Proof"; c = lconstr -> { VernacExactProof c } diff --git a/vernac/g_vernac.mlg b/vernac/g_vernac.mlg index f192d67624..1c80d71ea5 100644 --- a/vernac/g_vernac.mlg +++ b/vernac/g_vernac.mlg @@ -114,7 +114,8 @@ GRAMMAR EXTEND Gram ; attribute: [ [ k = ident ; v = attr_value -> { Names.Id.to_string k, v } - | "using" ; v = attr_value -> { "using", v } ] + (* Required because "ident" is declared a keyword when loading Ltac. *) + | IDENT "using" ; v = attr_value -> { "using", v } ] ] ; attr_value: -- cgit v1.2.3 From 403a9057b41ed3a8d069175a5834a88442e47f66 Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Thu, 12 Nov 2020 11:46:24 +0100 Subject: Test case for Proof using in -noinit mode. --- test-suite/success/proof_using_noinit.v | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test-suite/success/proof_using_noinit.v diff --git a/test-suite/success/proof_using_noinit.v b/test-suite/success/proof_using_noinit.v new file mode 100644 index 0000000000..f99b49619c --- /dev/null +++ b/test-suite/success/proof_using_noinit.v @@ -0,0 +1,9 @@ +(* -*- coq-prog-args: ("-noinit"); -*- *) + +Section A. +Variable A : Prop. +Hypothesis a : A. +Lemma b : A. +Proof using a. +Admitted. +End A. -- cgit v1.2.3 From 8ed2d808b2c9caf022b5e22bb43f2ca6876ebd1b Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Thu, 12 Nov 2020 11:49:36 +0100 Subject: Add changelog entry for Proof using in -noinit mode. --- doc/changelog/07-commands-and-options/13339-proof-using-noinit.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 doc/changelog/07-commands-and-options/13339-proof-using-noinit.rst diff --git a/doc/changelog/07-commands-and-options/13339-proof-using-noinit.rst b/doc/changelog/07-commands-and-options/13339-proof-using-noinit.rst new file mode 100644 index 0000000000..9ae759be56 --- /dev/null +++ b/doc/changelog/07-commands-and-options/13339-proof-using-noinit.rst @@ -0,0 +1,5 @@ +- **Added:** + The :cmd:`Proof using` command can now be used without loading the + Ltac plugin (`-noinit` mode) + (`#13339 `_, + by Théo Zimmermann). -- cgit v1.2.3