492 | string_of_arity (m, n) = string_of_int m ^ "+" ^ string_of_int n |
492 | string_of_arity (m, n) = string_of_int m ^ "+" ^ string_of_int n |
493 |
493 |
494 fun dfg_string_for_formula poly gen_simp info = |
494 fun dfg_string_for_formula poly gen_simp info = |
495 let |
495 let |
496 val str_for_typ = string_for_type (DFG poly) |
496 val str_for_typ = string_for_type (DFG poly) |
|
497 fun str_for_bound_typ (ty, []) = str_for_typ ty |
|
498 | str_for_bound_typ (ty, sorts) = str_for_typ ty ^ " : " ^ commas sorts |
497 fun suffix_tag top_level s = |
499 fun suffix_tag top_level s = |
498 if top_level then |
500 if top_level then |
499 case extract_isabelle_status info of |
501 case extract_isabelle_status info of |
500 SOME s' => if s' = defN then s ^ ":lt" |
502 SOME s' => if s' = defN then s ^ ":lt" |
501 else if s' = simpN andalso gen_simp then s ^ ":lr" |
503 else if s' = simpN andalso gen_simp then s ^ ":lr" |
519 | str_for_conn _ AAnd = "and" |
521 | str_for_conn _ AAnd = "and" |
520 | str_for_conn _ AOr = "or" |
522 | str_for_conn _ AOr = "or" |
521 | str_for_conn _ AImplies = "implies" |
523 | str_for_conn _ AImplies = "implies" |
522 | str_for_conn top_level AIff = "equiv" |> suffix_tag top_level |
524 | str_for_conn top_level AIff = "equiv" |> suffix_tag top_level |
523 fun str_for_formula top_level (ATyQuant (q, xs, phi)) = |
525 fun str_for_formula top_level (ATyQuant (q, xs, phi)) = |
524 str_for_quant q ^ "_sorts([" ^ commas (map (str_for_typ o fst) xs) ^ |
526 str_for_quant q ^ "_sorts([" ^ commas (map str_for_bound_typ xs) ^ |
525 "], " ^ str_for_formula top_level phi ^ ")" |
527 "], " ^ str_for_formula top_level phi ^ ")" |
526 | str_for_formula top_level (AQuant (q, xs, phi)) = |
528 | str_for_formula top_level (AQuant (q, xs, phi)) = |
527 str_for_quant q ^ "([" ^ |
529 str_for_quant q ^ "([" ^ |
528 commas (map (string_for_bound_var (DFG poly)) xs) ^ "], " ^ |
530 commas (map (string_for_bound_var (DFG poly)) xs) ^ "], " ^ |
529 str_for_formula top_level phi ^ ")" |
531 str_for_formula top_level phi ^ ")" |
544 fun ty_ary 0 sym = sym |
546 fun ty_ary 0 sym = sym |
545 | ty_ary n sym = "(" ^ sym ^ ", " ^ string_of_int n ^ ")" |
547 | ty_ary n sym = "(" ^ sym ^ ", " ^ string_of_int n ^ ")" |
546 fun fun_typ sym ty = "function(" ^ sym ^ ", " ^ str_for_typ ty ^ ")." |
548 fun fun_typ sym ty = "function(" ^ sym ^ ", " ^ str_for_typ ty ^ ")." |
547 fun pred_typ sym ty = |
549 fun pred_typ sym ty = |
548 let |
550 let |
549 val ((ty_vars, tys), _) = strip_atype ty |
|
550 val (ty_vars, tys) = |
551 val (ty_vars, tys) = |
551 strip_atype ty |> fst |
552 strip_atype ty |> fst |
552 |>> (fn [] => [] | ty_vars => ["[" ^ commas ty_vars ^ "]"]) |
553 |>> (fn [] => [] | ty_vars => ["[" ^ commas ty_vars ^ "]"]) |
553 in "predicate(" ^ commas (sym :: ty_vars @ map str_for_typ tys) ^ ")." end |
554 in "predicate(" ^ commas (sym :: ty_vars @ map str_for_typ tys) ^ ")." end |
554 fun formula pred (Formula (ident, kind, phi, _, info)) = |
555 fun formula pred (Formula (ident, kind, phi, _, info)) = |