[STATEMENT]
lemma fold_rbt_delete:
  assumes "inv_12 t1" "rbt_sorted t1" "rbt_sorted t2"
  shows "inv_12 (RBT_Impl.fold (\<lambda>k _ t. rbt_delete k t) t2 t1) \<and>
    rbt_sorted (RBT_Impl.fold (\<lambda>k _ t. rbt_delete k t) t2 t1) \<and>
    rbt_lookup (RBT_Impl.fold (\<lambda>k _ t. rbt_delete k t) t2 t1) k =
    (case rbt_lookup t1 k of None \<Rightarrow> None
    | Some v \<Rightarrow> (case rbt_lookup t2 k of None \<Rightarrow> Some v | _ \<Rightarrow> None))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_12 (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_sorted (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_lookup (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v | Some x \<Rightarrow> Map.empty x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inv_12 (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_sorted (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_lookup (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v | Some x \<Rightarrow> Map.empty x)
[PROOF STEP]
define xs where "xs = RBT_Impl.entries t2"
[PROOF STATE]
proof (state)
this:
xs = entries t2

goal (1 subgoal):
 1. inv_12 (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_sorted (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_lookup (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v | Some x \<Rightarrow> Map.empty x)
[PROOF STEP]
show "inv_12 (RBT_Impl.fold (\<lambda>k _ t. rbt_delete k t) t2 t1) \<and>
    rbt_sorted (RBT_Impl.fold (\<lambda>k _ t. rbt_delete k t) t2 t1) \<and>
    rbt_lookup (RBT_Impl.fold (\<lambda>k _ t. rbt_delete k t) t2 t1) k =
    (case rbt_lookup t1 k of None \<Rightarrow> None
    | Some v \<Rightarrow> (case rbt_lookup t2 k of None \<Rightarrow> Some v | _ \<Rightarrow> None))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_12 (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_sorted (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_lookup (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v | Some x \<Rightarrow> Map.empty x)
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
inv_12 t1
rbt_sorted t1

goal (1 subgoal):
 1. inv_12 (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_sorted (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_lookup (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v | Some x \<Rightarrow> Map.empty x)
[PROOF STEP]
unfolding map_of_entries[OF assms(3), symmetric] RBT_Impl.fold_def xs_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
inv_12 t1
rbt_sorted t1

goal (1 subgoal):
 1. inv_12 (List.fold (\<lambda>(k, uu_). rbt_delete k) xs t1) \<and> rbt_sorted (List.fold (\<lambda>(k, uu_). rbt_delete k) xs t1) \<and> rbt_lookup (List.fold (\<lambda>(k, uu_). rbt_delete k) xs t1) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case map_of xs k of None \<Rightarrow> Some v | Some x \<Rightarrow> Map.empty x)
[PROOF STEP]
by (induction xs arbitrary: t1 rule: rev_induct)
       (auto simp: rbt_delete rbt_sorted_delete rbt_lookup_delete split!: option.splits)
[PROOF STATE]
proof (state)
this:
inv_12 (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_sorted (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) \<and> rbt_lookup (RBT_Impl.fold (\<lambda>k _. rbt_delete k) t2 t1) k = (case rbt_lookup t1 k of None \<Rightarrow> None | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v | Some x \<Rightarrow> Map.empty x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma star_slide:
  "(x * y)\<^sup>\<star> * x = x * (y * x)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * y)\<^sup>\<star> * x = x * (y * x)\<^sup>\<star>
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (x * y)\<^sup>\<star> * x \<le> x * (y * x)\<^sup>\<star>
 2. x * (y * x)\<^sup>\<star> \<le> (x * y)\<^sup>\<star> * x
[PROOF STEP]
show "(x * y)\<^sup>\<star> * x \<le> x * (y * x)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * y)\<^sup>\<star> * x \<le> x * (y * x)\<^sup>\<star>
[PROOF STEP]
by (rule star_left_slide)
[PROOF STATE]
proof (state)
this:
(x * y)\<^sup>\<star> * x \<le> x * (y * x)\<^sup>\<star>

goal (1 subgoal):
 1. x * (y * x)\<^sup>\<star> \<le> (x * y)\<^sup>\<star> * x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * (y * x)\<^sup>\<star> \<le> (x * y)\<^sup>\<star> * x
[PROOF STEP]
have "x \<squnion> (x * y)\<^sup>\<star> * x * y * x \<le> (x * y)\<^sup>\<star> * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> (x * y)\<^sup>\<star> * x * y * x \<le> (x * y)\<^sup>\<star> * x
[PROOF STEP]
by (metis (full_types) sup.commute eq_refl star.circ_loop_fixpoint mult.assoc star_plus)
[PROOF STATE]
proof (state)
this:
x \<squnion> (x * y)\<^sup>\<star> * x * y * x \<le> (x * y)\<^sup>\<star> * x

goal (1 subgoal):
 1. x * (y * x)\<^sup>\<star> \<le> (x * y)\<^sup>\<star> * x
[PROOF STEP]
thus "x * (y * x)\<^sup>\<star> \<le> (x * y)\<^sup>\<star> * x"
[PROOF STATE]
proof (prove)
using this:
x \<squnion> (x * y)\<^sup>\<star> * x * y * x \<le> (x * y)\<^sup>\<star> * x

goal (1 subgoal):
 1. x * (y * x)\<^sup>\<star> \<le> (x * y)\<^sup>\<star> * x
[PROOF STEP]
by (simp add: mult_assoc star_right_induct)
[PROOF STATE]
proof (state)
this:
x * (y * x)\<^sup>\<star> \<le> (x * y)\<^sup>\<star> * x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p_not_div_choose:
  assumes "k < K" and "k \<le> n"
      and eeq: "\<And>j. \<lbrakk>0<j; j<K\<rbrakk> \<Longrightarrow> multiplicity p (n - k + (K - j)) = multiplicity p (K - j)" "prime p"
    shows "multiplicity p (n choose k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (n choose k) = 0
[PROOF STEP]
apply (rule p_not_div_choose_lemma [of K p "n-k" k, simplified assms nat_minus_add_max max_absorb1])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i. Suc i < K \<Longrightarrow> multiplicity p (Suc i) = multiplicity p (Suc (n - k + i))
 2. True
 3. True
[PROOF STEP]
apply (metis add_Suc_right eeq diff_diff_cancel order_less_imp_le zero_less_Suc zero_less_diff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. True
 2. True
[PROOF STEP]
apply (rule TrueI)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ln_approx_abs'':
  fixes x :: real and n :: nat
  defines "y \<equiv> (x-1)/(x+1)"
  defines "approx \<equiv> (\<Sum>k<n. 2*y^(2*k+1) / of_nat (2*k+1))"
  defines "d \<equiv> y^(2*n+1) / (1 - y^2) / of_nat (2*n+1)"
  assumes x: "x > 1"
  assumes A: "ln_approx_aux1 x' e n x"
  shows   "\<bar>ln x - x'\<bar> \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>ln x - x'\<bar> \<le> e
[PROOF STEP]
proof (rule approx_coarsen[OF ln_approx_abs[OF x, of n]], goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>(\<Sum>k<n. 2 * ((x - 1) / (x + 1)) ^ (2 * k + 1) / real (2 * k + 1)) + ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1) - x'\<bar> \<le> e - ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<bar>(\<Sum>k<n. 2 * ((x - 1) / (x + 1)) ^ (2 * k + 1) / real (2 * k + 1)) + ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1) - x'\<bar> \<le> e - ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1)
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
ln_approx_aux1 x' e n x
[PROOF STEP]
have "\<bar>2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) + d - x'\<bar> \<le> e - d"
[PROOF STATE]
proof (prove)
using this:
ln_approx_aux1 x' e n x

goal (1 subgoal):
 1. \<bar>2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) + d - x'\<bar> \<le> e - d
[PROOF STEP]
by (simp only: ln_approx_aux3_def ln_approx_aux2_def ln_approx_aux1_def
                   y_def [symmetric] d_def [symmetric])
[PROOF STATE]
proof (state)
this:
\<bar>2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) + d - x'\<bar> \<le> e - d

goal (1 subgoal):
 1. \<bar>(\<Sum>k<n. 2 * ((x - 1) / (x + 1)) ^ (2 * k + 1) / real (2 * k + 1)) + ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1) - x'\<bar> \<le> e - ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) + d - x'\<bar> \<le> e - d

goal (1 subgoal):
 1. \<bar>(\<Sum>k<n. 2 * ((x - 1) / (x + 1)) ^ (2 * k + 1) / real (2 * k + 1)) + ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1) - x'\<bar> \<le> e - ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1)
[PROOF STEP]
have "2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) =
               (\<Sum>k<n. 2 * y^(2*k+1) / (real (2 * k + 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) = (\<Sum>k<n. 2 * y ^ (2 * k + 1) / real (2 * k + 1))
[PROOF STEP]
by (subst sum_distrib_left, simp, subst power_mult)
       (simp_all add: field_split_simps mult_ac power_mult)
[PROOF STATE]
proof (state)
this:
2 * y * (\<Sum>k<n. inverse (real (2 * k + 1)) * y\<^sup>2 ^ k) = (\<Sum>k<n. 2 * y ^ (2 * k + 1) / real (2 * k + 1))

goal (1 subgoal):
 1. \<bar>(\<Sum>k<n. 2 * ((x - 1) / (x + 1)) ^ (2 * k + 1) / real (2 * k + 1)) + ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1) - x'\<bar> \<le> e - ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>(\<Sum>k<n. 2 * y ^ (2 * k + 1) / real (2 * k + 1)) + d - x'\<bar> \<le> e - d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<bar>(\<Sum>k<n. 2 * y ^ (2 * k + 1) / real (2 * k + 1)) + d - x'\<bar> \<le> e - d

goal (1 subgoal):
 1. \<bar>(\<Sum>k<n. 2 * ((x - 1) / (x + 1)) ^ (2 * k + 1) / real (2 * k + 1)) + ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1) - x'\<bar> \<le> e - ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1)
[PROOF STEP]
by (simp only: d_def y_def approx_def)
[PROOF STATE]
proof (state)
this:
\<bar>(\<Sum>k<n. 2 * ((x - 1) / (x + 1)) ^ (2 * k + 1) / real (2 * k + 1)) + ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1) - x'\<bar> \<le> e - ((x - 1) / (x + 1)) ^ (2 * n + 1) / (1 - ((x - 1) / (x + 1))\<^sup>2) / real (2 * n + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ball_eq_greaterThanLessThan:
  fixes a b::real
  shows "ball a b = {a - b <..< a + b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ball a b = {a - b<..<a + b}
[PROOF STEP]
by (auto simp: dist_real_def)


[STATEMENT]
lemma seven_BaseDimensions: "card BaseDimensions = 7"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card BaseDimensions = 7
[PROOF STEP]
by simp


[STATEMENT]
lemma findMin_correct':
  assumes I: "elem_invar x"
  shows
  "findMin' x \<in># elem_to_mset x"
  "\<forall>y\<in>set_mset (elem_to_mset x). snd (findMin' x) \<le> snd y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. findMin' x \<in># elem_to_mset x &&& \<forall>y\<in>#elem_to_mset x. snd (findMin' x) \<le> snd y
[PROOF STEP]
using I
[PROOF STATE]
proof (prove)
using this:
elem_invar x

goal (1 subgoal):
 1. findMin' x \<in># elem_to_mset x &&& \<forall>y\<in>#elem_to_mset x. snd (findMin' x) \<le> snd y
[PROOF STEP]
apply (cases x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2 x3. \<lbrakk>elem_invar x; x = Element x1 x2 x3\<rbrakk> \<Longrightarrow> findMin' x \<in># elem_to_mset x
 2. \<forall>y\<in>#elem_to_mset x. snd (findMin' x) \<le> snd y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y\<in>#elem_to_mset x. snd (findMin' x) \<le> snd y
[PROOF STEP]
apply (simp add: findMin'_min[OF I])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in pdigraph) pdg_dg_prod_vdiff_vunion_is_arr:
  assumes "J \<subseteq>\<^sub>\<circ> I"
    and "g : a \<mapsto>\<^bsub>(\<Prod>\<^sub>D\<^sub>Gk\<in>\<^sub>\<circ>I -\<^sub>\<circ> J. \<AA> k)\<^esub> b"
    and "f : c \<mapsto>\<^bsub>(\<Prod>\<^sub>D\<^sub>Gj\<in>\<^sub>\<circ>J. \<AA> j)\<^esub> d"
  shows "g \<union>\<^sub>\<circ> f : a \<union>\<^sub>\<circ> c \<mapsto>\<^bsub>\<Prod>\<^sub>D\<^sub>Gi\<in>\<^sub>\<circ>I. \<AA> i\<^esub> b \<union>\<^sub>\<circ> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<union>\<^sub>\<circ> f : a \<union>\<^sub>\<circ> c \<mapsto>\<^bsub>dg_prod I \<AA>\<^esub> b \<union>\<^sub>\<circ> d
[PROOF STEP]
by
    (
      vdiff_of_vunion'
        rule: pdg_dg_prod_vunion_is_arr assms: assms(2,3) subset: assms(1)
    )


[STATEMENT]
lemma "(-345::int) < -242 + -100"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 345 < - 242 + - 100
[PROOF STEP]
by simp


[STATEMENT]
theorem Gromov_boundaries_homeomorphic:
  fixes f::"'a::Gromov_hyperbolic_space_geodesic \<Rightarrow> 'b::Gromov_hyperbolic_space_geodesic"
  assumes "lambda C-quasi_isometry_between UNIV UNIV f"
  shows "(Gromov_boundary::'a Gromov_completion set) homeomorphic (Gromov_boundary::'b Gromov_completion set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_boundary homeomorphic Gromov_boundary
[PROOF STEP]
using Gromov_extension_boundary_homeomorphism[OF quasi_isometry_betweenD(1)[OF assms]] Gromov_extension_onto'[OF assms]
[PROOF STATE]
proof (prove)
using this:
homeomorphism_on Gromov_boundary (Gromov_extension f)
Gromov_extension f ` Gromov_boundary = Gromov_boundary

goal (1 subgoal):
 1. Gromov_boundary homeomorphic Gromov_boundary
[PROOF STEP]
unfolding homeomorphic_def homeomorphism_on_def
[PROOF STATE]
proof (prove)
using this:
Ex (homeomorphism Gromov_boundary (Gromov_extension f ` Gromov_boundary) (Gromov_extension f))
Gromov_extension f ` Gromov_boundary = Gromov_boundary

goal (1 subgoal):
 1. \<exists>f g. homeomorphism Gromov_boundary Gromov_boundary f g
[PROOF STEP]
by auto


[STATEMENT]
lemma "dec_10 (4 * dec_10 4) = 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dec_10 (4 * dec_10 4) = 6
[PROOF STEP]
by (smt dec_10.simps)


[STATEMENT]
lemma ln_less_zero: "0 < x \<Longrightarrow> x < 1 \<Longrightarrow> ln x < 0"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; x < 1\<rbrakk> \<Longrightarrow> ln x < 0
[PROOF STEP]
by simp


[STATEMENT]
theorem is_in_correct: "is_ord t \<Longrightarrow> is_in k t = (k : set_of t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_ord t \<Longrightarrow> is_in k t = (k \<in> set_of t)
[PROOF STEP]
by (induct t) auto


[STATEMENT]
lemma "(\<forall>x. P(x) \<longrightarrow> (\<forall>x. Q(x))) \<and>
        ((\<forall>x. Q(x)\<or>R(x)) \<longrightarrow> (\<exists>x. Q(x)\<and>S(x))) \<and>
        ((\<exists>x. S(x)) \<longrightarrow> (\<forall>x. L(x) \<longrightarrow> M(x)))
    \<longrightarrow> (\<forall>x. P(x) \<and> L(x) \<longrightarrow> M(x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. P x \<longrightarrow> (\<forall>x. Q x)) \<and> ((\<forall>x. Q x \<or> R x) \<longrightarrow> (\<exists>x. Q x \<and> S x)) \<and> ((\<exists>x. S x) \<longrightarrow> (\<forall>x. L x \<longrightarrow> M x)) \<longrightarrow> (\<forall>x. P x \<and> L x \<longrightarrow> M x)
[PROOF STEP]
by blast


[STATEMENT]
lemma unit_disc_fix_moebius_add [simp]:
  assumes "unit_disc_fix M1" and "unit_disc_fix M2"
  shows "unit_disc_fix (M1 + M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_disc_fix (M1 + M2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M1
unit_disc_fix M2

goal (1 subgoal):
 1. unit_disc_fix (M1 + M2)
[PROOF STEP]
unfolding unit_disc_fix_iff_ounit_circle
[PROOF STATE]
proof (prove)
using this:
moebius_ocircline M1 ounit_circle = ounit_circle
moebius_ocircline M2 ounit_circle = ounit_circle

goal (1 subgoal):
 1. moebius_ocircline (M1 + M2) ounit_circle = ounit_circle
[PROOF STEP]
by auto


[STATEMENT]
lemma eval_DISJ_prune_unsat: "finite B \<Longrightarrow> A \<subseteq> B \<Longrightarrow> \<forall>Q \<in> B - A. \<forall>\<sigma>. \<not> sat Q I \<sigma> \<Longrightarrow> eval_on X (DISJ A) I = eval_on X (DISJ B) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite B; A \<subseteq> B; \<forall>Q\<in>B - A. \<forall>\<sigma>. \<not> sat Q I \<sigma>\<rbrakk> \<Longrightarrow> eval_on X (DISJ A) I = eval_on X (DISJ B) I
[PROOF STEP]
by (auto simp: eval_on_def finite_subset)


[STATEMENT]
lemma distinct_adj_mapI: "distinct_adj xs \<Longrightarrow> inj_on f (set xs) \<Longrightarrow> distinct_adj (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct_adj xs; inj_on f (set xs)\<rbrakk> \<Longrightarrow> distinct_adj (map f xs)
[PROOF STEP]
unfolding distinct_adj_def successively_map
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>successively (\<noteq>) xs; inj_on f (set xs)\<rbrakk> \<Longrightarrow> successively (\<lambda>x y. f x \<noteq> f y) xs
[PROOF STEP]
by (erule successively_mono) (auto simp: inj_on_def)


[STATEMENT]
lemma (in aGroup) ag_inv_inv:"x \<in> carrier A \<Longrightarrow> -\<^sub>a (-\<^sub>a x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier A \<Longrightarrow> -\<^sub>a (-\<^sub>a x) = x
[PROOF STEP]
by (frule ag_l_inv1[of "x"], frule ag_mOp_closed[of "x"],
       rule  ag_inv_unique[THEN sym, of "-\<^sub>a x" "x"], assumption+)


[STATEMENT]
lemma isCont_cong:
  assumes "eventually (\<lambda>x. f x = g x) (nhds x)"
  shows "isCont f x \<longleftrightarrow> isCont g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f x = isCont g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isCont f x = isCont g x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in nhds x. f x = g x
[PROOF STEP]
have [simp]: "f x = g x"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. f x = g x

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
by (rule eventually_nhds_x_imp_x)
[PROOF STATE]
proof (state)
this:
f x = g x

goal (1 subgoal):
 1. isCont f x = isCont g x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in nhds x. f x = g x
[PROOF STEP]
have "eventually (\<lambda>x. f x = g x) (at x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. f x = g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x. f x = g x
[PROOF STEP]
by (auto simp: eventually_at_filter elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x. f x = g x

goal (1 subgoal):
 1. isCont f x = isCont g x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in nhds x. f x = g x
\<forall>\<^sub>F x in at x. f x = g x
[PROOF STEP]
have "isCont f x \<longleftrightarrow> isCont g x"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. f x = g x
\<forall>\<^sub>F x in at x. f x = g x

goal (1 subgoal):
 1. isCont f x = isCont g x
[PROOF STEP]
unfolding isCont_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. f x = g x
\<forall>\<^sub>F x in at x. f x = g x

goal (1 subgoal):
 1. f \<midarrow>x\<rightarrow> f x = g \<midarrow>x\<rightarrow> g x
[PROOF STEP]
by (intro filterlim_cong) (auto elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
isCont f x = isCont g x

goal (1 subgoal):
 1. isCont f x = isCont g x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in nhds x. f x = g x
isCont f x = isCont g x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. f x = g x
isCont f x = isCont g x

goal (1 subgoal):
 1. isCont f x = isCont g x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
isCont f x = isCont g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Empty_is_rbt [simp]:
  "is_rbt Empty"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_rbt Empty
[PROOF STEP]
by (simp add: is_rbt_def)


[STATEMENT]
lemma abs_summable_on_scaleR_right [intro]:
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
  shows   "(\<lambda>x. c *\<^sub>R f x) abs_summable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c *\<^sub>R f x) abs_summable_on A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0 \<Longrightarrow> f abs_summable_on A

goal (1 subgoal):
 1. (\<lambda>x. c *\<^sub>R f x) abs_summable_on A
[PROOF STEP]
unfolding abs_summable_on_def
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0 \<Longrightarrow> integrable (count_space A) f

goal (1 subgoal):
 1. integrable (count_space A) (\<lambda>x. c *\<^sub>R f x)
[PROOF STEP]
by (intro Bochner_Integration.integrable_scaleR_right)


[STATEMENT]
lemma trace_positive_eq:
   fixes A :: "complex mat"
   assumes pos: "positive A"
   shows "trace (A * adjoint A) \<le> (trace A)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
positive A
[PROOF STEP]
have normal: "A * adjoint A = adjoint A * A"
[PROOF STATE]
proof (prove)
using this:
positive A

goal (1 subgoal):
 1. A * adjoint A = adjoint A * A
[PROOF STEP]
by (rule positive_is_normal)
[PROOF STATE]
proof (state)
this:
A * adjoint A = adjoint A * A

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A * adjoint A = adjoint A * A

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
from assms positive_dim_eq
[PROOF STATE]
proof (chain)
picking this:
positive A
positive ?A \<Longrightarrow> dim_row ?A = dim_col ?A
[PROOF STEP]
obtain n where cA: "A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
positive A
positive ?A \<Longrightarrow> dim_row ?A = dim_col ?A

goal (1 subgoal):
 1. (\<And>n. A \<in> carrier_mat n n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
from assms complex_mat_char_poly_factorizable cA
[PROOF STATE]
proof (chain)
picking this:
positive A
?A \<in> carrier_mat ?n ?n \<Longrightarrow> \<exists>as. char_poly ?A = (\<Prod>a\<leftarrow>as. [:- a, 1:]) \<and> length as = ?n
A \<in> carrier_mat n n
[PROOF STEP]
obtain es where charpo: " char_poly A =  (\<Prod> a \<leftarrow> es. [:- a, 1:]) \<and> length es = n"
[PROOF STATE]
proof (prove)
using this:
positive A
?A \<in> carrier_mat ?n ?n \<Longrightarrow> \<exists>as. char_poly ?A = (\<Prod>a\<leftarrow>as. [:- a, 1:]) \<and> length as = ?n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. (\<And>es. char_poly A = (\<Prod>a\<leftarrow>es. [:- a, 1:]) \<and> length es = n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
char_poly A = (\<Prod>a\<leftarrow>es. [:- a, 1:]) \<and> length es = n

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
char_poly A = (\<Prod>a\<leftarrow>es. [:- a, 1:]) \<and> length es = n

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
obtain B P Q where B: "unitary_schur_decomposition A es = (B,P,Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B P Q. unitary_schur_decomposition A es = (B, P, Q) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "unitary_schur_decomposition A es", auto)
[PROOF STATE]
proof (state)
this:
unitary_schur_decomposition A es = (B, P, Q)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A * adjoint A = adjoint A * A
A \<in> carrier_mat n n
char_poly A = (\<Prod>a\<leftarrow>es. [:- a, 1:]) \<and> length es = n
unitary_schur_decomposition A es = (B, P, Q)
[PROOF STEP]
have
    smw: "similar_mat_wit A B P (adjoint P)"
    and ut: "diagonal_mat B"
    and uP:  "unitary P"
    and dB: "diag_mat B = es"
    and QaP: "Q = adjoint P"
[PROOF STATE]
proof (prove)
using this:
A * adjoint A = adjoint A * A
A \<in> carrier_mat n n
char_poly A = (\<Prod>a\<leftarrow>es. [:- a, 1:]) \<and> length es = n
unitary_schur_decomposition A es = (B, P, Q)

goal (1 subgoal):
 1. (similar_mat_wit A B P (adjoint P) &&& diagonal_mat B) &&& unitary P &&& diag_mat B = es &&& Q = adjoint P
[PROOF STEP]
using normal_complex_mat_has_spectral_decomposition[of A n es B P Q]  unitary_schur_decomposition
[PROOF STATE]
proof (prove)
using this:
A * adjoint A = adjoint A * A
A \<in> carrier_mat n n
char_poly A = (\<Prod>a\<leftarrow>es. [:- a, 1:]) \<and> length es = n
unitary_schur_decomposition A es = (B, P, Q)
\<lbrakk>A \<in> carrier_mat n n; A * adjoint A = adjoint A * A; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q)\<rbrakk> \<Longrightarrow> similar_mat_wit A B P (adjoint P) \<and> diagonal_mat B \<and> diag_mat B = es \<and> unitary P
\<lbrakk>?A \<in> carrier_mat ?n ?n; char_poly ?A = (\<Prod>e\<leftarrow>?es. [:- e, 1:]); unitary_schur_decomposition ?A ?es = (?B, ?P, ?Q)\<rbrakk> \<Longrightarrow> similar_mat_wit ?A ?B ?P ?Q \<and> upper_triangular ?B \<and> diag_mat ?B = ?es \<and> unitary ?P \<and> ?Q = adjoint ?P

goal (1 subgoal):
 1. (similar_mat_wit A B P (adjoint P) &&& diagonal_mat B) &&& unitary P &&& diag_mat B = es &&& Q = adjoint P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
similar_mat_wit A B P (adjoint P)
diagonal_mat B
unitary P
diag_mat B = es
Q = adjoint P

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
from smw cA QaP uP
[PROOF STATE]
proof (chain)
picking this:
similar_mat_wit A B P (adjoint P)
A \<in> carrier_mat n n
Q = adjoint P
unitary P
[PROOF STEP]
have cB: "B \<in> carrier_mat n n" and cP: "P \<in> carrier_mat n n" and cQ: "Q \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A B P (adjoint P)
A \<in> carrier_mat n n
Q = adjoint P
unitary P

goal (1 subgoal):
 1. B \<in> carrier_mat n n &&& P \<in> carrier_mat n n &&& Q \<in> carrier_mat n n
[PROOF STEP]
unfolding  similar_mat_wit_def Let_def unitary_def
[PROOF STATE]
proof (prove)
using this:
{A, B, P, adjoint P} \<subseteq> carrier_mat (dim_row A) (dim_row A) \<and> P * adjoint P = 1\<^sub>m (dim_row A) \<and> adjoint P * P = 1\<^sub>m (dim_row A) \<and> A = P * B * adjoint P
A \<in> carrier_mat n n
Q = adjoint P
P \<in> carrier_mat (dim_row P) (dim_row P) \<and> inverts_mat P (adjoint P)

goal (1 subgoal):
 1. B \<in> carrier_mat n n &&& P \<in> carrier_mat n n &&& Q \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n
[PROOF STEP]
have caP: "adjoint P \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n

goal (1 subgoal):
 1. adjoint P \<in> carrier_mat n n
[PROOF STEP]
using adjoint_dim[of P n]
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n
P \<in> carrier_mat n n \<Longrightarrow> adjoint P \<in> carrier_mat n n

goal (1 subgoal):
 1. adjoint P \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint P \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
from smw QaP cA
[PROOF STATE]
proof (chain)
picking this:
similar_mat_wit A B P (adjoint P)
Q = adjoint P
A \<in> carrier_mat n n
[PROOF STEP]
have A: "A = P * B * adjoint P" and traceA: "trace A = trace (P * B * Q)" and PB: "P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A B P (adjoint P)
Q = adjoint P
A \<in> carrier_mat n n

goal (1 subgoal):
 1. A = P * B * adjoint P &&& trace A = trace (P * B * Q) &&& P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n
[PROOF STEP]
unfolding similar_mat_wit_def
[PROOF STATE]
proof (prove)
using this:
let n = dim_row A in {A, B, P, adjoint P} \<subseteq> carrier_mat n n \<and> P * adjoint P = 1\<^sub>m n \<and> adjoint P * P = 1\<^sub>m n \<and> A = P * B * adjoint P
Q = adjoint P
A \<in> carrier_mat n n

goal (1 subgoal):
 1. A = P * B * adjoint P &&& trace A = trace (P * B * Q) &&& P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = P * B * adjoint P
trace A = trace (P * B * Q)
P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have traceAB: "trace (P * B * Q) = trace ((Q*P)*B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (P * B * Q) = trace (Q * P * B)
[PROOF STEP]
using cQ cP cB
[PROOF STATE]
proof (prove)
using this:
Q \<in> carrier_mat n n
P \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (P * B * Q) = trace (Q * P * B)
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
trace (P * B * Q) = trace (Q * P * B)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (P * B * Q) = trace (Q * P * B)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have traceelim: "\<dots> = trace B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (Q * P * B) = trace B
[PROOF STEP]
using traceAB PB cA cB cP cQ left_mult_one_mat[of "P*Q" n n]
[PROOF STATE]
proof (prove)
using this:
trace (P * B * Q) = trace (Q * P * B)
P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n
A \<in> carrier_mat n n
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n
P * Q \<in> carrier_mat n n \<Longrightarrow> 1\<^sub>m n * (P * Q) = P * Q

goal (1 subgoal):
 1. trace (Q * P * B) = trace B
[PROOF STEP]
using similar_mat_wit_sym
[PROOF STATE]
proof (prove)
using this:
trace (P * B * Q) = trace (Q * P * B)
P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n
A \<in> carrier_mat n n
B \<in> carrier_mat n n
P \<in> carrier_mat n n
Q \<in> carrier_mat n n
P * Q \<in> carrier_mat n n \<Longrightarrow> 1\<^sub>m n * (P * Q) = P * Q
similar_mat_wit ?A ?B ?P ?Q \<Longrightarrow> similar_mat_wit ?B ?A ?Q ?P

goal (1 subgoal):
 1. trace (Q * P * B) = trace B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (Q * P * B) = trace B

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (P * B * Q) = trace B
[PROOF STEP]
have traceAB: "trace A = trace B"
[PROOF STATE]
proof (prove)
using this:
trace (P * B * Q) = trace B

goal (1 subgoal):
 1. trace A = trace B
[PROOF STEP]
using traceA
[PROOF STATE]
proof (prove)
using this:
trace (P * B * Q) = trace B
trace A = trace (P * B * Q)

goal (1 subgoal):
 1. trace A = trace B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace A = trace B

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
from A cB cP
[PROOF STATE]
proof (chain)
picking this:
A = P * B * adjoint P
B \<in> carrier_mat n n
P \<in> carrier_mat n n
[PROOF STEP]
have aAa: "adjoint A = adjoint((P * B) * adjoint P)"
[PROOF STATE]
proof (prove)
using this:
A = P * B * adjoint P
B \<in> carrier_mat n n
P \<in> carrier_mat n n

goal (1 subgoal):
 1. adjoint A = adjoint (P * B * adjoint P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint A = adjoint (P * B * adjoint P)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have aA: "adjoint A = P * adjoint B * adjoint P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint A = P * adjoint B * adjoint P
[PROOF STEP]
unfolding aAa
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (P * B * adjoint P) = P * adjoint B * adjoint P
[PROOF STEP]
using cP cB
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. adjoint (P * B * adjoint P) = P * adjoint B * adjoint P
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
adjoint A = P * adjoint B * adjoint P

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have hA: "hermitian A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian A
[PROOF STEP]
using pos positive_is_hermitian
[PROOF STATE]
proof (prove)
using this:
positive A
positive ?A \<Longrightarrow> hermitian ?A

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

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hermitian A
[PROOF STEP]
have AaA: "A = adjoint A"
[PROOF STATE]
proof (prove)
using this:
hermitian A

goal (1 subgoal):
 1. A = adjoint A
[PROOF STEP]
using hA hermitian_def[of A]
[PROOF STATE]
proof (prove)
using this:
hermitian A
hermitian A
hermitian A = (adjoint A = A)

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

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = adjoint A
[PROOF STEP]
have PBaP: "P * B * adjoint P = P * adjoint B * adjoint P"
[PROOF STATE]
proof (prove)
using this:
A = adjoint A

goal (1 subgoal):
 1. P * B * adjoint P = P * adjoint B * adjoint P
[PROOF STEP]
using A aA
[PROOF STATE]
proof (prove)
using this:
A = adjoint A
A = P * B * adjoint P
adjoint A = P * adjoint B * adjoint P

goal (1 subgoal):
 1. P * B * adjoint P = P * adjoint B * adjoint P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P * B * adjoint P = P * adjoint B * adjoint P

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P * B * adjoint P = P * adjoint B * adjoint P
[PROOF STEP]
have BaB: "B = adjoint B"
[PROOF STATE]
proof (prove)
using this:
P * B * adjoint P = P * adjoint B * adjoint P

goal (1 subgoal):
 1. B = adjoint B
[PROOF STEP]
using unitary_elim[of B n "adjoint B" P] uP cP cB adjoint_dim[of B n]
[PROOF STATE]
proof (prove)
using this:
P * B * adjoint P = P * adjoint B * adjoint P
\<lbrakk>B \<in> carrier_mat n n; adjoint B \<in> carrier_mat n n; P \<in> carrier_mat n n; unitary P; P * B * adjoint P = P * adjoint B * adjoint P\<rbrakk> \<Longrightarrow> B = adjoint B
unitary P
P \<in> carrier_mat n n
B \<in> carrier_mat n n
B \<in> carrier_mat n n \<Longrightarrow> adjoint B \<in> carrier_mat n n

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

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have aPP: "adjoint P * P = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint P * P = 1\<^sub>m n
[PROOF STEP]
using uP PB QaP
[PROOF STATE]
proof (prove)
using this:
unitary P
P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n
Q = adjoint P

goal (1 subgoal):
 1. adjoint P * P = 1\<^sub>m n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
adjoint P * P = 1\<^sub>m n

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have "A * A = P * B * (adjoint P * P) * B * adjoint P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * A = P * B * (adjoint P * P) * B * adjoint P
[PROOF STEP]
unfolding A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * B * adjoint P * (P * B * adjoint P) = P * B * (adjoint P * P) * B * adjoint P
[PROOF STEP]
using cP cB
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. P * B * adjoint P * (P * B * adjoint P) = P * B * (adjoint P * P) * B * adjoint P
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
A * A = P * B * (adjoint P * P) * B * adjoint P

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A * A = P * B * (adjoint P * P) * B * adjoint P

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have "\<dots> = P * B * B * adjoint P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * B * (adjoint P * P) * B * adjoint P = P * B * B * adjoint P
[PROOF STEP]
unfolding aPP
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P * B * 1\<^sub>m n * B * adjoint P = P * B * B * adjoint P
[PROOF STEP]
using cP cB
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. P * B * 1\<^sub>m n * B * adjoint P = P * B * B * adjoint P
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
P * B * (adjoint P * P) * B * adjoint P = P * B * B * adjoint P

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A * A = P * B * B * adjoint P
[PROOF STEP]
have AA: "A * A = P * B * B * adjoint P"
[PROOF STATE]
proof (prove)
using this:
A * A = P * B * B * adjoint P

goal (1 subgoal):
 1. A * A = P * B * B * adjoint P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * A = P * B * B * adjoint P

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A * A = P * B * B * adjoint P
[PROOF STEP]
have tAA: "trace (A*A) = trace (P * B * B * adjoint P)"
[PROOF STATE]
proof (prove)
using this:
A * A = P * B * B * adjoint P

goal (1 subgoal):
 1. trace (A * A) = trace (P * B * B * adjoint P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (A * A) = trace (P * B * B * adjoint P)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (A * A) = trace (P * B * B * adjoint P)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have tBB: "\<dots> = trace (adjoint P * P * B * B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (P * B * B * adjoint P) = trace (adjoint P * P * B * B)
[PROOF STEP]
using cP cB
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (P * B * B * adjoint P) = trace (adjoint P * P * B * B)
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
trace (P * B * B * adjoint P) = trace (adjoint P * P * B * B)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (P * B * B * adjoint P) = trace (adjoint P * P * B * B)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have "\<dots> = trace (B * B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (adjoint P * P * B * B) = trace (B * B)
[PROOF STEP]
using uP unitary_def[of P] inverts_mat_def[of P "adjoint P"]
[PROOF STATE]
proof (prove)
using this:
unitary P
unitary P = (P \<in> carrier_mat (dim_row P) (dim_row P) \<and> inverts_mat P (adjoint P))
inverts_mat P (adjoint P) \<equiv> P * adjoint P = 1\<^sub>m (dim_row P)

goal (1 subgoal):
 1. trace (adjoint P * P * B * B) = trace (B * B)
[PROOF STEP]
using PB QaP cB
[PROOF STATE]
proof (prove)
using this:
unitary P
unitary P = (P \<in> carrier_mat (dim_row P) (dim_row P) \<and> inverts_mat P (adjoint P))
inverts_mat P (adjoint P) \<equiv> P * adjoint P = 1\<^sub>m (dim_row P)
P * Q = 1\<^sub>m n \<and> Q * P = 1\<^sub>m n
Q = adjoint P
B \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (adjoint P * P * B * B) = trace (B * B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (adjoint P * P * B * B) = trace (B * B)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (A * A) = trace (B * B)
[PROOF STEP]
have traceAABB: "trace (A * A) = trace (B * B)"
[PROOF STATE]
proof (prove)
using this:
trace (A * A) = trace (B * B)

goal (1 subgoal):
 1. trace (A * A) = trace (B * B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (A * A) = trace (B * B)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have BP: "\<And>i. i < n \<Longrightarrow> B$$(i, i) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> 0 \<le> B $$ (i, i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> 0 \<le> B $$ (i, i)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> 0 \<le> B $$ (i, i)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> 0 \<le> B $$ (i, i)
[PROOF STEP]
assume i: "i < n"
[PROOF STATE]
proof (state)
this:
i < n

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> 0 \<le> B $$ (i, i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < n
[PROOF STEP]
have "B$$(i, i) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. 0 \<le> B $$ (i, i)
[PROOF STEP]
using positive_eigenvalue_positive[of A n es B P Q i] cA pos charpo B
[PROOF STATE]
proof (prove)
using this:
i < n
\<lbrakk>A \<in> carrier_mat n n; positive A; char_poly A = (\<Prod>e\<leftarrow>es. [:- e, 1:]); unitary_schur_decomposition A es = (B, P, Q); i < n\<rbrakk> \<Longrightarrow> 0 \<le> B $$ (i, i)
A \<in> carrier_mat n n
positive A
char_poly A = (\<Prod>a\<leftarrow>es. [:- a, 1:]) \<and> length es = n
unitary_schur_decomposition A es = (B, P, Q)

goal (1 subgoal):
 1. 0 \<le> B $$ (i, i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> B $$ (i, i)

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> 0 \<le> B $$ (i, i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> B $$ (i, i)
[PROOF STEP]
show "B$$(i, i) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> B $$ (i, i)

goal (1 subgoal):
 1. 0 \<le> B $$ (i, i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> B $$ (i, i)

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 < n \<Longrightarrow> 0 \<le> B $$ (?i2, ?i2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> 0 \<le> B $$ (?i, ?i)

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
have Brel: "trace (B*B) \<le> (trace B)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (B * B) \<le> (trace B)\<^sup>2
[PROOF STEP]
using trace_square_less_square_trace[of B n] cB ut BP
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>B \<in> carrier_mat n n; diagonal_mat B; \<And>i. i < n \<Longrightarrow> 0 \<le> B $$ (i, i)\<rbrakk> \<Longrightarrow> trace (B * B) \<le> (trace B)\<^sup>2
B \<in> carrier_mat n n
diagonal_mat B
?i < n \<Longrightarrow> 0 \<le> B $$ (?i, ?i)

goal (1 subgoal):
 1. trace (B * B) \<le> (trace B)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (B * B) \<le> (trace B)\<^sup>2

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
from AaA traceAABB traceAB Brel
[PROOF STATE]
proof (chain)
picking this:
A = adjoint A
trace (A * A) = trace (B * B)
trace A = trace B
trace (B * B) \<le> (trace B)\<^sup>2
[PROOF STEP]
have "trace (A*adjoint A) \<le> (trace A)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
A = adjoint A
trace (A * A) = trace (B * B)
trace A = trace B
trace (B * B) \<le> (trace B)\<^sup>2

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (A * adjoint A) \<le> (trace A)\<^sup>2

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
trace (A * adjoint A) \<le> (trace A)\<^sup>2

goal (1 subgoal):
 1. trace (A * adjoint A) \<le> (trace A)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (A * adjoint A) \<le> (trace A)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem induced_left_coset_equality [simp]:
  assumes [simp]: "a \<in> G" shows "induced (a \<cdot>| L) = \<eta> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. induced (a \<cdot>| L) = \<eta> a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. induced (a \<cdot>| L) = \<eta> a
[PROOF STEP]
have "(THE b. \<exists>a' \<in> G. a' \<cdot>| L = a \<cdot>| L \<and> b = \<eta> a') = \<eta> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE b. \<exists>a'\<in>G. a' \<cdot>| L = a \<cdot>| L \<and> b = \<eta> a') = \<eta> a
[PROOF STEP]
by (rule the_equality) (auto intro: left_coset_equality)
[PROOF STATE]
proof (state)
this:
(THE b. \<exists>a'\<in>G. a' \<cdot>| L = a \<cdot>| L \<and> b = \<eta> a') = \<eta> a

goal (1 subgoal):
 1. induced (a \<cdot>| L) = \<eta> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(THE b. \<exists>a'\<in>G. a' \<cdot>| L = a \<cdot>| L \<and> b = \<eta> a') = \<eta> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(THE b. \<exists>a'\<in>G. a' \<cdot>| L = a \<cdot>| L \<and> b = \<eta> a') = \<eta> a

goal (1 subgoal):
 1. induced (a \<cdot>| L) = \<eta> a
[PROOF STEP]
unfolding induced_def
[PROOF STATE]
proof (prove)
using this:
(THE b. \<exists>a'\<in>G. a' \<cdot>| L = a \<cdot>| L \<and> b = \<eta> a') = \<eta> a

goal (1 subgoal):
 1. (\<lambda>A\<in>contained.Partition. THE b. \<exists>a\<in>G. a \<cdot>| L = A \<and> b = \<eta> a) (a \<cdot>| L) = \<eta> a
[PROOF STEP]
using contained.Class_is_Left_Coset contained.Class_in_Partition
[PROOF STATE]
proof (prove)
using this:
(THE b. \<exists>a'\<in>G. a' \<cdot>| L = a \<cdot>| L \<and> b = \<eta> a') = \<eta> a
?g \<in> G \<Longrightarrow> contained.Class ?g = ?g \<cdot>| L
?a \<in> G \<Longrightarrow> contained.Class ?a \<in> contained.Partition

goal (1 subgoal):
 1. (\<lambda>A\<in>contained.Partition. THE b. \<exists>a\<in>G. a \<cdot>| L = A \<and> b = \<eta> a) (a \<cdot>| L) = \<eta> a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
induced (a \<cdot>| L) = \<eta> a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem wls_substAbs_simp[simp]:
assumes "wls (asSort ys) Y"
and "wls s X" and "xs \<noteq> ys \<or> x \<noteq> y" and "fresh xs x Y"
shows "((Abs xs x X) $[Y / y]_ys) = Abs xs x (X #[Y / y]_ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs xs x X $[Y / y]_ys = Abs xs x (X #[Y / y]_ys)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Abs xs x X $[Y / y]_ys = Abs xs x (X #[Y / y]_ys)
[PROOF STEP]
have "freshEnv xs x (idEnv [y \<leftarrow> Y]_ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. freshEnv xs x (idEnv [y \<leftarrow> Y]_ys)
[PROOF STEP]
unfolding freshEnv_def liftAll_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (idEnv [y \<leftarrow> Y]_ys) xs x = None \<and> (\<forall>ysa i v. (idEnv [y \<leftarrow> Y]_ys) ysa i = Some v \<longrightarrow> fresh xs x v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wls (asSort ys) Y
wls s X
xs \<noteq> ys \<or> x \<noteq> y
fresh xs x Y

goal (1 subgoal):
 1. (idEnv [y \<leftarrow> Y]_ys) xs x = None \<and> (\<forall>ysa i v. (idEnv [y \<leftarrow> Y]_ys) ysa i = Some v \<longrightarrow> fresh xs x v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
freshEnv xs x (idEnv [y \<leftarrow> Y]_ys)

goal (1 subgoal):
 1. Abs xs x X $[Y / y]_ys = Abs xs x (X #[Y / y]_ys)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
freshEnv xs x (idEnv [y \<leftarrow> Y]_ys)

goal (1 subgoal):
 1. Abs xs x X $[Y / y]_ys = Abs xs x (X #[Y / y]_ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
freshEnv xs x (idEnv [y \<leftarrow> Y]_ys)
wls (asSort ys) Y
wls s X
xs \<noteq> ys \<or> x \<noteq> y
fresh xs x Y

goal (1 subgoal):
 1. Abs xs x X $[Y / y]_ys = Abs xs x (X #[Y / y]_ys)
[PROOF STEP]
unfolding subst_def substAbs_def
[PROOF STATE]
proof (prove)
using this:
freshEnv xs x (idEnv [y \<leftarrow> Y]_ys)
wls (asSort ys) Y
wls s X
xs \<noteq> ys \<or> x \<noteq> y
fresh xs x Y

goal (1 subgoal):
 1. Abs xs x X $[idEnv [y \<leftarrow> Y]_ys] = Abs xs x X #[idEnv [y \<leftarrow> Y]_ys]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Abs xs x X $[Y / y]_ys = Abs xs x (X #[Y / y]_ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map2_cong: "
  \<lbrakk> xs1 = xs2; ys1 = ys2; length xs2 \<le> length ys2;
    \<And>x y. \<lbrakk> x \<in> set xs2; y \<in> set ys2 \<rbrakk> \<Longrightarrow> f x y = g x y \<rbrakk> \<Longrightarrow>
  map2 f xs1 ys1 = map2 g xs2 ys2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs1 = xs2; ys1 = ys2; length xs2 \<le> length ys2; \<And>x y. \<lbrakk>x \<in> set xs2; y \<in> set ys2\<rbrakk> \<Longrightarrow> f x y = g x y\<rbrakk> \<Longrightarrow> List2.map2 f xs1 ys1 = List2.map2 g xs2 ys2
[PROOF STEP]
by (simp (no_asm_simp) add: expand_list_eq map2_length map2_nth)


[STATEMENT]
lemma arctan_add_small:
  assumes "\<bar>x * y\<bar> < 1"
    shows "(arctan x + arctan y = arctan((x + y) / (1 - x * y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x + arctan y = arctan ((x + y) / (1 - x * y))
[PROOF STEP]
proof (cases "x = 0 \<or> y = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (x = 0 \<or> y = 0)

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
\<bar>x * y\<bar> < 1
\<not> (x = 0 \<or> y = 0)
[PROOF STEP]
have "\<bar>x\<bar> < inverse \<bar>y\<bar>"
[PROOF STATE]
proof (prove)
using this:
\<bar>x * y\<bar> < 1
\<not> (x = 0 \<or> y = 0)

goal (1 subgoal):
 1. \<bar>x\<bar> < inverse \<bar>y\<bar>
[PROOF STEP]
by (simp add: field_split_simps abs_mult)
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> < inverse \<bar>y\<bar>

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> (x = 0 \<or> y = 0)
\<bar>x\<bar> < inverse \<bar>y\<bar>
[PROOF STEP]
have "\<bar>arctan x\<bar> < pi / 2 - \<bar>arctan y\<bar>"
[PROOF STATE]
proof (prove)
using this:
\<not> (x = 0 \<or> y = 0)
\<bar>x\<bar> < inverse \<bar>y\<bar>

goal (1 subgoal):
 1. \<bar>arctan x\<bar> < pi / 2 - \<bar>arctan y\<bar>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> (x = 0 \<or> y = 0)
\<bar>x\<bar> < inverse \<bar>y\<bar>
\<bar>x * y\<bar> < 1

goal (1 subgoal):
 1. \<bar>arctan x\<bar> < pi / 2 - \<bar>arctan y\<bar>
[PROOF STEP]
by (auto simp add: abs_arctan arctan_inverse [symmetric] arctan_less_iff)
[PROOF STATE]
proof (state)
this:
\<bar>arctan x\<bar> < pi / 2 - \<bar>arctan y\<bar>

goal (2 subgoals):
 1. x = 0 \<or> y = 0 \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
 2. \<not> (x = 0 \<or> y = 0) \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>arctan x\<bar> < pi / 2 - \<bar>arctan y\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>arctan x\<bar> < pi / 2 - \<bar>arctan y\<bar>

goal (1 subgoal):
 1. arctan x + arctan y = arctan ((x + y) / (1 - x * y))
[PROOF STEP]
by (intro arctan_add_raw) linarith
[PROOF STATE]
proof (state)
this:
arctan x + arctan y = arctan ((x + y) / (1 - x * y))

goal (1 subgoal):
 1. x = 0 \<or> y = 0 \<Longrightarrow> arctan x + arctan y = arctan ((x + y) / (1 - x * y))
[PROOF STEP]
qed auto


[STATEMENT]
lemma functions_of_is_inj_on:
  assumes "finite A" "finite B" "partition_on A P" "card P \<le> card B"
  assumes "\<forall>X\<in>P. card X = 1"
  shows "univ (\<lambda>f. inj_on f A) (functions_of P A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of P A B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of P A B)
[PROOF STEP]
have "functions_of P A B \<in> (A \<rightarrow>\<^sub>E B) // range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. functions_of P A B \<in> (A \<rightarrow>\<^sub>E B) // range_permutation A B
[PROOF STEP]
using functions_of \<open>finite A\<close> \<open>finite B\<close> \<open>partition_on A P\<close> \<open>card P \<le> card B\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; finite ?B; partition_on ?A ?P; card ?P \<le> card ?B\<rbrakk> \<Longrightarrow> functions_of ?P ?A ?B \<in> (?A \<rightarrow>\<^sub>E ?B) // range_permutation ?A ?B
finite A
finite B
partition_on A P
card P \<le> card B

goal (1 subgoal):
 1. functions_of P A B \<in> (A \<rightarrow>\<^sub>E B) // range_permutation A B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
functions_of P A B \<in> (A \<rightarrow>\<^sub>E B) // range_permutation A B

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of P A B)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
functions_of P A B \<in> (A \<rightarrow>\<^sub>E B) // range_permutation A B
[PROOF STEP]
obtain f where eq_f: "functions_of P A B = range_permutation A B `` {f}" and "f \<in> A \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
using this:
functions_of P A B \<in> (A \<rightarrow>\<^sub>E B) // range_permutation A B

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>functions_of P A B = range_permutation A B `` {f}; f \<in> A \<rightarrow>\<^sub>E B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using quotientE
[PROOF STATE]
proof (prove)
using this:
functions_of P A B \<in> (A \<rightarrow>\<^sub>E B) // range_permutation A B
\<lbrakk>?X \<in> ?A // ?r; \<And>x. \<lbrakk>?X = ?r `` {x}; x \<in> ?A\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>functions_of P A B = range_permutation A B `` {f}; f \<in> A \<rightarrow>\<^sub>E B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
functions_of P A B = range_permutation A B `` {f}
f \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of P A B)
[PROOF STEP]
from eq_f
[PROOF STATE]
proof (chain)
picking this:
functions_of P A B = range_permutation A B `` {f}
[PROOF STEP]
have "f \<in> functions_of P A B"
[PROOF STATE]
proof (prove)
using this:
functions_of P A B = range_permutation A B `` {f}

goal (1 subgoal):
 1. f \<in> functions_of P A B
[PROOF STEP]
using \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> equiv_range_permutation equiv_class_self
[PROOF STATE]
proof (prove)
using this:
functions_of P A B = range_permutation A B `` {f}
f \<in> A \<rightarrow>\<^sub>E B
equiv (?A \<rightarrow>\<^sub>E ?B) (range_permutation ?A ?B)
\<lbrakk>equiv ?A ?r; ?a \<in> ?A\<rbrakk> \<Longrightarrow> ?a \<in> ?r `` {?a}

goal (1 subgoal):
 1. f \<in> functions_of P A B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f \<in> functions_of P A B

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of P A B)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
f \<in> functions_of P A B
[PROOF STEP]
have eq: "(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = P"
[PROOF STATE]
proof (prove)
using this:
f \<in> functions_of P A B

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = P
[PROOF STEP]
unfolding functions_of_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = P}

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = P

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of P A B)
[PROOF STEP]
have "inj_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f A
[PROOF STEP]
proof (rule inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "x \<in> A" "y \<in> A" "f x = f y"
[PROOF STATE]
proof (state)
this:
x \<in> A
y \<in> A
f x = f y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from \<open>x \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
[PROOF STEP]
have "x \<in> {x' \<in> A. f x' = f x}"
[PROOF STATE]
proof (prove)
using this:
x \<in> A

goal (1 subgoal):
 1. x \<in> {x' \<in> A. f x' = f x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {x' \<in> A. f x' = f x}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> {x' \<in> A. f x' = f x}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from \<open>y \<in> A\<close> \<open>f x = f y\<close>
[PROOF STATE]
proof (chain)
picking this:
y \<in> A
f x = f y
[PROOF STEP]
have "y \<in> {x' \<in> A. f x' = f x}"
[PROOF STATE]
proof (prove)
using this:
y \<in> A
f x = f y

goal (1 subgoal):
 1. y \<in> {x' \<in> A. f x' = f x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> {x' \<in> A. f x' = f x}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
y \<in> {x' \<in> A. f x' = f x}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "card {x' \<in> A. f x' = f x} = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x' \<in> A. f x' = f x} = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {x' \<in> A. f x' = f x} = 1
[PROOF STEP]
from \<open>x \<in> A\<close> \<open>f \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
f \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
have "f x \<in> B"
[PROOF STATE]
proof (prove)
using this:
x \<in> A
f \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f x \<in> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f x \<in> B

goal (1 subgoal):
 1. card {x' \<in> A. f x' = f x} = 1
[PROOF STEP]
from this \<open>x \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
f x \<in> B
x \<in> A
[PROOF STEP]
have "{x' \<in> A. f x' = f x} \<in> (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}"
[PROOF STATE]
proof (prove)
using this:
f x \<in> B
x \<in> A

goal (1 subgoal):
 1. {x' \<in> A. f x' = f x} \<in> (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x' \<in> A. f x' = f x} \<in> (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}

goal (1 subgoal):
 1. card {x' \<in> A. f x' = f x} = 1
[PROOF STEP]
from this \<open>\<forall>X\<in>P. card X = 1\<close> eq
[PROOF STATE]
proof (chain)
picking this:
{x' \<in> A. f x' = f x} \<in> (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}
\<forall>X\<in>P. card X = 1
(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = P
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x' \<in> A. f x' = f x} \<in> (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}
\<forall>X\<in>P. card X = 1
(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = P

goal (1 subgoal):
 1. card {x' \<in> A. f x' = f x} = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {x' \<in> A. f x' = f x} = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {x' \<in> A. f x' = f x} = 1

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; f x = f y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> {x' \<in> A. f x' = f x}
y \<in> {x' \<in> A. f x' = f x}
card {x' \<in> A. f x' = f x} = 1
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> {x' \<in> A. f x' = f x}
y \<in> {x' \<in> A. f x' = f x}
card {x' \<in> A. f x' = f x} = 1

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (metis card_1_singletonE singletonD)
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on f A

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of P A B)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
inj_on f A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on f A

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (functions_of P A B)
[PROOF STEP]
unfolding eq_f
[PROOF STATE]
proof (prove)
using this:
inj_on f A

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (range_permutation A B `` {f})
[PROOF STEP]
using equiv_range_permutation inj_on_respects_range_permutation \<open>f \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (prove)
using this:
inj_on f A
equiv (?A \<rightarrow>\<^sub>E ?B) (range_permutation ?A ?B)
(\<lambda>f. inj_on f ?A) respects range_permutation ?A ?B
f \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. univ (\<lambda>f. inj_on f A) (range_permutation A B `` {f})
[PROOF STEP]
by (subst univ_commute') assumption+
[PROOF STATE]
proof (state)
this:
univ (\<lambda>f. inj_on f A) (functions_of P A B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma first_dilated_instant:
  assumes \<open>strict_mono f\<close>
      and \<open>f (0::nat) = (0::nat)\<close>
    shows \<open>Max {i. f i \<le> 0} = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max {i. f i \<le> 0} = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Max {i. f i \<le> 0} = 0
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
f 0 = 0
[PROOF STEP]
have \<open>\<forall>n > 0. f n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
f 0 = 0

goal (1 subgoal):
 1. \<forall>n>0. 0 < f n
[PROOF STEP]
using strict_monoD[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
f 0 = 0
?x < ?y \<Longrightarrow> f ?x < f ?y

goal (1 subgoal):
 1. \<forall>n>0. 0 < f n
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<forall>n>0. 0 < f n

goal (1 subgoal):
 1. Max {i. f i \<le> 0} = 0
[PROOF STEP]
hence \<open>\<forall>n \<noteq> 0. \<not>(f n \<le> 0)\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>n>0. 0 < f n

goal (1 subgoal):
 1. \<forall>n. n \<noteq> 0 \<longrightarrow> \<not> f n \<le> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>n. n \<noteq> 0 \<longrightarrow> \<not> f n \<le> 0

goal (1 subgoal):
 1. Max {i. f i \<le> 0} = 0
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
f 0 = 0
\<forall>n. n \<noteq> 0 \<longrightarrow> \<not> f n \<le> 0
[PROOF STEP]
have \<open>{i. f i \<le> 0} = {0}\<close>
[PROOF STATE]
proof (prove)
using this:
f 0 = 0
\<forall>n. n \<noteq> 0 \<longrightarrow> \<not> f n \<le> 0

goal (1 subgoal):
 1. {i. f i \<le> 0} = {0}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{i. f i \<le> 0} = {0}

goal (1 subgoal):
 1. Max {i. f i \<le> 0} = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{i. f i \<le> 0} = {0}

goal (1 subgoal):
 1. Max {i. f i \<le> 0} = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Max {i. f i \<le> 0} = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma descartes_sign_rule_aux:
  fixes p :: "real poly"
  assumes "p \<noteq> 0"
  shows   "coeff_sign_changes p \<ge> count_pos_roots p \<and>
           even (coeff_sign_changes p - count_pos_roots p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
proof (induction p rule: poly_root_induct[where P = "\<lambda>a. a > 0"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
 3. \<And>a p. \<lbrakk>0 < a; p \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p); [:a, - 1:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) ([:a, - 1:] * p) \<le> sign_changes (coeffs ([:a, - 1:] * p)) \<and> even (sign_changes (coeffs ([:a, - 1:] * p)) - count_roots_with ((<) 0) ([:a, - 1:] * p))
[PROOF STEP]
case (root a p)
[PROOF STATE]
proof (state)
this:
0 < a
p \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[:a, - 1:] * p \<noteq> 0

goal (3 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
 3. \<And>a p. \<lbrakk>0 < a; p \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p); [:a, - 1:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) ([:a, - 1:] * p) \<le> sign_changes (coeffs ([:a, - 1:] * p)) \<and> even (sign_changes (coeffs ([:a, - 1:] * p)) - count_roots_with ((<) 0) ([:a, - 1:] * p))
[PROOF STEP]
define q where "q = [:a, -1:] * p"
[PROOF STATE]
proof (state)
this:
q = [:a, - 1:] * p

goal (3 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
 3. \<And>a p. \<lbrakk>0 < a; p \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p); [:a, - 1:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) ([:a, - 1:] * p) \<le> sign_changes (coeffs ([:a, - 1:] * p)) \<and> even (sign_changes (coeffs ([:a, - 1:] * p)) - count_roots_with ((<) 0) ([:a, - 1:] * p))
[PROOF STEP]
from root.prems
[PROOF STATE]
proof (chain)
picking this:
[:a, - 1:] * p \<noteq> 0
[PROOF STEP]
have p: "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
[:a, - 1:] * p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (3 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
 3. \<And>a p. \<lbrakk>0 < a; p \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p); [:a, - 1:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) ([:a, - 1:] * p) \<le> sign_changes (coeffs ([:a, - 1:] * p)) \<and> even (sign_changes (coeffs ([:a, - 1:] * p)) - count_roots_with ((<) 0) ([:a, - 1:] * p))
[PROOF STEP]
with root p sign_changes_poly_times_root_minus_x[of p a]
       count_roots_with_times_root[of p "\<lambda>x. x > 0" a]
[PROOF STATE]
proof (chain)
picking this:
0 < a
p \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[:a, - 1:] * p \<noteq> 0
p \<noteq> 0
\<lbrakk>p \<noteq> 0; 0 < a\<rbrakk> \<Longrightarrow> 0 < sign_changes (coeffs ([:a, - 1:] * p)) - sign_changes (coeffs p) \<and> odd (sign_changes (coeffs ([:a, - 1:] * p)) - sign_changes (coeffs p))
\<lbrakk>p \<noteq> 0; 0 < a\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) ([:a, - 1:] * p) = Suc (count_roots_with ((<) 0) p)
p \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < a
p \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[:a, - 1:] * p \<noteq> 0
p \<noteq> 0
\<lbrakk>p \<noteq> 0; 0 < a\<rbrakk> \<Longrightarrow> 0 < sign_changes (coeffs ([:a, - 1:] * p)) - sign_changes (coeffs p) \<and> odd (sign_changes (coeffs ([:a, - 1:] * p)) - sign_changes (coeffs p))
\<lbrakk>p \<noteq> 0; 0 < a\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) ([:a, - 1:] * p) = Suc (count_roots_with ((<) 0) p)
p \<noteq> 0

goal (1 subgoal):
 1. count_roots_with ((<) 0) ([:a, - 1:] * p) \<le> sign_changes (coeffs ([:a, - 1:] * p)) \<and> even (sign_changes (coeffs ([:a, - 1:] * p)) - count_roots_with ((<) 0) ([:a, - 1:] * p))
[PROOF STEP]
by (fold q_def) fastforce
[PROOF STATE]
proof (state)
this:
count_roots_with ((<) 0) ([:a, - 1:] * p) \<le> sign_changes (coeffs ([:a, - 1:] * p)) \<and> even (sign_changes (coeffs ([:a, - 1:] * p)) - count_roots_with ((<) 0) ([:a, - 1:] * p))

goal (2 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
case (no_roots p)
[PROOF STATE]
proof (state)
this:
0 < ?a \<Longrightarrow> poly p ?a \<noteq> 0
p \<noteq> 0

goal (2 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
from no_roots
[PROOF STATE]
proof (chain)
picking this:
0 < ?a \<Longrightarrow> poly p ?a \<noteq> 0
p \<noteq> 0
[PROOF STEP]
have "pos_roots p = {}"
[PROOF STATE]
proof (prove)
using this:
0 < ?a \<Longrightarrow> poly p ?a \<noteq> 0
p \<noteq> 0

goal (1 subgoal):
 1. roots_with ((<) 0) p = {}
[PROOF STEP]
by (auto simp: roots_with_def)
[PROOF STATE]
proof (state)
this:
roots_with ((<) 0) p = {}

goal (2 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
hence [simp]: "count_pos_roots p = 0"
[PROOF STATE]
proof (prove)
using this:
roots_with ((<) 0) p = {}

goal (1 subgoal):
 1. count_roots_with ((<) 0) p = 0
[PROOF STEP]
by (simp add: count_roots_with_def)
[PROOF STATE]
proof (state)
this:
count_roots_with ((<) 0) p = 0

goal (2 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
 2. \<And>p. \<lbrakk>\<And>a. 0 < a \<Longrightarrow> poly p a \<noteq> 0; p \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
count_roots_with ((<) 0) p = 0

goal (1 subgoal):
 1. count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
using no_roots \<open>p \<noteq> 0\<close> odd_coeff_sign_changes_imp_pos_roots[of p]
[PROOF STATE]
proof (prove)
using this:
count_roots_with ((<) 0) p = 0
0 < ?a \<Longrightarrow> poly p ?a \<noteq> 0
p \<noteq> 0
p \<noteq> 0
\<lbrakk>p \<noteq> 0; odd (sign_changes (coeffs p)); \<And>x. \<lbrakk>0 < x; poly p x = 0\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)
[PROOF STEP]
by (auto simp: roots_with_def)
[PROOF STATE]
proof (state)
this:
count_roots_with ((<) 0) p \<le> sign_changes (coeffs p) \<and> even (sign_changes (coeffs p) - count_roots_with ((<) 0) p)

goal (1 subgoal):
 1. 0 \<noteq> 0 \<Longrightarrow> count_roots_with ((<) 0) 0 \<le> sign_changes (coeffs 0) \<and> even (sign_changes (coeffs 0) - count_roots_with ((<) 0) 0)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma algebraic_div:
  assumes x: "algebraic x" and y: "algebraic y" shows "algebraic (x/y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic (x / y)
[PROOF STEP]
proof(cases "y = 0 \<or> x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y = (0::'a) \<or> x = (0::'a) \<Longrightarrow> algebraic (x / y)
 2. \<not> (y = (0::'a) \<or> x = (0::'a)) \<Longrightarrow> algebraic (x / y)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y = (0::'a) \<or> x = (0::'a)

goal (2 subgoals):
 1. y = (0::'a) \<or> x = (0::'a) \<Longrightarrow> algebraic (x / y)
 2. \<not> (y = (0::'a) \<or> x = (0::'a)) \<Longrightarrow> algebraic (x / y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = (0::'a) \<or> x = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y = (0::'a) \<or> x = (0::'a)

goal (1 subgoal):
 1. algebraic (x / y)
[PROOF STEP]
using algebraic_of_rat[of 0]
[PROOF STATE]
proof (prove)
using this:
y = (0::'a) \<or> x = (0::'a)
algebraic (of_rat 0)

goal (1 subgoal):
 1. algebraic (x / y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
algebraic (x / y)

goal (1 subgoal):
 1. \<not> (y = (0::'a) \<or> x = (0::'a)) \<Longrightarrow> algebraic (x / y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (y = (0::'a) \<or> x = (0::'a)) \<Longrightarrow> algebraic (x / y)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (y = (0::'a) \<or> x = (0::'a))

goal (1 subgoal):
 1. \<not> (y = (0::'a) \<or> x = (0::'a)) \<Longrightarrow> algebraic (x / y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (y = (0::'a) \<or> x = (0::'a))
[PROOF STEP]
have x0: "x \<noteq> 0" and y0: "y \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (y = (0::'a) \<or> x = (0::'a))

goal (1 subgoal):
 1. x \<noteq> (0::'a) &&& y \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<noteq> (0::'a)
y \<noteq> (0::'a)

goal (1 subgoal):
 1. \<not> (y = (0::'a) \<or> x = (0::'a)) \<Longrightarrow> algebraic (x / y)
[PROOF STEP]
from x y
[PROOF STATE]
proof (chain)
picking this:
algebraic x
algebraic y
[PROOF STEP]
obtain p q
  where px: "p represents x" and irr: "irreducible q" and qy: "q represents y"
[PROOF STATE]
proof (prove)
using this:
algebraic x
algebraic y

goal (1 subgoal):
 1. (\<And>p q. \<lbrakk>p represents x; irreducible q; q represents y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto dest!: algebraic_imp_represents_irreducible)
[PROOF STATE]
proof (state)
this:
p represents x
irreducible q
q represents y

goal (1 subgoal):
 1. \<not> (y = (0::'a) \<or> x = (0::'a)) \<Longrightarrow> algebraic (x / y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic (x / y)
[PROOF STEP]
using False px represents_irr_non_0[OF irr qy]
[PROOF STATE]
proof (prove)
using this:
\<not> (y = (0::'a) \<or> x = (0::'a))
p represents x
y \<noteq> (0::'a) \<Longrightarrow> poly q 0 \<noteq> 0

goal (1 subgoal):
 1. algebraic (x / y)
[PROOF STEP]
by (auto intro!: algebraic_representsI[OF represents_div] qy)
[PROOF STATE]
proof (state)
this:
algebraic (x / y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insert_lt[simp]: "\<forall>j\<le>length l. \<forall>i\<le>j. (list_insert l i a)!Suc j = l!j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j
[PROOF STEP]
proof (induct l, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa l. \<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j \<Longrightarrow> \<forall>j\<le>length (aa # l). \<forall>i\<le>j. list_insert (aa # l) i a ! Suc j = (aa # l) ! j
[PROOF STEP]
case (Cons x l)
[PROOF STATE]
proof (state)
this:
\<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j

goal (1 subgoal):
 1. \<And>aa l. \<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j \<Longrightarrow> \<forall>j\<le>length (aa # l). \<forall>i\<le>j. list_insert (aa # l) i a ! Suc j = (aa # l) ! j
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j

goal (1 subgoal):
 1. \<forall>j\<le>length (x # l). \<forall>i\<le>j. list_insert (x # l) i a ! Suc j = (x # l) ! j
[PROOF STEP]
proof (auto split: nat.split)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j x2. \<lbrakk>\<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j; j \<le> Suc (length l); Suc x2 \<le> j\<rbrakk> \<Longrightarrow> list_insert l x2 a ! j = l ! (j - Suc 0)
[PROOF STEP]
fix n j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j x2. \<lbrakk>\<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j; j \<le> Suc (length l); Suc x2 \<le> j\<rbrakk> \<Longrightarrow> list_insert l x2 a ! j = l ! (j - Suc 0)
[PROOF STEP]
assume "j \<le> Suc (length l)" and "Suc n \<le> j"
[PROOF STATE]
proof (state)
this:
j \<le> Suc (length l)
Suc n \<le> j

goal (1 subgoal):
 1. \<And>j x2. \<lbrakk>\<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j; j \<le> Suc (length l); Suc x2 \<le> j\<rbrakk> \<Longrightarrow> list_insert l x2 a ! j = l ! (j - Suc 0)
[PROOF STEP]
with Cons(1)
[PROOF STATE]
proof (chain)
picking this:
\<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j
j \<le> Suc (length l)
Suc n \<le> j
[PROOF STEP]
show "(list_insert l n a)!j = l!(j - Suc 0)"
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<le>length l. \<forall>i\<le>j. list_insert l i a ! Suc j = l ! j
j \<le> Suc (length l)
Suc n \<le> j

goal (1 subgoal):
 1. list_insert l n a ! j = l ! (j - Suc 0)
[PROOF STEP]
by (cases j) simp_all
[PROOF STATE]
proof (state)
this:
list_insert l n a ! j = l ! (j - Suc 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>j\<le>length (x # l). \<forall>i\<le>j. list_insert (x # l) i a ! Suc j = (x # l) ! j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutes_in_image:
  \<open>p x \<in> S \<longleftrightarrow> x \<in> S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p x \<in> S) = (x \<in> S)
[PROOF STEP]
using permutes_image permutes_inj
[PROOF STATE]
proof (prove)
using this:
p ` S = S
inj p

goal (1 subgoal):
 1. (p x \<in> S) = (x \<in> S)
[PROOF STEP]
by (auto dest: inj_image_mem_iff)


[STATEMENT]
lemma butlast_bin_rest: "butlast bl = bin_to_bl (length bl - Suc 0) (bl_to_bin bl div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast bl = bin_to_bl (length bl - Suc 0) (bl_to_bin bl div 2)
[PROOF STEP]
using butlast_rest_bin [where w="bl_to_bin bl" and n="length bl"]
[PROOF STATE]
proof (prove)
using this:
butlast (bin_to_bl (length bl) (bl_to_bin bl)) = bin_to_bl (length bl - 1) (bl_to_bin bl div 2)

goal (1 subgoal):
 1. butlast bl = bin_to_bl (length bl - Suc 0) (bl_to_bin bl div 2)
[PROOF STEP]
by simp


[STATEMENT]
lemma x1_pos: "x\<^sub>1 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x\<^sub>1
[PROOF STEP]
using x1_ge_1
[PROOF STATE]
proof (prove)
using this:
1 \<le> x\<^sub>1

goal (1 subgoal):
 1. 0 < x\<^sub>1
[PROOF STEP]
by simp


[STATEMENT]
lemma frontier_of_Int:
     "X frontier_of (S \<inter> T) =
      X closure_of (S \<inter> T) \<inter> (X frontier_of S \<union> X frontier_of T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X frontier_of (S \<inter> T) = X closure_of (S \<inter> T) \<inter> (X frontier_of S \<union> X frontier_of T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. X frontier_of (S \<inter> T) = X closure_of (S \<inter> T) \<inter> (X frontier_of S \<union> X frontier_of T)
[PROOF STEP]
have *: "U \<subseteq> S \<and> U \<subseteq> T \<Longrightarrow> U \<inter> (S \<inter> A \<union> T \<inter> B) = U \<inter> (A \<union> B)" for U S T A B :: "'a set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<subseteq> S \<and> U \<subseteq> T \<Longrightarrow> U \<inter> (S \<inter> A \<union> T \<inter> B) = U \<inter> (A \<union> B)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?U \<subseteq> ?S \<and> ?U \<subseteq> ?T \<Longrightarrow> ?U \<inter> (?S \<inter> ?A \<union> ?T \<inter> ?B) = ?U \<inter> (?A \<union> ?B)

goal (1 subgoal):
 1. X frontier_of (S \<inter> T) = X closure_of (S \<inter> T) \<inter> (X frontier_of S \<union> X frontier_of T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X frontier_of (S \<inter> T) = X closure_of (S \<inter> T) \<inter> (X frontier_of S \<union> X frontier_of T)
[PROOF STEP]
by (simp add: frontier_of_closures closure_of_mono Diff_Int * flip: closure_of_Un)
[PROOF STATE]
proof (state)
this:
X frontier_of (S \<inter> T) = X closure_of (S \<inter> T) \<inter> (X frontier_of S \<union> X frontier_of T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uminus_r_inv_vec[simp]:
  "(v :: 'a :: group_add vec) \<in> carrier_vec n \<Longrightarrow> (v + - v) = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> carrier_vec n \<Longrightarrow> v + - v = 0\<^sub>v n
[PROOF STEP]
by (intro eq_vecI, auto)


[STATEMENT]
lemma admissible_transactions_fv_bvars_disj:
  assumes "\<forall>T \<in> set P. admissible_transaction T"
  shows "(\<Union>T \<in> set P. fv_transaction T) \<inter> (\<Union>T \<in> set P. bvars_transaction T) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (fv_transaction ` set P) \<inter> \<Union> (bvars_transaction ` set P) = {}
[PROOF STEP]
using assms admissible_transaction_no_bvars(2)
[PROOF STATE]
proof (prove)
using this:
Ball (set P) admissible_transaction
admissible_transaction ?T \<Longrightarrow> bvars_transaction ?T = {}

goal (1 subgoal):
 1. \<Union> (fv_transaction ` set P) \<inter> \<Union> (bvars_transaction ` set P) = {}
[PROOF STEP]
by fast


[STATEMENT]
lemma transitive_asymmetric_irreflexive:
  "transitive x \<Longrightarrow> asymmetric x \<longleftrightarrow> irreflexive x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transitive x \<Longrightarrow> asymmetric x = irreflexive x
[PROOF STEP]
using strict_order_var
[PROOF STATE]
proof (prove)
using this:
strict_order ?x = (asymmetric ?x \<and> transitive ?x)

goal (1 subgoal):
 1. transitive x \<Longrightarrow> asymmetric x = irreflexive x
[PROOF STEP]
by blast


[STATEMENT]
lemma of_rat_val_eval: "p \<lbrace>of_rat_val v\<rbrace> = of_rat (p \<lbrace>v\<rbrace>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<lbrace> of_rat_val v \<rbrace> = real_of_rat p \<lbrace> v \<rbrace>
[PROOF STEP]
unfolding of_rat_val_def linear_poly_sum of_rat_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>vars p. coeff p x *R real_of_rat (v x)) = (\<Sum>a\<in>vars p. real_of_rat (coeff p a *R v a))
[PROOF STEP]
by (rule sum.cong, auto simp: of_rat_mult)


[STATEMENT]
lemma option_rel_compp: "\<langle>A O B\<rangle>option_rel = \<langle>A\<rangle>option_rel O \<langle>B\<rangle>option_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>A O B\<rangle>option_rel = \<langle>A\<rangle>option_rel O \<langle>B\<rangle>option_rel
[PROOF STEP]
using option.rel_compp[of "rel2p A" "rel2p B"]
[PROOF STATE]
proof (prove)
using this:
rel_option (rel2p A OO rel2p B) = rel_option (rel2p A) OO rel_option (rel2p B)

goal (1 subgoal):
 1. \<langle>A O B\<rangle>option_rel = \<langle>A\<rangle>option_rel O \<langle>B\<rangle>option_rel
[PROOF STEP]
by (auto simp: rel2p(2-)[symmetric] rel2p_comp)


[STATEMENT]
lemma poly_eq_0_coprime:
  assumes "Rings.coprime p q" "p \<noteq> 0" "q \<noteq> 0"
  shows   "poly p x \<noteq> 0 \<or> poly q x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)
[PROOF STEP]
have False if "poly p x = 0" "poly q x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have "[:-x, 1:] dvd p" "[:-x, 1:] dvd q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:- x, 1::'a:] dvd p &&& [:- x, 1::'a:] dvd q
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
poly p x = (0::'a)
poly q x = (0::'a)

goal (1 subgoal):
 1. [:- x, 1::'a:] dvd p &&& [:- x, 1::'a:] dvd q
[PROOF STEP]
by (simp_all add: poly_eq_0_iff_dvd)
[PROOF STATE]
proof (state)
this:
[:- x, 1::'a:] dvd p
[:- x, 1::'a:] dvd q

goal (1 subgoal):
 1. False
[PROOF STEP]
hence "[:-x, 1:] dvd 1"
[PROOF STATE]
proof (prove)
using this:
[:- x, 1::'a:] dvd p
[:- x, 1::'a:] dvd q

goal (1 subgoal):
 1. is_unit [:- x, 1::'a:]
[PROOF STEP]
using \<open>Rings.coprime p q\<close>
[PROOF STATE]
proof (prove)
using this:
[:- x, 1::'a:] dvd p
[:- x, 1::'a:] dvd q
algebraic_semidom_class.coprime p q

goal (1 subgoal):
 1. is_unit [:- x, 1::'a:]
[PROOF STEP]
by (meson not_coprimeI)
[PROOF STATE]
proof (state)
this:
is_unit [:- x, 1::'a:]

goal (1 subgoal):
 1. False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
is_unit [:- x, 1::'a:]

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>poly p x = (0::'a); poly q x = (0::'a)\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>poly p x = (0::'a); poly q x = (0::'a)\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma language_state_inputs :
  assumes "well_formed M"
  and     "io \<in> language_state M q"
shows "set (map fst io) \<subseteq> inputs M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map fst io) \<subseteq> inputs M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (map fst io) \<subseteq> inputs M
[PROOF STEP]
obtain tr where "path M (io || tr) q" "length tr = length io"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>tr. \<lbrakk>path M (io || tr) q; length tr = length io\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
io \<in> LS M q

goal (1 subgoal):
 1. (\<And>tr. \<lbrakk>path M (io || tr) q; length tr = length io\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path M (io || tr) q
length tr = length io

goal (1 subgoal):
 1. set (map fst io) \<subseteq> inputs M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map fst io) \<subseteq> inputs M
[PROOF STEP]
by (metis (no_types)
        \<open>\<And>thesis. (\<And>tr. \<lbrakk>path M (io || tr) q; length tr = length io\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close>
        assms(1) map_fst_zip path_input_containment)
[PROOF STATE]
proof (state)
this:
set (map fst io) \<subseteq> inputs M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vreal_inverse_closed:
  assumes "x \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>"
  shows "x\<inverse>\<^sub>\<real> \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<inverse>\<^sub>\<real> \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<inverse>\<^sub>\<real> \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>
[PROOF STEP]
have "inverse x' \<in> UNIV" for x' :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse x' \<in> UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse ?x' \<in> UNIV

goal (1 subgoal):
 1. x\<inverse>\<^sub>\<real> \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>
[PROOF STEP]
from this[untransferred, OF assms]
[PROOF STATE]
proof (chain)
picking this:
x\<inverse>\<^sub>\<real> \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<inverse>\<^sub>\<real> \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>

goal (1 subgoal):
 1. x\<inverse>\<^sub>\<real> \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x\<inverse>\<^sub>\<real> \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma consequence_unit :
  assumes "(\<And> \<sigma>. P \<sigma> \<longrightarrow> P' \<sigma>)"
   and  "\<lbrace>P'\<rbrace> M \<lbrace>\<lambda>x::unit. \<lambda> \<sigma>.  Q' \<sigma>\<rbrace>"
   and  " (\<And> \<sigma>. Q'  \<sigma> \<longrightarrow> Q  \<sigma>)"
   shows "\<lbrace>P\<rbrace> M \<lbrace>\<lambda>x \<sigma>. Q \<sigma>\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrace>P\<rbrace> M \<lbrace>\<lambda>x. Q\<rbrace>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrace>P\<rbrace> M \<lbrace>\<lambda>x. Q\<rbrace>
[PROOF STEP]
have * : "(\<lambda>x \<sigma>. Q  \<sigma>) = (\<lambda>x::unit. \<lambda> \<sigma>. x\<in>UNIV \<and> Q  \<sigma>) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Q) = (\<lambda>x \<sigma>. x \<in> UNIV \<and> Q \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. Q) = (\<lambda>x \<sigma>. x \<in> UNIV \<and> Q \<sigma>)

goal (1 subgoal):
 1. \<lbrace>P\<rbrace> M \<lbrace>\<lambda>x. Q\<rbrace>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrace>P\<rbrace> M \<lbrace>\<lambda>x. Q\<rbrace>
[PROOF STEP]
apply(subst *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrace>P\<rbrace> M \<lbrace>\<lambda>x \<sigma>. x \<in> UNIV \<and> Q \<sigma>\<rbrace>
[PROOF STEP]
apply(rule_tac  P' = "P'" and Q' = "%_. Q'" in consequence)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Collect P \<subseteq> Collect P'
 2. \<lbrace>P'\<rbrace> M \<lbrace>\<lambda>x \<sigma>. x \<in> UNIV \<and> Q' \<sigma>\<rbrace>
 3. \<forall>x\<in>UNIV. Collect Q' \<subseteq> {\<sigma>. Q \<sigma>}
[PROOF STEP]
apply (simp add: Collect_mono assms(1))
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrace>P'\<rbrace> M \<lbrace>\<lambda>x \<sigma>. x \<in> UNIV \<and> Q' \<sigma>\<rbrace>
 2. \<forall>x\<in>UNIV. Collect Q' \<subseteq> {\<sigma>. Q \<sigma>}
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrace>P'\<rbrace> M \<lbrace>\<lambda>x. Q'\<rbrace>

goal (2 subgoals):
 1. \<lbrace>P'\<rbrace> M \<lbrace>\<lambda>x \<sigma>. x \<in> UNIV \<and> Q' \<sigma>\<rbrace>
 2. \<forall>x\<in>UNIV. Collect Q' \<subseteq> {\<sigma>. Q \<sigma>}
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. Collect Q' \<subseteq> {\<sigma>. Q \<sigma>}
[PROOF STEP]
by (simp add: Collect_mono assms(3))
[PROOF STATE]
proof (state)
this:
\<lbrace>P\<rbrace> M \<lbrace>\<lambda>x. Q\<rbrace>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hypnat_diff_split: "P (a - b) \<longleftrightarrow> (a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d)"
  for a b :: hypnat
  \<comment> \<open>elimination of \<open>-\<close> on \<open>hypnat\<close>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
[PROOF STEP]
proof (cases "a < b" rule: case_split)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a < b \<Longrightarrow> P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
 2. \<not> a < b \<Longrightarrow> P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a < b

goal (2 subgoals):
 1. a < b \<Longrightarrow> P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
 2. \<not> a < b \<Longrightarrow> P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
[PROOF STEP]
by (auto simp add: hypnat_add_self_not_less order_less_imp_le hypnat_diff_is_0_eq [THEN iffD2])
[PROOF STATE]
proof (state)
this:
P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))

goal (1 subgoal):
 1. \<not> a < b \<Longrightarrow> P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a < b \<Longrightarrow> P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> a < b

goal (1 subgoal):
 1. \<not> a < b \<Longrightarrow> P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> a < b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> a < b

goal (1 subgoal):
 1. P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))
[PROOF STEP]
by (auto simp add: linorder_not_less dest: order_le_less_trans)
[PROOF STATE]
proof (state)
this:
P (a - b) = ((a < b \<longrightarrow> P 0) \<and> (\<forall>d. a = b + d \<longrightarrow> P d))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  isometry_linear:
  "f (0::'a::real_inner) = (0::'a) \<Longrightarrow> \<forall>x y. dist(f x) (f y) = dist x y \<Longrightarrow> linear f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f (0::'a) = (0::'a); \<forall>x y. dist (f x) (f y) = dist x y\<rbrakk> \<Longrightarrow> linear f
[PROOF STEP]
by (rule scaling_linear[where c=1]) simp_all