let interpretate_term ~(context: Cic.name list) ~env ~uri ~is_path ast =
assert (uri = None);
+prerr_endline "ciao";
let rec aux loc (context: Cic.name list) = function
| CicNotationPt.AttributedTerm (`Loc loc, term) ->
aux loc context term
| `Inductive ->
(fun (var, _, _, _) cic ->
incr counter;
- Cic.LetIn (Cic.Name var, Cic.Fix (!counter, funs), cic))
+ let fix = Cic.Fix (!counter,funs) in
+ match cic with
+ Cic.Rel 1 -> fix
+ | (Cic.Appl (Cic.Rel 1::l)) -> Cic.Appl (fix::l)
+ | _ -> Cic.LetIn (Cic.Name var, fix, cic))
| `CoInductive ->
let funs =
List.map (fun (name, _, typ, body) -> (name, typ, body)) funs
in
(fun (var, _, _, _) cic ->
incr counter;
- Cic.LetIn (Cic.Name var, Cic.CoFix (!counter, funs), cic))
+ let cofix = Cic.CoFix (!counter,funs) in
+ match cic with
+ Cic.Rel 1 -> cofix
+ | (Cic.Appl (Cic.Rel 1::l)) -> Cic.Appl (cofix::l)
+ | _ -> Cic.LetIn (Cic.Name var, cofix, cic))
in
List.fold_right (build_term inductiveFuns) inductiveFuns cic_body
| CicNotationPt.Ident _