~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to checker/type_errors.ml

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(************************************************************************)
 
2
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
 
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
 
4
(*   \VV/  **************************************************************)
 
5
(*    //   *      This file is distributed under the terms of the       *)
 
6
(*         *       GNU Lesser General Public License Version 2.1        *)
 
7
(************************************************************************)
 
8
 
 
9
(* $Id: type_errors.ml 8845 2006-05-23 07:41:58Z herbelin $ *)
 
10
 
 
11
open Names
 
12
open Term
 
13
open Environ
 
14
 
 
15
type unsafe_judgment = constr * constr
 
16
 
 
17
let nf_betaiota c = c
 
18
 
 
19
(* Type errors. *)
 
20
 
 
21
type guard_error =
 
22
  (* Fixpoints *)
 
23
  | NotEnoughAbstractionInFixBody
 
24
  | RecursionNotOnInductiveType of constr
 
25
  | RecursionOnIllegalTerm of int * constr * int list * int list
 
26
  | NotEnoughArgumentsForFixCall of int
 
27
  (* CoFixpoints *)
 
28
  | CodomainNotInductiveType of constr
 
29
  | NestedRecursiveOccurrences
 
30
  | UnguardedRecursiveCall of constr
 
31
  | RecCallInTypeOfAbstraction of constr
 
32
  | RecCallInNonRecArgOfConstructor of constr
 
33
  | RecCallInTypeOfDef of constr
 
34
  | RecCallInCaseFun of constr
 
35
  | RecCallInCaseArg of constr
 
36
  | RecCallInCasePred of constr
 
37
  | NotGuardedForm of constr
 
38
 
 
39
type arity_error =
 
40
  | NonInformativeToInformative
 
41
  | StrongEliminationOnNonSmallType
 
42
  | WrongArity
 
43
 
 
44
type type_error =
 
45
  | UnboundRel of int
 
46
  | UnboundVar of variable
 
47
  | NotAType of unsafe_judgment
 
48
  | BadAssumption of unsafe_judgment
 
49
  | ReferenceVariables of constr
 
50
  | ElimArity of inductive * sorts_family list * constr * unsafe_judgment
 
51
      * (sorts_family * sorts_family * arity_error) option
 
52
  | CaseNotInductive of unsafe_judgment
 
53
  | WrongCaseInfo of inductive * case_info
 
54
  | NumberBranches of unsafe_judgment * int
 
55
  | IllFormedBranch of constr * int * constr * constr
 
56
  | Generalization of (name * constr) * unsafe_judgment
 
57
  | ActualType of unsafe_judgment * constr
 
58
  | CantApplyBadType of
 
59
      (int * constr * constr) * unsafe_judgment * unsafe_judgment array
 
60
  | CantApplyNonFunctional of unsafe_judgment * unsafe_judgment array
 
61
  | IllFormedRecBody of guard_error * name array * int
 
62
  | IllTypedRecBody of
 
63
      int * name array * unsafe_judgment array * constr array
 
64
 
 
65
exception TypeError of env * type_error
 
66
 
 
67
let nfj (c,ct) = (c, nf_betaiota ct)
 
68
 
 
69
let error_unbound_rel env n =
 
70
  raise (TypeError (env, UnboundRel n))
 
71
 
 
72
let error_unbound_var env v =
 
73
  raise (TypeError (env, UnboundVar v))
 
74
 
 
75
let error_not_type env j =
 
76
  raise (TypeError (env, NotAType j))
 
77
 
 
78
let error_assumption env j =
 
79
  raise (TypeError (env, BadAssumption j))
 
80
 
 
81
let error_reference_variables env id =
 
82
  raise (TypeError (env, ReferenceVariables id))
 
83
 
 
84
let error_elim_arity env ind aritylst c pj okinds = 
 
85
  raise (TypeError (env, ElimArity (ind,aritylst,c,pj,okinds)))
 
86
 
 
87
let error_case_not_inductive env j = 
 
88
  raise (TypeError (env, CaseNotInductive j))
 
89
 
 
90
let error_number_branches env cj expn =
 
91
  raise (TypeError (env, NumberBranches (nfj cj,expn)))
 
92
 
 
93
let error_ill_formed_branch env c i actty expty =
 
94
  raise (TypeError (env,
 
95
    IllFormedBranch (c,i,nf_betaiota actty, nf_betaiota expty)))
 
96
 
 
97
let error_generalization env nvar c =
 
98
  raise (TypeError (env, Generalization (nvar,c)))
 
99
 
 
100
let error_actual_type env j expty =
 
101
  raise (TypeError (env, ActualType (j,expty)))
 
102
 
 
103
let error_cant_apply_not_functional env rator randl =
 
104
  raise (TypeError (env, CantApplyNonFunctional (rator,randl)))
 
105
 
 
106
let error_cant_apply_bad_type env t rator randl =
 
107
  raise (TypeError (env, CantApplyBadType (t,rator,randl)))
 
108
 
 
109
let error_ill_formed_rec_body env why lna i =
 
110
  raise (TypeError (env, IllFormedRecBody (why,lna,i)))
 
111
 
 
112
let error_ill_typed_rec_body env i lna vdefj vargs =
 
113
  raise (TypeError (env, IllTypedRecBody (i,lna,vdefj,vargs)))
 
114
 
 
115