323 if is_fol then |
323 if is_fol then |
324 (case ResClause.make_axiom_clause tm (name,i) of |
324 (case ResClause.make_axiom_clause tm (name,i) of |
325 SOME cls => (FOLClause cls) :: cls_axiom true name (i+1) tms |
325 SOME cls => (FOLClause cls) :: cls_axiom true name (i+1) tms |
326 | NONE => cls_axiom true name i tms) |
326 | NONE => cls_axiom true name i tms) |
327 else |
327 else |
328 (HOLClause (ResHolClause.make_axiom_clause tm (name,i))) :: (cls_axiom false name (i+1) tms); |
328 HOLClause (ResHolClause.make_axiom_clause tm (name,i)) :: |
|
329 cls_axiom false name (i+1) tms; |
329 |
330 |
330 |
331 |
331 fun filtered_tptp_axiom is_fol name clss = |
332 fun filtered_tptp_axiom is_fol name clss = |
332 (fst(ListPair.unzip (map clause2tptp (filter (fn c => not (isTaut c)) (cls_axiom is_fol name 0 clss)))),[]) |
333 (fst |
333 handle _ => ([],[name]); |
334 (ListPair.unzip |
|
335 (map clause2tptp (filter (fn c => not (isTaut c)) (cls_axiom is_fol name 0 clss)))), |
|
336 []) handle _ => ([],[name]); |
334 |
337 |
335 fun tptp_axioms_aux _ [] err = ([],err) |
338 fun tptp_axioms_aux _ [] err = ([],err) |
336 | tptp_axioms_aux is_fol ((name,clss)::nclss) err = |
339 | tptp_axioms_aux is_fol ((name,clss)::nclss) err = |
337 let val (nclss1,err1) = tptp_axioms_aux is_fol nclss err |
340 let val (nclss1,err1) = tptp_axioms_aux is_fol nclss err |
338 val (clsstrs,err_name_list) = filtered_tptp_axiom is_fol name clss |
341 val (clsstrs,err_name_list) = filtered_tptp_axiom is_fol name clss |
425 (******* write to files ******) |
428 (******* write to files ******) |
426 |
429 |
427 datatype mode = Auto | Fol | Hol; |
430 datatype mode = Auto | Fol | Hol; |
428 |
431 |
429 fun write_out logic (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
432 fun write_out logic (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
430 let val is_fol = is_fol_logic logic |
433 let val is_fol = is_fol_logic logic |
431 val (files1,err1) = if (null claR) then ([],[]) else (atp_axioms is_fol claR (claset_file())) |
434 val (files1,err1) = if (null claR) then ([],[]) |
432 val (files2,err2) = if (null simpR) then ([],[]) else (atp_axioms is_fol simpR (simpset_file ())) |
435 else (atp_axioms is_fol claR (claset_file())) |
433 val (files3,err3) = if (null userR) then ([],[]) else (atp_axioms is_fol userR (local_lemma_file ())) |
436 val (files2,err2) = if (null simpR) then ([],[]) |
434 val files4 = atp_conjectures is_fol hyp_cls conj_cls n |
437 else (atp_axioms is_fol simpR (simpset_file ())) |
435 val errs = err1 @ err2 @ err3 @ err |
438 val (files3,err3) = if (null userR) then ([],[]) |
436 val logic' = if !include_combS then HOLCS |
439 else (atp_axioms is_fol userR (local_lemma_file ())) |
437 else |
440 val files4 = atp_conjectures is_fol hyp_cls conj_cls n |
438 if !include_min_comb then HOLC else logic |
441 val errs = err1 @ err2 @ err3 @ err |
439 val _ = warning ("Problems are " ^ (string_of_logic logic')) |
442 val logic' = if !include_combS then HOLCS |
440 val _ = if (null errs) then () else warning ("Can't clausify thms: " ^ (ResClause.paren_pack errs)) |
443 else |
441 val helpers = case logic' of FOL => [] |
444 if !include_min_comb then HOLC else logic |
442 | HOL => [HOL_helper1 ()] |
445 val _ = warning ("Problems are " ^ (string_of_logic logic')) |
443 | _ => [HOL_helper1(),HOL_comb()] (*HOLC or HOLCS*) |
446 val _ = if (null errs) then () else warning ("Can't clausify thms: " ^ (ResClause.paren_pack errs)) |
444 in |
447 val helpers = case logic' of FOL => [] |
445 (helpers,files4 @ files1 @ files2 @ files3) |
448 | HOL => [HOL_helper1 ()] |
446 end; |
449 | _ => [HOL_helper1(),HOL_comb()] (*HOLC or HOLCS*) |
|
450 in |
|
451 (helpers,files4 @ files1 @ files2 @ files3) |
|
452 end; |
447 |
453 |
448 |
454 |
449 fun write_out_ts is_fol ctxt (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
455 fun write_out_ts is_fol ctxt (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
450 let val ts_file = if ((is_fol andalso (!fol_keep_types)) orelse ((not is_fol) andalso (is_typed_hol ()))) then tptp_types_sorts (ProofContext.theory_of ctxt) else [] |
456 let val ts_file = if ((is_fol andalso (!fol_keep_types)) orelse ((not is_fol) andalso (is_typed_hol ()))) then tptp_types_sorts (ProofContext.theory_of ctxt) else [] |
451 val logic = if is_fol then FOL else HOL |
457 val logic = if is_fol then FOL else HOL |
455 end; |
461 end; |
456 |
462 |
457 |
463 |
458 fun prep_atp_input mode ctxt conjectures user_thms n = |
464 fun prep_atp_input mode ctxt conjectures user_thms n = |
459 let val conj_cls = map prop_of (make_clauses conjectures) |
465 let val conj_cls = map prop_of (make_clauses conjectures) |
460 val (userR,simpR,claR,errs) = cnf_rules_tms ctxt user_thms (!include_claset,!include_simpset) |
466 val (userR,simpR,claR,errs) = |
|
467 cnf_rules_tms ctxt user_thms (!include_claset,!include_simpset) |
461 val hyp_cls = map prop_of (cnf_hyps_thms ctxt) |
468 val hyp_cls = map prop_of (cnf_hyps_thms ctxt) |
462 val logic = case mode of Auto => problem_logic (conj_cls,hyp_cls,userR,claR,simpR) |
469 val logic = case mode of Auto => problem_logic (conj_cls,hyp_cls,userR,claR,simpR) |
463 | Fol => FOL |
470 | Fol => FOL |
464 | Hol => HOL |
471 | Hol => HOL |
465 in |
472 in |