]> matita.cs.unibo.it Git - helm.git/blob - helm/software/lambda-delta/src/common/output.ml
Matitaweb: layout change in the matitaweb inteface, in order to allow better
[helm.git] / helm / software / lambda-delta / src / common / output.ml
1 (*
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.                     
5     ||I||                                                                
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_______________________________________________________________ *)
11
12 module P = Printf
13 module L = Log
14 module G = Options
15
16 type reductions = {
17    beta   : int;
18    zeta   : int;
19    theta: int;
20    tau    : int;
21    ldelta : int;
22    gdelta : int;
23    si     : int;
24    lrt    : int;
25    grt    : int
26 }
27
28 let initial_reductions = {
29    beta = 0; theta = 0; tau = 0; zeta = 0; ldelta = 0; gdelta = 0;
30    si = 0; lrt = 0; grt = 0
31 }
32
33 let reductions = ref initial_reductions
34
35 let clear_reductions () = reductions := initial_reductions
36
37 let add 
38    ?(beta=0) ?(theta=0) ?(tau=0) ?(ldelta=0) ?(gdelta=0) ?(zeta=0) 
39    ?(si=0) ?(lrt=0) ?(grt=0) ()
40 = reductions := {
41    beta = !reductions.beta + beta;
42    zeta = !reductions.zeta + zeta;
43    theta = !reductions.theta + theta;
44    tau = !reductions.tau + tau;
45    ldelta = !reductions.ldelta + ldelta;
46    gdelta = !reductions.gdelta + gdelta;
47    si = !reductions.si + si;
48    lrt = !reductions.lrt + lrt;
49    grt = !reductions.grt + grt
50 }
51
52 let print_reductions () =
53    let r = !reductions in
54    let rs = r.beta + r.ldelta + r.zeta + r.theta + r.tau + r.gdelta in
55    let prs = r.si + r.lrt + r.grt in
56    let delta = r.ldelta + r.gdelta in
57    let rt = r.lrt + r.grt in   
58    L.warn (P.sprintf "  Reductions summary");
59    L.warn (P.sprintf "    Proper reductions:        %7u" rs);
60    L.warn (P.sprintf "      Beta:                   %7u" r.beta);
61    L.warn (P.sprintf "      Delta:                  %7u" delta);
62    L.warn (P.sprintf "        Local:                %7u" r.ldelta);
63    L.warn (P.sprintf "        Global:               %7u" r.gdelta);
64    L.warn (P.sprintf "      Theta:                  %7u" r.theta);
65    L.warn (P.sprintf "      Zeta for abbreviation:  %7u" r.zeta);
66    L.warn (P.sprintf "      Zeta for cast:          %7u" r.tau);
67    L.warn (P.sprintf "    Pseudo reductions:        %7u" prs);
68    L.warn (P.sprintf "      Reference typing:       %7u" rt);
69    L.warn (P.sprintf "        Local:                %7u" r.lrt);
70    L.warn (P.sprintf "        Global:               %7u" r.grt);
71    L.warn (P.sprintf "      Sort inclusion:         %7u" r.si);
72    L.warn (P.sprintf "  Relocated nodes (icm):      %7u" !G.icm)