]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/lambda-delta/src/basic_rg/brgOutput.ml
- initial support for abstractions with explicit levels
[helm.git] / helm / software / lambda-delta / src / basic_rg / brgOutput.ml
index d4b851b76acdde44401ff8db9067260c6ed134a1..ed024a68e8faeb50c6901ce118e9cd1a6e3ce0a4 100644 (file)
@@ -17,6 +17,7 @@ module L  = Log
 module G  = Options
 module E  = Entity
 module H  = Hierarchy
+module N  = Level
 module XD = XmlCrg
 module B  = Brg
 module BD = BrgCrg
@@ -48,13 +49,13 @@ let initial_counters = {
 }
 
 let rec count_term_binder f c e = function
-   | B.Abst w ->
+   | B.Abst (_, w) ->
       let c = {c with tabsts = succ c.tabsts; nodes = succ c.nodes} in
       count_term f c e w
-   | B.Abbr v -> 
+   | B.Abbr v      -> 
       let c = {c with tabbrs = succ c.tabbrs; xnodes = succ c.xnodes} in
       count_term f c e v
-   | B.Void   ->
+   | B.Void        ->
       let c = {c with tvoids = succ c.tvoids; xnodes = succ c.xnodes} in   
       f c
 
@@ -89,15 +90,15 @@ and count_term f c e = function
       count_term_binder f c e b
 
 let count_entity f c = function
-   | _, u, E.Abst w -> 
+   | _, u, E.Abst (_, w) -> 
       let c = {c with
          eabsts = succ c.eabsts; nodes = succ c.nodes; uris = u :: c.uris
       } in
       count_term f c B.empty w
-   | _, _, E.Abbr v ->  
+   | _, _, E.Abbr v      ->  
       let c = {c with eabbrs = succ c.eabbrs; xnodes = succ c.xnodes} in
       count_term f c B.empty v
-   | _, _, E.Void   -> assert false
+   | _, _, E.Void        -> assert false
 
 let print_counters f c =
    let terms =
@@ -151,10 +152,13 @@ let rename f e a =
 let name err frm a =
    let f n = function 
       | true  -> F.fprintf frm "%s" n
-      | false -> F.fprintf frm "^%s" n
+      | false -> F.fprintf frm "-%s" n
    in      
    E.name err f a
 
+let pp_level frm n =
+   if N.is_infinite n then () else F.fprintf frm "^%s" (N.to_string n)
+
 let rec pp_term e frm = function
    | B.Sort (_, h)           -> 
       let err _ = F.fprintf frm "@[*%u@]" h in
@@ -171,10 +175,10 @@ let rec pp_term e frm = function
       F.fprintf frm "@[{%a}.%a@]" (pp_term e) u (pp_term e) t
    | B.Appl (_, v, t)        ->
       F.fprintf frm "@[(%a).%a@]" (pp_term e) v (pp_term e) t
-   | B.Bind (a, B.Abst w, t) ->
+   | B.Bind (a, B.Abst (n, w), t) ->
       let f a =
-         let ee = B.push e B.empty a (B.abst w) in
-        F.fprintf frm "@[[%a:%a].%a@]" (name C.err) a (pp_term e) w (pp_term ee) t
+         let ee = B.push e B.empty a (B.abst w) in
+        F.fprintf frm "@[[%a:%a]%a.%a@]" (name C.err) a (pp_term e) w pp_level n (pp_term ee) t
       in
       rename f e a
    | B.Bind (a, B.Abbr v, t) ->