File: section_poly.v

package info (click to toggle)
coq 8.20.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 44,116 kB
  • sloc: ml: 234,160; sh: 4,301; python: 3,270; ansic: 2,644; makefile: 882; lisp: 172; javascript: 63; xml: 24; sed: 2
file content (74 lines) | stat: -rw-r--r-- 1,402 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74


Section Foo.

  Variable X : Type.

  Polymorphic Section Bar.

  Variable A : Type.

  Definition id (a:A) := a.

End Bar.
Check id@{_}.
End Foo.
Check id@{_}.

Polymorphic Section Foo.
Variable A : Type.
Section Bar.
  Variable B : Type.

  Inductive prod := Prod : A -> B -> prod.
End Bar.
Check prod@{_}.
End Foo.
Check prod@{_ _}.

Section Foo.

  Universe K.
  Inductive bla := Bla : Type@{K} -> bla.

  Polymorphic Definition bli@{j} := Type@{j} -> bla.

  Definition bloo := bli@{_}.

  Polymorphic Universe i.

  Fail Definition x := Type.
  Fail Inductive x : Type := .
  Polymorphic Definition x := Type.
  Polymorphic Inductive y : x := .

  Variable A : Type. (* adds a mono univ for the Type, which is unrelated to the others *)

  Fail Variable B : (y : Type@{i}).
  (* not allowed: mono constraint (about a fresh univ for y) regarding
  poly univ i *)

  Polymorphic Variable B : Type. (* new polymorphic stuff always OK *)

  Variable C : Type@{i}. (* no new univs so no problems *)

  Polymorphic Definition thing := bloo -> y -> A -> B.

End Foo.
Check bli@{_}.
Check bloo@{}.

Check thing@{_ _ _}.

Section Foo.

  Polymorphic Universes i k.
  Universe j.
  Fail Constraint i < j.
  Fail Constraint i < k.

  (* referring to mono univs in poly constraints is OK. *)
  Polymorphic Constraint i < j. Polymorphic Constraint j < k.

  Polymorphic Definition foo := Type@{j}.
End Foo.