src/HOL/Tools/Qelim/cooper.ML
changeset 51930 52fd62618631
parent 51717 9e7d1c139569
child 52059 2f970c7f722b
equal deleted inserted replaced
51929:5e8a0b8bb070 51930:52fd62618631
   382   val notz =
   382   val notz =
   383     let val tab = fold Inttab.update
   383     let val tab = fold Inttab.update
   384           (ds ~~ (map (fn x => nzprop (l div x)) ds)) Inttab.empty
   384           (ds ~~ (map (fn x => nzprop (l div x)) ds)) Inttab.empty
   385     in
   385     in
   386       fn ct => the (Inttab.lookup tab (ct |> term_of |> dest_number))
   386       fn ct => the (Inttab.lookup tab (ct |> term_of |> dest_number))
   387         handle Option =>
   387         handle Option.Option =>
   388           (writeln ("noz: Theorems-Table contains no entry for " ^
   388           (writeln ("noz: Theorems-Table contains no entry for " ^
   389               Syntax.string_of_term ctxt (Thm.term_of ct)); raise Option)
   389               Syntax.string_of_term ctxt (Thm.term_of ct)); raise Option.Option)
   390     end
   390     end
   391   fun unit_conv t =
   391   fun unit_conv t =
   392    case (term_of t) of
   392    case (term_of t) of
   393    Const(@{const_name HOL.conj},_)$_$_ => Conv.binop_conv unit_conv t
   393    Const(@{const_name HOL.conj},_)$_$_ => Conv.binop_conv unit_conv t
   394   | Const(@{const_name HOL.disj},_)$_$_ => Conv.binop_conv unit_conv t
   394   | Const(@{const_name HOL.disj},_)$_$_ => Conv.binop_conv unit_conv t
   470            (Thm.apply (Thm.apply dvdc (Numeral.mk_cnumber @{ctyp "int"} x)) cd))
   470            (Thm.apply (Thm.apply dvdc (Numeral.mk_cnumber @{ctyp "int"} x)) cd))
   471    in Thm.equal_elim (Thm.symmetric th) TrueI end;
   471    in Thm.equal_elim (Thm.symmetric th) TrueI end;
   472  val dvd =
   472  val dvd =
   473    let val tab = fold Inttab.update (ds ~~ (map divprop ds)) Inttab.empty in
   473    let val tab = fold Inttab.update (ds ~~ (map divprop ds)) Inttab.empty in
   474      fn ct => the (Inttab.lookup tab (term_of ct |> dest_number))
   474      fn ct => the (Inttab.lookup tab (term_of ct |> dest_number))
   475        handle Option =>
   475        handle Option.Option =>
   476         (writeln ("dvd: Theorems-Table contains no entry for" ^
   476         (writeln ("dvd: Theorems-Table contains no entry for" ^
   477             Syntax.string_of_term ctxt (Thm.term_of ct)); raise Option)
   477             Syntax.string_of_term ctxt (Thm.term_of ct)); raise Option.Option)
   478    end
   478    end
   479  val dp =
   479  val dp =
   480    let val th = Simplifier.rewrite (put_simpset lin_ss ctxt)
   480    let val th = Simplifier.rewrite (put_simpset lin_ss ctxt)
   481       (Thm.apply @{cterm Trueprop}
   481       (Thm.apply @{cterm Trueprop}
   482            (Thm.apply (Thm.apply @{cterm "op < :: int => _"} @{cterm "0::int"}) cd))
   482            (Thm.apply (Thm.apply @{cterm "op < :: int => _"} @{cterm "0::int"}) cd))
   539                                 [eq, the (Termtab.lookup inStab (term_of s))]
   539                                 [eq, the (Termtab.lookup inStab (term_of s))]
   540                  in (term_of t, th) end)
   540                  in (term_of t, th) end)
   541                   sths) Termtab.empty
   541                   sths) Termtab.empty
   542         in
   542         in
   543           fn ct => the (Termtab.lookup tab (term_of ct))
   543           fn ct => the (Termtab.lookup tab (term_of ct))
   544             handle Option =>
   544             handle Option.Option =>
   545               (writeln ("inS: No theorem for " ^ Syntax.string_of_term ctxt (Thm.term_of ct));
   545               (writeln ("inS: No theorem for " ^ Syntax.string_of_term ctxt (Thm.term_of ct));
   546                 raise Option)
   546                 raise Option.Option)
   547         end
   547         end
   548        val (inf, nb, pd) = divide_and_conquer (f x dvd inS (abths S)) p
   548        val (inf, nb, pd) = divide_and_conquer (f x dvd inS (abths S)) p
   549    in [dp, inf, nb, pd] MRS cpth
   549    in [dp, inf, nb, pd] MRS cpth
   550    end
   550    end
   551  val cpth' = Thm.transitive uth (cpth RS eq_reflection)
   551  val cpth' = Thm.transitive uth (cpth RS eq_reflection)