[STATEMENT]
lemma pow_res_equal_ord:
  assumes "n > 0"
  shows  "\<exists>m > 0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m>0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>m>0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
obtain m where m_def_0: "m > 0 \<and> ( \<forall> u \<in> carrier Q\<^sub>p. ac m u = 1 \<and> val u = 0 \<longrightarrow> u \<in> P_set n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. 0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> val u = 0 \<longrightarrow> u \<in> P_set n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms nth_power_fact[of n]
[PROOF STATE]
proof (prove)
using this:
0 < n
1 \<le> n \<Longrightarrow> \<exists>m>0. \<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> val u = 0 \<longrightarrow> u \<in> P_set n

goal (1 subgoal):
 1. (\<And>m. 0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> val u = 0 \<longrightarrow> u \<in> P_set n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis less_imp_le_nat less_one linorder_neqE_nat nat_le_linear zero_less_iff_neq_zero)
[PROOF STATE]
proof (state)
this:
0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> val u = 0 \<longrightarrow> u \<in> P_set n)

goal (1 subgoal):
 1. \<exists>m>0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> val u = 0 \<longrightarrow> u \<in> P_set n)
[PROOF STEP]
have  m_def: "m > 0 \<and> ( \<forall> u \<in> carrier Q\<^sub>p. ac m u = 1 \<and> ord u = 0 \<longrightarrow> u \<in> P_set n)"
[PROOF STATE]
proof (prove)
using this:
0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> val u = 0 \<longrightarrow> u \<in> P_set n)

goal (1 subgoal):
 1. 0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> ord u = 0 \<longrightarrow> u \<in> P_set n)
[PROOF STEP]
by (smt nonzero_ac_val_ord zero_eint_def)
[PROOF STATE]
proof (state)
this:
0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> ord u = 0 \<longrightarrow> u \<in> P_set n)

goal (1 subgoal):
 1. \<exists>m>0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
have  "\<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<forall>y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<forall>y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
show "\<forall>y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
show "x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
assume A: "x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y "
[PROOF STATE]
proof (state)
this:
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y
[PROOF STEP]
have 0: "ac m (x \<div> y) = 1"
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y

goal (1 subgoal):
 1. ac m (x \<div> y) = 1
[PROOF STEP]
using ac_inv[of y m] ac_mult
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y
\<lbrakk>y \<in> nonzero Q\<^sub>p; 0 < m\<rbrakk> \<Longrightarrow> ac m (inv y) = inv\<^bsub>residue_ring (p ^ m)\<^esub> ac m y
\<lbrakk>?x \<in> carrier Q\<^sub>p; ?y \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> ac ?n (?x \<otimes> ?y) = ac ?n ?x \<otimes>\<^bsub>residue_ring (p ^ ?n)\<^esub> ac ?n ?y

goal (1 subgoal):
 1. ac m (x \<div> y) = 1
[PROOF STEP]
by (metis ac_inv'''(1) ac_mult'  m_def nonzero_inverse_Qp)
[PROOF STATE]
proof (state)
this:
ac m (x \<div> y) = 1

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
have 1: "ord (x \<div> y) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord (x \<div> y) = 0
[PROOF STEP]
using A  ord_fract
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y
\<lbrakk>?a \<in> nonzero Q\<^sub>p; ?b \<in> nonzero Q\<^sub>p\<rbrakk> \<Longrightarrow> ord (?a \<div> ?b) = ord ?a - ord ?b

goal (1 subgoal):
 1. ord (x \<div> y) = 0
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
ord (x \<div> y) = 0

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
have 2: "(x \<div> y) \<in> nonzero Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<div> y) \<in> nonzero Q\<^sub>p
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y

goal (1 subgoal):
 1. (x \<div> y) \<in> nonzero Q\<^sub>p
[PROOF STEP]
by (metis Qp.nonzero_closed Qp.nonzero_mult_closed local.fract_cancel_right nonzero_inverse_Qp not_nonzero_Qp zero_fract)
[PROOF STATE]
proof (state)
this:
(x \<div> y) \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
have 3: "(x \<div> y) \<in> P_set n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<div> y) \<in> P_set n
[PROOF STEP]
using m_def 0 1 2 nonzero_def
[PROOF STATE]
proof (prove)
using this:
0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> ord u = 0 \<longrightarrow> u \<in> P_set n)
ac m (x \<div> y) = 1
ord (x \<div> y) = 0
(x \<div> y) \<in> nonzero Q\<^sub>p
nonzero ?R = {a \<in> carrier ?R. a \<noteq> \<zero>\<^bsub>?R\<^esub>}

goal (1 subgoal):
 1. (x \<div> y) \<in> P_set n
[PROOF STEP]
by (smt Qp.nonzero_closed)
[PROOF STATE]
proof (state)
this:
(x \<div> y) \<in> P_set n

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x \<div> y) \<in> P_set n
[PROOF STEP]
obtain b where b_def: "b \<in> carrier Q\<^sub>p \<and> (b[^]n) = (x \<div> y)"
[PROOF STATE]
proof (prove)
using this:
(x \<div> y) \<in> P_set n

goal (1 subgoal):
 1. (\<And>b. b \<in> carrier Q\<^sub>p \<and> b [^] n = (x \<div> y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using P_set_def
[PROOF STATE]
proof (prove)
using this:
(x \<div> y) \<in> P_set n
P_set ?n = {a \<in> nonzero Q\<^sub>p. \<exists>y\<in>carrier Q\<^sub>p. y [^] ?n = a}

goal (1 subgoal):
 1. (\<And>b. b \<in> carrier Q\<^sub>p \<and> b [^] n = (x \<div> y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> carrier Q\<^sub>p \<and> b [^] n = (x \<div> y)

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> carrier Q\<^sub>p \<and> b [^] n = (x \<div> y)
[PROOF STEP]
have "(x \<div> y) \<otimes> y = (b[^]n) \<otimes> y"
[PROOF STATE]
proof (prove)
using this:
b \<in> carrier Q\<^sub>p \<and> b [^] n = (x \<div> y)

goal (1 subgoal):
 1. (x \<div> y) \<otimes> y = b [^] n \<otimes> y
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(x \<div> y) \<otimes> y = b [^] n \<otimes> y

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x \<div> y) \<otimes> y = b [^] n \<otimes> y
[PROOF STEP]
have "x = (b[^]n) \<otimes> y"
[PROOF STATE]
proof (prove)
using this:
(x \<div> y) \<otimes> y = b [^] n \<otimes> y

goal (1 subgoal):
 1. x = b [^] n \<otimes> y
[PROOF STEP]
using A b_def
[PROOF STATE]
proof (prove)
using this:
(x \<div> y) \<otimes> y = b [^] n \<otimes> y
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y
b \<in> carrier Q\<^sub>p \<and> b [^] n = (x \<div> y)

goal (1 subgoal):
 1. x = b [^] n \<otimes> y
[PROOF STEP]
by (metis Qp.nonzero_closed local.fract_cancel_left)
[PROOF STATE]
proof (state)
this:
x = b [^] n \<otimes> y

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = b [^] n \<otimes> y
[PROOF STEP]
have "x = y \<otimes>(b[^]n)"
[PROOF STATE]
proof (prove)
using this:
x = b [^] n \<otimes> y

goal (1 subgoal):
 1. x = y \<otimes> b [^] n
[PROOF STEP]
using A b_def
[PROOF STATE]
proof (prove)
using this:
x = b [^] n \<otimes> y
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y
b \<in> carrier Q\<^sub>p \<and> b [^] n = (x \<div> y)

goal (1 subgoal):
 1. x = y \<otimes> b [^] n
[PROOF STEP]
by (metis Qp.nonzero_closed local.fract_cancel_right)
[PROOF STATE]
proof (state)
this:
x = y \<otimes> b [^] n

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = y \<otimes> b [^] n
[PROOF STEP]
have "x \<in> pow_res n y"
[PROOF STATE]
proof (prove)
using this:
x = y \<otimes> b [^] n

goal (1 subgoal):
 1. x \<in> pow_res n y
[PROOF STEP]
unfolding pow_res_def
[PROOF STATE]
proof (prove)
using this:
x = y \<otimes> b [^] n

goal (1 subgoal):
 1. x \<in> {a \<in> carrier Q\<^sub>p. \<exists>ya\<in>nonzero Q\<^sub>p. a = y \<otimes> ya [^] n}
[PROOF STEP]
using A b_def
[PROOF STATE]
proof (prove)
using this:
x = y \<otimes> b [^] n
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y
b \<in> carrier Q\<^sub>p \<and> b [^] n = (x \<div> y)

goal (1 subgoal):
 1. x \<in> {a \<in> carrier Q\<^sub>p. \<exists>ya\<in>nonzero Q\<^sub>p. a = y \<otimes> ya [^] n}
[PROOF STEP]
by (metis (mono_tags, lifting) "2" Qp.nat_pow_0 Qp.nonzero_closed Qp_nonzero_nat_pow mem_Collect_eq not_gr_zero)
[PROOF STATE]
proof (state)
this:
x \<in> pow_res n y

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<Longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> pow_res n y
[PROOF STEP]
show "pow_res n x = pow_res n y"
[PROOF STATE]
proof (prove)
using this:
x \<in> pow_res n y

goal (1 subgoal):
 1. pow_res n x = pow_res n y
[PROOF STEP]
using  A equal_pow_resI[of x y n]
[PROOF STATE]
proof (prove)
using this:
x \<in> pow_res n y
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y
\<lbrakk>x \<in> carrier Q\<^sub>p; y \<in> pow_res n x\<rbrakk> \<Longrightarrow> pow_res n x = pow_res n y

goal (1 subgoal):
 1. pow_res n x = pow_res n y
[PROOF STEP]
unfolding nonzero_def
[PROOF STATE]
proof (prove)
using this:
x \<in> pow_res n y
x \<in> {a \<in> carrier Q\<^sub>p. a \<noteq> \<zero>} \<and> y \<in> {a \<in> carrier Q\<^sub>p. a \<noteq> \<zero>} \<and> ac m x = ac m y \<and> ord x = ord y
\<lbrakk>x \<in> carrier Q\<^sub>p; y \<in> pow_res n x\<rbrakk> \<Longrightarrow> pow_res n x = pow_res n y

goal (1 subgoal):
 1. pow_res n x = pow_res n y
[PROOF STEP]
by (metis (mono_tags, lifting) A Qp.nonzero_closed equal_pow_resI)
[PROOF STATE]
proof (state)
this:
pow_res n x = pow_res n y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y

goal (1 subgoal):
 1. \<exists>m>0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y

goal (1 subgoal):
 1. \<exists>m>0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
using m_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
0 < m \<and> (\<forall>u\<in>carrier Q\<^sub>p. ac m u = 1 \<and> ord u = 0 \<longrightarrow> u \<in> P_set n)

goal (1 subgoal):
 1. \<exists>m>0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>m>0. \<forall>x y. x \<in> nonzero Q\<^sub>p \<and> y \<in> nonzero Q\<^sub>p \<and> ac m x = ac m y \<and> ord x = ord y \<longrightarrow> pow_res n x = pow_res n y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_interval_convex:
  fixes S :: "'a::euclidean_space set"
  assumes "is_interval S"
  shows "convex S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex S
[PROOF STEP]
proof (rule convexI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
fix x y and u v :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
assume "x \<in> S" "y \<in> S" and uv: "0 \<le> u" "0 \<le> v" "u + v = 1"
[PROOF STATE]
proof (state)
this:
x \<in> S
y \<in> S
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> S
y \<in> S
0 \<le> u
0 \<le> v
u + v = 1
[PROOF STEP]
have *: "u = 1 - v" "1 - v \<ge> 0" and **: "v = 1 - u" "1 - u \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
x \<in> S
y \<in> S
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. (u = 1 - v &&& 0 \<le> 1 - v) &&& v = 1 - u &&& 0 \<le> 1 - u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u = 1 - v
0 \<le> 1 - v
v = 1 - u
0 \<le> 1 - u

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
u = 1 - v
0 \<le> 1 - v
v = 1 - u
0 \<le> 1 - u

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
assume "\<not> b \<le> u * a + v * b"
[PROOF STATE]
proof (state)
this:
\<not> b \<le> u * a + v * b

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> b \<le> u * a + v * b
[PROOF STEP]
have "u * a < (1 - v) * b"
[PROOF STATE]
proof (prove)
using this:
\<not> b \<le> u * a + v * b

goal (1 subgoal):
 1. u * a < (1 - v) * b
[PROOF STEP]
unfolding not_le
[PROOF STATE]
proof (prove)
using this:
u * a + v * b < b

goal (1 subgoal):
 1. u * a < (1 - v) * b
[PROOF STEP]
using \<open>0 \<le> v\<close>
[PROOF STATE]
proof (prove)
using this:
u * a + v * b < b
0 \<le> v

goal (1 subgoal):
 1. u * a < (1 - v) * b
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
u * a < (1 - v) * b

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u * a < (1 - v) * b
[PROOF STEP]
have "a < b"
[PROOF STATE]
proof (prove)
using this:
u * a < (1 - v) * b

goal (1 subgoal):
 1. a < b
[PROOF STEP]
using "*"(1) less_eq_real_def uv(1)
[PROOF STATE]
proof (prove)
using this:
u * a < (1 - v) * b
u = 1 - v
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)
0 \<le> u

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

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < b
[PROOF STEP]
have "a \<le> u * a + v * b"
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. a \<le> u * a + v * b
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. a \<le> (1 - v) * a + v * b
[PROOF STEP]
using \<open>0 \<le> v\<close>
[PROOF STATE]
proof (prove)
using this:
a < b
0 \<le> v

goal (1 subgoal):
 1. a \<le> (1 - v) * a + v * b
[PROOF STEP]
by (auto simp: field_simps intro!:mult_right_mono)
[PROOF STATE]
proof (state)
this:
a \<le> u * a + v * b

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> ?b2 \<le> u * ?a2 + v * ?b2 \<Longrightarrow> ?a2 \<le> u * ?a2 + v * ?b2

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> ?b2 \<le> u * ?a2 + v * ?b2 \<Longrightarrow> ?a2 \<le> u * ?a2 + v * ?b2

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<not> ?b2 \<le> u * ?a2 + v * ?b2 \<Longrightarrow> ?a2 \<le> u * ?a2 + v * ?b2

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
assume "\<not> u * a + v * b \<le> a"
[PROOF STATE]
proof (state)
this:
\<not> u * a + v * b \<le> a

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> u * a + v * b \<le> a
[PROOF STEP]
have "v * b > (1 - u) * a"
[PROOF STATE]
proof (prove)
using this:
\<not> u * a + v * b \<le> a

goal (1 subgoal):
 1. (1 - u) * a < v * b
[PROOF STEP]
unfolding not_le
[PROOF STATE]
proof (prove)
using this:
a < u * a + v * b

goal (1 subgoal):
 1. (1 - u) * a < v * b
[PROOF STEP]
using \<open>0 \<le> v\<close>
[PROOF STATE]
proof (prove)
using this:
a < u * a + v * b
0 \<le> v

goal (1 subgoal):
 1. (1 - u) * a < v * b
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
(1 - u) * a < v * b

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 - u) * a < v * b
[PROOF STEP]
have "a < b"
[PROOF STATE]
proof (prove)
using this:
(1 - u) * a < v * b

goal (1 subgoal):
 1. a < b
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
(1 - (1 - v)) * a < v * b

goal (1 subgoal):
 1. a < b
[PROOF STEP]
using \<open>0 \<le> v\<close>
[PROOF STATE]
proof (prove)
using this:
(1 - (1 - v)) * a < v * b
0 \<le> v

goal (1 subgoal):
 1. a < b
[PROOF STEP]
by (rule_tac mult_left_less_imp_less) (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
a < b

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < b
[PROOF STEP]
have "u * a + v * b \<le> b"
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. u * a + v * b \<le> b
[PROOF STEP]
unfolding **
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. u * a + (1 - u) * b \<le> b
[PROOF STEP]
using **(2) \<open>0 \<le> u\<close>
[PROOF STATE]
proof (prove)
using this:
a < b
0 \<le> 1 - u
0 \<le> u

goal (1 subgoal):
 1. u * a + (1 - u) * b \<le> b
[PROOF STEP]
by (auto simp: algebra_simps mult_right_mono)
[PROOF STATE]
proof (state)
this:
u * a + v * b \<le> b

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> u * ?a2 + v * ?b2 \<le> ?a2 \<Longrightarrow> u * ?a2 + v * ?b2 \<le> ?b2

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> ?b2 \<le> u * ?a2 + v * ?b2 \<Longrightarrow> ?a2 \<le> u * ?a2 + v * ?b2
\<not> u * ?a2 + v * ?b2 \<le> ?a2 \<Longrightarrow> u * ?a2 + v * ?b2 \<le> ?b2
[PROOF STEP]
show "u *\<^sub>R x + v *\<^sub>R y \<in> S"
[PROOF STATE]
proof (prove)
using this:
\<not> ?b2 \<le> u * ?a2 + v * ?b2 \<Longrightarrow> ?a2 \<le> u * ?a2 + v * ?b2
\<not> u * ?a2 + v * ?b2 \<le> ?a2 \<Longrightarrow> u * ?a2 + v * ?b2 \<le> ?b2

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
using DIM_positive[where 'a='a]
[PROOF STATE]
proof (prove)
using this:
\<not> ?b2 \<le> u * ?a2 + v * ?b2 \<Longrightarrow> ?a2 \<le> u * ?a2 + v * ?b2
\<not> u * ?a2 + v * ?b2 \<le> ?a2 \<Longrightarrow> u * ?a2 + v * ?b2 \<le> ?b2
0 < DIM('a)

goal (1 subgoal):
 1. u *\<^sub>R x + v *\<^sub>R y \<in> S
[PROOF STEP]
by (intro mem_is_intervalI [OF assms \<open>x \<in> S\<close> \<open>y \<in> S\<close>]) (auto simp: inner_simps)
[PROOF STATE]
proof (state)
this:
u *\<^sub>R x + v *\<^sub>R y \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infinite_times_eqpoll_self:
  assumes "infinite A" shows "A \<times> A \<approx> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<times> A \<approx> A
[PROOF STEP]
by (simp add: Times_same_infinite_bij_betw assms eqpoll_def)


[STATEMENT]
lemma finite_UB: "finite(UB f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (UB f xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (UB f xs)
[PROOF STEP]
have "UB f xs = (\<lambda>k.  xs!k) ` set(ubounds(DLO.atoms\<^sub>0 f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UB f xs = (!) xs ` set (ubounds (DLO.atoms\<^sub>0 f))
[PROOF STEP]
by (auto simp:set_ubounds image_def)
[PROOF STATE]
proof (state)
this:
UB f xs = (!) xs ` set (ubounds (DLO.atoms\<^sub>0 f))

goal (1 subgoal):
 1. finite (UB f xs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
UB f xs = (!) xs ` set (ubounds (DLO.atoms\<^sub>0 f))

goal (1 subgoal):
 1. finite (UB f xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (UB f xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma MOST_conj_distrib: "(\<forall>\<^sub>\<infinity>x. P x \<and> Q x) \<longleftrightarrow> (\<forall>\<^sub>\<infinity>x. P x) \<and> (\<forall>\<^sub>\<infinity>x. Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>\<infinity>x. P x \<and> Q x) = ((\<forall>\<^sub>\<infinity>x. P x) \<and> (\<forall>\<^sub>\<infinity>x. Q x))
[PROOF STEP]
by (fact eventually_conj_iff)


[STATEMENT]
lemma convex_hull_eq: "convex hull s = s \<longleftrightarrow> convex s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (convex hull s = s) = convex s
[PROOF STEP]
by (metis convex_convex_hull hull_same)


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


[STATEMENT]
lemma NSCDERIV_pow: "NSDERIV (\<lambda>x. x ^ n) x :> complex_of_real (real n) * (x ^ (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NSDERIV (\<lambda>x. x ^ n) x :> complex_of_real (real n) * x ^ (n - 1)
[PROOF STEP]
by (metis CDERIV_pow NSDERIV_DERIV_iff One_nat_def)


[STATEMENT]
lemma total_linorder_matrix:
  fixes f :: "('a::finite,'b::linorder_stone_relation_algebra_expansion) square"
  shows "matrix_bounded_idempotent_semiring.total f \<longleftrightarrow> (\<forall>i . \<exists>j . f (i,j) = top)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_bounded_idempotent_semiring.total f = (\<forall>i. \<exists>j. f (i, j) = top)
[PROOF STEP]
using total_linorder_matrix_1 total_linorder_matrix_2 matrix_stone_relation_algebra.total_var
[PROOF STATE]
proof (prove)
using this:
matrix_stone_relation_algebra.total_var ?f \<Longrightarrow> \<exists>j. ?f (?i, j) = top
\<forall>i. \<exists>j. ?f (i, j) = top \<Longrightarrow> matrix_stone_relation_algebra.total_var ?f
matrix_bounded_idempotent_semiring.total ?x = matrix_stone_relation_algebra.total_var ?x

goal (1 subgoal):
 1. matrix_bounded_idempotent_semiring.total f = (\<forall>i. \<exists>j. f (i, j) = top)
[PROOF STEP]
by auto


[STATEMENT]
lemma reduced_word_singleton:
  assumes "a\<in>A" "a\<noteq>0"
  shows   "reduced_word A [a]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_word A [a]
[PROOF STEP]
proof (rule reduced_word_forI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. [a] \<in> lists A
 2. sum_list [a] = sum_list [a]
 3. \<And>bs. \<lbrakk>bs \<in> lists A; sum_list bs = sum_list [a]\<rbrakk> \<Longrightarrow> length [a] \<le> length bs
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
[PROOF STEP]
show "[a] \<in> lists A"
[PROOF STATE]
proof (prove)
using this:
a \<in> A

goal (1 subgoal):
 1. [a] \<in> lists A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[a] \<in> lists A

goal (2 subgoals):
 1. sum_list [a] = sum_list [a]
 2. \<And>bs. \<lbrakk>bs \<in> lists A; sum_list bs = sum_list [a]\<rbrakk> \<Longrightarrow> length [a] \<le> length bs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum_list [a] = sum_list [a]
 2. \<And>bs. \<lbrakk>bs \<in> lists A; sum_list bs = sum_list [a]\<rbrakk> \<Longrightarrow> length [a] \<le> length bs
[PROOF STEP]
fix bs
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum_list [a] = sum_list [a]
 2. \<And>bs. \<lbrakk>bs \<in> lists A; sum_list bs = sum_list [a]\<rbrakk> \<Longrightarrow> length [a] \<le> length bs
[PROOF STEP]
assume bs: "bs \<in> lists A" "sum_list bs = sum_list [a]"
[PROOF STATE]
proof (state)
this:
bs \<in> lists A
sum_list bs = sum_list [a]

goal (2 subgoals):
 1. sum_list [a] = sum_list [a]
 2. \<And>bs. \<lbrakk>bs \<in> lists A; sum_list bs = sum_list [a]\<rbrakk> \<Longrightarrow> length [a] \<le> length bs
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a)
bs \<in> lists A
sum_list bs = sum_list [a]
[PROOF STEP]
show "length [a] \<le> length bs"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a)
bs \<in> lists A
sum_list bs = sum_list [a]

goal (1 subgoal):
 1. length [a] \<le> length bs
[PROOF STEP]
by (cases bs) auto
[PROOF STATE]
proof (state)
this:
length [a] \<le> length bs

goal (1 subgoal):
 1. sum_list [a] = sum_list [a]
[PROOF STEP]
qed simp


[STATEMENT]
lemma countable_image_inj_gen:
   "\<lbrakk>inj_on f S; countable A\<rbrakk> \<Longrightarrow> countable {x \<in> S. f x \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f S; countable A\<rbrakk> \<Longrightarrow> countable {x \<in> S. f x \<in> A}
[PROOF STEP]
using countable_image_inj_Int_vimage
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>inj_on ?f ?S; countable ?A\<rbrakk> \<Longrightarrow> countable (?S \<inter> ?f -` ?A)

goal (1 subgoal):
 1. \<lbrakk>inj_on f S; countable A\<rbrakk> \<Longrightarrow> countable {x \<in> S. f x \<in> A}
[PROOF STEP]
by (auto simp: vimage_def Collect_conj_eq)


[STATEMENT]
lemma bd_FGl_card_order: "card_order bd_FGl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_order bd_FGl
[PROOF STEP]
unfolding bd_FGl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_order (bd_F *c bd_G +c bd_F)
[PROOF STEP]
using bd_F_card_order bd_G_card_order
[PROOF STATE]
proof (prove)
using this:
card_order bd_F
card_order bd_G

goal (1 subgoal):
 1. card_order (bd_F *c bd_G +c bd_F)
[PROOF STEP]
by (intro card_order_csum card_order_cprod)


[STATEMENT]
lemma tree_enum_elem_injective: "n \<noteq> m \<Longrightarrow> x \<in> set (tree_enum n) \<Longrightarrow> y \<in> set (tree_enum m) \<Longrightarrow> x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<noteq> m; x \<in> set (tree_enum n); y \<in> set (tree_enum m)\<rbrakk> \<Longrightarrow> x \<noteq> y
[PROOF STEP]
using tree_enum_correct1
[PROOF STATE]
proof (prove)
using this:
?t \<in> set (tree_enum ?n) \<Longrightarrow> size ?t = ?n

goal (1 subgoal):
 1. \<lbrakk>n \<noteq> m; x \<in> set (tree_enum n); y \<in> set (tree_enum m)\<rbrakk> \<Longrightarrow> x \<noteq> y
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_product:
  assumes fst: "finite (fst ` A)"
  and     snd: "finite (snd ` A)"
  shows   "finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
have "A \<subseteq> (fst ` A) \<times> (snd ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> fst ` A \<times> snd ` A
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
A \<subseteq> fst ` A \<times> snd ` A

goal (1 subgoal):
 1. finite A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> fst ` A \<times> snd ` A

goal (1 subgoal):
 1. finite A
[PROOF STEP]
using snd fst finite_subset
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> fst ` A \<times> snd ` A
finite (snd ` A)
finite (fst ` A)
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PosOrdeq_antisym:
  assumes "v1 :\<sqsubseteq>val v2" "v2 :\<sqsubseteq>val v1"
  shows "v1 = v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v1 = v2
[PROOF STEP]
using assms PosOrd_ordering
[PROOF STATE]
proof (prove)
using this:
v1 :\<sqsubseteq>val v2
v2 :\<sqsubseteq>val v1
ordering PosOrd_ex_eq PosOrd_ex

goal (1 subgoal):
 1. v1 = v2
[PROOF STEP]
by (metis ordering.eq_iff)


[STATEMENT]
lemma NSLIM_add_minus: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m \<Longrightarrow> (\<lambda>x. f x + - g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S (l + -m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l; g \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S m\<rbrakk> \<Longrightarrow> (\<lambda>x. f x + - g x) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S l + - m
[PROOF STEP]
by (simp only: NSLIM_add NSLIM_minus)


[STATEMENT]
lemma Upper_memI:
  fixes L (structure)
  shows "\<lbrakk>!! y. y \<in> A \<Longrightarrow> y \<sqsubseteq> x; x \<in> carrier L\<rbrakk> \<Longrightarrow> x \<in> Upper L A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>y. y \<in> A \<Longrightarrow> y \<sqsubseteq> x; x \<in> carrier L\<rbrakk> \<Longrightarrow> x \<in> Upper L A
[PROOF STEP]
by (unfold Upper_def) blast


[STATEMENT]
lemma Sep_disj: "\<forall>A B. Sep A B \<longrightarrow> Disj A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A. contains (\<lambda>B. \<forall>w. (A \<^bold>\<and> B) w = \<^bold>\<bottom> w) (Sep A)
[PROOF STEP]
using Cl_fr_def Sep_def conn
[PROOF STATE]
proof (prove)
using this:
\<C>\<^sub>F ?\<F> \<equiv> \<lambda>A. A \<^bold>\<or> ?\<F> A
Sep ?A ?B \<equiv> (\<forall>w. (\<C> ?A \<^bold>\<and> ?B) w = \<^bold>\<bottom> w) \<and> (\<forall>w. (\<C> ?B \<^bold>\<and> ?A) w = \<^bold>\<bottom> w)
?A \<^bold>\<and> ?B \<equiv> \<lambda>w. ?A w \<and> ?B w
?A \<^bold>\<or> ?B \<equiv> \<lambda>w. ?A w \<or> ?B w
\<^bold>\<top> \<equiv> \<lambda>w. True
\<^bold>\<bottom> \<equiv> \<lambda>w. False
?A \<^bold>\<rightarrow> ?B \<equiv> \<lambda>w. ?B w \<longleftarrow> ?A w
?A \<^bold>\<leftrightarrow> ?B \<equiv> \<lambda>w. ?A w = ?B w
?A \<^bold>\<leftharpoonup> ?B \<equiv> \<lambda>w. ?A w \<and> \<not> ?B w
\<^bold>\<midarrow>?A \<equiv> \<lambda>w. \<not> ?A w

goal (1 subgoal):
 1. \<forall>A. contains (\<lambda>B. \<forall>w. (A \<^bold>\<and> B) w = \<^bold>\<bottom> w) (Sep A)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma UP_DN [simp]:
    assumes "t \<in> UP ` U"
    shows "UP (DN t) = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UP (DN t) = t
[PROOF STEP]
using assms o_def inj_UP
[PROOF STATE]
proof (prove)
using this:
t \<in> UP ` U
?f \<circ> ?g = (\<lambda>x. ?f (?g x))
inj_on UP U

goal (1 subgoal):
 1. UP (DN t) = t
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_list_us_bounded:
  assumes "i < k"
  shows "sum_list (\<^bold>u y i) \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (\<^bold>u y i) \<le> k
[PROOF STEP]
using assms and sum_list_us_le [of y i]
[PROOF STATE]
proof (prove)
using this:
i < k
sum_list (\<^bold>u y i) \<le> i + 1

goal (1 subgoal):
 1. sum_list (\<^bold>u y i) \<le> k
[PROOF STEP]
by force


[STATEMENT]
lemma mult_vec_left_commute: "p ** (q ** r) = q ** (p ** r)"
  for p::"_ \<Rightarrow>\<^sub>0 'b::comm_semiring_0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ** (q ** r) = q ** (p ** r)
[PROOF STEP]
by (rule poly_mapping_eqI_proj, simp add: term_simps ac_simps)


[STATEMENT]
theorem wls_swapAbs_sym:
"wlsAbs (us,s) A \<Longrightarrow> (A $[x \<and> y]_zs) = (A $[y \<and> x]_zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wlsAbs (us, s) A \<Longrightarrow> A $[x \<and> y]_zs = A $[y \<and> x]_zs
[PROOF STEP]
by (erule wlsAbs_cases) (auto simp add: swap_sym sw_sym)


[STATEMENT]
lemma up_one_closed: "(\<lambda>n. if n = 0 then \<one> else \<zero>) \<in> up R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n = 0 then \<one> else \<zero>) \<in> up R
[PROOF STEP]
using up_def
[PROOF STATE]
proof (prove)
using this:
up ?R = {f \<in> UNIV \<rightarrow> carrier ?R. \<exists>n. bound \<zero>\<^bsub>?R\<^esub> n f}

goal (1 subgoal):
 1. (\<lambda>n. if n = 0 then \<one> else \<zero>) \<in> up R
[PROOF STEP]
by force


[STATEMENT]
lemma box_L_left_antitone:
  "y \<le> x \<Longrightarrow> \<parallel>x\<rbrakk>z \<le> \<parallel>y\<rbrakk>z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> x \<Longrightarrow> \<parallel> x \<rbrakk> z \<le> \<parallel> y \<rbrakk> z
[PROOF STEP]
by (simp add: box_L_ani ani_antitone mult_left_isotone)


[STATEMENT]
lemma fmrel_on_fsubset: "fmrel_on_fset S R m n \<Longrightarrow> T |\<subseteq>| S \<Longrightarrow> fmrel_on_fset T R m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fmrel_on_fset S R m n; T |\<subseteq>| S\<rbrakk> \<Longrightarrow> fmrel_on_fset T R m n
[PROOF STEP]
unfolding fmrel_on_fset_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fBall S (\<lambda>x. rel_option R (fmlookup m x) (fmlookup n x)); T |\<subseteq>| S\<rbrakk> \<Longrightarrow> fBall T (\<lambda>x. rel_option R (fmlookup m x) (fmlookup n x))
[PROOF STEP]
by auto


[STATEMENT]
lemma simple_distributed_joint2_finite:
  assumes X: "simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Px"
  shows "finite (X ` space M)" "finite (Y ` space M)" "finite (Z ` space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (X ` space M) &&& finite (Y ` space M) &&& finite (Z ` space M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite (X ` space M)
 2. finite (Y ` space M)
 3. finite (Z ` space M)
[PROOF STEP]
have "finite ((\<lambda>x. (X x, Y x, Z x)) ` space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>x. (X x, Y x, Z x)) ` space M)
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
simple_distributed M (\<lambda>x. (X x, Y x, Z x)) Px

goal (1 subgoal):
 1. finite ((\<lambda>x. (X x, Y x, Z x)) ` space M)
[PROOF STEP]
by (auto simp: simple_distributed_def simple_functionD)
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>x. (X x, Y x, Z x)) ` space M)

goal (3 subgoals):
 1. finite (X ` space M)
 2. finite (Y ` space M)
 3. finite (Z ` space M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite ((\<lambda>x. (X x, Y x, Z x)) ` space M)
[PROOF STEP]
have "finite (fst ` (\<lambda>x. (X x, Y x, Z x)) ` space M)"
    "finite ((fst \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)"
    "finite ((snd \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)"
[PROOF STATE]
proof (prove)
using this:
finite ((\<lambda>x. (X x, Y x, Z x)) ` space M)

goal (1 subgoal):
 1. finite (fst ` (\<lambda>x. (X x, Y x, Z x)) ` space M) &&& finite ((fst \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M) &&& finite ((snd \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (fst ` (\<lambda>x. (X x, Y x, Z x)) ` space M)
finite ((fst \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)
finite ((snd \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)

goal (3 subgoals):
 1. finite (X ` space M)
 2. finite (Y ` space M)
 3. finite (Z ` space M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (fst ` (\<lambda>x. (X x, Y x, Z x)) ` space M)
finite ((fst \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)
finite ((snd \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)
[PROOF STEP]
show fin: "finite (X ` space M)" "finite (Y ` space M)" "finite (Z ` space M)"
[PROOF STATE]
proof (prove)
using this:
finite (fst ` (\<lambda>x. (X x, Y x, Z x)) ` space M)
finite ((fst \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)
finite ((snd \<circ> snd) ` (\<lambda>x. (X x, Y x, Z x)) ` space M)

goal (1 subgoal):
 1. finite (X ` space M) &&& finite (Y ` space M) &&& finite (Z ` space M)
[PROOF STEP]
by (auto simp: image_image)
[PROOF STATE]
proof (state)
this:
finite (X ` space M)
finite (Y ` space M)
finite (Z ` space M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord_power_aux:
  fixes m x k a :: nat
  defines "l \<equiv> ord m a"
  shows   "ord m (a ^ k) * gcd k l = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord m (a ^ k) * gcd k l = l
[PROOF STEP]
proof (rule dvd_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ord m (a ^ k) * gcd k l dvd l
 2. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
have "[a ^ lcm k l = 1] (mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ lcm k l = 1] (mod m)
[PROOF STEP]
unfolding ord_divides
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord m a dvd lcm k l
[PROOF STEP]
by (simp add: l_def)
[PROOF STATE]
proof (state)
this:
[a ^ lcm k l = 1] (mod m)

goal (2 subgoals):
 1. ord m (a ^ k) * gcd k l dvd l
 2. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[a ^ lcm k l = 1] (mod m)

goal (2 subgoals):
 1. ord m (a ^ k) * gcd k l dvd l
 2. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
have "lcm k l = k * (l div gcd k l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm k l = k * (l div gcd k l)
[PROOF STEP]
by (simp add: lcm_nat_def div_mult_swap)
[PROOF STATE]
proof (state)
this:
lcm k l = k * (l div gcd k l)

goal (2 subgoals):
 1. ord m (a ^ k) * gcd k l dvd l
 2. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[a ^ (k * (l div gcd k l)) = 1] (mod m)
[PROOF STEP]
have "ord m (a ^ k) dvd l div gcd k l"
[PROOF STATE]
proof (prove)
using this:
[a ^ (k * (l div gcd k l)) = 1] (mod m)

goal (1 subgoal):
 1. ord m (a ^ k) dvd l div gcd k l
[PROOF STEP]
unfolding ord_divides [symmetric]
[PROOF STATE]
proof (prove)
using this:
[a ^ (k * (l div gcd k l)) = 1] (mod m)

goal (1 subgoal):
 1. [(a ^ k) ^ (l div gcd k l) = 1] (mod m)
[PROOF STEP]
by (simp add: power_mult [symmetric])
[PROOF STATE]
proof (state)
this:
ord m (a ^ k) dvd l div gcd k l

goal (2 subgoals):
 1. ord m (a ^ k) * gcd k l dvd l
 2. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
thus "ord m (a ^ k) * gcd k l dvd l"
[PROOF STATE]
proof (prove)
using this:
ord m (a ^ k) dvd l div gcd k l

goal (1 subgoal):
 1. ord m (a ^ k) * gcd k l dvd l
[PROOF STEP]
by (cases "l = 0") (auto simp: dvd_div_iff_mult)
[PROOF STATE]
proof (state)
this:
ord m (a ^ k) * gcd k l dvd l

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
have "[(a ^ k) ^ ord m (a ^ k) = 1] (mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(a ^ k) ^ ord m (a ^ k) = 1] (mod m)
[PROOF STEP]
by (rule ord)
[PROOF STATE]
proof (state)
this:
[(a ^ k) ^ ord m (a ^ k) = 1] (mod m)

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[(a ^ k) ^ ord m (a ^ k) = 1] (mod m)

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
have "(a ^ k) ^ ord m (a ^ k) = a ^ (k * ord m (a ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a ^ k) ^ ord m (a ^ k) = a ^ (k * ord m (a ^ k))
[PROOF STEP]
by (simp add: power_mult)
[PROOF STATE]
proof (state)
this:
(a ^ k) ^ ord m (a ^ k) = a ^ (k * ord m (a ^ k))

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[a ^ (k * ord m (a ^ k)) = 1] (mod m)
[PROOF STEP]
have "ord m a dvd k * ord m (a ^ k)"
[PROOF STATE]
proof (prove)
using this:
[a ^ (k * ord m (a ^ k)) = 1] (mod m)

goal (1 subgoal):
 1. ord m a dvd k * ord m (a ^ k)
[PROOF STEP]
by (simp add: ord_divides')
[PROOF STATE]
proof (state)
this:
ord m a dvd k * ord m (a ^ k)

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
hence "l dvd gcd (k * ord m (a ^ k)) (l * ord m (a ^ k))"
[PROOF STATE]
proof (prove)
using this:
ord m a dvd k * ord m (a ^ k)

goal (1 subgoal):
 1. l dvd gcd (k * ord m (a ^ k)) (l * ord m (a ^ k))
[PROOF STEP]
by (intro gcd_greatest dvd_triv_left) (auto simp: l_def ord_divides')
[PROOF STATE]
proof (state)
this:
l dvd gcd (k * ord m (a ^ k)) (l * ord m (a ^ k))

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
l dvd gcd (k * ord m (a ^ k)) (l * ord m (a ^ k))

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
have "gcd (k * ord m (a ^ k)) (l * ord m (a ^ k)) = ord m (a ^ k) * gcd k l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (k * ord m (a ^ k)) (l * ord m (a ^ k)) = ord m (a ^ k) * gcd k l
[PROOF STEP]
by (subst gcd_mult_distrib_nat) (auto simp: mult_ac)
[PROOF STATE]
proof (state)
this:
gcd (k * ord m (a ^ k)) (l * ord m (a ^ k)) = ord m (a ^ k) * gcd k l

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
show "l dvd ord m (a ^ k) * gcd k l"
[PROOF STATE]
proof (prove)
using this:
l dvd ord m (a ^ k) * gcd k l

goal (1 subgoal):
 1. l dvd ord m (a ^ k) * gcd k l
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
l dvd ord m (a ^ k) * gcd k l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_ord_distinct_aux: "
  \<lbrakk> irrefl {(a, b). ord a b}; transP ord; list_ord ord xs;
    i < length xs; j < length xs; i < j \<rbrakk> \<Longrightarrow>
  xs ! i \<noteq> xs ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
[PROOF STEP]
apply (subgoal_tac "\<And>x y. ord x y \<Longrightarrow> x \<noteq> y")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j; \<And>x y. ord x y \<Longrightarrow> x \<noteq> y\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
 2. \<And>x y. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j; ord x y\<rbrakk> \<Longrightarrow> x \<noteq> y
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j; ord x y\<rbrakk> \<Longrightarrow> x \<noteq> y
 2. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j; \<And>x y. ord x y \<Longrightarrow> x \<noteq> y\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
[PROOF STEP]
apply (rule ccontr)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j; ord x y; \<not> x \<noteq> y\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j; \<And>x y. ord x y \<Longrightarrow> x \<noteq> y\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
[PROOF STEP]
apply (simp add: irrefl_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j; \<And>x y. ord x y \<Longrightarrow> x \<noteq> y\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
[PROOF STEP]
apply (simp add: list_ord_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ilist_i_take_eq_conv: "(f = g) = (\<forall>n. f \<Down> n = g \<Down> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f = g) = (\<forall>n. f \<Down> n = g \<Down> n)
[PROOF STEP]
apply (rule iffI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. f \<Down> n = g \<Down> n \<Longrightarrow> f = g
[PROOF STEP]
apply (clarsimp simp: expand_ilist_eq, rename_tac i)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<forall>n. f \<Down> n = g \<Down> n \<Longrightarrow> f i = g i
[PROOF STEP]
apply (drule_tac x="Suc i" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. f \<Down> Suc i = g \<Down> Suc i \<Longrightarrow> f i = g i
[PROOF STEP]
apply (drule_tac f="\<lambda>xs. xs ! i" in arg_cong)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. f \<Down> Suc i ! i = g \<Down> Suc i ! i \<Longrightarrow> f i = g i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma inc_mat_col_inc_vec: "j < length Bs \<Longrightarrow> col (inc_mat_of Vs Bs) j = inc_vec_of Vs (Bs ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < length Bs \<Longrightarrow> col (inc_mat_of Vs Bs) j = inc_vec_of Vs (Bs ! j)
[PROOF STEP]
by (auto simp add: inc_mat_of_def inc_vec_of_def)


[STATEMENT]
lemma inj_on_map_sum [simp]:
  "\<lbrakk> inj_on f A; inj_on g B \<rbrakk> \<Longrightarrow> inj_on (map_sum f g) (A <+> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A; inj_on g B\<rbrakk> \<Longrightarrow> inj_on (map_sum f g) (A <+> B)
[PROOF STEP]
proof(rule inj_onI, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>inj_on f A; inj_on g B; x \<in> A <+> B; y \<in> A <+> B; map_sum f g x = map_sum f g y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
case (1 x y)
[PROOF STATE]
proof (state)
this:
inj_on f A
inj_on g B
x \<in> A <+> B
y \<in> A <+> B
map_sum f g x = map_sum f g y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>inj_on f A; inj_on g B; x \<in> A <+> B; y \<in> A <+> B; map_sum f g x = map_sum f g y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on f A
inj_on g B
x \<in> A <+> B
y \<in> A <+> B
map_sum f g x = map_sum f g y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
inj_on f A
inj_on g B
x \<in> A <+> B
y \<in> A <+> B
map_sum f g x = map_sum f g y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by(cases x; cases y; auto simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vifunionD[dest]:
  assumes "a \<in>\<^sub>\<circ> (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i)"
  shows "\<exists>i\<in>\<^sub>\<circ>I. a \<in>\<^sub>\<circ> f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i\<in>elts I. a \<in>\<^sub>\<circ> f i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in>\<^sub>\<circ> \<Union>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I)

goal (1 subgoal):
 1. \<exists>i\<in>elts I. a \<in>\<^sub>\<circ> f i
[PROOF STEP]
by auto


[STATEMENT]
lemma enn2ereal_nonneg[simp]: "0 \<le> enn2ereal x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> enn2ereal x
[PROOF STEP]
using ennreal.enn2ereal[of x]
[PROOF STATE]
proof (prove)
using this:
enn2ereal x \<in> {x. 0 \<le> x}

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


[STATEMENT]
lemma gcd'_zero [simp]:
  assumes "is_gcd gcd'"
  shows "gcd' x y = 0 \<longleftrightarrow> x = 0 \<and> y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (gcd' x y = (0::'a)) = (x = (0::'a) \<and> y = (0::'a))
[PROOF STEP]
by (metis dvd_0_left dvd_refl gcd'_dvd1 gcd'_dvd2 gcd'_greatest assms)+


[STATEMENT]
lemma is_aligned_iff_take_bit_eq_0:
  \<open>is_aligned w n \<longleftrightarrow> take_bit n w = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_aligned w n = (take_bit n w = 0)
[PROOF STEP]
by (simp add: is_aligned_iff_udvd take_bit_eq_0_iff exp_dvd_iff_exp_udvd)


[STATEMENT]
lemma complete_sgraph: "sgraph S (all_edges S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgraph S (all_edges S)
[PROOF STEP]
unfolding all_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgraph S {e. e \<subseteq> S \<and> card e = 2}
[PROOF STEP]
by (unfold_locales) (simp_all)


[STATEMENT]
lemma split_float_interval_realD: "split_float_interval X = (A, B) \<Longrightarrow> x \<in>\<^sub>r X \<Longrightarrow> x \<in>\<^sub>r A \<or> x \<in>\<^sub>r B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>split_float_interval X = (A, B); x \<in>\<^sub>r X\<rbrakk> \<Longrightarrow> x \<in>\<^sub>r A \<or> x \<in>\<^sub>r B
[PROOF STEP]
by (auto simp: set_of_eq prod_eq_iff split_float_interval_bounds)


[STATEMENT]
lemma vector_nth_eq: "(vector A) $ i = foldr (\<lambda>x f n. (f (n + 1))(n := x)) A (\<lambda>n x. 0) 1 i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector A $ i = foldr (\<lambda>x f n. (f (n + (1::'b)))(n := x)) A (\<lambda>n x. 0::'a) (1::'b) i
[PROOF STEP]
unfolding vector_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_lambda (foldr (\<lambda>x f n. (f (n + (1::'b)))(n := x)) A (\<lambda>n x. 0::'a) (1::'b)) $ i = foldr (\<lambda>x f n. (f (n + (1::'b)))(n := x)) A (\<lambda>n x. 0::'a) (1::'b) i
[PROOF STEP]
by simp


[STATEMENT]
lemma CHAR_eq [simp]: "CHAR('a) = CARD('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CHAR('a) = CARD('a)
[PROOF STEP]
proof (rule CHAR_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. of_nat CARD('a) = (0::'a)
 2. \<And>x. of_nat x = (0::'a) \<Longrightarrow> CARD('a) dvd x
[PROOF STEP]
show "of_nat (CARD('a)) = (0 :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat CARD('a) = (0::'a)
[PROOF STEP]
by (simp add: CARD_eq of_nat_eq zero_def)
[PROOF STATE]
proof (state)
this:
of_nat CARD('a) = (0::'a)

goal (1 subgoal):
 1. \<And>x. of_nat x = (0::'a) \<Longrightarrow> CARD('a) dvd x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. of_nat x = (0::'a) \<Longrightarrow> CARD('a) dvd x
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. of_nat x = (0::'a) \<Longrightarrow> CARD('a) dvd x
[PROOF STEP]
assume "of_nat n = (0 :: 'a)"
[PROOF STATE]
proof (state)
this:
of_nat n = (0::'a)

goal (1 subgoal):
 1. \<And>x. of_nat x = (0::'a) \<Longrightarrow> CARD('a) dvd x
[PROOF STEP]
thus "CARD('a) dvd n"
[PROOF STATE]
proof (prove)
using this:
of_nat n = (0::'a)

goal (1 subgoal):
 1. CARD('a) dvd n
[PROOF STEP]
by (metis CARD_eq Rep_0 Rep_Abs_mod Rep_le_n mod_0_imp_dvd nat_dvd_iff of_nat_eq)
[PROOF STATE]
proof (state)
this:
CARD('a) dvd n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cnb_minus [simp]: "x \<in> set l ==> cnb (remove l x) = cnb l - crypt_nb x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set l \<Longrightarrow> cnb (remove l x) = cnb l - crypt_nb x
[PROOF STEP]
apply (induct l, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>cnb (remove l x) = cnb l - crypt_nb x; a \<noteq> x; x \<in> set l\<rbrakk> \<Longrightarrow> crypt_nb a + (cnb l - crypt_nb x) = crypt_nb a + cnb l - crypt_nb x
[PROOF STEP]
apply (erule_tac l=l and x=x in mem_cnb_minus_substI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>cnb (remove l x) = cnb l - crypt_nb x; a \<noteq> x\<rbrakk> \<Longrightarrow> crypt_nb a + (crypt_nb x + (cnb l - crypt_nb x) - crypt_nb x) = crypt_nb a + (crypt_nb x + (cnb l - crypt_nb x)) - crypt_nb x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pref_comp_len_trans: "w \<le>p v \<Longrightarrow> u \<bowtie> v \<Longrightarrow> \<^bold>|w\<^bold>| \<le> \<^bold>|u\<^bold>| \<Longrightarrow> w \<le>p u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w \<le>p v; u \<bowtie> v; \<^bold>|w\<^bold>| \<le> \<^bold>|u\<^bold>|\<rbrakk> \<Longrightarrow> w \<le>p u
[PROOF STEP]
using ruler_le pref_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?ps \<le>p ?xs; ?qs \<le>p ?xs; \<^bold>|?ps\<^bold>| \<le> \<^bold>|?qs\<^bold>|\<rbrakk> \<Longrightarrow> ?ps \<le>p ?qs
\<lbrakk>?a \<le>p ?b; ?b \<le>p ?c\<rbrakk> \<Longrightarrow> ?a \<le>p ?c

goal (1 subgoal):
 1. \<lbrakk>w \<le>p v; u \<bowtie> v; \<^bold>|w\<^bold>| \<le> \<^bold>|u\<^bold>|\<rbrakk> \<Longrightarrow> w \<le>p u
[PROOF STEP]
by (elim pref_compE)


[STATEMENT]
theorem herbrand'_contra:
  assumes finite_cs: "finite Cs" "\<forall>C\<in>Cs. finite C"
  assumes unsat: "\<forall>G. \<not>eval\<^sub>c\<^sub>s HFun G Cs"
  shows "\<exists>T. \<forall>G. branch G T \<longrightarrow> closed_branch G T Cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>T. anybranch T (\<lambda>G. closed_branch G T Cs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>T. anybranch T (\<lambda>G. closed_branch G T Cs)
[PROOF STEP]
from finite_cs unsat
[PROOF STATE]
proof (chain)
picking this:
finite Cs
\<forall>C\<in>Cs. finite C
\<forall>G. \<not> eval\<^sub>c\<^sub>s HFun G Cs
[PROOF STEP]
have "(\<forall>T. \<exists>G. open_branch G T Cs) \<longrightarrow> (\<exists>G. eval\<^sub>c\<^sub>s HFun G Cs)"
[PROOF STATE]
proof (prove)
using this:
finite Cs
\<forall>C\<in>Cs. finite C
\<forall>G. \<not> eval\<^sub>c\<^sub>s HFun G Cs

goal (1 subgoal):
 1. (\<forall>T. \<exists>G. branch G T \<and> \<not> falsifies\<^sub>c\<^sub>s G Cs) \<longrightarrow> (\<exists>G. eval\<^sub>c\<^sub>s HFun G Cs)
[PROOF STEP]
using herbrand'
[PROOF STATE]
proof (prove)
using this:
finite Cs
\<forall>C\<in>Cs. finite C
\<forall>G. \<not> eval\<^sub>c\<^sub>s HFun G Cs
\<lbrakk>\<forall>T. \<exists>G. branch G T \<and> \<not> falsifies\<^sub>c\<^sub>s G ?Cs; finite ?Cs; \<forall>C\<in>?Cs. finite C\<rbrakk> \<Longrightarrow> \<exists>G. eval\<^sub>c\<^sub>s HFun G ?Cs

goal (1 subgoal):
 1. (\<forall>T. \<exists>G. branch G T \<and> \<not> falsifies\<^sub>c\<^sub>s G Cs) \<longrightarrow> (\<exists>G. eval\<^sub>c\<^sub>s HFun G Cs)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>T. \<exists>G. branch G T \<and> \<not> falsifies\<^sub>c\<^sub>s G Cs) \<longrightarrow> (\<exists>G. eval\<^sub>c\<^sub>s HFun G Cs)

goal (1 subgoal):
 1. \<exists>T. anybranch T (\<lambda>G. closed_branch G T Cs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>T. \<exists>G. branch G T \<and> \<not> falsifies\<^sub>c\<^sub>s G Cs) \<longrightarrow> (\<exists>G. eval\<^sub>c\<^sub>s HFun G Cs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<forall>T. \<exists>G. branch G T \<and> \<not> falsifies\<^sub>c\<^sub>s G Cs) \<longrightarrow> (\<exists>G. eval\<^sub>c\<^sub>s HFun G Cs)

goal (1 subgoal):
 1. \<exists>T. anybranch T (\<lambda>G. closed_branch G T Cs)
[PROOF STEP]
using unsat
[PROOF STATE]
proof (prove)
using this:
(\<forall>T. \<exists>G. branch G T \<and> \<not> falsifies\<^sub>c\<^sub>s G Cs) \<longrightarrow> (\<exists>G. eval\<^sub>c\<^sub>s HFun G Cs)
\<forall>G. \<not> eval\<^sub>c\<^sub>s HFun G Cs

goal (1 subgoal):
 1. \<exists>T. anybranch T (\<lambda>G. closed_branch G T Cs)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>T. anybranch T (\<lambda>G. closed_branch G T Cs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ucast_plus:
  fixes a b :: "'a::len word"
  assumes "LENGTH('a) > LENGTH('b)"
  shows "(ucast (a + b) ::'b::len word) = (ucast a + ucast b::'b::len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ucast (a + b) = ucast a + ucast b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ucast (a + b) = ucast a + ucast b
[PROOF STEP]
have "to_bl (ucast (a + b) ::'b::len word) = to_bl (ucast a + ucast b::'b::len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_bl (ucast (a + b)) = to_bl (ucast a + ucast b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
LENGTH('b) < LENGTH('a)

goal (1 subgoal):
 1. to_bl (ucast (a + b)) = to_bl (ucast a + ucast b)
[PROOF STEP]
apply (auto simp add: to_bl_ucast to_bl_plus_carry word_rep_drop length_foldr_bitwise_add drop_zip[symmetric] rev_drop bitwise_add_def simp del: foldr_replicate foldr_append)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LENGTH('b) < LENGTH('a) \<Longrightarrow> drop (LENGTH('a) - LENGTH('b)) (rev (foldr (\<lambda>(x, y) res car. xor3 x y car # res (carry x y car)) (rev (zip (to_bl a) (to_bl b))) (\<lambda>_. []) False)) = rev (foldr (\<lambda>(x, y) res car. xor3 x y car # res (carry x y car)) (take LENGTH('b) (rev (zip (to_bl a) (to_bl b)))) (\<lambda>_. []) False)
[PROOF STEP]
apply (simp only: bitwise_add_def[symmetric] length_foldr_bitwise_add)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LENGTH('b) < LENGTH('a) \<Longrightarrow> drop (LENGTH('a) - LENGTH('b)) (rev (bitwise_add (rev (zip (to_bl a) (to_bl b))) False)) = rev (bitwise_add (take LENGTH('b) (rev (zip (to_bl a) (to_bl b)))) False)
[PROOF STEP]
by (auto simp add: drop_take bitwise_add_take[symmetric] rev_take length_foldr_bitwise_add)
[PROOF STATE]
proof (state)
this:
to_bl (ucast (a + b)) = to_bl (ucast a + ucast b)

goal (1 subgoal):
 1. ucast (a + b) = ucast a + ucast b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
to_bl (ucast (a + b)) = to_bl (ucast a + ucast b)

goal (1 subgoal):
 1. ucast (a + b) = ucast a + ucast b
[PROOF STEP]
using word_bl.Rep_eqD
[PROOF STATE]
proof (prove)
using this:
to_bl (ucast (a + b)) = to_bl (ucast a + ucast b)
to_bl ?x = to_bl ?y \<Longrightarrow> ?x = ?y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_eq_exp_ivp: "exp x = snd (exp_ivp.flow0 (0, 1) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x = snd (exp_ivp.flow0 (0, 1) x)
[PROOF STEP]
unfolding exp_eq_exp_ivp_aux
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x = snd (x, exp x)
[PROOF STEP]
by simp


[STATEMENT]
lemma outer_prod_smult_right:
  fixes v::"complex Matrix.vec"
  shows "outer_prod v (a \<cdot>\<^sub>v w) = (conjugate a) \<cdot>\<^sub>m outer_prod v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w
[PROOF STEP]
define paw where "paw = outer_prod v (a \<cdot>\<^sub>v w)"
[PROOF STATE]
proof (state)
this:
paw = outer_prod v (a \<cdot>\<^sub>v w)

goal (1 subgoal):
 1. outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w
[PROOF STEP]
define apw where "apw = (conjugate a) \<cdot>\<^sub>m outer_prod v w"
[PROOF STATE]
proof (state)
this:
apw = conjugate a \<cdot>\<^sub>m outer_prod v w

goal (1 subgoal):
 1. outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w
[PROOF STEP]
have "paw = apw"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. paw = apw
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_row paw = dim_row apw
 3. dim_col paw = dim_col apw
[PROOF STEP]
have "dim_row paw = dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row paw = dim_vec v
[PROOF STEP]
unfolding paw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (outer_prod v (a \<cdot>\<^sub>v w)) = dim_vec v
[PROOF STEP]
using outer_prod_dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. dim_row (outer_prod v (a \<cdot>\<^sub>v w)) = dim_vec v
[PROOF STEP]
by (metis carrier_matD(1) carrier_vec_dim_vec)
[PROOF STATE]
proof (state)
this:
dim_row paw = dim_vec v

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_row paw = dim_row apw
 3. dim_col paw = dim_col apw
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_row paw = dim_vec v

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_row paw = dim_row apw
 3. dim_col paw = dim_col apw
[PROOF STEP]
have "... = dim_row apw"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec v = dim_row apw
[PROOF STEP]
unfolding apw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec v = dim_row (conjugate a \<cdot>\<^sub>m outer_prod v w)
[PROOF STEP]
using outer_prod_dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. dim_vec v = dim_row (conjugate a \<cdot>\<^sub>m outer_prod v w)
[PROOF STEP]
by (metis carrier_matD(1) carrier_vec_dim_vec index_smult_mat(2))
[PROOF STATE]
proof (state)
this:
dim_vec v = dim_row apw

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_row paw = dim_row apw
 3. dim_col paw = dim_col apw
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dim_row paw = dim_row apw
[PROOF STEP]
show dr: "dim_row paw = dim_row apw"
[PROOF STATE]
proof (prove)
using this:
dim_row paw = dim_row apw

goal (1 subgoal):
 1. dim_row paw = dim_row apw
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dim_row paw = dim_row apw

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_col paw = dim_col apw
[PROOF STEP]
have "dim_col paw = dim_vec w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col paw = dim_vec w
[PROOF STEP]
unfolding paw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (outer_prod v (a \<cdot>\<^sub>v w)) = dim_vec w
[PROOF STEP]
using outer_prod_dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. dim_col (outer_prod v (a \<cdot>\<^sub>v w)) = dim_vec w
[PROOF STEP]
using carrier_vec_dim_vec
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m
?v \<in> carrier_vec (dim_vec ?v)

goal (1 subgoal):
 1. dim_col (outer_prod v (a \<cdot>\<^sub>v w)) = dim_vec w
[PROOF STEP]
by (metis carrier_matD(2) index_smult_vec(2))
[PROOF STATE]
proof (state)
this:
dim_col paw = dim_vec w

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_col paw = dim_col apw
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_col paw = dim_vec w

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_col paw = dim_col apw
[PROOF STEP]
have "... = dim_col apw"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec w = dim_col apw
[PROOF STEP]
unfolding apw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec w = dim_col (conjugate a \<cdot>\<^sub>m outer_prod v w)
[PROOF STEP]
using outer_prod_dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. dim_vec w = dim_col (conjugate a \<cdot>\<^sub>m outer_prod v w)
[PROOF STEP]
by (metis apw_def carrier_matD(2) carrier_vec_dim_vec smult_carrier_mat)
[PROOF STATE]
proof (state)
this:
dim_vec w = dim_col apw

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_col paw = dim_col apw
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dim_col paw = dim_col apw
[PROOF STEP]
show dc: "dim_col paw = dim_col apw"
[PROOF STATE]
proof (prove)
using this:
dim_col paw = dim_col apw

goal (1 subgoal):
 1. dim_col paw = dim_col apw
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dim_col paw = dim_col apw

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
show "\<And>i j. i < dim_row apw \<Longrightarrow> j < dim_col apw \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
assume  "i < dim_row apw" and "j < dim_col apw"
[PROOF STATE]
proof (state)
this:
i < dim_row apw
j < dim_col apw

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
note ij = this
[PROOF STATE]
proof (state)
this:
i < dim_row apw
j < dim_col apw

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
hence "paw $$ (i,j) = (conjugate a) * (Matrix.vec_index v i) * cnj (Matrix.vec_index w j)"
[PROOF STATE]
proof (prove)
using this:
i < dim_row apw
j < dim_col apw

goal (1 subgoal):
 1. paw $$ (i, j) = conjugate a * v $ i * cnj (w $ j)
[PROOF STEP]
using dr dc
[PROOF STATE]
proof (prove)
using this:
i < dim_row apw
j < dim_col apw
dim_row paw = dim_row apw
dim_col paw = dim_col apw

goal (1 subgoal):
 1. paw $$ (i, j) = conjugate a * v $ i * cnj (w $ j)
[PROOF STEP]
unfolding  paw_def outer_prod_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row apw
j < dim_col apw
dim_row (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec (a \<cdot>\<^sub>v w)) (\<lambda>(i, y). conjugate (a \<cdot>\<^sub>v w) $ y)) = dim_row apw
dim_col (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec (a \<cdot>\<^sub>v w)) (\<lambda>(i, y). conjugate (a \<cdot>\<^sub>v w) $ y)) = dim_col apw

goal (1 subgoal):
 1. (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec (a \<cdot>\<^sub>v w)) (\<lambda>(i, y). conjugate (a \<cdot>\<^sub>v w) $ y)) $$ (i, j) = conjugate a * v $ i * cnj (w $ j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
paw $$ (i, j) = conjugate a * v $ i * cnj (w $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
paw $$ (i, j) = conjugate a * v $ i * cnj (w $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
have "... = apw $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate a * v $ i * cnj (w $ j) = apw $$ (i, j)
[PROOF STEP]
using dr dc ij
[PROOF STATE]
proof (prove)
using this:
dim_row paw = dim_row apw
dim_col paw = dim_col apw
i < dim_row apw
j < dim_col apw

goal (1 subgoal):
 1. conjugate a * v $ i * cnj (w $ j) = apw $$ (i, j)
[PROOF STEP]
unfolding apw_def outer_prod_def
[PROOF STATE]
proof (prove)
using this:
dim_row paw = dim_row (conjugate a \<cdot>\<^sub>m (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)))
dim_col paw = dim_col (conjugate a \<cdot>\<^sub>m (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)))
i < dim_row (conjugate a \<cdot>\<^sub>m (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)))
j < dim_col (conjugate a \<cdot>\<^sub>m (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)))

goal (1 subgoal):
 1. conjugate a * v $ i * cnj (w $ j) = (conjugate a \<cdot>\<^sub>m (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y))) $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
conjugate a * v $ i * cnj (w $ j) = apw $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
show "paw $$ (i, j) = apw $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
paw $$ (i, j) = apw $$ (i, j)

goal (1 subgoal):
 1. paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
paw $$ (i, j) = apw $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < dim_row apw; ?j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (?i, ?j) = apw $$ (?i, ?j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
paw = apw

goal (1 subgoal):
 1. outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
paw = apw

goal (1 subgoal):
 1. outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w
[PROOF STEP]
unfolding paw_def apw_def
[PROOF STATE]
proof (prove)
using this:
outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w

goal (1 subgoal):
 1. outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod v (a \<cdot>\<^sub>v w) = conjugate a \<cdot>\<^sub>m outer_prod v w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Group) c_top_welldefTr2:"\<lbrakk>G \<triangleright> N; a \<in> carrier G; b \<in> carrier G \<rbrakk>
                       \<Longrightarrow> c_top G N (N \<bullet> a) (N \<bullet> b) \<subseteq>  N \<bullet> (a \<cdot> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<triangleright> N; a \<in> carrier G; b \<in> carrier G\<rbrakk> \<Longrightarrow> c_top G N (N \<bullet> a) (N \<bullet> b) \<subseteq> N \<bullet> (a \<cdot> b)
[PROOF STEP]
apply (frule nsg_sg[of "N"],
       simp add:c_top_def, simp add:rcs_in_set_rcs)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<triangleright> N; a \<in> carrier G; b \<in> carrier G; G \<guillemotright> N \<rbrakk> \<Longrightarrow> {z. \<exists>x\<in>N \<bullet> a. \<exists>y\<in>N \<bullet> b. x \<cdot> y = z} \<subseteq> N \<bullet> (a \<cdot> b)
[PROOF STEP]
apply (rule subsetI, simp, (erule bexE)+,
       frule_tac x = xa and y = y in c_top_welldefTr1[of "N" "a" "b"],
       assumption+, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma moebius_similarity_inv [simp]:
  assumes "a \<noteq> 0"
  shows "moebius_inv (moebius_similarity a b) = moebius_similarity (1/a) (-b/a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_inv (moebius_similarity a b) = moebius_similarity (1 / a) (- b / a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. moebius_inv (moebius_similarity a b) = moebius_similarity (1 / a) (- b / a)
[PROOF STEP]
unfolding moebius_similarity_def
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. moebius_inv (mk_moebius a b 0 1) = mk_moebius (1 / a) (- b / a) 0 1
[PROOF STEP]
by simp


[STATEMENT]
lemma direct_decompI_alt:
  "(\<And>qs. qs \<in> listset ss \<Longrightarrow> sum_list qs \<in> A) \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> \<exists>!qs\<in>listset ss. a = sum_list qs) \<Longrightarrow>
    direct_decomp A ss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>qs. qs \<in> listset ss \<Longrightarrow> sum_list qs \<in> A; \<And>a. a \<in> A \<Longrightarrow> \<exists>!qs. qs \<in> listset ss \<and> a = sum_list qs\<rbrakk> \<Longrightarrow> direct_decomp A ss
[PROOF STEP]
by (auto simp: direct_decomp_def intro!: bij_betwI') blast


[STATEMENT]
lemma Ints_add_iff1 [simp]: "x \<in> \<int> \<Longrightarrow> x + y \<in> \<int> \<longleftrightarrow> y \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> \<int> \<Longrightarrow> (x + y \<in> \<int>) = (y \<in> \<int>)
[PROOF STEP]
by (metis Ints_add Ints_diff add.commute add_diff_cancel_right')


[STATEMENT]
lemma less_le_mult': "w * c < b * c \<Longrightarrow> 0 \<le> c \<Longrightarrow> (w + 1) * c \<le> b * c"
  for b c w :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w * c < b * c; 0 \<le> c\<rbrakk> \<Longrightarrow> (w + 1) * c \<le> b * c
[PROOF STEP]
apply (rule mult_right_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>w * c < b * c; 0 \<le> c\<rbrakk> \<Longrightarrow> w + 1 \<le> b
 2. \<lbrakk>w * c < b * c; 0 \<le> c\<rbrakk> \<Longrightarrow> 0 \<le> c
[PROOF STEP]
apply (rule zless_imp_add1_zle)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>w * c < b * c; 0 \<le> c\<rbrakk> \<Longrightarrow> w < b
 2. \<lbrakk>w * c < b * c; 0 \<le> c\<rbrakk> \<Longrightarrow> 0 \<le> c
[PROOF STEP]
apply (erule (1) mult_right_less_imp_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w * c < b * c; 0 \<le> c\<rbrakk> \<Longrightarrow> 0 \<le> c
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma freeword_funlift_Abs_freeword:
  "proper_signed_list xs \<Longrightarrow> freeword_funlift f (Abs_freeword xs) =
    (\<Sum>x\<leftarrow>xs. apply_sign f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proper_signed_list xs \<Longrightarrow> freeword_funlift f (Abs_freeword xs) = sum_list (map (apply_sign f) xs)
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. proper_signed_list [] \<Longrightarrow> freeword_funlift f (Abs_freeword []) = sum_list (map (apply_sign f) [])
 2. \<And>a xs. \<lbrakk>proper_signed_list xs \<Longrightarrow> freeword_funlift f (Abs_freeword xs) = sum_list (map (apply_sign f) xs); proper_signed_list (a # xs)\<rbrakk> \<Longrightarrow> freeword_funlift f (Abs_freeword (a # xs)) = sum_list (map (apply_sign f) (a # xs))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
proper_signed_list xs \<Longrightarrow> freeword_funlift f (Abs_freeword xs) = sum_list (map (apply_sign f) xs)
proper_signed_list (x # xs)

goal (2 subgoals):
 1. proper_signed_list [] \<Longrightarrow> freeword_funlift f (Abs_freeword []) = sum_list (map (apply_sign f) [])
 2. \<And>a xs. \<lbrakk>proper_signed_list xs \<Longrightarrow> freeword_funlift f (Abs_freeword xs) = sum_list (map (apply_sign f) xs); proper_signed_list (a # xs)\<rbrakk> \<Longrightarrow> freeword_funlift f (Abs_freeword (a # xs)) = sum_list (map (apply_sign f) (a # xs))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
proper_signed_list xs \<Longrightarrow> freeword_funlift f (Abs_freeword xs) = sum_list (map (apply_sign f) xs)
proper_signed_list (x # xs)

goal (1 subgoal):
 1. freeword_funlift f (Abs_freeword (x # xs)) = sum_list (map (apply_sign f) (x # xs))
[PROOF STEP]
using freeword_funlift_Abs_freeword_Cons[of _ _ f]
          binrelchain_Cons_reduce[of _ x xs]
[PROOF STATE]
proof (prove)
using this:
proper_signed_list xs \<Longrightarrow> freeword_funlift f (Abs_freeword xs) = sum_list (map (apply_sign f) xs)
proper_signed_list (x # xs)
proper_signed_list (?x # ?xs) \<Longrightarrow> freeword_funlift f (Abs_freeword (?x # ?xs)) = apply_sign f ?x + freeword_funlift f (Abs_freeword ?xs)
binrelchain ?P (x # xs) \<Longrightarrow> binrelchain ?P xs

goal (1 subgoal):
 1. freeword_funlift f (Abs_freeword (x # xs)) = sum_list (map (apply_sign f) (x # xs))
[PROOF STEP]
by    simp
[PROOF STATE]
proof (state)
this:
freeword_funlift f (Abs_freeword (x # xs)) = sum_list (map (apply_sign f) (x # xs))

goal (1 subgoal):
 1. proper_signed_list [] \<Longrightarrow> freeword_funlift f (Abs_freeword []) = sum_list (map (apply_sign f) [])
[PROOF STEP]
qed (simp add: zero_freeword.abs_eq[THEN sym] freeword_funlift_0)


[STATEMENT]
lemma norm_scaleC_sgn[simp]: \<open>complex_of_real (norm \<psi>) *\<^sub>C sgn \<psi> = \<psi>\<close> for \<psi> :: "'a::complex_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (norm \<psi>) *\<^sub>C sgn \<psi> = \<psi>
[PROOF STEP]
apply (cases \<open>\<psi> = 0\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<psi> = (0::'a) \<Longrightarrow> complex_of_real (norm \<psi>) *\<^sub>C sgn \<psi> = \<psi>
 2. \<psi> \<noteq> (0::'a) \<Longrightarrow> complex_of_real (norm \<psi>) *\<^sub>C sgn \<psi> = \<psi>
[PROOF STEP]
by (auto simp: sgn_div_norm scaleR_scaleC)


[STATEMENT]
lemma unitary_col_norm_square:
  assumes "unitary U"
and "U\<in> carrier_mat n n"
  and "i < n"
shows "\<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
define vn::"complex Matrix.vec" where "vn = unit_vec n i"
[PROOF STATE]
proof (state)
this:
vn = unit_vec n i

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
have "\<parallel>Matrix.col U i\<parallel>\<^sup>2 = (vec_norm (Matrix.col U i))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<parallel>Matrix.col U i\<parallel>\<^sup>2) = (vec_norm (Matrix.col U i))\<^sup>2
[PROOF STEP]
using vec_norm_sq_cpx_vec_length_sq
[PROOF STATE]
proof (prove)
using this:
(vec_norm ?v)\<^sup>2 = complex_of_real (\<parallel>?v\<parallel>\<^sup>2)

goal (1 subgoal):
 1. complex_of_real (\<parallel>Matrix.col U i\<parallel>\<^sup>2) = (vec_norm (Matrix.col U i))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
complex_of_real (\<parallel>Matrix.col U i\<parallel>\<^sup>2) = (vec_norm (Matrix.col U i))\<^sup>2

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real (\<parallel>Matrix.col U i\<parallel>\<^sup>2) = (vec_norm (Matrix.col U i))\<^sup>2

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
have "... = (vec_norm vn)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec_norm (Matrix.col U i))\<^sup>2 = (vec_norm vn)\<^sup>2
[PROOF STEP]
using assms unitary_vec_norm
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U
U \<in> carrier_mat n n
i < n
\<lbrakk>?v \<in> carrier_vec ?n; ?U \<in> carrier_mat ?n ?n; Complex_Matrix.unitary ?U\<rbrakk> \<Longrightarrow> vec_norm (?U *\<^sub>v ?v) = vec_norm ?v

goal (1 subgoal):
 1. (vec_norm (Matrix.col U i))\<^sup>2 = (vec_norm vn)\<^sup>2
[PROOF STEP]
by (metis mat_unit_vec_col unit_vec_carrier vn_def)
[PROOF STATE]
proof (state)
this:
(vec_norm (Matrix.col U i))\<^sup>2 = (vec_norm vn)\<^sup>2

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(vec_norm (Matrix.col U i))\<^sup>2 = (vec_norm vn)\<^sup>2

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
have "... = \<parallel>vn\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec_norm vn)\<^sup>2 = complex_of_real (\<parallel>vn\<parallel>\<^sup>2)
[PROOF STEP]
using vec_norm_sq_cpx_vec_length_sq
[PROOF STATE]
proof (prove)
using this:
(vec_norm ?v)\<^sup>2 = complex_of_real (\<parallel>?v\<parallel>\<^sup>2)

goal (1 subgoal):
 1. (vec_norm vn)\<^sup>2 = complex_of_real (\<parallel>vn\<parallel>\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(vec_norm vn)\<^sup>2 = complex_of_real (\<parallel>vn\<parallel>\<^sup>2)

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(vec_norm vn)\<^sup>2 = complex_of_real (\<parallel>vn\<parallel>\<^sup>2)

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<parallel>vn\<parallel>\<^sup>2) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U
U \<in> carrier_mat n n
i < n

goal (1 subgoal):
 1. complex_of_real (\<parallel>vn\<parallel>\<^sup>2) = 1
[PROOF STEP]
unfolding vn_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U
U \<in> carrier_mat n n
i < n

goal (1 subgoal):
 1. complex_of_real (\<parallel>unit_vec n i\<parallel>\<^sup>2) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
complex_of_real (\<parallel>vn\<parallel>\<^sup>2) = 1

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
complex_of_real (\<parallel>Matrix.col U i\<parallel>\<^sup>2) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
complex_of_real (\<parallel>Matrix.col U i\<parallel>\<^sup>2) = 1

goal (1 subgoal):
 1. \<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<parallel>Matrix.col U i\<parallel>\<^sup>2 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_le_const2: "X \<longlonglongrightarrow> x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. X n \<le> a \<Longrightarrow> x \<le> a"
  for a x :: "'a::linorder_topology"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow> x; \<exists>N. \<forall>n\<ge>N. X n \<le> a\<rbrakk> \<Longrightarrow> x \<le> a
[PROOF STEP]
by (rule LIMSEQ_le[of X x "\<lambda>n. a"]) auto


[STATEMENT]
lemma product_nodes_finite[intro]:
      assumes "list_all (finite \<circ> a.nodes) AA"
      shows "finite (b.nodes (product AA))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (b.nodes' (product AA))
[PROOF STEP]
using list.pred_map product_nodes assms
[PROOF STATE]
proof (prove)
using this:
list_all ?Q (map ?f ?x) = list_all (?Q \<circ> ?f) ?x
b.nodes' (product ?AA) \<subseteq> listset (map a.nodes' ?AA)
list_all (finite \<circ> a.nodes') AA

goal (1 subgoal):
 1. finite (b.nodes' (product AA))
[PROOF STEP]
by (blast dest: finite_subset)


[STATEMENT]
lemma ipoly_roots_finite: "p \<noteq> 0 \<Longrightarrow> finite {x :: 'a :: {idom, ring_char_0}. ipoly p x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> finite {x. ipoly p x = (0::'a)}
[PROOF STEP]
by (rule poly_roots_finite, simp)


[STATEMENT]
lemma lowner_le_imp_trace_le:
  assumes "A \<in> carrier_mat n n" and "B \<in> carrier_mat n n"
    and "A \<le>\<^sub>L B"
  shows "trace A \<le> trace B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
have "positive (B - A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
using assms lowner_le_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
A \<le>\<^sub>L B
(?A \<le>\<^sub>L ?B) = (dim_row ?A = dim_row ?B \<and> dim_col ?A = dim_col ?B \<and> positive (?B - ?A))

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

goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
positive (B - A)

goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
have "B - A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B - A \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
A \<le>\<^sub>L B

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

goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
positive (B - A)
B - A \<in> carrier_mat n n
[PROOF STEP]
have "trace (B - A) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
positive (B - A)
B - A \<in> carrier_mat n n

goal (1 subgoal):
 1. 0 \<le> trace (B - A)
[PROOF STEP]
using positive_trace
[PROOF STATE]
proof (prove)
using this:
positive (B - A)
B - A \<in> carrier_mat n n
\<lbrakk>?A \<in> carrier_mat ?n ?n; positive ?A\<rbrakk> \<Longrightarrow> 0 \<le> trace ?A

goal (1 subgoal):
 1. 0 \<le> trace (B - A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> trace (B - A)

goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> trace (B - A)

goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
have "trace (B - A) = trace B - trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (B - A) = trace B - trace A
[PROOF STEP]
using trace_minus_linear assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> trace (?A - ?B) = trace ?A - trace ?B
A \<in> carrier_mat n n
B \<in> carrier_mat n n
A \<le>\<^sub>L B

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

goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<le> trace (B - A)
trace (B - A) = trace B - trace A
[PROOF STEP]
have "trace B - trace A \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> trace (B - A)
trace (B - A) = trace B - trace A

goal (1 subgoal):
 1. 0 \<le> trace B - trace A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> trace B - trace A

goal (1 subgoal):
 1. trace A \<le> trace B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> trace B - trace A
[PROOF STEP]
show "trace A \<le> trace B"
[PROOF STATE]
proof (prove)
using this:
0 \<le> trace B - trace A

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

goal:
No subgoals!
[PROOF STEP]
qed