src/HOL/Tools/TFL/tfl.ML
changeset 32091 30e2ffbba718
parent 31784 bd3486c57ba3
child 32432 64f30bdd3ba1
equal deleted inserted replaced
32090:39acf19e9f3a 32091:30e2ffbba718
   527            wfrec_eqns thy fid tflCongs eqns
   527            wfrec_eqns thy fid tflCongs eqns
   528      val R1 = S.rand WFR
   528      val R1 = S.rand WFR
   529      val f = #lhs(S.dest_eq proto_def)
   529      val f = #lhs(S.dest_eq proto_def)
   530      val (extractants,TCl) = ListPair.unzip extracta
   530      val (extractants,TCl) = ListPair.unzip extracta
   531      val dummy = if !trace
   531      val dummy = if !trace
   532                  then (writeln "Extractants = ";
   532                  then writeln (cat_lines ("Extractants =" ::
   533                        Display.prths extractants;
   533                   map (Display.string_of_thm_global thy) extractants))
   534                        ())
       
   535                  else ()
   534                  else ()
   536      val TCs = List.foldr (gen_union (op aconv)) [] TCl
   535      val TCs = List.foldr (gen_union (op aconv)) [] TCl
   537      val full_rqt = WFR::TCs
   536      val full_rqt = WFR::TCs
   538      val R' = S.mk_select{Bvar=R1, Body=S.list_mk_conj full_rqt}
   537      val R' = S.mk_select{Bvar=R1, Body=S.list_mk_conj full_rqt}
   539      val R'abs = S.rand R'
   538      val R'abs = S.rand R'
   549      val ([def0], theory) =
   548      val ([def0], theory) =
   550        thy
   549        thy
   551        |> PureThy.add_defs false
   550        |> PureThy.add_defs false
   552             [Thm.no_attributes (Binding.name (fid ^ "_def"), defn)]
   551             [Thm.no_attributes (Binding.name (fid ^ "_def"), defn)]
   553      val def = Thm.freezeT def0;
   552      val def = Thm.freezeT def0;
   554      val dummy = if !trace then writeln ("DEF = " ^ Display.string_of_thm def)
   553      val dummy =
   555                            else ()
   554        if !trace then writeln ("DEF = " ^ Display.string_of_thm_global theory def)
       
   555        else ()
   556      (* val fconst = #lhs(S.dest_eq(concl def))  *)
   556      (* val fconst = #lhs(S.dest_eq(concl def))  *)
   557      val tych = Thry.typecheck theory
   557      val tych = Thry.typecheck theory
   558      val full_rqt_prop = map (Dcterm.mk_prop o tych) full_rqt
   558      val full_rqt_prop = map (Dcterm.mk_prop o tych) full_rqt
   559          (*lcp: a lot of object-logic inference to remove*)
   559          (*lcp: a lot of object-logic inference to remove*)
   560      val baz = R.DISCH_ALL
   560      val baz = R.DISCH_ALL
   561                  (fold_rev R.DISCH full_rqt_prop
   561                  (fold_rev R.DISCH full_rqt_prop
   562                   (R.LIST_CONJ extractants))
   562                   (R.LIST_CONJ extractants))
   563      val dum = if !trace then writeln ("baz = " ^ Display.string_of_thm baz)
   563      val dum = if !trace then writeln ("baz = " ^ Display.string_of_thm_global theory baz)
   564                            else ()
   564                            else ()
   565      val f_free = Free (fid, fastype_of f)  (*'cos f is a Const*)
   565      val f_free = Free (fid, fastype_of f)  (*'cos f is a Const*)
   566      val SV' = map tych SV;
   566      val SV' = map tych SV;
   567      val SVrefls = map reflexive SV'
   567      val SVrefls = map reflexive SV'
   568      val def0 = (fold (fn x => fn th => R.rbeta(combination th x))
   568      val def0 = (fold (fn x => fn th => R.rbeta(combination th x))
   907 fun elim_tc tcthm (rule,induction) =
   907 fun elim_tc tcthm (rule,induction) =
   908    (R.MP rule tcthm, R.PROVE_HYP tcthm induction)
   908    (R.MP rule tcthm, R.PROVE_HYP tcthm induction)
   909 
   909 
   910 
   910 
   911 fun trace_thms s L =
   911 fun trace_thms s L =
   912   if !trace then writeln (cat_lines (s :: map Display.string_of_thm L))
   912   if !trace then writeln (cat_lines (s :: map Display.string_of_thm_without_context L))
   913   else ();
   913   else ();
   914 
   914 
   915 fun trace_cterms s L =
   915 fun trace_cterms s L =
   916   if !trace then writeln (cat_lines (s :: map Display.string_of_cterm L))
   916   if !trace then writeln (cat_lines (s :: map Display.string_of_cterm L))
   917   else ();;
   917   else ();;