X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fsoftware%2Fcomponents%2Fcic%2FcicUtil.ml;h=c5061c62fd1f7a7ac6db4e0bbd66258ad74e3a86;hb=b615d727f53aaa868f28dd3ba16c988d79e61bba;hp=48481440929dacc40a88f68bb740a712e30884d8;hpb=0b76904a3f10bfd6390d26172fd6979626bd72f4;p=helm.git diff --git a/helm/software/components/cic/cicUtil.ml b/helm/software/components/cic/cicUtil.ml index 484814409..c5061c62f 100644 --- a/helm/software/components/cic/cicUtil.ml +++ b/helm/software/components/cic/cicUtil.ml @@ -628,7 +628,7 @@ let pp_rel out c i = try match List.nth c (pred i) with | None -> out (Printf.sprintf "%u[?]" i) | Some (s, _) -> out (Printf.sprintf "%u[" i); pp_name out s; out "]" - with Failure "nth" -> out (Printf.sprintf "%u[%u]" i (List.length c - i)) + with Failure "nth" -> out (Printf.sprintf "%u[%i]" i (List.length c - i)) let pp_implict out = function | None -> out "?" @@ -696,7 +696,10 @@ and pp_xss out e c xss = let map (a, v) = pp_uri out a; out " <- "; pp_term out e c v in xiter out "[" "; " "]" map xss -and pp_attrs out attrs = +let pp_int out i = + out (Printf.sprintf "%u" i) + +let pp_attrs out attrs = let map = function | _ -> () in @@ -705,19 +708,32 @@ and pp_attrs out attrs = let pp_pars out pars = xiter out " (" ", " ")\n" (pp_uri out) pars +let pp_point out point = + if point then out "ind " else out "coind " + +let pp_constructor out (s, w) = + out s; out " of "; pp_term out [] [] w + +let pp_definition out (s, point, w, ts) = + out "let "; pp_point out point; out s; out " of "; pp_term out [] [] w; + xiter out "\ndef " "\nor " "" (pp_constructor out) ts + let pp_obj out = function - | C.Constant (s, None, u, pars, attrs) -> + | C.Constant (s, None, u, pars, attrs) -> out "fun "; pp_attrs out attrs; out s; pp_pars out pars; out " of "; pp_term out [] [] u - | C.Constant (s, Some t, u, pars, attrs) -> + | C.Constant (s, Some t, u, pars, attrs) -> out "let "; pp_attrs out attrs; out s; pp_pars out pars; out " def "; pp_term out [] [] t; out " of "; pp_term out [] [] u - | C.Variable (s, None, u, pars, attrs) -> - out "Local declaration" - | C.Variable (s, Some t, u, pars, attrs) -> - out "Local definition" - | C.CurrentProof (s, e, t, u, pars, attrs) -> + | C.Variable (s, None, u, pars, attrs) -> + out "local fun "; pp_attrs out attrs; out s; pp_pars out pars; + out " of "; pp_term out [] [] u + | C.Variable (s, Some t, u, pars, attrs) -> + out "local let "; pp_attrs out attrs; out s; pp_pars out pars; + out " def "; pp_term out [] [] t; out " of "; pp_term out [] [] u + | C.InductiveDefinition (us, pars, lpsno, attrs) -> + out "Inductive "; pp_attrs out attrs; pp_int out lpsno; pp_pars out pars; + xiter out "" "\n" "" (pp_definition out) us + | C.CurrentProof (s, e, t, u, pars, attrs) -> out "Current Proof" - | C.InductiveDefinition (us, pars, lpno, attrs) -> - out "Inductive Definition" - +