let module Ast = CicAst in
let idref id t = Ast.AttributedTerm (`IdRef id, t) in
let rec aux = function
- | Cic.ARel (id,_,_,b) -> idref id (Ast.Ident (b, []))
+ | Cic.ARel (id,_,_,b) -> idref id (Ast.Ident (b, None))
| Cic.AVar (id,uri,subst) ->
register_uri id (UriManager.string_of_uri uri);
idref id
| _ -> assert false)
with Not_found -> assert false
in
- idref id (Ast.LetRec (`Inductive, defs, Ast.Ident (name, [])))
+ idref id (Ast.LetRec (`Inductive, defs, Ast.Ident (name, None)))
| Cic.ACoFix (id, no, funs) ->
let defs =
List.map
| _ -> assert false)
with Not_found -> assert false
in
- idref id (Ast.LetRec (`CoInductive, defs, Ast.Ident (name, [])))
+ idref id (Ast.LetRec (`CoInductive, defs, Ast.Ident (name, None)))
and astsubst_of_cicsubst subst =
- List.map (fun (uri, annterm) -> (UriManager.name_of_uri uri, aux annterm))
- subst
+ Some
+ (List.map (fun (uri, annterm) ->
+ (UriManager.name_of_uri uri, aux annterm))
+ subst)
and astcontext_of_ciccontext context =
List.map
let size1 = countvar c var in
countterm size1 s) current_size l in
countterm size1 t
- | A.Ident(s,l) ->
+ | A.Ident(s,None) -> current_size + (String.length s)
+ | A.Ident(s,Some l) ->
List.fold_left
(fun c (v,t) -> countterm (c + (String.length v)) t)
(current_size + (String.length s)) l
| [(s,t)] ->
make_subst start_txt s t "]"
| (s,t)::tl ->
- (make_subst start_txt s t ";")@(make_substs " " tl) in
- make_substs "[" subst in
+ (make_subst start_txt s t ";")@(make_substs " " tl)
+ in
+ match subst with
+ | Some subst -> make_substs "[" subst
+ | None -> []
+ in
Box.V([], (* attr here or on Vbox? *)
[Box.Text(map_attributes attr,s);
Box.indent(Box.V([],subst))])
| LetIn of capture_variable * term * term (* name, body, where *)
| LetRec of induction_kind * (capture_variable * term * int) list * term
(* (name, body, decreasing argument) list, where *)
- | Ident of string * subst list (* literal, substitutions *)
+ | Ident of string * subst list option
+ (* literal, substitutions.
+ * Some [] -> user has given an empty explicit substitution list
+ * None -> user has given no explicit substitution list *)
| Implicit
| Meta of int * meta_subst list
| Num of string * int (* literal, instance *)
sprintf "%s = %s" (pp_capture_variable var) (pp_term body))
definitions))
(pp_term term)
- | CicAst.Ident (name, []) -> name
- | CicAst.Ident (name, substs) -> sprintf "%s[%s]" name (pp_substs substs)
+ | CicAst.Ident (name, Some [])
+ | CicAst.Ident (name, None) ->
+ name
+ | CicAst.Ident (name, Some substs) -> sprintf "%s[%s]" name (pp_substs substs)
| CicAst.Implicit -> "?"
| CicAst.Meta (index, substs) ->
sprintf "%d[%s]" index