src/HOL/Import/proof_kernel.ML
changeset 39557 fe5722fce758
parent 39288 f1ae2493d93f
child 40627 becf5d5187cc
equal deleted inserted replaced
39556:32a00ff29d1a 39557:fe5722fce758
  1259         fun mk_res th = HOLThm (rens_of info, Thm.equal_elim i2h_conc th)
  1259         fun mk_res th = HOLThm (rens_of info, Thm.equal_elim i2h_conc th)
  1260     in
  1260     in
  1261         case get_hol4_mapping thyname thmname thy of
  1261         case get_hol4_mapping thyname thmname thy of
  1262             SOME (SOME thmname) =>
  1262             SOME (SOME thmname) =>
  1263             let
  1263             let
  1264                 val th1 = (SOME (PureThy.get_thm thy thmname)
  1264                 val th1 = (SOME (Global_Theory.get_thm thy thmname)
  1265                            handle ERROR _ =>
  1265                            handle ERROR _ =>
  1266                                   (case split_name thmname of
  1266                                   (case split_name thmname of
  1267                                        SOME (listname,idx) => (SOME (List.nth(PureThy.get_thms thy listname,idx-1))
  1267                                        SOME (listname,idx) => (SOME (List.nth(Global_Theory.get_thms thy listname,idx-1))
  1268                                                                handle _ => NONE)  (* FIXME avoid handle _ *)
  1268                                                                handle _ => NONE)  (* FIXME avoid handle _ *)
  1269                                      | NONE => NONE))
  1269                                      | NONE => NONE))
  1270             in
  1270             in
  1271                 case th1 of
  1271                 case th1 of
  1272                     SOME th2 =>
  1272                     SOME th2 =>
  1920         val thy1 = case HOL4DefThy.get thy of
  1920         val thy1 = case HOL4DefThy.get thy of
  1921                        Replaying _ => thy
  1921                        Replaying _ => thy
  1922                      | _ => (ImportRecorder.add_consts [(constname, ctype, csyn)];
  1922                      | _ => (ImportRecorder.add_consts [(constname, ctype, csyn)];
  1923                               Sign.add_consts_i [(Binding.name constname,ctype,csyn)] thy)
  1923                               Sign.add_consts_i [(Binding.name constname,ctype,csyn)] thy)
  1924         val eq = mk_defeq constname rhs' thy1
  1924         val eq = mk_defeq constname rhs' thy1
  1925         val (thms, thy2) = PureThy.add_defs false [((Binding.name thmname,eq),[])] thy1
  1925         val (thms, thy2) = Global_Theory.add_defs false [((Binding.name thmname,eq),[])] thy1
  1926         val _ = ImportRecorder.add_defs thmname eq
  1926         val _ = ImportRecorder.add_defs thmname eq
  1927         val def_thm = hd thms
  1927         val def_thm = hd thms
  1928         val thm' = def_thm RS meta_eq_to_obj_eq_thm
  1928         val thm' = def_thm RS meta_eq_to_obj_eq_thm
  1929         val (thy',th) = (thy2, thm')
  1929         val (thy',th) = (thy2, thm')
  1930         val fullcname = Sign.intern_const thy' constname
  1930         val fullcname = Sign.intern_const thy' constname
  2142     end
  2142     end
  2143 
  2143 
  2144 fun type_introduction thyname thmname tycname abs_name rep_name (P,t) hth thy =
  2144 fun type_introduction thyname thmname tycname abs_name rep_name (P,t) hth thy =
  2145     case HOL4DefThy.get thy of
  2145     case HOL4DefThy.get thy of
  2146         Replaying _ => (thy,
  2146         Replaying _ => (thy,
  2147           HOLThm([], PureThy.get_thm thy (thmname^"_@intern")) handle ERROR _ => hth)
  2147           HOLThm([], Global_Theory.get_thm thy (thmname^"_@intern")) handle ERROR _ => hth)
  2148       | _ =>
  2148       | _ =>
  2149         let
  2149         let
  2150             val _ = message "TYPE_INTRO:"
  2150             val _ = message "TYPE_INTRO:"
  2151             val _ = if_debug pth hth
  2151             val _ = if_debug pth hth
  2152             val _ = warning ("Introducing type " ^ tycname ^ " (with morphisms " ^ abs_name ^ " and " ^ rep_name ^ ")")
  2152             val _ = warning ("Introducing type " ^ tycname ^ " (with morphisms " ^ abs_name ^ " and " ^ rep_name ^ ")")