363 | _ => I) |
363 | _ => I) |
364 fun atp_schematic_consts_of t = add_schematic_consts_of t Symtab.empty |
364 fun atp_schematic_consts_of t = add_schematic_consts_of t Symtab.empty |
365 |
365 |
366 (** Definitions and functions for FOL clauses and formulas for TPTP **) |
366 (** Definitions and functions for FOL clauses and formulas for TPTP **) |
367 |
367 |
368 (* The first component is the type class; the second is a "TVar" or "TFree". *) |
|
369 datatype type_literal = |
|
370 TyLitVar of name * name | |
|
371 TyLitFree of name * name |
|
372 |
|
373 |
|
374 (** Isabelle arities **) |
368 (** Isabelle arities **) |
375 |
369 |
376 datatype arity_literal = |
370 datatype arity_literal = |
377 AryLitConst of name * name * name list | |
371 AryLitConst of name * name * name list | |
378 AryLitVar of name * name |
372 AryLitVar of name * name |
730 | generic_add_sorts_on_type ((x, i), s :: ss) = |
724 | generic_add_sorts_on_type ((x, i), s :: ss) = |
731 generic_add_sorts_on_type ((x, i), ss) |
725 generic_add_sorts_on_type ((x, i), ss) |
732 #> (if s = the_single @{sort HOL.type} then |
726 #> (if s = the_single @{sort HOL.type} then |
733 I |
727 I |
734 else if i = ~1 then |
728 else if i = ~1 then |
735 insert (op =) (TyLitFree (`make_type_class s, `make_fixed_type_var x)) |
729 insert (op =) (`make_type_class s, `make_fixed_type_var x) |
736 else |
730 else |
737 insert (op =) (TyLitVar (`make_type_class s, |
731 insert (op =) (`make_type_class s, |
738 (make_schematic_type_var (x, i), x)))) |
732 (make_schematic_type_var (x, i), x))) |
739 fun add_sorts_on_tfree (TFree (s, S)) = generic_add_sorts_on_type ((s, ~1), S) |
733 fun add_sorts_on_tfree (TFree (s, S)) = generic_add_sorts_on_type ((s, ~1), S) |
740 | add_sorts_on_tfree _ = I |
734 | add_sorts_on_tfree _ = I |
741 fun add_sorts_on_tvar (TVar z) = generic_add_sorts_on_type z |
735 fun add_sorts_on_tvar (TVar z) = generic_add_sorts_on_type z |
742 | add_sorts_on_tvar _ = I |
736 | add_sorts_on_tvar _ = I |
743 |
737 |
1468 Simple_Types (_, Polymorphic, _) => |
1462 Simple_Types (_, Polymorphic, _) => |
1469 if exploit_tff1_dummy_type_vars then ATerm (class, [arg]) |
1463 if exploit_tff1_dummy_type_vars then ATerm (class, [arg]) |
1470 else ATerm (class, [arg, ATerm (TYPE_name, [arg])]) |
1464 else ATerm (class, [arg, ATerm (TYPE_name, [arg])]) |
1471 | _ => ATerm (class, [arg]) |
1465 | _ => ATerm (class, [arg]) |
1472 |
1466 |
1473 fun fo_literal_from_type_literal type_enc (TyLitVar (class, name)) = |
1467 fun fo_literal_from_type_literal type_enc (class, name) = |
1474 (true, type_class_aterm type_enc class (ATerm (name, []))) |
1468 (true, type_class_aterm type_enc class (ATerm (name, []))) |
1475 | fo_literal_from_type_literal type_enc (TyLitFree (class, name)) = |
|
1476 (true, type_class_aterm type_enc class (ATerm (name, []))) |
|
1477 (* FIXME: Really "true" in both cases? If so, merge "TyLitVar" and |
|
1478 "TyLitFree". *) |
|
1479 |
1469 |
1480 fun formula_from_fo_literal (pos, t) = AAtom t |> not pos ? mk_anot |
1470 fun formula_from_fo_literal (pos, t) = AAtom t |> not pos ? mk_anot |
1481 |
1471 |
1482 fun bound_tvars type_enc Ts = |
1472 fun bound_tvars type_enc Ts = |
1483 mk_ahorn (map (formula_from_fo_literal |
1473 mk_ahorn (map (formula_from_fo_literal |