234 | "op =" => SOME (p, i, "=", q, j) |
234 | "op =" => SOME (p, i, "=", q, j) |
235 | _ => NONE |
235 | _ => NONE |
236 end handle Rat.DIVZERO => NONE; |
236 end handle Rat.DIVZERO => NONE; |
237 |
237 |
238 fun of_lin_arith_sort thy U = |
238 fun of_lin_arith_sort thy U = |
239 Sign.of_sort thy (U, @{sort Ring_and_Field.ordered_idom}); |
239 Sign.of_sort thy (U, @{sort Ring_and_Field.linordered_idom}); |
240 |
240 |
241 fun allows_lin_arith thy (discrete : string list) (U as Type (D, [])) : bool * bool = |
241 fun allows_lin_arith thy (discrete : string list) (U as Type (D, [])) : bool * bool = |
242 if of_lin_arith_sort thy U then (true, member (op =) discrete D) |
242 if of_lin_arith_sort thy U then (true, member (op =) discrete D) |
243 else if member (op =) discrete D then (true, true) else (false, false) |
243 else if member (op =) discrete D then (true, true) else (false, false) |
244 | allows_lin_arith sg discrete U = (of_lin_arith_sort sg U, false); |
244 | allows_lin_arith sg discrete U = (of_lin_arith_sort sg U, false); |
802 (* reduce contradictory <= to False. |
802 (* reduce contradictory <= to False. |
803 Most of the work is done by the cancel tactics. *) |
803 Most of the work is done by the cancel tactics. *) |
804 |
804 |
805 val init_arith_data = |
805 val init_arith_data = |
806 Fast_Arith.map_data (fn {add_mono_thms, mult_mono_thms, inj_thms, lessD, number_of, ...} => |
806 Fast_Arith.map_data (fn {add_mono_thms, mult_mono_thms, inj_thms, lessD, number_of, ...} => |
807 {add_mono_thms = @{thms add_mono_thms_ordered_semiring} @ @{thms add_mono_thms_ordered_field} @ add_mono_thms, |
807 {add_mono_thms = @{thms add_mono_thms_linordered_semiring} @ @{thms add_mono_thms_linordered_field} @ add_mono_thms, |
808 mult_mono_thms = @{thm mult_strict_left_mono} :: @{thm mult_left_mono} :: |
808 mult_mono_thms = @{thm mult_strict_left_mono} :: @{thm mult_left_mono} :: |
809 @{lemma "a = b ==> c*a = c*b" by (rule arg_cong)} :: mult_mono_thms, |
809 @{lemma "a = b ==> c*a = c*b" by (rule arg_cong)} :: mult_mono_thms, |
810 inj_thms = inj_thms, |
810 inj_thms = inj_thms, |
811 lessD = lessD @ [@{thm "Suc_leI"}], |
811 lessD = lessD @ [@{thm "Suc_leI"}], |
812 neqE = [@{thm linorder_neqE_nat}, @{thm linorder_neqE_ordered_idom}], |
812 neqE = [@{thm linorder_neqE_nat}, @{thm linorder_neqE_linordered_idom}], |
813 simpset = HOL_basic_ss |
813 simpset = HOL_basic_ss |
814 addsimps @{thms ring_distribs} |
814 addsimps @{thms ring_distribs} |
815 addsimps [@{thm if_True}, @{thm if_False}] |
815 addsimps [@{thm if_True}, @{thm if_False}] |
816 addsimps |
816 addsimps |
817 [@{thm "monoid_add_class.add_0_left"}, |
817 [@{thm "monoid_add_class.add_0_left"}, |