equal
deleted
inserted
replaced
331 | NONE => SOME v) |
331 | NONE => SOME v) |
332 | [] => error ("No type variable in type signature of constant " ^ quote c) |
332 | [] => error ("No type variable in type signature of constant " ^ quote c) |
333 | _ => error ("More than one type variable in type signature of constant " ^ quote c)); |
333 | _ => error ("More than one type variable in type signature of constant " ^ quote c)); |
334 val consts1 = |
334 val consts1 = |
335 Locale.parameters_of thy name_locale |
335 Locale.parameters_of thy name_locale |
336 |> map (apsnd (Syntax.unlocalize_mixfix true)) |
336 |> map (apsnd (TheoryTarget.fork_mixfix false true #> fst)) |
337 val SOME v = fold extract_classvar consts1 NONE; |
337 val SOME v = fold extract_classvar consts1 NONE; |
338 val consts2 = map ((apfst o apsnd) (subst_clsvar v (TFree (v, [])))) consts1; |
338 val consts2 = map ((apfst o apsnd) (subst_clsvar v (TFree (v, [])))) consts1; |
339 in (v, chop (length mapp_sup) consts2) end; |
339 in (v, chop (length mapp_sup) consts2) end; |
340 fun add_consts v raw_cs_sup raw_cs_this thy = |
340 fun add_consts v raw_cs_sup raw_cs_this thy = |
341 let |
341 let |
602 class_subP --| P.$$$ "+" -- class_bodyP |
602 class_subP --| P.$$$ "+" -- class_bodyP |
603 || class_subP >> rpair [] |
603 || class_subP >> rpair [] |
604 || class_bodyP >> pair []) |
604 || class_bodyP >> pair []) |
605 -- P.opt_begin |
605 -- P.opt_begin |
606 >> (fn ((bname, (supclasses, elems)), begin) => |
606 >> (fn ((bname, (supclasses, elems)), begin) => |
607 Toplevel.begin_local_theory begin (class bname supclasses elems #-> TheoryTarget.begin))); |
607 Toplevel.begin_local_theory begin |
|
608 (class bname supclasses elems #-> TheoryTarget.begin true))); |
608 |
609 |
609 val instanceP = |
610 val instanceP = |
610 OuterSyntax.command instanceK "prove type arity or subclass relation" K.thy_goal (( |
611 OuterSyntax.command instanceK "prove type arity or subclass relation" K.thy_goal (( |
611 P.xname -- ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- P.!!! P.xname) >> wrap_add_instance_sort |
612 P.xname -- ((P.$$$ "\\<subseteq>" || P.$$$ "<") |-- P.!!! P.xname) >> wrap_add_instance_sort |
612 || P.opt_thm_name ":" -- (P.and_list1 parse_arity -- Scan.repeat (P.opt_thm_name ":" -- P.prop)) |
613 || P.opt_thm_name ":" -- (P.and_list1 parse_arity -- Scan.repeat (P.opt_thm_name ":" -- P.prop)) |