Printf.sprintf "[%d; %s]" cw s
-let weight_of_term term =
+let weight_of_term ?(consider_metas=true) term =
(* ALB: what to consider as a variable? I think "variables" in our case are
Metas and maybe Rels... *)
let module C = Cic in
let vars_dict = Hashtbl.create 5 in
let rec aux = function
- | C.Meta (metano, _) ->
+ | C.Meta (metano, _) when consider_metas ->
(try
let oldw = Hashtbl.find vars_dict metano in
Hashtbl.replace vars_dict metano (oldw+1)
with Not_found ->
Hashtbl.add vars_dict metano 1);
0
-
+ | C.Meta _ -> 0 (* "variables" are lighter than constants and functions...*)
+
| C.Var (_, ens)
| C.Const (_, ens)
| C.MutInd (_, _, ens)