101 | T_CONST => const_typed_comb () |
101 | T_CONST => const_typed_comb () |
102 | T_NONE => untyped_comb () |
102 | T_NONE => untyped_comb () |
103 end; |
103 end; |
104 |
104 |
105 |
105 |
106 val claset_file = File.tmp_path (Path.basic "claset"); |
106 fun atp_input_file file = |
107 val simpset_file = File.tmp_path (Path.basic "simp"); |
107 let val file' = !ResAtp.problem_name ^ "_" ^ file |
108 val local_lemma_file = File.tmp_path (Path.basic "locallemmas"); |
108 in |
109 |
109 if !ResAtp.destdir = "" then File.platform_path (File.tmp_path (Path.basic file')) |
110 val prob_file = File.tmp_path (Path.basic "prob"); |
110 else if File.exists (File.unpack_platform_path (!ResAtp.destdir)) |
111 val hyps_file = File.tmp_path (Path.basic "hyps"); |
111 then !ResAtp.destdir ^ "/" ^ file' |
112 |
112 else error ("No such directory: " ^ !ResAtp.destdir) |
113 val types_sorts_file = File.tmp_path (Path.basic "typsorts"); |
113 end; |
|
114 |
|
115 fun claset_file () = atp_input_file "claset"; |
|
116 fun simpset_file () = atp_input_file "simp"; |
|
117 fun local_lemma_file () = atp_input_file "locallemmas"; |
|
118 fun hyps_file () = atp_input_file "hyps"; |
|
119 fun prob_file _ = atp_input_file ""; |
|
120 |
|
121 fun types_sorts_file () = atp_input_file "typesorts"; |
|
122 |
|
123 |
114 |
124 |
115 (*******************************************************) |
125 (*******************************************************) |
116 (* operations on Isabelle theorems: *) |
126 (* operations on Isabelle theorems: *) |
117 (* retrieving from ProofContext, *) |
127 (* retrieving from ProofContext, *) |
118 (* modifying local theorems, *) |
128 (* modifying local theorems, *) |
343 |
353 |
344 fun atp_conjectures_h_g filt_conj_fn hyp_cls = |
354 fun atp_conjectures_h_g filt_conj_fn hyp_cls = |
345 let val (tptp_h_clss,tfree_litss) = filt_conj_fn hyp_cls |
355 let val (tptp_h_clss,tfree_litss) = filt_conj_fn hyp_cls |
346 val tfree_lits = ResClause.union_all tfree_litss |
356 val tfree_lits = ResClause.union_all tfree_litss |
347 val tfree_clss = map ResClause.tfree_clause tfree_lits |
357 val tfree_clss = map ResClause.tfree_clause tfree_lits |
348 val hypsfile = File.platform_path hyps_file |
358 val hypsfile = hyps_file () |
349 val out = TextIO.openOut(hypsfile) |
359 val out = TextIO.openOut(hypsfile) |
350 in |
360 in |
351 ResAtp.writeln_strs out (tfree_clss @ tptp_h_clss); |
361 ResAtp.writeln_strs out (tfree_clss @ tptp_h_clss); |
352 TextIO.closeOut out; warning hypsfile; |
362 TextIO.closeOut out; warning hypsfile; |
353 ([hypsfile],tfree_lits) |
363 ([hypsfile],tfree_lits) |
358 fun atp_conjectures_h_hol hyp_cls = atp_conjectures_h_g filtered_tptp_conjectures_hol hyp_cls; |
368 fun atp_conjectures_h_hol hyp_cls = atp_conjectures_h_g filtered_tptp_conjectures_hol hyp_cls; |
359 |
369 |
360 fun atp_conjectures_c_g filt_conj_fn conj_cls n tfrees = |
370 fun atp_conjectures_c_g filt_conj_fn conj_cls n tfrees = |
361 let val (tptp_c_clss,tfree_litss) = filt_conj_fn conj_cls |
371 let val (tptp_c_clss,tfree_litss) = filt_conj_fn conj_cls |
362 val tfree_clss = map ResClause.tfree_clause ((ResClause.union_all tfree_litss) \\ tfrees) |
372 val tfree_clss = map ResClause.tfree_clause ((ResClause.union_all tfree_litss) \\ tfrees) |
363 val probfile = File.platform_path prob_file ^ "_" ^ string_of_int n |
373 val probfile = prob_file n |
364 val out = TextIO.openOut(probfile) |
374 val out = TextIO.openOut(probfile) |
365 in |
375 in |
366 ResAtp.writeln_strs out (tfree_clss @ tptp_c_clss); |
376 ResAtp.writeln_strs out (tfree_clss @ tptp_c_clss); |
367 TextIO.closeOut out; |
377 TextIO.closeOut out; |
368 warning probfile; |
378 warning probfile; |
396 let val classrel_clauses = ResClause.classrel_clauses_thy thy |
406 let val classrel_clauses = ResClause.classrel_clauses_thy thy |
397 val arity_clauses = ResClause.arity_clause_thy thy |
407 val arity_clauses = ResClause.arity_clause_thy thy |
398 val classrel_cls = map ResClause.tptp_classrelClause classrel_clauses |
408 val classrel_cls = map ResClause.tptp_classrelClause classrel_clauses |
399 val arity_cls = map ResClause.tptp_arity_clause arity_clauses |
409 val arity_cls = map ResClause.tptp_arity_clause arity_clauses |
400 fun write_ts () = |
410 fun write_ts () = |
401 let val tsfile = File.platform_path types_sorts_file |
411 let val tsfile = types_sorts_file () |
402 val out = TextIO.openOut(tsfile) |
412 val out = TextIO.openOut(tsfile) |
403 in |
413 in |
404 ResAtp.writeln_strs out (classrel_cls @ arity_cls); |
414 ResAtp.writeln_strs out (classrel_cls @ arity_cls); |
405 TextIO.closeOut out; |
415 TextIO.closeOut out; |
406 [tsfile] |
416 [tsfile] |
415 (******* write to files ******) |
425 (******* write to files ******) |
416 |
426 |
417 datatype mode = Auto | Fol | Hol; |
427 datatype mode = Auto | Fol | Hol; |
418 |
428 |
419 fun write_out_g logic atp_ax_fn atp_conj_fn (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
429 fun write_out_g logic atp_ax_fn atp_conj_fn (claR,simpR,userR,hyp_cls,conj_cls,n,err) = |
420 let val (files1,err1) = if (null claR) then ([],[]) else (atp_ax_fn claR (File.platform_path claset_file)) |
430 let val (files1,err1) = if (null claR) then ([],[]) else (atp_ax_fn claR (claset_file())) |
421 val (files2,err2) = if (null simpR) then ([],[]) else (atp_ax_fn simpR (File.platform_path simpset_file)) |
431 val (files2,err2) = if (null simpR) then ([],[]) else (atp_ax_fn simpR (simpset_file ())) |
422 val (files3,err3) = if (null userR) then ([],[]) else (atp_ax_fn userR (File.platform_path local_lemma_file)) |
432 val (files3,err3) = if (null userR) then ([],[]) else (atp_ax_fn userR (local_lemma_file ())) |
423 val files4 = atp_conj_fn hyp_cls conj_cls n |
433 val files4 = atp_conj_fn hyp_cls conj_cls n |
424 val errs = err1 @ err2 @ err3 @ err |
434 val errs = err1 @ err2 @ err3 @ err |
425 val logic' = if !include_combS then HOLCS |
435 val logic' = if !include_combS then HOLCS |
426 else |
436 else |
427 if !include_min_comb then HOLC else logic |
437 if !include_min_comb then HOLC else logic |
493 | rm_tmp_files1 (f::fs) = |
503 | rm_tmp_files1 (f::fs) = |
494 (OS.FileSys.remove f; rm_tmp_files1 fs); |
504 (OS.FileSys.remove f; rm_tmp_files1 fs); |
495 |
505 |
496 fun cond_rm_tmp files = |
506 fun cond_rm_tmp files = |
497 if !keep_atp_input then warning "ATP input kept..." |
507 if !keep_atp_input then warning "ATP input kept..." |
|
508 else if !ResAtp.destdir <> "" then warning ("ATP input kept in directory " ^ (!ResAtp.destdir)) |
498 else (warning "deleting ATP inputs..."; rm_tmp_files1 files); |
509 else (warning "deleting ATP inputs..."; rm_tmp_files1 files); |
499 |
510 |
500 |
|
501 end |
511 end |