src/Pure/Tools/class_package.ML
changeset 22588 4a859d13ef83
parent 22524 f9bf5c08b446
child 22658 263d42253f53
equal deleted inserted replaced
22587:5454b06320fb 22588:4a859d13ef83
   620       let
   620       let
   621         val term = Display.raw_string_of_term t;
   621         val term = Display.raw_string_of_term t;
   622         val tfrees = map string_of_tfree (Term.add_tfrees t []);
   622         val tfrees = map string_of_tfree (Term.add_tfrees t []);
   623         val tvars = map string_of_tvar (Term.add_tvars t []);
   623         val tvars = map string_of_tvar (Term.add_tvars t []);
   624       in term :: tfrees @ tvars end;
   624       in term :: tfrees @ tvars end;
   625   in (map Output.info (print_term t); map Output.info (print_term prop)) end;
   625   in (map warning (print_term t); map warning (print_term prop)) end;
   626 
   626 
   627 fun add_def_in_class lthy class ((c, syn), ((name, atts), (rhs, eq))) thy =
   627 fun add_def_in_class lthy class ((c, syn), ((name, atts), (rhs, eq))) thy =
   628   let
   628   let
   629     val prfx = (Logic.const_of_class o NameSpace.base) class;
   629     val prfx = (Logic.const_of_class o NameSpace.base) class;
   630     val rhs' = global_term thy [class] rhs;
   630     val rhs' = global_term thy [class] rhs;
   641       #> pair (mk_name thy c, ty);
   641       #> pair (mk_name thy c, ty);
   642     fun add_def ((name, atts), prop) thy =
   642     fun add_def ((name, atts), prop) thy =
   643       thy
   643       thy
   644       |> PureThy.add_defs_i false [((name, prop), map (Attrib.attribute thy) atts)]
   644       |> PureThy.add_defs_i false [((name, prop), map (Attrib.attribute thy) atts)]
   645       |>> the_single;
   645       |>> the_single;
   646     val _ = Output.info "------ DEF ------";
   646     val _ = warning "------ DEF ------";
   647     val _ = Output.info c;
   647     val _ = warning c;
   648     val _ = Output.info name;
   648     val _ = warning name;
   649     val _ = (Output.info o Sign.string_of_term thy) rhs';
   649     val _ = (warning o Sign.string_of_term thy) rhs';
   650     val eq' = Morphism.thm (LocalTheory.target_morphism lthy) eq;
   650     val eq' = Morphism.thm (LocalTheory.target_morphism lthy) eq;
   651     val _ = (Output.info o string_of_thm) eq;
   651     val _ = (warning o string_of_thm) eq;
   652     val _ = (Output.info o string_of_thm) eq';
   652     val _ = (warning o string_of_thm) eq';
   653     val witness = the_witness thy class;
   653     val witness = the_witness thy class;
   654     val _ = Output.info "------ WIT ------";
   654     val _ = warning "------ WIT ------";
   655     fun print_wit (t, thm) = "(" ^ Sign.string_of_term thy t ^ ", " ^ Display.string_of_thm thm ^ ")"
   655     fun print_wit (t, thm) = "(" ^ Sign.string_of_term thy t ^ ", " ^ Display.string_of_thm thm ^ ")"
   656     fun print_raw_wit (t, thm) = "(" ^ Display.raw_string_of_term t ^ ", " ^ (Display.raw_string_of_term o Thm.prop_of) thm ^ ")"
   656     fun print_raw_wit (t, thm) = "(" ^ Display.raw_string_of_term t ^ ", " ^ (Display.raw_string_of_term o Thm.prop_of) thm ^ ")"
   657     val _ = (Output.info o cat_lines o map (print_wit o Element.dest_witness)) witness;
   657     val _ = (warning o cat_lines o map (print_wit o Element.dest_witness)) witness;
   658     val _ = map print_witness witness;
   658     val _ = map print_witness witness;
   659     val _ = (Output.info o string_of_thm) eq';
   659     val _ = (warning o string_of_thm) eq';
   660     val eq'' = Element.satisfy_thm witness eq';
   660     val eq'' = Element.satisfy_thm witness eq';
   661     val _ = (Output.info o string_of_thm) eq'';
   661     val _ = (warning o string_of_thm) eq'';
   662   in
   662   in
   663     thy
   663     thy
   664     |> Sign.add_path prfx
   664     |> Sign.add_path prfx
   665     |> add_const (c, ty, syn')
   665     |> add_const (c, ty, syn')
   666     |-> (fn c => add_def ((name, atts), Logic.mk_equals (Const c, rhs')))
   666     |-> (fn c => add_def ((name, atts), Logic.mk_equals (Const c, rhs')))
   667     |-> (fn global_def_thm => tap (fn _ => (Output.info o string_of_thm) global_def_thm))
   667     |-> (fn global_def_thm => tap (fn _ => (warning o string_of_thm) global_def_thm))
   668     |> Sign.restore_naming thy
   668     |> Sign.restore_naming thy
   669   end;
   669   end;
   670 
   670 
   671 end;
   671 end;