summaryrefslogtreecommitdiff
path: root/pretyping/cases.mli
blob: 5919c42a74556b3a08a93ca22be5729ed1d5784a (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
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(*i $Id: cases.mli 8654 2006-03-22 15:36:58Z msozeau $ i*)

(*i*)
open Util
open Names
open Term
open Evd
open Environ
open Inductiveops
open Rawterm
open Evarutil
(*i*)

type pattern_matching_error =
  | BadPattern of constructor * constr
  | BadConstructor of constructor * inductive
  | WrongNumargConstructor of constructor * int
  | WrongNumargInductive of inductive * int
  | WrongPredicateArity of constr * constr * constr
  | NeedsInversion of constr * constr
  | UnusedClause of cases_pattern list
  | NonExhaustive of cases_pattern list
  | CannotInferPredicate of (constr * types) array

exception PatternMatchingError of env * pattern_matching_error

val error_wrong_numarg_constructor_loc : loc -> env -> constructor -> int -> 'a

val error_wrong_numarg_inductive_loc : loc -> env -> inductive -> int -> 'a

(*s Compilation of pattern-matching. *)

module type S = sig
  val compile_cases :
    loc ->
    (type_constraint -> env -> rawconstr -> unsafe_judgment) *    
      evar_defs ref ->
    type_constraint -> 
    env ->
    rawconstr option *
      (rawconstr * (name * (loc * inductive * name list) option)) list *
      (loc * identifier list * cases_pattern list * rawconstr) list ->
    unsafe_judgment
end

module Cases_F(C : Coercion.S) : S