X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Ftptp_grafite%2Ftptp2grafite.ml;h=e2a05e1c79814016d6efa1f4eef9a1412ce0ca39;hb=11b2157bacf59cfc561c2ef6f92ee41ee2c1a006;hp=5abe88526b4836eb6afb9f5f14550c1d9341908a;hpb=7362b0a510580edeb6bf0b5823316bbe82959faa;p=helm.git diff --git a/helm/software/components/tptp_grafite/tptp2grafite.ml b/helm/software/components/tptp_grafite/tptp2grafite.ml index 5abe88526..e2a05e1c7 100644 --- a/helm/software/components/tptp_grafite/tptp2grafite.ml +++ b/helm/software/components/tptp_grafite/tptp2grafite.ml @@ -84,11 +84,18 @@ let rec convert_term = function PT.Appl (mk_ident name :: List.map convert_term args) ;; -let rec atom_of_formula = function - | A.Disjunction (a,b) -> - atom_of_formula a @ atom_of_formula b - | A.NegAtom a -> [a] (* removes the negation *) - | A.Atom a -> [a] +let rec atom_of_formula neg pos = function + | A.Disjunction (a,b) -> + let neg, pos = atom_of_formula neg pos a in + atom_of_formula neg pos b + | A.NegAtom a -> a::neg, pos + | A.Atom (A.NotEq (a,b)) -> (A.Eq (a,b) :: neg), pos + | A.Atom a -> neg, a::pos +;; + +let atom_of_formula f = + let neg, pos = atom_of_formula [] [] f in + neg @ pos ;; let rec mk_arrow component tail = function @@ -246,35 +253,40 @@ let convert_ast statements context = function let o = PT.Theorem (`Theorem,name,f,None) in statements @ [ GA.Executable(floc,GA.Command(floc,GA.Obj(floc,o))); - GA.Executable(floc,GA.Tactical(floc, GA.Tactic(floc, - GA.Intros (floc,None,[])),Some (GA.Dot(floc))))] @ + GA.Executable(floc,GA.Tactic(floc, Some + (GA.Intros (floc,(None,[]))),GA.Dot(floc)))] @ (if fv <> [] then (List.flatten (List.map (fun _ -> - [GA.Executable(floc,GA.Tactical(floc, GA.Tactic(floc, - GA.Exists floc),Some (GA.Branch floc))); - GA.Executable(floc,GA.Tactical(floc, - GA.Pos (floc,[2]),None))]) + [GA.Executable(floc,GA.Tactic(floc, Some + (GA.Exists floc),GA.Branch floc)); + GA.Executable(floc,GA.Tactic(floc, None, + (GA.Pos (floc,[2]))))]) fv)) else [])@ - [GA.Executable(floc,GA.Tactical(floc, GA.Tactic(floc, + [GA.Executable(floc,GA.Tactic(floc, Some ( if ueq_case then - GA.Auto (floc,["paramodulation",""; - "timeout",string_of_int !paramod_timeout]) + GA.AutoBatch (floc,([],["paramodulation",""; + "timeout",string_of_int !paramod_timeout])) else - GA.Auto (floc,["depth",string_of_int !depth]) + GA.AutoBatch (floc,([],[ + "depth",string_of_int 5; + "width",string_of_int 5; + "size",string_of_int 20; + "timeout",string_of_int 10; + ])) ), - Some (GA.Dot(floc)))); - GA.Executable(floc,GA.Tactical(floc, GA.Try(floc, - GA.Tactic (floc, GA.Assumption floc)), Some (GA.Dot(floc)))) + GA.Semicolon(floc))); + GA.Executable(floc,GA.Tactic(floc, Some (GA.Try(floc, + GA.Assumption floc)), GA.Dot(floc))) ]@ (if fv <> [] then (List.flatten (List.map (fun _ -> - [GA.Executable(floc,GA.Tactical(floc, GA.Shift floc, None)); - GA.Executable(floc,GA.Tactical(floc, GA.Skip floc,Some + [GA.Executable(floc,GA.Tactic(floc, None, GA.Shift floc)); + GA.Executable(floc,GA.NonPunctuationTactical(floc, GA.Skip floc, (GA.Merge floc)))]) fv)) else [])@ @@ -337,16 +349,17 @@ let tptp2grafite ?(timeout=600) ?(def_depth=10) ?raw_preamble ~tptppath ~filenam let width = max_int in let term_pp content_term = let pres_term = TermContentPres.pp_ast content_term in - let dummy_tbl = Hashtbl.create 1 in - let markup = CicNotationPres.render dummy_tbl pres_term in - let s = BoxPp.render_to_string List.hd width markup in + let lookup_uri = fun _ -> None in + let markup = CicNotationPres.render ~lookup_uri pres_term in + let s = BoxPp.render_to_string List.hd width markup ~map_unicode_to_tex:false in Pcre.substitute ~pat:"\\\\forall [Ha-z][a-z0-9_]*" ~subst:(fun x -> "\n" ^ x) s in CicNotationPp.set_pp_term term_pp; let lazy_term_pp = fun x -> assert false in let obj_pp = CicNotationPp.pp_obj CicNotationPp.pp_term in - GrafiteAstPp.pp_statement ~term_pp ~lazy_term_pp ~obj_pp t + GrafiteAstPp.pp_statement + ~map_unicode_to_tex:false ~term_pp ~lazy_term_pp ~obj_pp t in let buri = Pcre.replace ~pat:"\\.p$" ("cic:/matita/TPTP/" ^ filename) in let extra_statements_start = [ @@ -357,7 +370,7 @@ let tptp2grafite ?(timeout=600) ?(def_depth=10) ?raw_preamble ~tptppath ~filenam match raw_preamble with | None -> pp (GA.Executable(floc, - GA.Command(floc,GA.Include(floc,"logic/equality.ma")))) + GA.Command(floc,GA.Include(floc,false,"logic/equality.ma")))) | Some s -> s buri in let extra_statements_end = [] in