X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fcic%2FcicUtil.ml;h=8fa9828590a604242c234bb25cf39cff3de17ce3;hb=3d16e43756f5e7c7e551e93e003a15c90627b77b;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..8fa982859 100644 --- a/helm/software/components/cic/cicUtil.ml +++ b/helm/software/components/cic/cicUtil.ml @@ -216,16 +216,6 @@ let attributes_of_obj = function let is_generated obj = List.exists ((=) `Generated) (attributes_of_obj obj) -let arity_of_composed_coercion obj = - let attrs = attributes_of_obj obj in - try - let tag=List.find (function `Class (`Coercion _) -> true|_->false) attrs in - match tag with - | `Class (`Coercion n) -> n - | _-> assert false - with Not_found -> 0 -;; - let projections_of_record obj uri = let attrs = attributes_of_obj obj in try @@ -628,7 +618,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 +686,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 +698,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" - +