X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fbinaries%2Fmatitaprover%2Ftptp_cnf.ml;h=8d3cedfd4f9e90ad05f3e976f1099d788e634bc8;hb=1c8e230b1d81491b38126900d76201fb84303ced;hp=51ed32431af6eb699cfe11c72d60f6bb2bc292ef;hpb=d4d8691cd71651c778eacd6cc8d7ecc6f51d41df;p=helm.git diff --git a/helm/software/components/binaries/matitaprover/tptp_cnf.ml b/helm/software/components/binaries/matitaprover/tptp_cnf.ml index 51ed32431..8d3cedfd4 100644 --- a/helm/software/components/binaries/matitaprover/tptp_cnf.ml +++ b/helm/software/components/binaries/matitaprover/tptp_cnf.ml @@ -1,15 +1,13 @@ -let trans_atom ~neg = function +let trans_atom = function | Ast.True | Ast.False | Ast.Predicate _ | Ast.Proposition _ -> assert false - | Ast.Eq _ when neg -> assert false - | Ast.Eq (a,b) -> Ast.Function ("==",[Ast.Constant "Ω"; a; b]) - | Ast.NotEq (a,b) when neg -> Ast.Function ("==",[Ast.Constant "Ω"; a; b]) - | Ast.NotEq _ -> assert false + | Ast.Eq (a,b) -> true, Ast.Function ("==",[Ast.Constant "_"; a; b]) + | Ast.NotEq (a,b) -> false, Ast.Function ("==",[Ast.Constant "_"; a; b]) ;; -let trans_formulae ~neg = function +let trans_formulae = function | Ast.Disjunction _ -> assert false - | Ast.Atom a -> trans_atom ~neg a + | Ast.Atom a -> trans_atom a | Ast.NegAtom _ -> assert false ;; @@ -17,12 +15,13 @@ let trans_formulae ~neg = function (* HELPERS *) let resolve ~tptppath s = let resolved_name = + if HExtlib.is_regular s then s else + if tptppath = "/" then s else if Filename.check_suffix s ".p" then - (assert (String.length s > 5); - let prefix = String.sub s 0 3 in - tptppath ^ "/Problems/" ^ prefix ^ "/" ^ s) - else - tptppath ^ "/" ^ s + (assert (String.length s > 5); + let prefix = String.sub s 0 3 in + tptppath ^ "/Problems/" ^ prefix ^ "/" ^ s) + else tptppath ^ "/" ^ s in if HExtlib.is_regular resolved_name then resolved_name @@ -49,11 +48,11 @@ let parse ~tptppath filename = let rec aux p n = function | [] -> p,n | Ast.Comment _ :: tl -> aux p n tl - | Ast.AnnotatedFormula (name, (Ast.Axiom | Ast.Hypothesis), f,_,_) :: tl-> - aux (p@[Ast.Constant name,trans_formulae ~neg:false f]) n tl - | Ast.AnnotatedFormula (name, Ast.Negated_conjecture, f,_,_) :: tl -> - assert (n = []); - aux p (n@[Ast.Constant name, trans_formulae ~neg:true f]) tl + | Ast.AnnotatedFormula (name, + (Ast.Axiom | Ast.Hypothesis|Ast.Negated_conjecture), f,_,_) :: tl-> + let is_positive, f = trans_formulae f in + if is_positive then aux (p@[Ast.Constant name,f]) n tl + else aux p (n@[Ast.Constant name,f]) tl | _ -> prerr_endline "bad syntax"; assert false in aux [] [] statements