1 (* Copyright (C) 2000, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
38 | C.Implicit as t -> t
39 | C.Cast (te,ty) -> C.Cast (liftaux k te, liftaux k ty)
40 | C.Prod (n,s,t) -> C.Prod (n, liftaux k s, liftaux (k+1) t)
41 | C.Lambda (n,s,t) -> C.Lambda (n, liftaux k s, liftaux (k+1) t)
42 | C.Appl l -> C.Appl (List.map (liftaux k) l)
45 | C.MutInd _ as t -> t
46 | C.MutConstruct _ as t -> t
47 | C.MutCase (sp,cookingsno,i,outty,t,pl) ->
48 C.MutCase (sp, cookingsno, i, liftaux k outty, liftaux k t,
49 List.map (liftaux k) pl)
51 let len = List.length fl in
54 (fun (name, i, ty, bo) -> (name, i, liftaux k ty, liftaux (k+len) bo))
59 let len = List.length fl in
62 (fun (name, ty, bo) -> (name, liftaux k ty, liftaux (k+len) bo))
76 n when n = k -> lift (k - 1) arg
83 | C.Implicit as t -> t
84 | C.Cast (te,ty) -> C.Cast (substaux k te, substaux k ty) (*CSC ??? *)
85 | C.Prod (n,s,t) -> C.Prod (n, substaux k s, substaux (k + 1) t)
86 | C.Lambda (n,s,t) -> C.Lambda (n, substaux k s, substaux (k + 1) t)
87 | C.Appl l -> C.Appl (List.map (substaux k) l)
90 | C.MutInd _ as t -> t
91 | C.MutConstruct _ as t -> t
92 | C.MutCase (sp,cookingsno,i,outt,t,pl) ->
93 C.MutCase (sp,cookingsno,i,substaux k outt, substaux k t,
94 List.map (substaux k) pl)
96 let len = List.length fl in
99 (fun (name,i,ty,bo) -> (name, i, substaux k ty, substaux (k+len) bo))
102 C.Fix (i, substitutedfl)
104 let len = List.length fl in
107 (fun (name,ty,bo) -> (name, substaux k ty, substaux (k+len) bo))
110 C.CoFix (i, substitutedfl)
115 let undebrujin_inductive_def uri =
117 Cic.InductiveDefinition (dl,params,n_ind_params) ->
120 (fun (name,inductive,arity,constructors) ->
125 let counter = ref (List.length dl) in
129 subst (Cic.MutInd (uri,0,!counter))
135 (name,inductive,arity,constructors')
138 Cic.InductiveDefinition (dl', params, n_ind_params)