src/HOL/Tools/ATP/atp_problem_generate.ML
changeset 51651 21a932f64366
parent 50969 4179fa5c79fe
child 51717 9e7d1c139569
equal deleted inserted replaced
51650:3dd495cd98a2 51651:21a932f64366
   475       val new_cls =
   475       val new_cls =
   476         [] |> fold (fold (fold (fold maybe_insert_class) o snd) o snd) pairs
   476         [] |> fold (fold (fold (fold maybe_insert_class) o snd) o snd) pairs
   477       val (cls', pairs') = all_class_pairs thy tycons new_cls
   477       val (cls', pairs') = all_class_pairs thy tycons new_cls
   478     in (cls' @ cls, union (op =) pairs' pairs) end
   478     in (cls' @ cls, union (op =) pairs' pairs) end
   479 
   479 
   480 fun tcon_clause _ _ (_, []) = []
   480 fun tcon_clause _ _ [] = []
   481   | tcon_clause seen n (tcons, (ar as (cl, _)) :: ars) =
   481   | tcon_clause seen n ((_, []) :: rest) = tcon_clause seen n rest
       
   482   | tcon_clause seen n ((tcons, (ar as (cl, _)) :: ars) :: rest) =
   482     if cl = class_of_types then
   483     if cl = class_of_types then
   483       tcon_clause seen n (tcons, ars)
   484       tcon_clause seen n ((tcons, ars) :: rest)
   484     else if member (op =) seen cl then
   485     else if member (op =) seen cl then
   485       (* multiple clauses for the same (tycon, cl) pair *)
   486       (* multiple clauses for the same (tycon, cl) pair *)
   486       make_axiom_tcon_clause (tcons,
   487       make_axiom_tcon_clause (tcons,
   487           lookup_const tcons ^ "___" ^ ascii_of cl ^ "_" ^ string_of_int n,
   488           lookup_const tcons ^ "___" ^ ascii_of cl ^ "_" ^ string_of_int n,
   488           ar) ::
   489           ar) ::
   489       tcon_clause seen (n + 1) (tcons, ars)
   490       tcon_clause seen (n + 1) ((tcons, ars) :: rest)
   490     else
   491     else
   491       make_axiom_tcon_clause (tcons, lookup_const tcons ^ "___" ^ ascii_of cl,
   492       make_axiom_tcon_clause (tcons, lookup_const tcons ^ "___" ^ ascii_of cl,
   492                               ar) ::
   493                               ar) ::
   493       tcon_clause (cl :: seen) n (tcons, ars)
   494       tcon_clause (cl :: seen) n ((tcons, ars) :: rest)
   494 
   495 
   495 fun make_tcon_clauses thy tycons =
   496 fun make_tcon_clauses thy tycons =
   496   all_class_pairs thy tycons ##> maps (tcon_clause [] 1)
   497   all_class_pairs thy tycons ##> tcon_clause [] 1
   497 
   498 
   498 
   499 
   499 (** Isabelle class relations **)
   500 (** Isabelle class relations **)
   500 
   501 
   501 (* Generate a list ("sub", "supers") such that "sub" is a proper subclass of all
   502 (* Generate a list ("sub", "supers") such that "sub" is a proper subclass of all