296 | check (v::rst) = |
296 | check (v::rst) = |
297 if member (op aconv) rst v then |
297 if member (op aconv) rst v then |
298 raise TFL_ERR "no_repeat_vars" |
298 raise TFL_ERR "no_repeat_vars" |
299 (quote (#1 (dest_Free v)) ^ |
299 (quote (#1 (dest_Free v)) ^ |
300 " occurs repeatedly in the pattern " ^ |
300 " occurs repeatedly in the pattern " ^ |
301 quote (string_of_cterm (Thry.typecheck thy pat))) |
301 quote (Display.string_of_cterm (Thry.typecheck thy pat))) |
302 else check rst |
302 else check rst |
303 in check (FV_multiset pat) |
303 in check (FV_multiset pat) |
304 end; |
304 end; |
305 |
305 |
306 fun dest_atom (Free p) = p |
306 fun dest_atom (Free p) = p |
530 val R1 = S.rand WFR |
530 val R1 = S.rand WFR |
531 val f = #lhs(S.dest_eq proto_def) |
531 val f = #lhs(S.dest_eq proto_def) |
532 val (extractants,TCl) = ListPair.unzip extracta |
532 val (extractants,TCl) = ListPair.unzip extracta |
533 val dummy = if !trace |
533 val dummy = if !trace |
534 then (writeln "Extractants = "; |
534 then (writeln "Extractants = "; |
535 prths extractants; |
535 Display.prths extractants; |
536 ()) |
536 ()) |
537 else () |
537 else () |
538 val TCs = foldr (gen_union (op aconv)) [] TCl |
538 val TCs = foldr (gen_union (op aconv)) [] TCl |
539 val full_rqt = WFR::TCs |
539 val full_rqt = WFR::TCs |
540 val R' = S.mk_select{Bvar=R1, Body=S.list_mk_conj full_rqt} |
540 val R' = S.mk_select{Bvar=R1, Body=S.list_mk_conj full_rqt} |
551 val ([def0], theory) = |
551 val ([def0], theory) = |
552 thy |
552 thy |
553 |> PureThy.add_defs_i false |
553 |> PureThy.add_defs_i false |
554 [Thm.no_attributes (fid ^ "_def", defn)] |
554 [Thm.no_attributes (fid ^ "_def", defn)] |
555 val def = Thm.freezeT def0; |
555 val def = Thm.freezeT def0; |
556 val dummy = if !trace then writeln ("DEF = " ^ string_of_thm def) |
556 val dummy = if !trace then writeln ("DEF = " ^ Display.string_of_thm def) |
557 else () |
557 else () |
558 (* val fconst = #lhs(S.dest_eq(concl def)) *) |
558 (* val fconst = #lhs(S.dest_eq(concl def)) *) |
559 val tych = Thry.typecheck theory |
559 val tych = Thry.typecheck theory |
560 val full_rqt_prop = map (Dcterm.mk_prop o tych) full_rqt |
560 val full_rqt_prop = map (Dcterm.mk_prop o tych) full_rqt |
561 (*lcp: a lot of object-logic inference to remove*) |
561 (*lcp: a lot of object-logic inference to remove*) |
562 val baz = R.DISCH_ALL |
562 val baz = R.DISCH_ALL |
563 (fold_rev R.DISCH full_rqt_prop |
563 (fold_rev R.DISCH full_rqt_prop |
564 (R.LIST_CONJ extractants)) |
564 (R.LIST_CONJ extractants)) |
565 val dum = if !trace then writeln ("baz = " ^ string_of_thm baz) |
565 val dum = if !trace then writeln ("baz = " ^ Display.string_of_thm baz) |
566 else () |
566 else () |
567 val f_free = Free (fid, fastype_of f) (*'cos f is a Const*) |
567 val f_free = Free (fid, fastype_of f) (*'cos f is a Const*) |
568 val SV' = map tych SV; |
568 val SV' = map tych SV; |
569 val SVrefls = map reflexive SV' |
569 val SVrefls = map reflexive SV' |
570 val def0 = (fold (fn x => fn th => R.rbeta(combination th x)) |
570 val def0 = (fold (fn x => fn th => R.rbeta(combination th x)) |
909 fun elim_tc tcthm (rule,induction) = |
909 fun elim_tc tcthm (rule,induction) = |
910 (R.MP rule tcthm, R.PROVE_HYP tcthm induction) |
910 (R.MP rule tcthm, R.PROVE_HYP tcthm induction) |
911 |
911 |
912 |
912 |
913 fun trace_thms s L = |
913 fun trace_thms s L = |
914 if !trace then writeln (cat_lines (s :: map string_of_thm L)) |
914 if !trace then writeln (cat_lines (s :: map Display.string_of_thm L)) |
915 else (); |
915 else (); |
916 |
916 |
917 fun trace_cterms s L = |
917 fun trace_cterms s L = |
918 if !trace then writeln (cat_lines (s :: map string_of_cterm L)) |
918 if !trace then writeln (cat_lines (s :: map Display.string_of_cterm L)) |
919 else ();; |
919 else ();; |
920 |
920 |
921 |
921 |
922 fun postprocess strict {wf_tac, terminator, simplifier} theory {rules,induction,TCs} = |
922 fun postprocess strict {wf_tac, terminator, simplifier} theory {rules,induction,TCs} = |
923 let val tych = Thry.typecheck theory |
923 let val tych = Thry.typecheck theory |