Debian Codegraph @

test-suite/success/locality_attributes_sections_ltac2.v

raw
1 (** This file tests how locality attributes affect usual vernacular commands.
2 PLEASE, when this file fails to compute following a voluntary change in
3 Coq's behaviour, modify accordingly the tables in [sections.rst] and
4 [modules.rst] in [doc/sphinx/language/core].
5
6 Also look at the corresponding discussions about locality attributes in the
7 refman (directory doc/sphinx)
8 - For Definition, Lemma, ..., look at language/core/definitions.rst
9 - For Axiom, Conjecture, ..., look at language/core/assumptions.rst
10 - For abbreviations, look at user-extensions/syntax-extensions.rst
11 - For Notations, look at user-extensions/syntax-extensions.rst
12 - For Tactic Notations, look at user-extensions/syntax-extensions.rst
13 - For Ltac, look at proof-engine/ltac.rst
14 - For Canonical Structures, look at language/extensions/canonical.rst
15 - For Hints, look at proofs/automatic-tactics/auto.rst
16 - For Coercions, look at addendum/implicit-coercions.rst
17 - For Ltac2, look at proof-engine/ltac2.rst
18 - For Ltac2 Notations, look at proof-engine/ltac2.rst
19 - For Set, look at language/core/basic.rst
20 *)
21
22
23 From Ltac2 Require Import Ltac2.
24
25 (** ** Tests for sections and visibility attributes with Ltac2 *)
26
27 (* A parameter: *)
28 Parameter (secret : nat).
29 (* An axiom: *)
30 Axiom secret_is_42 : secret = 42.
31
32 (** *** Without attribute (default) *)
33
34 Module InSectionDefault.
35
36 Section Bar.
37 (* A custom tactic: *)
38 Ltac2 find_secret () := rewrite secret_is_42.
39 Ltac2 Notation "rfl" := reflexivity.
40 End Bar.
41
42 (* Availability of the tactic *)
43 Fail Print find_secret.
44 (* Availability of the tactic notation *)
45 Lemma plop_ni : 2 + 2 = 4.
46 Proof. Fail rfl. Admitted.
47
48 End InSectionDefault.
49
50 Module InSectionLocal.
51 Section Bar.
52 #[local]
53 Ltac2 find_secret () := rewrite secret_is_42.
54 #[local]
55 Ltac2 Notation "rfl" := reflexivity.
56 End Bar.
57
58 (* Availability of the tactic *)
59 Fail Print find_secret.
60 Fail Print Bar.find_secret.
61 (* Availability of the tactic notation *)
62 Lemma plop_ni : 2 + 2 = 4.
63 Proof. Fail rfl. Admitted.
64 End InSectionLocal.
65
66 Module InSectionExport.
67 Section Bar.
68 (* A custom tactic: *)
69 Fail #[export]
70 Ltac2 find_secret := reflexivity.
71 (* A tactic notation: *)
72 Fail #[export]
73 Ltac2 Notation "rfl" := reflexivity.
74 End Bar.
75
76 (** Nothing to check, Ltac2 and Ltac2 Notation do not support the [export]
77 attribute. *)
78
79 End InSectionExport.
80
81 Module InSectionGlobal.
82 Section Bar.
83 (* A custom tactic: *)
84 #[global]
85 Ltac2 find_secret () := rewrite secret_is_42.
86 (* A tactic notation: *)
87 #[global]
88 Ltac2 Notation "rfl" := reflexivity.
89 End Bar.
90
91 (* Availability of the tactic *)
92 Fail Print find_secret.
93 (* Availability of the tactic notation *)
94 Lemma plop_ni : 2 + 2 = 4.
95 Proof. Fail rfl. Admitted.
96 End InSectionGlobal.