equal
deleted
inserted
replaced
22 val print_classes: theory -> unit |
22 val print_classes: theory -> unit |
23 |
23 |
24 val begin: class list -> sort -> Proof.context -> Proof.context |
24 val begin: class list -> sort -> Proof.context -> Proof.context |
25 val init: class -> theory -> Proof.context |
25 val init: class -> theory -> Proof.context |
26 val declare: class -> Properties.T |
26 val declare: class -> Properties.T |
27 -> (string * mixfix) * term -> theory -> theory |
27 -> (binding * mixfix) * term -> theory -> theory |
28 val abbrev: class -> Syntax.mode -> Properties.T |
28 val abbrev: class -> Syntax.mode -> Properties.T |
29 -> (string * mixfix) * term -> theory -> theory |
29 -> (binding * mixfix) * term -> theory -> theory |
30 val class_prefix: string -> string |
30 val class_prefix: string -> string |
31 val refresh_syntax: class -> Proof.context -> Proof.context |
31 val refresh_syntax: class -> Proof.context -> Proof.context |
32 val redeclare_operations: theory -> sort -> Proof.context -> Proof.context |
32 val redeclare_operations: theory -> sort -> Proof.context -> Proof.context |
33 |
33 |
34 (*instances*) |
34 (*instances*) |
50 |
50 |
51 val intro_classes_tac: thm list -> tactic |
51 val intro_classes_tac: thm list -> tactic |
52 val default_intro_tac: Proof.context -> thm list -> tactic |
52 val default_intro_tac: Proof.context -> thm list -> tactic |
53 |
53 |
54 (*old axclass layer*) |
54 (*old axclass layer*) |
55 val axclass_cmd: bstring * xstring list |
55 val axclass_cmd: binding * xstring list |
56 -> (Attrib.binding * string list) list |
56 -> (Attrib.binding * string list) list |
57 -> theory -> class * theory |
57 -> theory -> class * theory |
58 val classrel_cmd: xstring * xstring -> theory -> Proof.state |
58 val classrel_cmd: xstring * xstring -> theory -> Proof.state |
59 val instance_arity: (theory -> theory) -> arity -> theory -> Proof.state |
59 val instance_arity: (theory -> theory) -> arity -> theory -> Proof.state |
60 val instance_arity_cmd: bstring * xstring list * xstring -> theory -> Proof.state |
60 val instance_arity_cmd: xstring * xstring list * xstring -> theory -> Proof.state |
61 end; |
61 end; |
62 |
62 |
63 structure Class_Target : CLASS_TARGET = |
63 structure Class_Target : CLASS_TARGET = |
64 struct |
64 struct |
65 |
65 |
361 val class_prefix = Logic.const_of_class o NameSpace.base_name; |
361 val class_prefix = Logic.const_of_class o NameSpace.base_name; |
362 |
362 |
363 fun declare class pos ((c, mx), dict) thy = |
363 fun declare class pos ((c, mx), dict) thy = |
364 let |
364 let |
365 val morph = morphism thy class; |
365 val morph = morphism thy class; |
366 val b = Morphism.binding morph (Binding.name c); |
366 val b = Morphism.binding morph c; |
367 val b_def = Morphism.binding morph (Binding.name (c ^ "_dict")); |
367 val b_def = Morphism.binding morph (Binding.suffix_name "_dict" b); |
368 val c' = Sign.full_name thy b; |
368 val c' = Sign.full_name thy b; |
369 val dict' = Morphism.term morph dict; |
369 val dict' = Morphism.term morph dict; |
370 val ty' = Term.fastype_of dict'; |
370 val ty' = Term.fastype_of dict'; |
371 val def_eq = Logic.mk_equals (Const (c', ty'), dict') |
371 val def_eq = Logic.mk_equals (Const (c', ty'), dict') |
372 |> map_types Type.strip_sorts; |
372 |> map_types Type.strip_sorts; |
384 |
384 |
385 fun abbrev class prmode pos ((c, mx), rhs) thy = |
385 fun abbrev class prmode pos ((c, mx), rhs) thy = |
386 let |
386 let |
387 val morph = morphism thy class; |
387 val morph = morphism thy class; |
388 val unchecks = these_unchecks thy [class]; |
388 val unchecks = these_unchecks thy [class]; |
389 val b = Morphism.binding morph (Binding.name c); |
389 val b = Morphism.binding morph c; |
390 val c' = Sign.full_name thy b; |
390 val c' = Sign.full_name thy b; |
391 val rhs' = Pattern.rewrite_term thy unchecks [] rhs; |
391 val rhs' = Pattern.rewrite_term thy unchecks [] rhs; |
392 val ty' = Term.fastype_of rhs'; |
392 val ty' = Term.fastype_of rhs'; |
393 val rhs'' = map_types ((*Type.strip_sorts o *)Logic.varifyT) rhs'; |
393 val rhs'' = map_types ((*Type.strip_sorts o *)Logic.varifyT) rhs'; |
394 in |
394 in |