aboutsummaryrefslogtreecommitdiffhomepage
path: root/test-suite/failure/positivity.v
blob: b21204b9e4e895798609986356f9a0ddd37496d2 (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
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(* 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.