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.ALetIn (_,_,name,so,ta) ->
19 C.LetIn (name, deannotate_term so, deannotate_term ta)
20 | C.AAppl (_,_,l) -> C.Appl (List.map deannotate_term l)
21 | C.AConst (_,_,uri, cookingsno) -> C.Const (uri, cookingsno)
22 | C.AAbst (_,_,uri) -> C.Abst uri
23 | C.AMutInd (_,_,uri,cookingsno,i) -> C.MutInd (uri,cookingsno,i)
24 | C.AMutConstruct (_,_,uri,cookingsno,i,j) ->
25 C.MutConstruct (uri,cookingsno,i,j)
26 | C.AMutCase (_,_,uri,cookingsno,i,outtype,te,pl) ->
27 C.MutCase (uri,cookingsno,i,deannotate_term outtype,
28 deannotate_term te, List.map deannotate_term pl)
29 | C.AFix (_,_,funno,ifl) ->
30 C.Fix (funno, List.map deannotate_inductiveFun ifl)
31 | C.ACoFix (_,_,funno,ifl) ->
32 C.CoFix (funno, List.map deannotate_coinductiveFun ifl)
34 and deannotate_inductiveFun (name,index,ty,bo) =
35 (name, index, deannotate_term ty, deannotate_term bo)
37 and deannotate_coinductiveFun (name,ty,bo) =
38 (name, deannotate_term ty, deannotate_term bo)
41 let deannotate_inductiveType (name, isinductive, arity, cons) =
42 (name, isinductive, deannotate_term arity,
43 List.map (fun (id,ty,recs) -> (id,deannotate_term ty, recs)) cons)
49 C.ADefinition (_, _, id, bo, ty, params) ->
52 if !expect_possible_parameters then
53 C.Definition (id, deannotate_term bo, deannotate_term ty, params)
55 raise NotExpectingPossibleParameters
57 C.Definition (id, deannotate_term bo, deannotate_term ty, params)
59 | C.AAxiom (_, _, id, ty, params) ->
60 C.Axiom (id, deannotate_term ty, params)
61 | C.AVariable (_, _, name, bo, ty) ->
63 (match bo with None -> None | Some bo -> Some (deannotate_term bo)),
65 | C.ACurrentProof (_, _, name, conjs, bo, ty) ->
67 name, List.map (fun (id,con) -> (id,deannotate_term con)) conjs,
68 deannotate_term bo, deannotate_term ty
70 | C.AInductiveDefinition (_, _, tys, params, parno) ->
71 C.InductiveDefinition ( List.map deannotate_inductiveType tys,