[STATEMENT]
lemma cube_minus:"\<forall>p q.((((p::rat_poly) - (q::rat_poly))^3)
                = (p^3) - 3*(p^2)*(q) + 3*(p)*(q^2) - (q^3))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
apply(rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. \<forall>q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
apply(rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
fix p q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have 1:"(((p::rat_poly) - (q::rat_poly))^3) = (p - q)*(p-q)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p - q) ^ 3 = rat_poly_times (p - q) ((p - q)\<^sup>2)
[PROOF STEP]
by (metis One_nat_def Suc_1 numeral_3_eq_3 power_Suc)
[PROOF STATE]
proof (state)
this:
(p - q) ^ 3 = rat_poly_times (p - q) ((p - q)\<^sup>2)

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(p - q) ^ 3 = rat_poly_times (p - q) ((p - q)\<^sup>2)
[PROOF STEP]
have "(p-q)^2 = (p^2) - (2*p*q) + (q^2)"
[PROOF STATE]
proof (prove)
using this:
(p - q) ^ 3 = rat_poly_times (p - q) ((p - q)\<^sup>2)

goal (1 subgoal):
 1. (p - q)\<^sup>2 = rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)
[PROOF STEP]
using square_subtract
[PROOF STATE]
proof (prove)
using this:
(p - q) ^ 3 = rat_poly_times (p - q) ((p - q)\<^sup>2)
(?p - ?q)\<^sup>2 = rat_poly_plus (?p\<^sup>2 - rat_poly_times (rat_poly_times 2 ?p) ?q) (?q\<^sup>2)

goal (1 subgoal):
 1. (p - q)\<^sup>2 = rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p - q)\<^sup>2 = rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(p - q)\<^sup>2 = rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)
[PROOF STEP]
have 2:"(p - q)*(p-q)^2 = (p - q)*((p^2) - (2*p*q) + (q^2))"
[PROOF STATE]
proof (prove)
using this:
(p - q)\<^sup>2 = rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)

goal (1 subgoal):
 1. rat_poly_times (p - q) ((p - q)\<^sup>2) = rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly_times (p - q) ((p - q)\<^sup>2) = rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly_times (p - q) ((p - q)\<^sup>2) = rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have 3:"(p - q)*((p^2) - (2*p*q) + (q^2))
                   = p*((p^2) - (2*p*q) + (q^2))
               - (q*((p^2) - (2*p*q) + (q^2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) - rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
[PROOF STEP]
by (metis minus_right_distributivity)
[PROOF STATE]
proof (state)
this:
rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) - rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) - rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have "p*((p^2) - (2*p*q) + (q^2))
                   = p*(p^2) - p*(2*p*q) + (p*(q^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times p (p\<^sup>2) - rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times p (q\<^sup>2))
[PROOF STEP]
using minus_left_distributivity
[PROOF STATE]
proof (prove)
using this:
rat_poly_times ?p (?q - ?r) = rat_poly_times ?p ?q - rat_poly_times ?p ?r

goal (1 subgoal):
 1. rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times p (p\<^sup>2) - rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times p (q\<^sup>2))
[PROOF STEP]
by (simp add: distrib_left)
[PROOF STATE]
proof (state)
this:
rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times p (p\<^sup>2) - rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times p (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times p (p\<^sup>2) - rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times p (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have "p*(p^2) = p^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times p (p\<^sup>2) = p ^ 3
[PROOF STEP]
by (metis One_nat_def Suc_1 numeral_3_eq_3 power_Suc)
[PROOF STATE]
proof (state)
this:
rat_poly_times p (p\<^sup>2) = p ^ 3

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly_times p (p\<^sup>2) = p ^ 3

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have "p*(2*p*q) = 2*(p^2)*q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q) = rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q
[PROOF STEP]
by (metis (no_types, lifting) distrib_left mult_2 power2_eq_square
               semigroup_mult_class.mult.assoc)
[PROOF STATE]
proof (state)
this:
rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q) = rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rat_poly_times (p - q) ((p - q)\<^sup>2) = rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) - rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times p (p\<^sup>2) - rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times p (q\<^sup>2))
rat_poly_times p (p\<^sup>2) = p ^ 3
rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q) = rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q
[PROOF STEP]
have 4:"p*((p^2) - (2*p*q) + (q^2))
                   = (p^3) - (2*(p^2)*q) + (p*(q^2))"
[PROOF STATE]
proof (prove)
using this:
rat_poly_times (p - q) ((p - q)\<^sup>2) = rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) - rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times p (p\<^sup>2) - rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times p (q\<^sup>2))
rat_poly_times p (p\<^sup>2) = p ^ 3
rat_poly_times p (rat_poly_times (rat_poly_times 2 p) q) = rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q

goal (1 subgoal):
 1. rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have "q*((p^2) - (2*p*q) + (q^2))
                   = q*(p^2) - q*(2*p*q) + (q*(q^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times q (p\<^sup>2) - rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times q (q\<^sup>2))
[PROOF STEP]
by (simp add: distrib_left minus_left_distributivity)
[PROOF STATE]
proof (state)
this:
rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times q (p\<^sup>2) - rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times q (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times q (p\<^sup>2) - rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times q (q\<^sup>2))

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have "q*(p^2) = (p^2)*q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times q (p\<^sup>2) = rat_poly_times (p\<^sup>2) q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rat_poly_times q (p\<^sup>2) = rat_poly_times (p\<^sup>2) q

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly_times q (p\<^sup>2) = rat_poly_times (p\<^sup>2) q

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have "q*(2*p*q) = 2*p*(q^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q) = rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q) = rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times q (p\<^sup>2) - rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times q (q\<^sup>2))
rat_poly_times q (p\<^sup>2) = rat_poly_times (p\<^sup>2) q
rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q) = rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)
[PROOF STEP]
have 5:"q*((p^2) - (2*p*q) + (q^2))
                   = (p^2)*q - 2*p*(q^2) + (q^3)"
[PROOF STATE]
proof (prove)
using this:
rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times q (p\<^sup>2) - rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q)) (rat_poly_times q (q\<^sup>2))
rat_poly_times q (p\<^sup>2) = rat_poly_times (p\<^sup>2) q
rat_poly_times q (rat_poly_times (rat_poly_times 2 p) q) = rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)

goal (1 subgoal):
 1. rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)
[PROOF STEP]
by (metis One_nat_def Suc_1 numeral_3_eq_3 power_Suc)
[PROOF STATE]
proof (state)
this:
rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
with 1 2 3 4
[PROOF STATE]
proof (chain)
picking this:
(p - q) ^ 3 = rat_poly_times (p - q) ((p - q)\<^sup>2)
rat_poly_times (p - q) ((p - q)\<^sup>2) = rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) - rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2))
rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)
[PROOF STEP]
have "(p - q)^3
                      = (p^3) - (2*(p^2)*q) + (p*(q^2))
                          - ((p^2)*q - 2*p*(q^2) + (q^3))"
[PROOF STATE]
proof (prove)
using this:
(p - q) ^ 3 = rat_poly_times (p - q) ((p - q)\<^sup>2)
rat_poly_times (p - q) ((p - q)\<^sup>2) = rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
rat_poly_times (p - q) (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) - rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2))
rat_poly_times p (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2))
rat_poly_times q (rat_poly_plus (p\<^sup>2 - rat_poly_times (rat_poly_times 2 p) q) (q\<^sup>2)) = rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)

goal (1 subgoal):
 1. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have "... = (p^3) - (2*(p^2)*q) + (p*(q^2))
                     - (p^2)*q + 2*p*(q^2) - (q^3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3) = rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3) = rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3) = rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
have "... = (p^3) - 3*(p^2)*(q) + 3*(p)*(q^2) - (q^3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3

goal (1 subgoal):
 1. \<And>p q. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)
rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3) = rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3
rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
show
    "(p - q) ^ 3
        = rat_poly_plus (p ^ 3 -
                          rat_poly_times
                              (rat_poly_times 3 (p\<^sup>2)) q)
                              (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2))
                                                               - q ^ 3"
[PROOF STATE]
proof (prove)
using this:
(p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3)
rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_plus (rat_poly_times (p\<^sup>2) q - rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) (q ^ 3) = rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3
rat_poly_plus (rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 2 (p\<^sup>2)) q) (rat_poly_times p (q\<^sup>2)) - rat_poly_times (p\<^sup>2) q) (rat_poly_times (rat_poly_times 2 p) (q\<^sup>2)) - q ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3

goal (1 subgoal):
 1. (p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p - q) ^ 3 = rat_poly_plus (p ^ 3 - rat_poly_times (rat_poly_times 3 (p\<^sup>2)) q) (rat_poly_times (rat_poly_times 3 p) (q\<^sup>2)) - q ^ 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiset_filter_mono2: \<open>filter_mset P A \<subseteq># filter_mset Q A \<longleftrightarrow> (\<forall>a\<in>#A. P a \<longrightarrow> Q a)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filter_mset P A \<subseteq># filter_mset Q A) = (\<forall>a\<in>#A. P a \<longrightarrow> Q a)
[PROOF STEP]
by (induction A) (auto intro: subset_mset.trans)


[STATEMENT]
lemma implements_trans:
  "\<lbrakk> implements pi1 S1 S2; implements pi2 S2 S3 \<rbrakk>
  \<Longrightarrow> implements (pi1 o pi2) S1 S3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>implements pi1 S1 S2; implements pi2 S2 S3\<rbrakk> \<Longrightarrow> implements (pi1 \<circ> pi2) S1 S3
[PROOF STEP]
by (fastforce simp add: implements_def image_subset_iff)


[STATEMENT]
lemma continuous_power' [continuous_intros]:
  fixes f :: "_ \<Rightarrow> 'b::topological_monoid_mult"
  shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. f x ^ g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. f x ^ g x)
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F; (g \<longlongrightarrow> g (Lim F (\<lambda>x. x))) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x ^ g x) \<longlongrightarrow> f (Lim F (\<lambda>x. x)) ^ g (Lim F (\<lambda>x. x))) F
[PROOF STEP]
by (rule tendsto_power_strong) auto


[STATEMENT]
lemma bij_betw_compose: "bij_betw f A B \<Longrightarrow> bij_betw g B C \<Longrightarrow> bij_betw (compose A g f) A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij_betw f A B; bij_betw g B C\<rbrakk> \<Longrightarrow> bij_betw (compose A g f) A C
[PROOF STEP]
apply (simp add: bij_betw_def compose_eq inj_on_compose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A \<and> f ` A = B; inj_on g B \<and> g ` B = C\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) ` A = C
[PROOF STEP]
apply (auto simp add: compose_def image_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma floorlog_geI:
  "w \<le> floorlog b x" if "b ^ (w - 1) \<le> x" "b > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<le> floorlog b x
[PROOF STEP]
using floorlog_ge_SucI[of b "w - 1" x] that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b ^ (w - 1) \<le> x; 1 < b\<rbrakk> \<Longrightarrow> Suc (w - 1) \<le> floorlog b x
b ^ (w - 1) \<le> x
1 < b

goal (1 subgoal):
 1. w \<le> floorlog b x
[PROOF STEP]
by auto


[STATEMENT]
lemma unwrapExist'' : "eval (ExN (i + j) A) L = eval (ExN i(ExN j A)) L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (ExN (i + j) A) L = eval (ExN i (ExN j A)) L
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>l. length l = i + j \<and> eval A (l @ L)) = (\<exists>l. length l = i \<and> (\<exists>la. length la = j \<and> eval A (la @ l @ L)))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>l. \<lbrakk>length l = i + j; eval A (l @ L)\<rbrakk> \<Longrightarrow> \<exists>l. length l = i \<and> (\<exists>la. length la = j \<and> eval A (la @ l @ L))
 2. \<And>l la. \<lbrakk>i = length l; eval A (la @ l @ L); j = length la\<rbrakk> \<Longrightarrow> \<exists>lb. length lb = length l + length la \<and> eval A (lb @ L)
[PROOF STEP]
subgoal for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = i + j; eval A (l @ L)\<rbrakk> \<Longrightarrow> \<exists>l. length l = i \<and> (\<exists>la. length la = j \<and> eval A (la @ l @ L))
[PROOF STEP]
apply(rule exI[where x="drop j l"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = i + j; eval A (l @ L)\<rbrakk> \<Longrightarrow> length (drop j l) = i \<and> (\<exists>la. length la = j \<and> eval A (la @ drop j l @ L))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = i + j; eval A (l @ L)\<rbrakk> \<Longrightarrow> \<exists>la. length la = j \<and> eval A (la @ drop j l @ L)
[PROOF STEP]
apply(rule exI[where x="take j l"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = i + j; eval A (l @ L)\<rbrakk> \<Longrightarrow> length (take j l) = j \<and> eval A (take j l @ drop j l @ L)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length l = i + j; eval A (l @ L)\<rbrakk> \<Longrightarrow> eval A (take j l @ drop j l @ L)
[PROOF STEP]
by (metis append.assoc append_take_drop_id)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l la. \<lbrakk>i = length l; eval A (la @ l @ L); j = length la\<rbrakk> \<Longrightarrow> \<exists>lb. length lb = length l + length la \<and> eval A (lb @ L)
[PROOF STEP]
subgoal for l la
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i = length l; eval A (la @ l @ L); j = length la\<rbrakk> \<Longrightarrow> \<exists>lb. length lb = length l + length la \<and> eval A (lb @ L)
[PROOF STEP]
apply(rule exI[where x="la@l"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i = length l; eval A (la @ l @ L); j = length la\<rbrakk> \<Longrightarrow> length (la @ l) = length l + length la \<and> eval A ((la @ l) @ L)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma integrable_add: "f integrable_on S \<Longrightarrow> g integrable_on S \<Longrightarrow> (\<lambda>x. f x + g x) integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f integrable_on S; g integrable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. f x + g x) integrable_on S
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>y. (f has_integral y) S; \<exists>y. (g has_integral y) S\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. f x + g x) has_integral y) S
[PROOF STEP]
by(auto intro: has_integral_add)


[STATEMENT]
lemma ring_hom_ringI3:
  fixes R (structure) and S (structure)
  assumes "abelian_group_hom R S h" "ring R" "ring S"
  assumes compatible_mult: "\<And>x y. [| x \<in> carrier R; y \<in> carrier R |] ==> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y"
      and compatible_one: "h \<one> = \<one>\<^bsub>S\<^esub>"
  shows "ring_hom_ring R S h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_ring R S h
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ring_hom_ring R S h
[PROOF STEP]
interpret abelian_group_hom R S h
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abelian_group_hom R S h
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ring_hom_ring R S h
[PROOF STEP]
interpret R: ring R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring R
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ring_hom_ring R S h
[PROOF STEP]
interpret S: ring S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring S
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ring_hom_ring R S h
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_ring R S h
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h \<in> ring_hom R S
[PROOF STEP]
show "h \<in> ring_hom R S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<in> ring_hom R S
[PROOF STEP]
unfolding ring_hom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<in> {h \<in> carrier R \<rightarrow> carrier S. (\<forall>x y. x \<in> carrier R \<and> y \<in> carrier R \<longrightarrow> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y \<and> h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y) \<and> h \<one> = \<one>\<^bsub>S\<^esub>}
[PROOF STEP]
by (auto simp: compatible_one compatible_mult)
[PROOF STATE]
proof (state)
this:
h \<in> ring_hom R S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ring_hom_ring R S h

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hom_kernel_dim[simp]: "kernel_dim (mat\<^sub>h A) = kernel_dim A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel_dim (mat\<^sub>h A) = kernel_dim A
[PROOF STEP]
unfolding kernel_dim_code
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (mat\<^sub>h A) - length (pivot_positions (gauss_jordan_single (mat\<^sub>h A))) = dim_col A - length (pivot_positions (gauss_jordan_single A))
[PROOF STEP]
by simp


[STATEMENT]
lemma r01_binary_expression_ex0_strong:
  assumes "0 < r" "r < 1"
  shows "\<exists>i\<ge>n. r01_binary_expansion' r i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i\<ge>n. r01_binary_expansion' r i = 0
[PROOF STEP]
proof(cases "r01_binary_expansion'' r n")
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b c. r01_binary_expansion'' r n = (a, b, c) \<Longrightarrow> \<exists>i\<ge>n. r01_binary_expansion' r i = 0
[PROOF STEP]
case 1:(fields a ur lr)
[PROOF STATE]
proof (state)
this:
r01_binary_expansion'' r n = (a, ur, lr)

goal (1 subgoal):
 1. \<And>a b c. r01_binary_expansion'' r n = (a, b, c) \<Longrightarrow> \<exists>i\<ge>n. r01_binary_expansion' r i = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i\<ge>n. r01_binary_expansion' r i = 0
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0)"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0)

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0)
[PROOF STEP]
have h:"\<forall>i\<ge>n. r01_binary_expansion' r i = 1"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0)

goal (1 subgoal):
 1. \<forall>i\<ge>n. r01_binary_expansion' r i = 1
[PROOF STEP]
using real01_binary_expansion'_0or1[of r]
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0)
r01_binary_expansion' r ?n \<in> {0, 1}

goal (1 subgoal):
 1. \<forall>i\<ge>n. r01_binary_expansion' r i = 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>i\<ge>n. r01_binary_expansion' r i = 1

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
have "r = (\<Sum>i=0..n. real (r01_binary_expansion' r i) * ((1/2)^(Suc i))) + (\<Sum>i::nat. real (r01_binary_expansion' r (i + (Suc n))) * ((1/2)^(Suc (i + (Suc n)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
have "r = (\<Sum>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r = (\<Sum>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l)
[PROOF STEP]
using r01_binary_expression_correct[of r] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < r; r < 1\<rbrakk> \<Longrightarrow> r = (\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n)
0 < r
r < 1

goal (1 subgoal):
 1. r = (\<Sum>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r = (\<Sum>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l)

goal (1 subgoal):
 1. r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r = (\<Sum>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l)

goal (1 subgoal):
 1. r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
have "... = (\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l) = (\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i)
[PROOF STEP]
apply(rule suminf_split_initial_segment)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l)
[PROOF STEP]
apply(rule binary_expression_summable)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. r01_binary_expansion' r l \<in> {0, 1}
[PROOF STEP]
using real01_binary_expansion'_0or1[of r]
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion' r ?n \<in> {0, 1}

goal (1 subgoal):
 1. \<And>l. r01_binary_expansion' r l \<in> {0, 1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l) = (\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i)

goal (1 subgoal):
 1. r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>l. real (r01_binary_expansion' r l) * (1 / 2) ^ Suc l) = (\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i)

goal (1 subgoal):
 1. r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
have "... = (\<Sum>i=0..n. real (r01_binary_expansion' r i) * ((1/2)^(Suc i))) + (\<Sum>i::nat. real (r01_binary_expansion' r (i + (Suc n))) * ((1/2)^(Suc (i + (Suc n)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
have "\<And>n. {..<Suc n} = {0..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. {..<Suc n} = {0..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..<Suc ?n} = {0..?n}

goal (1 subgoal):
 1. (\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{..<Suc ?n} = {0..?n}

goal (1 subgoal):
 1. (\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>l. real (r01_binary_expansion' r (l + Suc n)) * (1 / 2) ^ Suc (l + Suc n)) + (\<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))

goal (1 subgoal):
 1. r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))

goal (1 subgoal):
 1. r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
r = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n))

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
have "... = (\<Sum>i=0..n. real (r01_binary_expansion' r i) * ((1/2)^(Suc i))) + (\<Sum>i::nat. ((1/2)^(Suc (i + (Suc n)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n)) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<ge>n. r01_binary_expansion' r i = 1

goal (1 subgoal):
 1. (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n)) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. (1 / 2) ^ Suc (i + Suc n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n)) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. (1 / 2) ^ Suc (i + Suc n))

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. real (r01_binary_expansion' r (i + Suc n)) * (1 / 2) ^ Suc (i + Suc n)) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. (1 / 2) ^ Suc (i + Suc n))

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
have "... = (\<Sum>i=0..n. real (r01_binary_expansion' r i) * ((1/2)^(Suc i))) + (1/2)^(Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. (1 / 2) ^ Suc (i + Suc n)) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (1 / 2) ^ Suc n
[PROOF STEP]
using half_sum[of "Suc n"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>na. (1 / 2) ^ Suc (na + Suc n)) = (1 / 2) ^ Suc n

goal (1 subgoal):
 1. (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. (1 / 2) ^ Suc (i + Suc n)) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (1 / 2) ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. (1 / 2) ^ Suc (i + Suc n)) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (1 / 2) ^ Suc n

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (\<Sum>i. (1 / 2) ^ Suc (i + Suc n)) = (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (1 / 2) ^ Suc n

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
have "... = lr + (1/2)^(Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (1 / 2) ^ Suc n = lr + (1 / 2) ^ Suc n
[PROOF STEP]
using 1 r01_binary_expression_eq_lr[of r n]
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion'' r n = (a, ur, lr)
snd (snd (r01_binary_expansion'' r n)) = r01_binary_expression r n

goal (1 subgoal):
 1. (\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (1 / 2) ^ Suc n = lr + (1 / 2) ^ Suc n
[PROOF STEP]
by(simp add: r01_binary_expression_def r01_binary_sum_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (1 / 2) ^ Suc n = lr + (1 / 2) ^ Suc n

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) + (1 / 2) ^ Suc n = lr + (1 / 2) ^ Suc n

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
have "... = ur"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lr + (1 / 2) ^ Suc n = ur
[PROOF STEP]
using r01_binary_expansion_diff[of r n]
[PROOF STATE]
proof (prove)
using this:
fst (snd (r01_binary_expansion'' r n)) - snd (snd (r01_binary_expansion'' r n)) = (1 / 2) ^ Suc n

goal (1 subgoal):
 1. lr + (1 / 2) ^ Suc n = ur
[PROOF STEP]
by(simp add: 1)
[PROOF STATE]
proof (state)
this:
lr + (1 / 2) ^ Suc n = ur

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
r = ur
[PROOF STEP]
have "r = ur"
[PROOF STATE]
proof (prove)
using this:
r = ur

goal (1 subgoal):
 1. r = ur
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
r = ur

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r = ur

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
have "r < ur"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r < ur
[PROOF STEP]
using r01_binary_expansion_lr_r_ur[of r n] assms 1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < r; r < 1\<rbrakk> \<Longrightarrow> snd (snd (r01_binary_expansion'' r n)) \<le> r \<and> r < fst (snd (r01_binary_expansion'' r n))
0 < r
r < 1
r01_binary_expansion'' r n = (a, ur, lr)

goal (1 subgoal):
 1. r < ur
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r < ur

goal (1 subgoal):
 1. \<not> (\<exists>i\<ge>n. r01_binary_expansion' r i = 0) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r = ur
r < ur
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
r = ur
r < ur

goal (1 subgoal):
 1. False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>i\<ge>n. r01_binary_expansion' r i = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diameter_lower_bounded:
  fixes S :: "'a :: metric_space set"
  assumes S: "bounded S"
    and d: "0 < d" "d < diameter S"
  shows "\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. d < dist x y
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y) \<Longrightarrow> False
[PROOF STEP]
assume contr: "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y)

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y)

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y) \<Longrightarrow> False
[PROOF STEP]
have "S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<noteq> {}
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
0 < d
d < diameter S

goal (1 subgoal):
 1. S \<noteq> {}
[PROOF STEP]
by (auto simp: diameter_def)
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y)
S \<noteq> {}
[PROOF STEP]
have "diameter S \<le> d"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y)
S \<noteq> {}

goal (1 subgoal):
 1. diameter S \<le> d
[PROOF STEP]
by (auto simp: not_less diameter_def intro!: cSUP_least)
[PROOF STATE]
proof (state)
this:
diameter S \<le> d

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y) \<Longrightarrow> False
[PROOF STEP]
with \<open>d < diameter S\<close>
[PROOF STATE]
proof (chain)
picking this:
d < diameter S
diameter S \<le> d
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
d < diameter S
diameter S \<le> d

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quat_inner_j_left [simp]: "inner \<j> x = Im2 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<j> \<bullet> x = Im2 x
[PROOF STEP]
unfolding inner_quat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quat.Re \<j> * quat.Re x + Im1 \<j> * Im1 x + Im2 \<j> * Im2 x + Im3 \<j> * Im3 x = Im2 x
[PROOF STEP]
by simp


[STATEMENT]
lemma poly_roots_prod_list:
  assumes "0 \<notin> set xs"
  shows   "poly_roots (prod_list xs) = sum_list (map poly_roots xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (prod_list xs) = sum_list (map poly_roots xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<notin> set xs

goal (1 subgoal):
 1. poly_roots (prod_list xs) = sum_list (map poly_roots xs)
[PROOF STEP]
by (induction xs) (auto simp: poly_roots_mult)


[STATEMENT]
lemma cross_ratio_swap_12:
  assumes "cross_ratio_correct p q r s" and "cross_ratio_correct q p r s"
  shows "cross_ratio q p r s = 1 / (cross_ratio p q r s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
 2. \<not> ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
assume "r = s"
[PROOF STATE]
proof (state)
this:
r = s

goal (2 subgoals):
 1. ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
 2. \<not> ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
from \<open>cross_ratio_correct p q r s\<close>
[PROOF STATE]
proof (chain)
picking this:
cross_ratio_correct p q r s
[PROOF STEP]
have "proj2_set_Col {p,q,r,s}" and "p \<noteq> q" and "r \<noteq> p" and "r \<noteq> q"
[PROOF STATE]
proof (prove)
using this:
cross_ratio_correct p q r s

goal (1 subgoal):
 1. (proj2_set_Col {p, q, r, s} &&& p \<noteq> q) &&& r \<noteq> p &&& r \<noteq> q
[PROOF STEP]
by (unfold cross_ratio_correct_def) simp_all
[PROOF STATE]
proof (state)
this:
proj2_set_Col {p, q, r, s}
p \<noteq> q
r \<noteq> p
r \<noteq> q

goal (2 subgoals):
 1. ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
 2. \<not> ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
from \<open>proj2_set_Col {p,q,r,s}\<close> and \<open>r = s\<close>
[PROOF STATE]
proof (chain)
picking this:
proj2_set_Col {p, q, r, s}
r = s
[PROOF STEP]
have "proj2_Col p q r"
[PROOF STATE]
proof (prove)
using this:
proj2_set_Col {p, q, r, s}
r = s

goal (1 subgoal):
 1. proj2_Col p q r
[PROOF STEP]
by (simp_all add: proj2_Col_iff_set_Col)
[PROOF STATE]
proof (state)
this:
proj2_Col p q r

goal (2 subgoals):
 1. ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
 2. \<not> ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
hence "proj2_Col q p r"
[PROOF STATE]
proof (prove)
using this:
proj2_Col p q r

goal (1 subgoal):
 1. proj2_Col q p r
[PROOF STEP]
by (rule proj2_Col_permute)
[PROOF STATE]
proof (state)
this:
proj2_Col q p r

goal (2 subgoals):
 1. ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
 2. \<not> ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
with \<open>proj2_Col p q r\<close> and \<open>p \<noteq> q\<close> and \<open>r \<noteq> p\<close> and \<open>r \<noteq> q\<close> and \<open>r = s\<close>
[PROOF STATE]
proof (chain)
picking this:
proj2_Col p q r
p \<noteq> q
r \<noteq> p
r \<noteq> q
r = s
proj2_Col q p r
[PROOF STEP]
have "cross_ratio p q r s = 1" and "cross_ratio q p r s = 1"
[PROOF STATE]
proof (prove)
using this:
proj2_Col p q r
p \<noteq> q
r \<noteq> p
r \<noteq> q
r = s
proj2_Col q p r

goal (1 subgoal):
 1. cross_ratio p q r s = 1 &&& cross_ratio q p r s = 1
[PROOF STEP]
by (simp_all add: cross_ratio_equal_1)
[PROOF STATE]
proof (state)
this:
cross_ratio p q r s = 1
cross_ratio q p r s = 1

goal (2 subgoals):
 1. ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
 2. \<not> ?P \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
thus "cross_ratio q p r s = 1 / (cross_ratio p q r s)"
[PROOF STATE]
proof (prove)
using this:
cross_ratio p q r s = 1
cross_ratio q p r s = 1

goal (1 subgoal):
 1. cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cross_ratio q p r s = 1 / cross_ratio p q r s

goal (1 subgoal):
 1. r \<noteq> s \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<noteq> s \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
assume "r \<noteq> s"
[PROOF STATE]
proof (state)
this:
r \<noteq> s

goal (1 subgoal):
 1. r \<noteq> s \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
with \<open>cross_ratio_correct q p r s\<close>
[PROOF STATE]
proof (chain)
picking this:
cross_ratio_correct q p r s
r \<noteq> s
[PROOF STEP]
have "cross_ratio q p r s = cross_ratio r s q p"
[PROOF STATE]
proof (prove)
using this:
cross_ratio_correct q p r s
r \<noteq> s

goal (1 subgoal):
 1. cross_ratio q p r s = cross_ratio r s q p
[PROOF STEP]
by (simp add: cross_ratio_swap_13_24)
[PROOF STATE]
proof (state)
this:
cross_ratio q p r s = cross_ratio r s q p

goal (1 subgoal):
 1. r \<noteq> s \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cross_ratio q p r s = cross_ratio r s q p

goal (1 subgoal):
 1. r \<noteq> s \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
have "\<dots> = 1 / (cross_ratio r s p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cross_ratio r s q p = 1 / cross_ratio r s p q
[PROOF STEP]
by (rule cross_ratio_swap_34)
[PROOF STATE]
proof (state)
this:
cross_ratio r s q p = 1 / cross_ratio r s p q

goal (1 subgoal):
 1. r \<noteq> s \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cross_ratio r s q p = 1 / cross_ratio r s p q

goal (1 subgoal):
 1. r \<noteq> s \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
from \<open>cross_ratio_correct p q r s\<close> and \<open>r \<noteq> s\<close>
[PROOF STATE]
proof (chain)
picking this:
cross_ratio_correct p q r s
r \<noteq> s
[PROOF STEP]
have "\<dots> = 1 / (cross_ratio p q r s)"
[PROOF STATE]
proof (prove)
using this:
cross_ratio_correct p q r s
r \<noteq> s

goal (1 subgoal):
 1. 1 / cross_ratio r s p q = 1 / cross_ratio p q r s
[PROOF STEP]
by (simp add: cross_ratio_swap_13_24)
[PROOF STATE]
proof (state)
this:
1 / cross_ratio r s p q = 1 / cross_ratio p q r s

goal (1 subgoal):
 1. r \<noteq> s \<Longrightarrow> cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
show "cross_ratio q p r s = 1 / (cross_ratio p q r s)"
[PROOF STATE]
proof (prove)
using this:
cross_ratio q p r s = 1 / cross_ratio p q r s

goal (1 subgoal):
 1. cross_ratio q p r s = 1 / cross_ratio p q r s
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cross_ratio q p r s = 1 / cross_ratio p q r s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_rep: "sum (rep_nat \<circ> f) A = rep_nat (sum f A)" for f :: "'b \<Rightarrow> 'a" and A :: "'b set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (rep_nat \<circ> f) A = rep_nat (sum f A)
[PROOF STEP]
proof (induct A rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> sum (rep_nat \<circ> f) A = rep_nat (sum f A)
 2. sum (rep_nat \<circ> f) {} = rep_nat (sum f {})
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum (rep_nat \<circ> f) F = rep_nat (sum f F)\<rbrakk> \<Longrightarrow> sum (rep_nat \<circ> f) (insert x F) = rep_nat (sum f (insert x F))
[PROOF STEP]
case (infinite A)
[PROOF STATE]
proof (state)
this:
infinite A

goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> sum (rep_nat \<circ> f) A = rep_nat (sum f A)
 2. sum (rep_nat \<circ> f) {} = rep_nat (sum f {})
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum (rep_nat \<circ> f) F = rep_nat (sum f F)\<rbrakk> \<Longrightarrow> sum (rep_nat \<circ> f) (insert x F) = rep_nat (sum f (insert x F))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. sum (rep_nat \<circ> f) A = rep_nat (sum f A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum (rep_nat \<circ> f) A = rep_nat (sum f A)

goal (2 subgoals):
 1. sum (rep_nat \<circ> f) {} = rep_nat (sum f {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum (rep_nat \<circ> f) F = rep_nat (sum f F)\<rbrakk> \<Longrightarrow> sum (rep_nat \<circ> f) (insert x F) = rep_nat (sum f (insert x F))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum (rep_nat \<circ> f) {} = rep_nat (sum f {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum (rep_nat \<circ> f) F = rep_nat (sum f F)\<rbrakk> \<Longrightarrow> sum (rep_nat \<circ> f) (insert x F) = rep_nat (sum f (insert x F))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. sum (rep_nat \<circ> f) {} = rep_nat (sum f {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum (rep_nat \<circ> f) F = rep_nat (sum f F)\<rbrakk> \<Longrightarrow> sum (rep_nat \<circ> f) (insert x F) = rep_nat (sum f (insert x F))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (rep_nat \<circ> f) {} = rep_nat (sum f {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum (rep_nat \<circ> f) {} = rep_nat (sum f {})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum (rep_nat \<circ> f) F = rep_nat (sum f F)\<rbrakk> \<Longrightarrow> sum (rep_nat \<circ> f) (insert x F) = rep_nat (sum f (insert x F))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum (rep_nat \<circ> f) F = rep_nat (sum f F)\<rbrakk> \<Longrightarrow> sum (rep_nat \<circ> f) (insert x F) = rep_nat (sum f (insert x F))
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
sum (rep_nat \<circ> f) A = rep_nat (sum f A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum (rep_nat \<circ> f) F = rep_nat (sum f F)\<rbrakk> \<Longrightarrow> sum (rep_nat \<circ> f) (insert x F) = rep_nat (sum f (insert x F))
[PROOF STEP]
from insert(1, 2)
[PROOF STATE]
proof (chain)
picking this:
finite A
a \<notin> A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A

goal (1 subgoal):
 1. sum (rep_nat \<circ> f) (insert a A) = rep_nat (sum f (insert a A))
[PROOF STEP]
by (simp del: comp_apply add: insert(3) rep_plus, simp)
[PROOF STATE]
proof (state)
this:
sum (rep_nat \<circ> f) (insert a A) = rep_nat (sum f (insert a A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma string_infinite:
  "infinite (UNIV :: string set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
apply(simp add: infinite_iff_countable_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. inj f
[PROOF STEP]
apply(rule_tac x = "\<lambda>n. replicate n c" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>n. replicate n c)
[PROOF STEP]
apply(rule linorder_injI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. x < y \<Longrightarrow> replicate x c \<noteq> replicate y c
[PROOF STEP]
apply(clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x < y; replicate x c = replicate y c\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply(frule replicate_eq_length)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x < y; replicate x c = replicate y c; x = y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in gram_schmidt_fs_Rn) Gramian_matrix_alt_alt_def:
  assumes "k \<le> m"
  shows "Gramian_matrix fs k = mat k k (\<lambda>(i,j). fs ! i \<bullet> fs ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gramian_matrix fs k = mat k k (\<lambda>(i, j). fs ! i \<bullet> fs ! j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Gramian_matrix fs k = mat k k (\<lambda>(i, j). fs ! i \<bullet> fs ! j)
[PROOF STEP]
have *: "vec n (($) (fs ! i)) = fs ! i" if "i < m" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (($) (fs ! i)) = fs ! i
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
i < length fs

goal (1 subgoal):
 1. vec n (($) (fs ! i)) = fs ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i1 < length fs \<Longrightarrow> vec n (($) (fs ! ?i1)) = fs ! ?i1

goal (1 subgoal):
 1. Gramian_matrix fs k = mat k k (\<lambda>(i, j). fs ! i \<bullet> fs ! j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i1 < length fs \<Longrightarrow> vec n (($) (fs ! ?i1)) = fs ! ?i1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i1 < length fs \<Longrightarrow> vec n (($) (fs ! ?i1)) = fs ! ?i1

goal (1 subgoal):
 1. Gramian_matrix fs k = mat k k (\<lambda>(i, j). fs ! i \<bullet> fs ! j)
[PROOF STEP]
unfolding Gramian_matrix_def
[PROOF STATE]
proof (prove)
using this:
?i1 < length fs \<Longrightarrow> vec n (($) (fs ! ?i1)) = fs ! ?i1

goal (1 subgoal):
 1. (let M = mat k n (\<lambda>(i, y). fs ! i $ y) in M * M\<^sup>T) = mat k k (\<lambda>(i, j). fs ! i \<bullet> fs ! j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i1 < length fs \<Longrightarrow> vec n (($) (fs ! ?i1)) = fs ! ?i1
k \<le> length fs

goal (1 subgoal):
 1. (let M = mat k n (\<lambda>(i, y). fs ! i $ y) in M * M\<^sup>T) = mat k k (\<lambda>(i, j). fs ! i \<bullet> fs ! j)
[PROOF STEP]
by (intro eq_matI) (auto simp add: Let_def)
[PROOF STATE]
proof (state)
this:
Gramian_matrix fs k = mat k k (\<lambda>(i, j). fs ! i \<bullet> fs ! j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_suntil: "(\<not> (p suntil q) \<omega>) = (\<not> (p until q) \<omega> \<or> alw (not q) \<omega>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (p suntil q) \<omega>) = (\<not> (p until q) \<omega> \<or> alw (\<lambda>xs. \<not> q xs) \<omega>)
[PROOF STEP]
by (simp add: suntil_as_until alw_iff_sdrop ev_iff_sdrop)


[STATEMENT]
lemma reconstruct_prod:
  shows "reconstruct_poly (a::complex) as * reconstruct_poly b bs
        = reconstruct_poly (a * b) (as @ bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reconstruct_poly a as * reconstruct_poly b bs = reconstruct_poly (a * b) (as @ bs)
[PROOF STEP]
unfolding reconstruct_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult a (\<Prod>a\<leftarrow>as. [:- a, 1:]) * Polynomial.smult b (\<Prod>a\<leftarrow>bs. [:- a, 1:]) = Polynomial.smult (a * b) (\<Prod>a\<leftarrow>as @ bs. [:- a, 1:])
[PROOF STEP]
by auto


[STATEMENT]
lemma transpose_mat_eq[simp]: "A\<^sup>T = B\<^sup>T \<longleftrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A\<^sup>T = B\<^sup>T) = (A = B)
[PROOF STEP]
using transpose_transpose
[PROOF STATE]
proof (prove)
using this:
?A\<^sup>T\<^sup>T = ?A

goal (1 subgoal):
 1. (A\<^sup>T = B\<^sup>T) = (A = B)
[PROOF STEP]
by metis


[STATEMENT]
lemma powerset_lift_union[simp]:
  "\<^ps>f\<cdot>(A \<union> B) = \<^ps>f\<cdot>A \<union> \<^ps>f\<cdot>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^ps> f\<cdot>(A \<union> B) = \<^ps> f\<cdot>A \<union> \<^ps> f\<cdot>B
[PROOF STEP]
unfolding powerset_lift_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Lambda> S. \<Union> (Rep_cfun f ` S))\<cdot>(A \<union> B) = (\<Lambda> S. \<Union> (Rep_cfun f ` S))\<cdot>A \<union> (\<Lambda> S. \<Union> (Rep_cfun f ` S))\<cdot>B
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_subset_implies_one: "I \<subseteq> {..< \<v>} \<Longrightarrow> j < \<b> \<Longrightarrow> (!) \<V>s ` I \<subseteq> \<B>s ! j \<Longrightarrow> i \<in> I \<Longrightarrow>
  N $$ (i, j) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<subseteq> {..<\<v>}; j < \<b>; (!) \<V>s ` I \<subseteq> \<B>s ! j; i \<in> I\<rbrakk> \<Longrightarrow> N $$ (i, j) = 1
[PROOF STEP]
by (metis blocks_list_length points_list_length inc_matrix_subset_implies_one)


[STATEMENT]
lemma path_is_step: "lts.path c p c' \<Longrightarrow> (c, c') \<in> step\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lts.path c p c' \<Longrightarrow> (c, c') \<in> step\<^sup>*
[PROOF STEP]
unfolding step_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lts.path c p c' \<Longrightarrow> (c, c') \<in> {(c, c'). \<exists>a. astep c a c'}\<^sup>*
[PROOF STEP]
apply (induction p arbitrary: c)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>c. lts.path c [] c' \<Longrightarrow> (c, c') \<in> {(c, c'). \<exists>a. astep c a c'}\<^sup>*
 2. \<And>a p c. \<lbrakk>\<And>c. lts.path c p c' \<Longrightarrow> (c, c') \<in> {(c, c'). \<exists>a. astep c a c'}\<^sup>*; lts.path c (a # p) c'\<rbrakk> \<Longrightarrow> (c, c') \<in> {(c, c'). \<exists>a. astep c a c'}\<^sup>*
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p c sh. \<lbrakk>\<And>c. lts.path c p c' \<Longrightarrow> (c, c') \<in> {(c, c'). \<exists>a. astep c a c'}\<^sup>*; astep c a sh; lts.path sh p c'\<rbrakk> \<Longrightarrow> (c, c') \<in> {(c, c'). \<exists>a. astep c a c'}\<^sup>*
[PROOF STEP]
by (metis (mono_tags, lifting) case_prod_conv converse_rtrancl_into_rtrancl mem_Collect_eq)


[STATEMENT]
lemma codegree_bipartite_eq:
  "\<forall> x \<in> X. \<forall> x' \<in> X. codegree x x' = card {y \<in> Y. vert_adj x y \<and> vert_adj x' y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>X. \<forall>x'\<in>X. codegree x x' = card {y \<in> Y. vert_adj x y \<and> vert_adj x' y}
[PROOF STEP]
unfolding codegree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>X. \<forall>x'\<in>X. card {xa \<in> V. vert_adj x xa \<and> vert_adj x' xa} = card {y \<in> Y. vert_adj x y \<and> vert_adj x' y}
[PROOF STEP]
using vert_adj_imp_inV X_vert_adj_Y
[PROOF STATE]
proof (prove)
using this:
vert_adj ?v1.0 ?v2.0 \<Longrightarrow> ?v1.0 \<in> V \<and> ?v2.0 \<in> V
\<lbrakk>?x \<in> X; vert_adj ?x ?y\<rbrakk> \<Longrightarrow> ?y \<in> Y

goal (1 subgoal):
 1. \<forall>x\<in>X. \<forall>x'\<in>X. card {xa \<in> V. vert_adj x xa \<and> vert_adj x' xa} = card {y \<in> Y. vert_adj x y \<and> vert_adj x' y}
[PROOF STEP]
by (metis (no_types, lifting) Collect_cong)


[STATEMENT]
lemma is_interval_uminus[simp]: "is_interval (uminus ` x) = is_interval x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_interval (uminus ` x) = is_interval x
[PROOF STEP]
using is_interval_uminusI[of x] is_interval_uminusI[of "uminus ` x"]
[PROOF STATE]
proof (prove)
using this:
is_interval x \<Longrightarrow> is_interval (uminus ` x)
is_interval (uminus ` x) \<Longrightarrow> is_interval (uminus ` uminus ` x)

goal (1 subgoal):
 1. is_interval (uminus ` x) = is_interval x
[PROOF STEP]
by (auto simp: image_image)


[STATEMENT]
lemma has_integral_I0: "((\<lambda>x. x powr (-(1/2)) * sqrt (4 - x)) has_integral 2*pi) {0..4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr - (1 / 2) * sqrt (4 - x)) has_integral 2 * pi) {0..4}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. x powr - (1 / 2) * sqrt (4 - x)) has_integral 2 * pi) {0..4}
[PROOF STEP]
have "\<And>x. x\<in>{0..4}-{} \<Longrightarrow> x powr (-(1/2)) * sqrt (4 - x) = sqrt ((4 - x) / x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..4} - {} \<Longrightarrow> x powr - (1 / 2) * sqrt (4 - x) = sqrt ((4 - x) / x)
[PROOF STEP]
by (auto simp: powr_minus field_simps powr_half_sqrt real_sqrt_divide)
[PROOF STATE]
proof (state)
this:
?x \<in> {0..4} - {} \<Longrightarrow> ?x powr - (1 / 2) * sqrt (4 - ?x) = sqrt ((4 - ?x) / ?x)

goal (1 subgoal):
 1. ((\<lambda>x. x powr - (1 / 2) * sqrt (4 - x)) has_integral 2 * pi) {0..4}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> {0..4} - {} \<Longrightarrow> ?x powr - (1 / 2) * sqrt (4 - ?x) = sqrt ((4 - ?x) / ?x)

goal (1 subgoal):
 1. ((\<lambda>x. x powr - (1 / 2) * sqrt (4 - x)) has_integral 2 * pi) {0..4}
[PROOF STEP]
by (rule has_integral_spike[OF negligible_empty _ catalan_aux_integral])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr - (1 / 2) * sqrt (4 - x)) has_integral 2 * pi) {0..4}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tensor_mat_positive:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "m2 \<in> carrier_mat d2 d2"
    and "positive m1"
    and "positive m2"
  shows "positive (tensor_mat m1 m2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
obtain M1 where M1: "m1 = M1 * adjoint M1" and dM1:"M1 \<in> carrier_mat d1 d1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>M1. \<lbrakk>m1 = M1 * adjoint M1; M1 \<in> carrier_mat d1 d1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using positive_only_if_decomp assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; positive ?A\<rbrakk> \<Longrightarrow> \<exists>M\<in>carrier_mat ?n ?n. M * adjoint M = ?A
m1 \<in> carrier_mat d1 d1
m2 \<in> carrier_mat d2 d2
positive m1
positive m2

goal (1 subgoal):
 1. (\<And>M1. \<lbrakk>m1 = M1 * adjoint M1; M1 \<in> carrier_mat d1 d1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m1 = M1 * adjoint M1
M1 \<in> carrier_mat d1 d1

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
obtain M2 where M2: "m2 = M2 * adjoint M2" and dM2:"M2 \<in> carrier_mat d2 d2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>M2. \<lbrakk>m2 = M2 * adjoint M2; M2 \<in> carrier_mat d2 d2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using positive_only_if_decomp assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; positive ?A\<rbrakk> \<Longrightarrow> \<exists>M\<in>carrier_mat ?n ?n. M * adjoint M = ?A
m1 \<in> carrier_mat d1 d1
m2 \<in> carrier_mat d2 d2
positive m1
positive m2

goal (1 subgoal):
 1. (\<And>M2. \<lbrakk>m2 = M2 * adjoint M2; M2 \<in> carrier_mat d2 d2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m2 = M2 * adjoint M2
M2 \<in> carrier_mat d2 d2

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
have "(adjoint (tensor_mat M1 M2)) = tensor_mat (adjoint M1) (adjoint M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (tensor_mat M1 M2) = tensor_mat (adjoint M1) (adjoint M2)
[PROOF STEP]
using tensor_mat_adjoint dM1 dM2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?m1.0 \<in> carrier_mat d1 d1; ?m2.0 \<in> carrier_mat d2 d2\<rbrakk> \<Longrightarrow> adjoint (tensor_mat ?m1.0 ?m2.0) = tensor_mat (adjoint ?m1.0) (adjoint ?m2.0)
M1 \<in> carrier_mat d1 d1
M2 \<in> carrier_mat d2 d2

goal (1 subgoal):
 1. adjoint (tensor_mat M1 M2) = tensor_mat (adjoint M1) (adjoint M2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint (tensor_mat M1 M2) = tensor_mat (adjoint M1) (adjoint M2)

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
adjoint (tensor_mat M1 M2) = tensor_mat (adjoint M1) (adjoint M2)
[PROOF STEP]
have "tensor_mat M1 M2 * (adjoint (tensor_mat M1 M2)) = tensor_mat (M1 * adjoint M1) (M2 * adjoint M2)"
[PROOF STATE]
proof (prove)
using this:
adjoint (tensor_mat M1 M2) = tensor_mat (adjoint M1) (adjoint M2)

goal (1 subgoal):
 1. tensor_mat M1 M2 * adjoint (tensor_mat M1 M2) = tensor_mat (M1 * adjoint M1) (M2 * adjoint M2)
[PROOF STEP]
using dM1 dM2 adjoint_dim[OF dM1] adjoint_dim[OF dM2]
[PROOF STATE]
proof (prove)
using this:
adjoint (tensor_mat M1 M2) = tensor_mat (adjoint M1) (adjoint M2)
M1 \<in> carrier_mat d1 d1
M2 \<in> carrier_mat d2 d2
adjoint M1 \<in> carrier_mat d1 d1
adjoint M2 \<in> carrier_mat d2 d2

goal (1 subgoal):
 1. tensor_mat M1 M2 * adjoint (tensor_mat M1 M2) = tensor_mat (M1 * adjoint M1) (M2 * adjoint M2)
[PROOF STEP]
by (auto simp add: tensor_mat_mult)
[PROOF STATE]
proof (state)
this:
tensor_mat M1 M2 * adjoint (tensor_mat M1 M2) = tensor_mat (M1 * adjoint M1) (M2 * adjoint M2)

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
tensor_mat M1 M2 * adjoint (tensor_mat M1 M2) = tensor_mat (M1 * adjoint M1) (M2 * adjoint M2)

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
have "\<dots> = tensor_mat m1 m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat (M1 * adjoint M1) (M2 * adjoint M2) = tensor_mat m1 m2
[PROOF STEP]
using M1 M2
[PROOF STATE]
proof (prove)
using this:
m1 = M1 * adjoint M1
m2 = M2 * adjoint M2

goal (1 subgoal):
 1. tensor_mat (M1 * adjoint M1) (M2 * adjoint M2) = tensor_mat m1 m2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
tensor_mat (M1 * adjoint M1) (M2 * adjoint M2) = tensor_mat m1 m2

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
tensor_mat M1 M2 * adjoint (tensor_mat M1 M2) = tensor_mat m1 m2
[PROOF STEP]
have "tensor_mat m1 m2 = tensor_mat M1 M2 * (adjoint (tensor_mat M1 M2))"
[PROOF STATE]
proof (prove)
using this:
tensor_mat M1 M2 * adjoint (tensor_mat M1 M2) = tensor_mat m1 m2

goal (1 subgoal):
 1. tensor_mat m1 m2 = tensor_mat M1 M2 * adjoint (tensor_mat M1 M2)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
tensor_mat m1 m2 = tensor_mat M1 M2 * adjoint (tensor_mat M1 M2)

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
tensor_mat m1 m2 = tensor_mat M1 M2 * adjoint (tensor_mat M1 M2)
[PROOF STEP]
have "\<exists>M. M * adjoint M = tensor_mat m1 m2"
[PROOF STATE]
proof (prove)
using this:
tensor_mat m1 m2 = tensor_mat M1 M2 * adjoint (tensor_mat M1 M2)

goal (1 subgoal):
 1. \<exists>M. M * adjoint M = tensor_mat m1 m2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>M. M * adjoint M = tensor_mat m1 m2

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>M. M * adjoint M = tensor_mat m1 m2

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
have "tensor_mat m1 m2 \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat m1 m2 \<in> carrier_mat d d
[PROOF STEP]
using tensor_mat_carrier
[PROOF STATE]
proof (prove)
using this:
tensor_mat ?m1.0 ?m2.0 \<in> carrier_mat d d

goal (1 subgoal):
 1. tensor_mat m1 m2 \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
tensor_mat m1 m2 \<in> carrier_mat d d

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>M. M * adjoint M = tensor_mat m1 m2
tensor_mat m1 m2 \<in> carrier_mat d d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>M. M * adjoint M = tensor_mat m1 m2
tensor_mat m1 m2 \<in> carrier_mat d d

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
using positive_if_decomp[of "tensor_mat m1 m2"]
[PROOF STATE]
proof (prove)
using this:
\<exists>M. M * adjoint M = tensor_mat m1 m2
tensor_mat m1 m2 \<in> carrier_mat d d
\<lbrakk>tensor_mat m1 m2 \<in> carrier_mat ?n ?n; \<exists>M. M * adjoint M = tensor_mat m1 m2\<rbrakk> \<Longrightarrow> positive (tensor_mat m1 m2)

goal (1 subgoal):
 1. positive (tensor_mat m1 m2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
positive (tensor_mat m1 m2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pCons_eq_iff [simp]: "pCons a p = pCons b q \<longleftrightarrow> a = b \<and> p = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pCons a p = pCons b q) = (a = b \<and> p = q)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pCons a p = pCons b q \<Longrightarrow> a = b
 2. pCons a p = pCons b q \<Longrightarrow> p = q
[PROOF STEP]
assume "pCons a p = pCons b q"
[PROOF STATE]
proof (state)
this:
pCons a p = pCons b q

goal (2 subgoals):
 1. pCons a p = pCons b q \<Longrightarrow> a = b
 2. pCons a p = pCons b q \<Longrightarrow> p = q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pCons a p = pCons b q
[PROOF STEP]
have "coeff (pCons a p) 0 = coeff (pCons b q) 0"
[PROOF STATE]
proof (prove)
using this:
pCons a p = pCons b q

goal (1 subgoal):
 1. coeff (pCons a p) 0 = coeff (pCons b q) 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff (pCons a p) 0 = coeff (pCons b q) 0

goal (2 subgoals):
 1. pCons a p = pCons b q \<Longrightarrow> a = b
 2. pCons a p = pCons b q \<Longrightarrow> p = q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coeff (pCons a p) 0 = coeff (pCons b q) 0
[PROOF STEP]
show "a = b"
[PROOF STATE]
proof (prove)
using this:
coeff (pCons a p) 0 = coeff (pCons b q) 0

goal (1 subgoal):
 1. a = b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a = b

goal (1 subgoal):
 1. pCons a p = pCons b q \<Longrightarrow> p = q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pCons a p = pCons b q \<Longrightarrow> p = q
[PROOF STEP]
assume "pCons a p = pCons b q"
[PROOF STATE]
proof (state)
this:
pCons a p = pCons b q

goal (1 subgoal):
 1. pCons a p = pCons b q \<Longrightarrow> p = q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pCons a p = pCons b q
[PROOF STEP]
have "coeff (pCons a p) (Suc n) = coeff (pCons b q) (Suc n)" for n
[PROOF STATE]
proof (prove)
using this:
pCons a p = pCons b q

goal (1 subgoal):
 1. coeff (pCons a p) (Suc n) = coeff (pCons b q) (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff (pCons a p) (Suc ?n) = coeff (pCons b q) (Suc ?n)

goal (1 subgoal):
 1. pCons a p = pCons b q \<Longrightarrow> p = q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coeff (pCons a p) (Suc ?n) = coeff (pCons b q) (Suc ?n)
[PROOF STEP]
show "p = q"
[PROOF STATE]
proof (prove)
using this:
coeff (pCons a p) (Suc ?n) = coeff (pCons b q) (Suc ?n)

goal (1 subgoal):
 1. p = q
[PROOF STEP]
by (simp add: poly_eq_iff)
[PROOF STATE]
proof (state)
this:
p = q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod256: "((d::nat) + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256
[PROOF STEP]
from mod_mult_self2[where a="d + 256 * c + 65536 * b" and b="256" and c="65536 * a"]
[PROOF STATE]
proof (chain)
picking this:
(d + 256 * c + 65536 * b + 256 * (65536 * a)) mod 256 = (d + 256 * c + 65536 * b) mod 256
[PROOF STEP]
have
    "(d + 256 * c + 65536 * b + 256 * 65536 * a) mod 256 = (d + 256 * c + 65536 * b) mod 256"
[PROOF STATE]
proof (prove)
using this:
(d + 256 * c + 65536 * b + 256 * (65536 * a)) mod 256 = (d + 256 * c + 65536 * b) mod 256

goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 256 * 65536 * a) mod 256 = (d + 256 * c + 65536 * b) mod 256
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(d + 256 * c + 65536 * b + 256 * 65536 * a) mod 256 = (d + 256 * c + 65536 * b) mod 256

goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(d + 256 * c + 65536 * b + 256 * 65536 * a) mod 256 = (d + 256 * c + 65536 * b) mod 256

goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256
[PROOF STEP]
have "\<dots>  = (d + 256 * c) mod 256"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d + 256 * c + 65536 * b) mod 256 = (d + 256 * c) mod 256
[PROOF STEP]
using mod_mult_self2[where a="d + 256 * c" and b="256" and c="256 * b"]
[PROOF STATE]
proof (prove)
using this:
(d + 256 * c + 256 * (256 * b)) mod 256 = (d + 256 * c) mod 256

goal (1 subgoal):
 1. (d + 256 * c + 65536 * b) mod 256 = (d + 256 * c) mod 256
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(d + 256 * c + 65536 * b) mod 256 = (d + 256 * c) mod 256

goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(d + 256 * c + 65536 * b) mod 256 = (d + 256 * c) mod 256

goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256
[PROOF STEP]
have "\<dots> = d mod 256"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d + 256 * c) mod 256 = d mod 256
[PROOF STEP]
using mod_mult_self2
[PROOF STATE]
proof (prove)
using this:
(?a + ?b * ?c) mod ?b = ?a mod ?b

goal (1 subgoal):
 1. (d + 256 * c) mod 256 = d mod 256
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(d + 256 * c) mod 256 = d mod 256

goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(d + 256 * c + 65536 * b + 256 * 65536 * a) mod 256 = d mod 256
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(d + 256 * c + 65536 * b + 256 * 65536 * a) mod 256 = d mod 256

goal (1 subgoal):
 1. (d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(d + 256 * c + 65536 * b + 16777216 * a) mod 256 = d mod 256

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sumAssocRight:
  fixes P   :: pi
  and   Q   :: pi
  and   R   :: pi
  and   Rel :: "(pi \<times> pi) set"

  assumes Id: "Id \<subseteq> Rel"

  shows "P \<oplus> (Q \<oplus> R) \<leadsto>[Rel] (P \<oplus> Q) \<oplus> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<oplus> Q \<oplus> R \<leadsto>[Rel] (P \<oplus> Q) \<oplus> R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Id \<subseteq> Rel

goal (1 subgoal):
 1. P \<oplus> Q \<oplus> R \<leadsto>[Rel] (P \<oplus> Q) \<oplus> R
[PROOF STEP]
by(fastforce simp add: simulation_def elim: sumCases intro: Sum1 Sum2 derivativeReflexive)


[STATEMENT]
lemma imp_wf_dfa:
  assumes "wf_dfa M n" and "wf_dfa N n"
  shows "wf_dfa (imp_dfa M N) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dfa (imp_dfa M N) n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_dfa M n
wf_dfa N n

goal (1 subgoal):
 1. wf_dfa (imp_dfa M N) n
[PROOF STEP]
by (simp add: binop_wf_dfa imp_dfa_def)


[STATEMENT]
lemma Liminf_add_ereal_left:
  "F \<noteq> bot \<Longrightarrow> abs c \<noteq> \<infinity> \<Longrightarrow> Liminf F (\<lambda>n. (c :: ereal) + g n) = c + Liminf F g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<noteq> bot; \<bar>c\<bar> \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> Liminf F (\<lambda>n. c + g n) = c + Liminf F g
[PROOF STEP]
by (subst (1 2) add.commute) (rule Liminf_add_ereal_right)


[STATEMENT]
lemma lim_ln_1_plus_x_over_x_at_0: "(\<lambda>x::real. ln (1 + x) / x) \<midarrow>0\<rightarrow> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (1 + x) / x) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
proof (rule lhopital)
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. (\<lambda>x. ln (1 + x)) \<midarrow>0\<rightarrow> 0
 2. (\<lambda>x. x) \<midarrow>0\<rightarrow> 0
 3. \<forall>\<^sub>F x in at 0. x \<noteq> 0
 4. \<forall>\<^sub>F x in at 0. ?g' x \<noteq> 0
 5. \<forall>\<^sub>F x in at 0. ((\<lambda>x. ln (1 + x)) has_real_derivative ?f' x) (at x)
 6. \<forall>\<^sub>F x in at 0. ((\<lambda>x. x) has_real_derivative ?g' x) (at x)
 7. (\<lambda>x. ?f' x / ?g' x) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
show "(\<lambda>x::real. ln (1 + x)) \<midarrow>0\<rightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (1 + x)) \<midarrow>0\<rightarrow> 0
[PROOF STEP]
by (rule tendsto_eq_intros refl | simp)+
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ln (1 + x)) \<midarrow>0\<rightarrow> 0

goal (6 subgoals):
 1. (\<lambda>x. x) \<midarrow>0\<rightarrow> 0
 2. \<forall>\<^sub>F x in at 0. x \<noteq> 0
 3. \<forall>\<^sub>F x in at 0. ?g' x \<noteq> 0
 4. \<forall>\<^sub>F x in at 0. ((\<lambda>x. ln (1 + x)) has_real_derivative ?f' x) (at x)
 5. \<forall>\<^sub>F x in at 0. ((\<lambda>x. x) has_real_derivative ?g' x) (at x)
 6. (\<lambda>x. ?f' x / ?g' x) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
have "eventually (\<lambda>x::real. x \<in> {-1/2<..<1/2}) (nhds 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds 0. x \<in> {- 1 / 2<..<1 / 2}
[PROOF STEP]
by (rule eventually_nhds_in_open) auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds 0. x \<in> {- 1 / 2<..<1 / 2}

goal (6 subgoals):
 1. (\<lambda>x. x) \<midarrow>0\<rightarrow> 0
 2. \<forall>\<^sub>F x in at 0. x \<noteq> 0
 3. \<forall>\<^sub>F x in at 0. ?g' x \<noteq> 0
 4. \<forall>\<^sub>F x in at 0. ((\<lambda>x. ln (1 + x)) has_real_derivative ?f' x) (at x)
 5. \<forall>\<^sub>F x in at 0. ((\<lambda>x. x) has_real_derivative ?g' x) (at x)
 6. (\<lambda>x. ?f' x / ?g' x) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
hence *: "eventually (\<lambda>x::real. x \<in> {-1/2<..<1/2}) (at 0)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds 0. x \<in> {- 1 / 2<..<1 / 2}

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at 0. x \<in> {- 1 / 2<..<1 / 2}
[PROOF STEP]
by (rule filter_leD [rotated]) (simp_all add: at_within_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at 0. x \<in> {- 1 / 2<..<1 / 2}

goal (6 subgoals):
 1. (\<lambda>x. x) \<midarrow>0\<rightarrow> 0
 2. \<forall>\<^sub>F x in at 0. x \<noteq> 0
 3. \<forall>\<^sub>F x in at 0. ?g' x \<noteq> 0
 4. \<forall>\<^sub>F x in at 0. ((\<lambda>x. ln (1 + x)) has_real_derivative ?f' x) (at x)
 5. \<forall>\<^sub>F x in at 0. ((\<lambda>x. x) has_real_derivative ?g' x) (at x)
 6. (\<lambda>x. ?f' x / ?g' x) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
show "eventually (\<lambda>x::real. ((\<lambda>x. ln (1 + x)) has_field_derivative inverse (1 + x)) (at x)) (at 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at 0. ((\<lambda>x. ln (1 + x)) has_real_derivative inverse (1 + x)) (at x)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at 0. x \<in> {- 1 / 2<..<1 / 2}

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at 0. ((\<lambda>x. ln (1 + x)) has_real_derivative inverse (1 + x)) (at x)
[PROOF STEP]
by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at 0. ((\<lambda>x. ln (1 + x)) has_real_derivative inverse (1 + x)) (at x)

goal (5 subgoals):
 1. (\<lambda>x. x) \<midarrow>0\<rightarrow> 0
 2. \<forall>\<^sub>F x in at 0. x \<noteq> 0
 3. \<forall>\<^sub>F x in at 0. ?g' x \<noteq> 0
 4. \<forall>\<^sub>F x in at 0. ((\<lambda>x. x) has_real_derivative ?g' x) (at x)
 5. (\<lambda>x. inverse (1 + x) / ?g' x) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
show "eventually (\<lambda>x::real. ((\<lambda>x. x) has_field_derivative 1) (at x)) (at 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at 0. ((\<lambda>x. x) has_real_derivative 1) (at x)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at 0. x \<in> {- 1 / 2<..<1 / 2}

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at 0. ((\<lambda>x. x) has_real_derivative 1) (at x)
[PROOF STEP]
by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at 0. ((\<lambda>x. x) has_real_derivative 1) (at x)

goal (4 subgoals):
 1. (\<lambda>x. x) \<midarrow>0\<rightarrow> 0
 2. \<forall>\<^sub>F x in at 0. x \<noteq> 0
 3. \<forall>\<^sub>F x in at 0. 1 \<noteq> 0
 4. (\<lambda>x. inverse (1 + x) / 1) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
show "\<forall>\<^sub>F x in at 0. x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at (0::'a). x \<noteq> (0::'a)
[PROOF STEP]
by (auto simp: at_within_def eventually_inf_principal)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at (0::?'a1). x \<noteq> (0::?'a1)

goal (3 subgoals):
 1. (\<lambda>x. x) \<midarrow>0\<rightarrow> 0
 2. \<forall>\<^sub>F x in at 0. 1 \<noteq> 0
 3. (\<lambda>x. inverse (1 + x) / 1) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
show "(\<lambda>x::real. inverse (1 + x) / 1) \<midarrow>0\<rightarrow> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. inverse (1 + x) / 1) \<midarrow>0\<rightarrow> 1
[PROOF STEP]
by (rule tendsto_eq_intros refl | simp)+
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (1 + x) / 1) \<midarrow>0\<rightarrow> 1

goal (2 subgoals):
 1. (\<lambda>x. x) \<midarrow>0\<rightarrow> 0
 2. \<forall>\<^sub>F x in at 0. 1 \<noteq> 0
[PROOF STEP]
qed auto


[STATEMENT]
lemma aff_dim_subspace:
  fixes S :: "'n::euclidean_space set"
  assumes "subspace S"
  shows "aff_dim S = int (dim S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S = int (dim S)
[PROOF STEP]
proof (cases "S={}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> aff_dim S = int (dim S)
 2. S \<noteq> {} \<Longrightarrow> aff_dim S = int (dim S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> aff_dim S = int (dim S)
 2. S \<noteq> {} \<Longrightarrow> aff_dim S = int (dim S)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
subspace S
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subspace S
S = {}

goal (1 subgoal):
 1. aff_dim S = int (dim S)
[PROOF STEP]
by (simp add: subspace_affine)
[PROOF STATE]
proof (state)
this:
aff_dim S = int (dim S)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S = int (dim S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S = int (dim S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> aff_dim S = int (dim S)
[PROOF STEP]
with aff_dim_affine[of S S] assms subspace_imp_affine[of S] affine_parallel_reflex[of S] subspace_affine
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>S \<noteq> {}; affine S; subspace S; affine_parallel S S\<rbrakk> \<Longrightarrow> aff_dim S = int (dim S)
subspace S
subspace S \<Longrightarrow> affine S
affine_parallel S S
subspace ?S = (affine ?S \<and> (0::?'a) \<in> ?S)
S \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>S \<noteq> {}; affine S; subspace S; affine_parallel S S\<rbrakk> \<Longrightarrow> aff_dim S = int (dim S)
subspace S
subspace S \<Longrightarrow> affine S
affine_parallel S S
subspace ?S = (affine ?S \<and> (0::?'a) \<in> ?S)
S \<noteq> {}

goal (1 subgoal):
 1. aff_dim S = int (dim S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aff_dim S = int (dim S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_front_sums: "finite (front_sums xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (front_sums xs)
[PROOF STEP]
using front_sums_def finite_fronts
[PROOF STATE]
proof (prove)
using this:
front_sums ?xs \<equiv> sum_list ` fronts ?xs
finite (fronts ?xs)

goal (1 subgoal):
 1. finite (front_sums xs)
[PROOF STEP]
by simp


[STATEMENT]
lemma bij_extend_act: "bij h ==> bij (extend_act (%(x,u::'c). h x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> bij (extend_act (\<lambda>(x, u). h x))
[PROOF STEP]
apply (rule bijI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. bij h \<Longrightarrow> inj (extend_act (\<lambda>(x, u). h x))
 2. bij h \<Longrightarrow> surj (extend_act (\<lambda>(x, u). h x))
[PROOF STEP]
apply (rule Extend.inj_extend_act)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. bij h \<Longrightarrow> Extend (\<lambda>(x, u). h x)
 2. bij h \<Longrightarrow> surj (extend_act (\<lambda>(x, u). h x))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> surj (extend_act (\<lambda>(x, u). h x))
[PROOF STEP]
apply (simp add: bij_extend_act_eq_project_act)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> surj (project_act (\<lambda>(x, u). inv h x))
[PROOF STEP]
apply (rule surjI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. bij h \<Longrightarrow> project_act (\<lambda>(x, u). inv h x) (?f6 x) = x
[PROOF STEP]
apply (rule Extend.extend_act_inverse)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. bij h \<Longrightarrow> Extend (\<lambda>(x, u). inv h x)
[PROOF STEP]
apply (blast intro: bij_imp_bij_inv)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem ordinal_util_imp_rat_prefs:
  assumes "ordinal_utility carrier relation u"
  shows "rational_preference carrier relation"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rational_preference carrier relation
[PROOF STEP]
by (metis (full_types) assms order_on_defs(1) ordinal_utility.util_imp_refl
      ordinal_utility.util_imp_total ordinal_utility.util_imp_trans ordinal_utility_def
      preference.intro rational_preference.intro rational_preference_axioms_def)


[STATEMENT]
lemma winding_number_paths_linear_eq:
  "\<lbrakk>path g; path h; pathstart h = pathstart g; pathfinish h = pathfinish g;
    \<And>t. t \<in> {0..1} \<Longrightarrow> z \<notin> closed_segment (g t) (h t)\<rbrakk>
        \<Longrightarrow> winding_number h z = winding_number g z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path g; path h; pathstart h = pathstart g; pathfinish h = pathfinish g; \<And>t. t \<in> {0..1} \<Longrightarrow> z \<notin> closed_segment (g t) (h t)\<rbrakk> \<Longrightarrow> winding_number h z = winding_number g z
[PROOF STEP]
by (blast intro: sym homotopic_paths_linear winding_number_homotopic_paths)


[STATEMENT]
lemma closed_Real_halfspace_Re_ge: "closed (\<real> \<inter> {w. x \<le> Re(w)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (\<real> \<inter> {w. x \<le> Re w})
[PROOF STEP]
using closed_halfspace_Re_ge
[PROOF STATE]
proof (prove)
using this:
closed {z. ?b \<le> Re z}

goal (1 subgoal):
 1. closed (\<real> \<inter> {w. x \<le> Re w})
[PROOF STEP]
by (simp add: closed_Int closed_complex_Reals)


[STATEMENT]
lemma continuous_on_components_eq:
    "locally connected S
     \<Longrightarrow> (continuous_on S f \<longleftrightarrow> (\<forall>c \<in> components S. continuous_on c f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally connected S \<Longrightarrow> continuous_on S f = (\<forall>c\<in>components S. continuous_on c f)
[PROOF STEP]
by (meson continuous_on_components continuous_on_subset in_components_subset)


[STATEMENT]
lemma delete_prefix_trie:
  "delete xs (prefix_trie xs (Nd b (l,r)))
   = (if (l,r) = (Lf,Lf) then Lf else prefix_trie xs (Nd False (l,r)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. delete xs (prefix_trie xs (Nd b (l, r))) = (if (l, r) = (Lf, Lf) then Lf else prefix_trie xs (Nd False (l, r)))
[PROOF STEP]
by(induction xs)(auto simp: prefix_trie_Lf)