Debian Codegraph @

test-suite/success/Scopes.v

raw
1 (* Check exportation of Argument Scopes even without import of modules *)
2
3 Declare Scope Z_scope.
4 Module Z.
5 Definition Z := unit.
6 Definition opp (x : Z) := x.
7 End Z.
8 Bind Scope Z_scope with Z.Z.
9 Notation "3" := tt : Z_scope.
10
11 Module A.
12 Definition opp := Z.opp.
13 End A.
14 Check (A.opp 3).
15
16 (* Test extra scopes to be used in the presence of coercions *)
17
18 Record B := { f :> Z.Z -> Z.Z }.
19 Parameter a:B.
20 Arguments a _%_Z_scope : extra scopes.
21 Check a 3.
22
23 (* Check that casts activate scopes if ever possible *)
24
25 Inductive U := A.
26 Bind Scope u with U.
27 Notation "'ε'" := A : u.
28 Definition c := ε : U.
29
30 (* Check activation of type scope for tactics such as assert *)
31
32 Goal True.
33 assert (nat * nat).
34 Abort.
35
36 (* Check propagation of scopes in indirect applications to references *)
37
38 Module PropagateIndirect.
39 Notation "0" := true : bool_scope.
40
41 Axiom f : bool -> bool -> nat.
42 Check (@f 0) 0.
43
44 Record R := { p : bool -> nat }.
45 Check fun r => r.(@p) 0.
46 End PropagateIndirect.
47
48 Module ScopeProjNotation.
49
50 Declare Scope foo_scope.
51 Delimit Scope foo_scope with foo.
52 Record prod A B := pair { fst : A ; snd : B }.
53 Notation "[[ t , u ]]" := (pair _ _ t u) : foo_scope.
54 Arguments fst {A B} p%_foo.
55 Check [[2,3]].(fst).
56
57 End ScopeProjNotation.