From: Stefano Zacchiroli Date: Wed, 27 Jul 2005 08:30:40 +0000 (+0000) Subject: added get_proof_conclusione and list_tl_at X-Git-Tag: V_0_7_2~43 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=c90e354dfd2a81f03664ca68504e0932f670fe17;p=helm.git added get_proof_conclusione and list_tl_at --- diff --git a/helm/matita/matitaMisc.ml b/helm/matita/matitaMisc.ml index 3ed1f001c..1ebe49e39 100644 --- a/helm/matita/matitaMisc.ml +++ b/helm/matita/matitaMisc.ml @@ -270,6 +270,13 @@ let get_proof_context status = context | _ -> [] +let get_proof_conclusion status = + match status.proof_status with + | Incomplete_proof ((_, metasenv, _, _), goal) -> + let (_, _, conclusion) = CicUtil.lookup_meta goal metasenv in + conclusion + | _ -> statement_error "no ongoing proof" + let get_proof_aliases status = status.aliases let qualify status name = get_string_option status "baseuri" ^ "/" ^ name @@ -297,6 +304,15 @@ let rec list_uniq = function | h1::h2::tl when h1 = h2 -> list_uniq (h2 :: tl) | h1::tl (* when h1 <> h2 *) -> h1 :: list_uniq tl +let list_tl_at ?(equality=(==)) e l = + let rec aux = + function + | [] -> raise Not_found + | hd :: tl as l when equality hd e -> l + | hd :: tl -> aux tl + in + aux l + let debug_wrap name f = prerr_endline (sprintf "debug_wrap: ==>> %s" name); let res = f () in diff --git a/helm/matita/matitaMisc.mli b/helm/matita/matitaMisc.mli index dafd91387..c4adbf6e1 100644 --- a/helm/matita/matitaMisc.mli +++ b/helm/matita/matitaMisc.mli @@ -59,6 +59,11 @@ val split: ?char:char -> string -> string list val list_uniq: 'a list -> 'a list (* uniq unix filter on lists *) + (** @return tl tail of a list starting at a given element + * @param eq equality to be used, defaults to physical equality (==) + * @raise Not_found *) +val list_tl_at: ?equality:('a -> 'a -> bool) -> 'a -> 'a list -> 'a list + (** @raise Failure *) val unopt: 'a option -> 'a @@ -104,6 +109,7 @@ val qualify: MatitaTypes.status -> string -> string val get_proof_status: MatitaTypes.status -> ProofEngineTypes.status val get_proof_metasenv: MatitaTypes.status -> Cic.metasenv val get_proof_context: MatitaTypes.status -> Cic.context +val get_proof_conclusion: MatitaTypes.status -> Cic.term val get_proof_aliases: MatitaTypes.status -> DisambiguateTypes.environment (** given the base name of an image, returns its full path *)