aboutsummaryrefslogtreecommitdiffhomepage
path: root/test-suite/failure/positivity.v
blob: 2798dcf974f36b7b0f9ab763d5fc563923c920c1 (plain)
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
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)

(* Negative occurrence *)
Fail Inductive t : Type :=
  c : (t -> nat) -> t.

(* Non-strictely positive occurrence *)
Fail Inductive t : Type :=
  c : ((t -> nat) -> nat) -> t.

(* Self-nested type (no proof of
   soundness yet *)
Fail Inductive t (A:Type) : Type :=
  c : t (t A) -> t A.

(* Nested inductive types *)

Inductive pos (A:Type) :=
  p : pos A -> pos A.

Inductive nnpos (A:Type) :=
  nnp : ((A -> nat) -> nat) -> nnpos A.

Inductive neg (A:Type) :=
  n : (A->neg A) -> neg A.

Inductive arg : Type -> Prop :=
  a : forall A, arg A -> arg A.

(* Strictly covariant parameter: accepted. *)
Fail Fail Inductive t :=
  c : pos t -> t.

(* Non-strictly covariant parameter: not
   strictly positive. *)
Fail Inductive t :=
  c : nnpos t -> t.

(* Contravariant parameter: not positive. *)
Fail Inductive t :=
  c : neg t -> t.

(* Strict index: not positive. *)
Fail Inductive t :=
  c : arg t -> t.