1 let expect_possible_parameters = ref false;;
3 exception NotExpectingPossibleParameters;;
5 let rec deannotate_term =
8 C.ARel (_,_,n,_) -> C.Rel n
9 | C.AVar (_,_,uri) -> C.Var uri
10 | C.AMeta (_,_,n) -> C.Meta n
11 | C.ASort (_,_,s) -> C.Sort s
12 | C.AImplicit _ -> C.Implicit
13 | C.ACast (_,_,va,ty) -> C.Cast (deannotate_term va, deannotate_term ty)
14 | C.AProd (_,_,name,so,ta) ->
15 C.Prod (name, deannotate_term so, deannotate_term ta)
16 | C.ALambda (_,_,name,so,ta) ->
17 C.Lambda (name, deannotate_term so, deannotate_term ta)
18 | C.AAppl (_,_,l) -> C.Appl (List.map deannotate_term l)
19 | C.AConst (_,_,uri, cookingsno) -> C.Const (uri, cookingsno)
20 | C.AAbst (_,_,uri) -> C.Abst uri
21 | C.AMutInd (_,_,uri,cookingsno,i) -> C.MutInd (uri,cookingsno,i)
22 | C.AMutConstruct (_,_,uri,cookingsno,i,j) ->
23 C.MutConstruct (uri,cookingsno,i,j)
24 | C.AMutCase (_,_,uri,cookingsno,i,outtype,te,pl) ->
25 C.MutCase (uri,cookingsno,i,deannotate_term outtype,
26 deannotate_term te, List.map deannotate_term pl)
27 | C.AFix (_,_,funno,ifl) ->
28 C.Fix (funno, List.map deannotate_inductiveFun ifl)
29 | C.ACoFix (_,_,funno,ifl) ->
30 C.CoFix (funno, List.map deannotate_coinductiveFun ifl)
32 and deannotate_inductiveFun (name,index,ty,bo) =
33 (name, index, deannotate_term ty, deannotate_term bo)
35 and deannotate_coinductiveFun (name,ty,bo) =
36 (name, deannotate_term ty, deannotate_term bo)
39 let deannotate_inductiveType (name, isinductive, arity, cons) =
40 (name, isinductive, deannotate_term arity,
41 List.map (fun (id,ty,recs) -> (id,deannotate_term ty, recs)) cons)
47 C.ADefinition (_, _, id, bo, ty, params) ->
50 if !expect_possible_parameters then
51 C.Definition (id, deannotate_term bo, deannotate_term ty, params)
53 raise NotExpectingPossibleParameters
55 C.Definition (id, deannotate_term bo, deannotate_term ty, params)
57 | C.AAxiom (_, _, id, ty, params) ->
58 C.Axiom (id, deannotate_term ty, params)
59 | C.AVariable (_, _, name, ty) ->
60 C.Variable (name, deannotate_term ty)
61 | C.ACurrentProof (_, _, name, conjs, bo, ty) ->
63 name, List.map (fun (id,con) -> (id,deannotate_term con)) conjs,
64 deannotate_term bo, deannotate_term ty
66 | C.AInductiveDefinition (_, _, tys, params, parno) ->
67 C.InductiveDefinition ( List.map deannotate_inductiveType tys,