diff -r 2d153e052aea -r ed15f2cd4f7d src/HOL/Library/Char_ord.thy --- a/src/HOL/Library/Char_ord.thy Fri Jul 08 22:30:35 2022 +0200 +++ b/src/HOL/Library/Char_ord.thy Sat Jul 09 08:05:53 2022 +0000 @@ -8,85 +8,6 @@ imports Main begin -context linordered_semidom -begin - -lemma horner_sum_nonnegative: - \0 \ horner_sum of_bool 2 bs\ - by (induction bs) simp_all - -end - -context unique_euclidean_semiring_numeral -begin - -lemma horner_sum_bound: - \horner_sum of_bool 2 bs < 2 ^ length bs\ -proof (induction bs) - case Nil - then show ?case - by simp -next - case (Cons b bs) - moreover define a where \a = 2 ^ length bs - horner_sum of_bool 2 bs\ - ultimately have *: \2 ^ length bs = horner_sum of_bool 2 bs + a\ - by simp - have \1 < a * 2\ if \0 < a\ - using that add_mono [of 1 a 1 a] - by (simp add: mult_2_right discrete) - with Cons show ?case - by (simp add: algebra_simps *) -qed - -end - -context unique_euclidean_semiring_numeral -begin - -lemma horner_sum_less_eq_iff_lexordp_eq: - \horner_sum of_bool 2 bs \ horner_sum of_bool 2 cs \ lexordp_eq (rev bs) (rev cs)\ - if \length bs = length cs\ -proof - - have \horner_sum of_bool 2 (rev bs) \ horner_sum of_bool 2 (rev cs) \ lexordp_eq bs cs\ - if \length bs = length cs\ for bs cs - using that proof (induction bs cs rule: list_induct2) - case Nil - then show ?case - by simp - next - case (Cons b bs c cs) - with horner_sum_nonnegative [of \rev bs\] horner_sum_nonnegative [of \rev cs\] - horner_sum_bound [of \rev bs\] horner_sum_bound [of \rev cs\] - show ?case - by (auto simp add: horner_sum_append not_le Cons intro: add_strict_increasing2 add_increasing) - qed - from that this [of \rev bs\ \rev cs\] show ?thesis - by simp -qed - -lemma horner_sum_less_iff_lexordp: - \horner_sum of_bool 2 bs < horner_sum of_bool 2 cs \ ord_class.lexordp (rev bs) (rev cs)\ - if \length bs = length cs\ -proof - - have \horner_sum of_bool 2 (rev bs) < horner_sum of_bool 2 (rev cs) \ ord_class.lexordp bs cs\ - if \length bs = length cs\ for bs cs - using that proof (induction bs cs rule: list_induct2) - case Nil - then show ?case - by simp - next - case (Cons b bs c cs) - with horner_sum_nonnegative [of \rev bs\] horner_sum_nonnegative [of \rev cs\] - horner_sum_bound [of \rev bs\] horner_sum_bound [of \rev cs\] - show ?case - by (auto simp add: horner_sum_append not_less Cons intro: add_strict_increasing2 add_increasing) - qed - from that this [of \rev bs\ \rev cs\] show ?thesis - by simp -qed - -end - instantiation char :: linorder begin