src/HOL/Tools/Qelim/cooper.ML
changeset 45620 f2a587696afb
parent 45196 78478d938cb8
child 45740 132a3e1c0fe5
equal deleted inserted replaced
45619:76c5f277b234 45620:f2a587696afb
   782    val p' = fold_rev gen ts p
   782    val p' = fold_rev gen ts p
   783  in Thm.implies_intr p' (Thm.implies_elim st (fold Thm.forall_elim ts (Thm.assume p'))) end));
   783  in Thm.implies_intr p' (Thm.implies_elim st (fold Thm.forall_elim ts (Thm.assume p'))) end));
   784 
   784 
   785 local
   785 local
   786 val ss1 = comp_ss
   786 val ss1 = comp_ss
   787   addsimps @{thms simp_thms} @ [@{thm "nat_number_of_def"}, @{thm "zdvd_int"}] 
   787   addsimps @{thms simp_thms} @ [@{thm "nat_number_of_def"}, @{thm "zdvd_int"}]
   788       @ map (fn r => r RS sym) 
   788       @ map (fn r => r RS sym)
   789         [@{thm "int_int_eq"}, @{thm "zle_int"}, @{thm "zless_int"}, @{thm "zadd_int"}, 
   789         [@{thm "int_int_eq"}, @{thm "zle_int"}, @{thm "zless_int"}, @{thm "zadd_int"}, 
   790          @{thm "zmult_int"}]
   790          @{thm "zmult_int"}]
   791     addsplits [@{thm "zdiff_int_split"}]
   791   |> Splitter.add_split @{thm "zdiff_int_split"}
   792 
   792 
   793 val ss2 = HOL_basic_ss
   793 val ss2 = HOL_basic_ss
   794   addsimps [@{thm "nat_0_le"}, @{thm "int_nat_number_of"},
   794   addsimps [@{thm "nat_0_le"}, @{thm "int_nat_number_of"},
   795             @{thm "all_nat"}, @{thm "ex_nat"}, @{thm "number_of1"}, 
   795             @{thm "all_nat"}, @{thm "ex_nat"}, @{thm "number_of1"}, 
   796             @{thm "number_of2"}, @{thm "int_0"}, @{thm "int_1"}, @{thm "Suc_eq_plus1"}]
   796             @{thm "number_of2"}, @{thm "int_0"}, @{thm "int_1"}, @{thm "Suc_eq_plus1"}]
   797   addcongs [@{thm "conj_le_cong"}, @{thm "imp_le_cong"}]
   797   |> fold Simplifier.add_cong [@{thm "conj_le_cong"}, @{thm "imp_le_cong"}]
   798 val div_mod_ss = HOL_basic_ss addsimps @{thms simp_thms}
   798 val div_mod_ss = HOL_basic_ss addsimps @{thms simp_thms}
   799   @ map (Thm.symmetric o mk_meta_eq) 
   799   @ map (Thm.symmetric o mk_meta_eq) 
   800     [@{thm "dvd_eq_mod_eq_0"},
   800     [@{thm "dvd_eq_mod_eq_0"},
   801      @{thm "mod_add_left_eq"}, @{thm "mod_add_right_eq"}, 
   801      @{thm "mod_add_left_eq"}, @{thm "mod_add_right_eq"}, 
   802      @{thm "mod_add_eq"}, @{thm "div_add1_eq"}, @{thm "zdiv_zadd1_eq"}]
   802      @{thm "mod_add_eq"}, @{thm "div_add1_eq"}, @{thm "zdiv_zadd1_eq"}]
   805      @{thm "DIVISION_BY_ZERO"} RS conjunct2, @{thm "zdiv_zero"}, @{thm "zmod_zero"}, 
   805      @{thm "DIVISION_BY_ZERO"} RS conjunct2, @{thm "zdiv_zero"}, @{thm "zmod_zero"}, 
   806      @{thm "div_0"}, @{thm "mod_0"}, @{thm "div_by_1"}, @{thm "mod_by_1"}, @{thm "div_1"}, 
   806      @{thm "div_0"}, @{thm "mod_0"}, @{thm "div_by_1"}, @{thm "mod_by_1"}, @{thm "div_1"}, 
   807      @{thm "mod_1"}, @{thm "Suc_eq_plus1"}]
   807      @{thm "mod_1"}, @{thm "Suc_eq_plus1"}]
   808   @ @{thms add_ac}
   808   @ @{thms add_ac}
   809  addsimprocs [@{simproc cancel_div_mod_nat}, @{simproc cancel_div_mod_int}]
   809  addsimprocs [@{simproc cancel_div_mod_nat}, @{simproc cancel_div_mod_int}]
   810  val splits_ss = comp_ss addsimps [@{thm "mod_div_equality'"}] addsplits 
   810 val splits_ss =
   811      [@{thm "split_zdiv"}, @{thm "split_zmod"}, @{thm "split_div'"}, 
   811   comp_ss addsimps [@{thm "mod_div_equality'"}]
   812       @{thm "split_min"}, @{thm "split_max"}, @{thm "abs_split"}]
   812   |> fold Splitter.add_split
       
   813     [@{thm "split_zdiv"}, @{thm "split_zmod"}, @{thm "split_div'"}, 
       
   814      @{thm "split_min"}, @{thm "split_max"}, @{thm "abs_split"}]
   813 in
   815 in
   814 fun nat_to_int_tac ctxt = 
   816 fun nat_to_int_tac ctxt = 
   815   simp_tac (Simplifier.context ctxt ss1) THEN_ALL_NEW
   817   simp_tac (Simplifier.context ctxt ss1) THEN_ALL_NEW
   816   simp_tac (Simplifier.context ctxt ss2) THEN_ALL_NEW
   818   simp_tac (Simplifier.context ctxt ss2) THEN_ALL_NEW
   817   simp_tac (Simplifier.context ctxt comp_ss);
   819   simp_tac (Simplifier.context ctxt comp_ss);