2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
30 let initial_counters = {
31 sections = 0; contexts = 0; blocks = 0; decls = 0; defs = 0;
32 sorts = 0; grefs = 0; appls = 0; absts = 0; pars = 0; xnodes = 0
35 let rec count_term f c = function
37 f {c with sorts = succ c.sorts; xnodes = succ c.xnodes}
39 let c = {c with grefs = succ c.grefs} in
40 let c = {c with pars = c.pars + List.length ts} in
41 let c = {c with xnodes = succ c.xnodes + List.length ts} in
42 Cps.list_fold_left f count_term c ts
44 let c = {c with appls = succ c.appls; xnodes = succ c.xnodes} in
45 let f c = count_term f c t in
48 let c = {c with absts = succ c.absts; xnodes = succ c.xnodes} in
49 let f c = count_term f c t in
52 let count_item f c = function
54 f {c with sections = succ c.sections}
56 f {c with contexts = succ c.contexts}
58 let c = {c with blocks = succ c.blocks; xnodes = succ c.xnodes} in
61 let c = {c with decls = succ c.decls; xnodes = succ c.xnodes} in
63 | A.Def (_, w, _, t) ->
64 let c = {c with defs = succ c.defs; xnodes = succ c.xnodes} in
65 let f c = count_term f c t in
68 let print_counters f c =
69 let terms = c.sorts + c.grefs + c.appls + c.absts in
70 let items = c.sections + c.contexts + c.blocks + c.decls + c.defs in
71 L.warn (P.sprintf " Automath representation summary");
72 L.warn (P.sprintf " Total book items: %7u" items);
73 L.warn (P.sprintf " Section items: %7u" c.sections);
74 L.warn (P.sprintf " Context items: %7u" c.contexts);
75 L.warn (P.sprintf " Block items: %7u" c.blocks);
76 L.warn (P.sprintf " Declaration items: %7u" c.decls);
77 L.warn (P.sprintf " Definition items: %7u" c.defs);
78 L.warn (P.sprintf " Total Parameter items: %7u" c.pars);
79 L.warn (P.sprintf " Application items: %7u" c.pars);
80 L.warn (P.sprintf " Total term items: %7u" terms);
81 L.warn (P.sprintf " Sort items: %7u" c.sorts);
82 L.warn (P.sprintf " Reference items: %7u" c.grefs);
83 L.warn (P.sprintf " Application items: %7u" c.appls);
84 L.warn (P.sprintf " Abstraction items: %7u" c.absts);
85 L.warn (P.sprintf " Global Int. Complexity: unknown");
86 L.warn (P.sprintf " + Abbreviation nodes: %7u" c.xnodes);