From b3ce13018a7e6230313124ee2428a91ec5109e51 Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Tue, 15 May 2007 11:29:36 +0000 Subject: [PATCH] Wrong invariant: Hypothesis (i.e. lambda-abstractions) can have no (= None) name (if unusable). --- .../components/content_pres/content2pres.ml | 78 +++++++------------ 1 file changed, 28 insertions(+), 50 deletions(-) diff --git a/helm/software/components/content_pres/content2pres.ml b/helm/software/components/content_pres/content2pres.ml index 7c0ad99c4..a8b0bc6a0 100644 --- a/helm/software/components/content_pres/content2pres.ml +++ b/helm/software/components/content_pres/content2pres.ml @@ -112,6 +112,7 @@ let make_args_for_apply term2pres args = make_arg_for_apply true hd (List.fold_right (make_arg_for_apply false) tl []) | _ -> assert false + let get_name = function | Some s -> s | None -> "_" @@ -209,44 +210,32 @@ and proof2pres term2pres p = and ce2pres = function `Declaration d -> - (match d.Con.dec_name with - Some s -> - let ty = term2pres d.Con.dec_type in - B.H ([], - [(B.b_kw "Assume"); - B.b_space; - B.Object ([], P.Mi([],s)); - B.Text([],":"); - ty]) - | None -> - prerr_endline "NO NAME!!"; assert false) + let ty = term2pres d.Con.dec_type in + B.H ([], + [(B.b_kw "Assume"); + B.b_space; + B.Object ([], P.Mi([],get_name d.Con.dec_name)); + B.Text([],":"); + ty]) | `Hypothesis h -> - (match h.Con.dec_name with - Some s -> - let ty = term2pres h.Con.dec_type in - B.H ([], - [(B.b_kw "Suppose"); - B.b_space; - B.Text([],"("); - B.Object ([], P.Mi ([],s)); - B.Text([],")"); - B.b_space; - ty]) - | None -> - prerr_endline "NO NAME!!"; assert false) + let ty = term2pres h.Con.dec_type in + B.H ([], + [(B.b_kw "Suppose"); + B.b_space; + B.Text([],"("); + B.Object ([], P.Mi ([],get_name h.Con.dec_name)); + B.Text([],")"); + B.b_space; + ty]) | `Proof p -> proof2pres p | `Definition d -> - (match d.Con.def_name with - Some s -> - let term = term2pres d.Con.def_term in - B.H ([], - [ B.b_kw "Let"; B.b_space; - B.Object ([], P.Mi([],s)); - B.Text([]," = "); - term]) - | None -> - prerr_endline "NO NAME!!"; assert false) + let term = term2pres d.Con.def_term in + B.H ([], + [ B.b_kw "Let"; B.b_space; + B.Object ([], P.Mi([],get_name d.Con.def_name)); + B.Text([]," = "); + term]) and acontext2pres ac continuation indent = List.fold_right @@ -500,10 +489,7 @@ and proof2pres term2pres p = (match e with `Declaration h | `Hypothesis h -> - let name = - (match h.Con.dec_name with - None -> "NO NAME???" - | Some n ->n) in + let name = get_name h.Con.dec_name in [B.b_space; B.Object ([], P.Mi ([],name)); B.Text([],":"); @@ -605,21 +591,17 @@ and proof2pres term2pres p = | _ -> assert false) in match proof.Con.proof_context with `Hypothesis hyp1::`Hypothesis hyp2::tl -> - let get_name hyp = - (match hyp.Con.dec_name with - None -> "_" - | Some s -> s) in let preshyp1 = B.H ([], [B.Text([],"("); - B.Object ([], P.Mi([],get_name hyp1)); + B.Object ([], P.Mi([],get_name hyp1.Con.dec_name)); B.Text([],")"); B.skip; term2pres hyp1.Con.dec_type]) in let preshyp2 = B.H ([], [B.Text([],"("); - B.Object ([], P.Mi([],get_name hyp2)); + B.Object ([], P.Mi([],get_name hyp2.Con.dec_name)); B.Text([],")"); B.skip; term2pres hyp2.Con.dec_type]) in @@ -647,22 +629,18 @@ and proof2pres term2pres p = match proof.Con.proof_context with `Declaration decl::`Hypothesis hyp::tl | `Hypothesis decl::`Hypothesis hyp::tl -> - let get_name decl = - (match decl.Con.dec_name with - None -> "_" - | Some s -> s) in let presdecl = B.H ([], [(B.b_kw "let"); B.skip; - B.Object ([], P.Mi([],get_name decl)); + B.Object ([], P.Mi([],get_name decl.Con.dec_name)); B.Text([],":"); term2pres decl.Con.dec_type]) in let suchthat = B.H ([], [(B.b_kw "such that"); B.skip; B.Text([],"("); - B.Object ([], P.Mi([],get_name hyp)); + B.Object ([], P.Mi([],get_name hyp.Con.dec_name)); B.Text([],")"); B.skip; term2pres hyp.Con.dec_type]) in -- 2.39.2