aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/typeops.mli
blob: 9747dbe83246d6f6e02a4516afef9f78f01fd2d8 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

open Names
open Univ
open Term
open Context
open Environ
open Entries
open Declarations

(** {6 Typing functions (not yet tagged as safe) }

    They return unsafe judgments that are "in context" of a set of 
    (local) universe variables (the ones that appear in the term)
    and associated constraints. In case of polymorphic definitions,
    these variables and constraints will be generalized.
 *)


val infer      : env -> constr       -> unsafe_judgment
val infer_v    : env -> constr array -> unsafe_judgment array
val infer_type : env -> types        -> unsafe_type_judgment

val infer_local_decls :
  env -> (Id.t * local_entry) list -> (env * rel_context)

(** {6 Basic operations of the typing machine. } *)

(** If [j] is the judgement {% $ %}c:t{% $ %}, then [assumption_of_judgement env j]
   returns the type {% $ %}c{% $ %}, checking that {% $ %}t{% $ %} is a sort. *)

val assumption_of_judgment :  env -> unsafe_judgment -> types
val type_judgment          :  env -> unsafe_judgment -> unsafe_type_judgment

(** {6 Type of sorts. } *)
val judge_of_prop : unsafe_judgment
val judge_of_set  : unsafe_judgment
val judge_of_prop_contents  : contents -> unsafe_judgment
val judge_of_type           : universe -> unsafe_judgment

(** {6 Type of a bound variable. } *)
val judge_of_relative : env -> int -> unsafe_judgment

(** {6 Type of variables } *)
val judge_of_variable : env -> variable -> unsafe_judgment

(** {6 type of a constant } *)

val judge_of_constant : env -> pconstant -> unsafe_judgment

val judge_of_constant_knowing_parameters :
  env -> pconstant -> unsafe_judgment array -> unsafe_judgment

(** {6 type of an applied projection } *)

val judge_of_projection : env -> Names.projection -> unsafe_judgment -> unsafe_judgment

(** {6 Type of application. } *)
val judge_of_apply :
  env -> unsafe_judgment -> unsafe_judgment array
    -> unsafe_judgment

(** {6 Type of an abstraction. } *)
val judge_of_abstraction :
  env -> Name.t -> unsafe_type_judgment -> unsafe_judgment
    -> unsafe_judgment

val sort_of_product : env -> sorts -> sorts -> sorts

(** {6 Type of a product. } *)
val judge_of_product :
  env -> Name.t -> unsafe_type_judgment -> unsafe_type_judgment
    -> unsafe_judgment

(** s Type of a let in. *)
val judge_of_letin :
  env -> Name.t -> unsafe_judgment -> unsafe_type_judgment -> unsafe_judgment
    -> unsafe_judgment

(** {6 Type of a cast. } *)
val judge_of_cast :
  env -> unsafe_judgment -> cast_kind -> unsafe_type_judgment ->
  unsafe_judgment

(** {6 Inductive types. } *)

val judge_of_inductive : env -> inductive puniverses -> unsafe_judgment

(* val judge_of_inductive_knowing_parameters : *)
(*   env -> inductive -> unsafe_judgment array -> unsafe_judgment *)

val judge_of_constructor : env -> constructor puniverses -> unsafe_judgment

(** {6 Type of Cases. } *)
val judge_of_case : env -> case_info
  -> unsafe_judgment -> unsafe_judgment -> unsafe_judgment array
    -> unsafe_judgment

(** Typecheck general fixpoint (not checking guard conditions) *)
val type_fixpoint : env -> Name.t array -> types array
    -> unsafe_judgment array -> unit

val type_of_constant : env -> pconstant -> types constrained

val type_of_constant_type : env -> constant_type -> types

val type_of_projection : env -> Names.projection puniverses -> types

val type_of_constant_in : env -> pconstant -> types

val type_of_constant_type_knowing_parameters :
  env -> constant_type -> types Lazy.t array -> types

val type_of_constant_knowing_parameters :
  env -> pconstant -> types Lazy.t array -> types constrained

(** Make a type polymorphic if an arity *)
val make_polymorphic_if_constant_for_ind : env -> unsafe_judgment ->
  constant_type