[STATEMENT]
lemma alice_step_1:
  assumes "state 1 \<phi>" and "\<alpha> = \<phi> $$ (0,0)" and "\<beta> = \<phi> $$ (1,0)"
  shows "(\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = mat_of_cols_list 8 [[\<alpha>/sqrt(2),0,0,\<alpha>/sqrt(2),\<beta>/sqrt(2),0,0,\<beta>/sqrt(2)]]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle> = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]); j < dim_col (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]] $$ (i, j)
 2. dim_row (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_row (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])
 3. dim_col (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_col (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])
[PROOF STEP]
define v where asm:"v = mat_of_cols_list 8 [[\<alpha>/sqrt(2),0,0,\<alpha>/sqrt(2),\<beta>/sqrt(2),0,0,\<beta>/sqrt(2)]]"
[PROOF STATE]
proof (state)
this:
v = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]); j < dim_col (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]] $$ (i, j)
 2. dim_row (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_row (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])
 3. dim_col (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_col (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]
[PROOF STEP]
show "dim_row (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_row v"
[PROOF STATE]
proof (prove)
using this:
v = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]

goal (1 subgoal):
 1. dim_row (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_row v
[PROOF STEP]
using assms(1) alice_step_1_state state.dim_row mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
v = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]
state 1 \<phi>
state 1 ?\<phi> \<Longrightarrow> state 3 (?\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>)
state ?n ?v \<Longrightarrow> dim_row ?v = 2 ^ ?n
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_row (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_row v
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dim_row (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_row v

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]); j < dim_col (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]] $$ (i, j)
 2. dim_col (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_col (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])
[PROOF STEP]
show "dim_col (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_col v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_col v
[PROOF STEP]
using assms(1) alice_step_1_state state.is_column asm mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
state 1 \<phi>
state 1 ?\<phi> \<Longrightarrow> state 3 (?\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>)
state ?n ?v \<Longrightarrow> dim_col ?v = 1
v = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_col (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_col v
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dim_col (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) = dim_col v

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]); j < dim_col (Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]])\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]] $$ (i, j)
[PROOF STEP]
show "\<And>i j. i < dim_row v \<Longrightarrow> j < dim_col v \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i,j) = v $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
assume "i < dim_row v" and "j < dim_col v"
[PROOF STATE]
proof (state)
this:
i < dim_row v
j < dim_col v

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row v
j < dim_col v
[PROOF STEP]
have "i \<in> {0..<8} \<and> j = 0"
[PROOF STATE]
proof (prove)
using this:
i < dim_row v
j < dim_col v

goal (1 subgoal):
 1. i \<in> {0..<8} \<and> j = 0
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
i < dim_row v
j < dim_col v
v = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]

goal (1 subgoal):
 1. i \<in> {0..<8} \<and> j = 0
[PROOF STEP]
by (auto simp add: mat_of_cols_list_def)
[PROOF STATE]
proof (state)
this:
i \<in> {0..<8} \<and> j = 0

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i \<in> {0..<8} \<and> j = 0

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
have "dim_row |\<beta>\<^sub>0\<^sub>0\<rangle> = 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row |\<beta>\<^sub>0\<^sub>0\<rangle> = 4
[PROOF STEP]
using bell00_is_state state_def
[PROOF STATE]
proof (prove)
using this:
state 2 |\<beta>\<^sub>0\<^sub>0\<rangle>
state ?n ?v \<equiv> dim_col ?v = 1 \<and> dim_row ?v = 2 ^ ?n \<and> \<parallel>Matrix.col ?v 0\<parallel> = 1

goal (1 subgoal):
 1. dim_row |\<beta>\<^sub>0\<^sub>0\<rangle> = 4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row |\<beta>\<^sub>0\<^sub>0\<rangle> = 4

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dim_row |\<beta>\<^sub>0\<^sub>0\<rangle> = 4

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
have "dim_col |\<beta>\<^sub>0\<^sub>0\<rangle> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col |\<beta>\<^sub>0\<^sub>0\<rangle> = 1
[PROOF STEP]
using bell00_is_state state_def
[PROOF STATE]
proof (prove)
using this:
state 2 |\<beta>\<^sub>0\<^sub>0\<rangle>
state ?n ?v \<equiv> dim_col ?v = 1 \<and> dim_row ?v = 2 ^ ?n \<and> \<parallel>Matrix.col ?v 0\<parallel> = 1

goal (1 subgoal):
 1. dim_col |\<beta>\<^sub>0\<^sub>0\<rangle> = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col |\<beta>\<^sub>0\<^sub>0\<rangle> = 1

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
i \<in> {0..<8} \<and> j = 0
dim_row |\<beta>\<^sub>0\<^sub>0\<rangle> = 4
dim_col |\<beta>\<^sub>0\<^sub>0\<rangle> = 1
[PROOF STEP]
show "(\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<8} \<and> j = 0
dim_row |\<beta>\<^sub>0\<^sub>0\<rangle> = 4
dim_col |\<beta>\<^sub>0\<^sub>0\<rangle> = 1

goal (1 subgoal):
 1. (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
using state_def assms asm
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<8} \<and> j = 0
dim_row |\<beta>\<^sub>0\<^sub>0\<rangle> = 4
dim_col |\<beta>\<^sub>0\<^sub>0\<rangle> = 1
state ?n ?v \<equiv> dim_col ?v = 1 \<and> dim_row ?v = 2 ^ ?n \<and> \<parallel>Matrix.col ?v 0\<parallel> = 1
state 1 \<phi>
\<alpha> = \<phi> $$ (0, 0)
\<beta> = \<phi> $$ (1, 0)
v = Tensor.mat_of_cols_list 8 [[\<alpha> / complex_of_real (sqrt 2), 0, 0, \<alpha> / complex_of_real (sqrt 2), \<beta> / complex_of_real (sqrt 2), 0, 0, \<beta> / complex_of_real (sqrt 2)]]

goal (1 subgoal):
 1. (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
by (auto simp add: bell00_def)
[PROOF STATE]
proof (state)
this:
(\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (i, j) = v $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < dim_row v; ?j < dim_col v\<rbrakk> \<Longrightarrow> (\<phi> \<Otimes> |\<beta>\<^sub>0\<^sub>0\<rangle>) $$ (?i, ?j) = v $$ (?i, ?j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_measurable_vimage_halfspace_component_ge:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  shows "f \<in> borel_measurable (lebesgue_on S) \<longleftrightarrow>
         (\<forall>a i. i \<in> Basis \<longrightarrow> {x \<in> S. f x \<bullet> i \<ge> a} \<in> sets (lebesgue_on S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> borel_measurable (lebesgue_on S)) = (\<forall>a i. i \<in> Basis \<longrightarrow> {x \<in> S. a \<le> f x \<bullet> i} \<in> sets (lebesgue_on S))
[PROOF STEP]
apply (rule trans [OF borel_measurable_iff_halfspace_ge])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>Basis. \<forall>a. {w \<in> space (lebesgue_on S). a \<le> f w \<bullet> i} \<in> sets (lebesgue_on S)) = (\<forall>a i. i \<in> Basis \<longrightarrow> {x \<in> S. a \<le> f x \<bullet> i} \<in> sets (lebesgue_on S))
[PROOF STEP]
apply (fastforce simp add: space_restrict_space)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem red_stat_red_is_stat_red:
  "reducedly_statically_complete_calculus Bot Inf entails Red_Red_I Red_F \<longleftrightarrow>
   statically_complete_calculus Bot Inf entails Red_Red_I Red_F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reducedly_statically_complete_calculus Bot Inf (\<Turnstile>) Red_Red_I Red_F = statically_complete_calculus Bot Inf (\<Turnstile>) Red_Red_I Red_F
[PROOF STEP]
using reduc_calc.stat_ref_comp_imp_red_stat_ref_comp
[PROOF STATE]
proof (prove)
using this:
statically_complete_calculus Bot Inf (\<Turnstile>) Red_Red_I Red_F \<Longrightarrow> reducedly_statically_complete_calculus Bot Inf (\<Turnstile>) Red_Red_I Red_F

goal (1 subgoal):
 1. reducedly_statically_complete_calculus Bot Inf (\<Turnstile>) Red_Red_I Red_F = statically_complete_calculus Bot Inf (\<Turnstile>) Red_Red_I Red_F
[PROOF STEP]
by (metis reduc_calc.sat_eq_reduc_sat reducedly_statically_complete_calculus.axioms(2)
    reducedly_statically_complete_calculus_axioms_def reduced_calc_is_calc
    statically_complete_calculus.intro statically_complete_calculus_axioms.intro)


[STATEMENT]
lemma qbs_prob_ennintegral_indep1:
  assumes "p \<in> monadP_qbs_Px X"
      and "f \<in> X \<rightarrow>\<^sub>Q \<real>\<^sub>Q\<^sub>\<ge>\<^sub>0"
    shows "(\<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>(p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)) = (\<integral>\<^sup>+\<^sub>Q x. f x \<partial>p)"
          (is "?lhs = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral p f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral p f
[PROOF STEP]
obtain Y \<beta> \<nu> where hq:
   "q = qbs_prob_space (Y, \<beta>, \<nu>)" "qbs_prob Y \<beta> \<nu>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Y \<beta> \<nu>. \<lbrakk>q = qbs_prob_space (Y, \<beta>, \<nu>); qbs_prob Y \<beta> \<nu>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using rep_qbs_prob_space[of q]
[PROOF STATE]
proof (prove)
using this:
\<exists>X \<alpha> \<mu>. q = qbs_prob_space (X, \<alpha>, \<mu>) \<and> qbs_prob X \<alpha> \<mu>

goal (1 subgoal):
 1. (\<And>Y \<beta> \<nu>. \<lbrakk>q = qbs_prob_space (Y, \<beta>, \<nu>); qbs_prob Y \<beta> \<nu>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q = qbs_prob_space (Y, \<beta>, \<nu>)
qbs_prob Y \<beta> \<nu>

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral p f
[PROOF STEP]
have "?lhs = (\<integral>\<^sup>+\<^sub>Q y. \<integral>\<^sup>+\<^sub>Q x. f x \<partial>p \<partial>q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sup>+\<^sub>Q y. qbs_prob_ennintegral p f \<partial>q
[PROOF STEP]
using qbs_prob_ennintegral_Fubini_snd[OF assms(1) qbs_prob.qbs_prob_space_in_Px[OF hq(2)] qbs_morphism_fst''[OF assms(2)]]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+\<^sub>Q y. \<integral>\<^sup>+\<^sub>Q x. f (fst (x, y)) \<partial>p \<partial>qbs_prob_space (Y, \<beta>, \<nu>) = \<integral>\<^sup>+\<^sub>Q x. f (fst x) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s qbs_prob_space (Y, \<beta>, \<nu>)

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sup>+\<^sub>Q y. qbs_prob_ennintegral p f \<partial>q
[PROOF STEP]
by(simp add: hq(1))
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sup>+\<^sub>Q y. qbs_prob_ennintegral p f \<partial>q

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral p f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sup>+\<^sub>Q y. qbs_prob_ennintegral p f \<partial>q

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral p f
[PROOF STEP]
by(simp add: qbs_prob_ennintegral_const)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+\<^sub>Q z. f (fst z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral p f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reciprocal_1: "reciprocal_poly p 1 = monom 1 p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly p 1 = monom (1::'a) p
[PROOF STEP]
by (simp add: reciprocal_poly_def monom_altdef Poly_append)


[STATEMENT]
lemma H_while_inv: "d p \<le> d i \<Longrightarrow> d i \<cdot> ad r \<le> d q \<Longrightarrow> H (d i \<cdot> d r) x i \<Longrightarrow> H p (while r inv i do x od) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d p \<le> d i; d i \<cdot> ad r \<le> d q; H (d i \<cdot> d r) x i\<rbrakk> \<Longrightarrow> H p (while r inv i do x od) q
[PROOF STEP]
using H_def a_closed dom_op_def wp_while_inv
[PROOF STATE]
proof (prove)
using this:
H ?p ?x ?q = (d ?p \<le> wp ?x ?q)
d (ad ?x \<cdot> ad ?y) = ad ?x \<cdot> ad ?y
d ?x = ad (ad ?x)
\<lbrakk>d ?p \<le> d ?i; d ?i \<cdot> ad ?r \<le> d ?q; d ?i \<cdot> d ?r \<le> wp ?x ?i\<rbrakk> \<Longrightarrow> d ?p \<le> wp (while ?r inv ?i do ?x od) ?q

goal (1 subgoal):
 1. \<lbrakk>d p \<le> d i; d i \<cdot> ad r \<le> d q; H (d i \<cdot> d r) x i\<rbrakk> \<Longrightarrow> H p (while r inv i do x od) q
[PROOF STEP]
by auto


[STATEMENT]
lemma  to_Zp_res_of_pow:
  assumes "a \<in> \<O>\<^sub>p"
  assumes "b \<in> \<O>\<^sub>p"
  assumes "to_Zp a n = to_Zp b n"
  shows "to_Zp (a[^](k::nat)) n = to_Zp (b[^](k::nat)) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_Zp (a [^] k) n = to_Zp (b [^] k) n
[PROOF STEP]
using assms val_ring_memE Zp_res_of_pow to_Zp_closed to_Zp_nat_pow
[PROOF STATE]
proof (prove)
using this:
a \<in> \<O>\<^sub>p
b \<in> \<O>\<^sub>p
to_Zp a n = to_Zp b n
?a \<in> \<O>\<^sub>p \<Longrightarrow> 0 \<le> val ?a
?a \<in> \<O>\<^sub>p \<Longrightarrow> ?a \<in> carrier Q\<^sub>p
\<lbrakk>?a \<in> carrier Z\<^sub>p; ?b \<in> carrier Z\<^sub>p; ?a ?n = ?b ?n\<rbrakk> \<Longrightarrow> (?a [^]\<^bsub>Z\<^sub>p\<^esub> ?k) ?n = (?b [^]\<^bsub>Z\<^sub>p\<^esub> ?k) ?n
?a \<in> carrier Q\<^sub>p \<Longrightarrow> to_Zp ?a \<in> carrier Z\<^sub>p
?a \<in> \<O>\<^sub>p \<Longrightarrow> to_Zp (?a [^] ?n) = to_Zp ?a [^]\<^bsub>Z\<^sub>p\<^esub> ?n

goal (1 subgoal):
 1. to_Zp (a [^] k) n = to_Zp (b [^] k) n
[PROOF STEP]
by presburger


[STATEMENT]
lemma eval_in_ring_smult:
  assumes "P \<in> carrier (Pring R I)"
  assumes "a \<in> carrier R"
  assumes "closed_fun R g"
  shows "eval_in_ring R S g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<otimes> eval_in_ring R S g P "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_in_ring R S g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<otimes> eval_in_ring R S g P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier (Pring R I)
a \<in> carrier R
g \<in> UNIV \<rightarrow> carrier R

goal (1 subgoal):
 1. eval_in_ring R S g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<otimes> eval_in_ring R S g P
[PROOF STEP]
unfolding eval_in_ring_def
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier (Pring R I)
a \<in> carrier R
g \<in> UNIV \<rightarrow> carrier R

goal (1 subgoal):
 1. poly_eval R S g (a \<odot>\<^bsub>Pring R I\<^esub> P) {#} = a \<otimes> poly_eval R S g P {#}
[PROOF STEP]
by (smt Pring_car Pring_smult poly_eval_scalar_mult poly_scalar_mult_def)


[STATEMENT]
lemma subset_box_imp:
  fixes a :: "'a::euclidean_space"
  shows "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> cbox c d \<subseteq> cbox a b"
    and "(\<forall>i\<in>Basis. a\<bullet>i < c\<bullet>i \<and> d\<bullet>i < b\<bullet>i) \<Longrightarrow> cbox c d \<subseteq> box a b"
    and "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> box c d \<subseteq> cbox a b"
     and "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> box c d \<subseteq> box a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> cbox c d \<subseteq> cbox a b) &&& (\<forall>i\<in>Basis. a \<bullet> i < c \<bullet> i \<and> d \<bullet> i < b \<bullet> i \<Longrightarrow> cbox c d \<subseteq> box a b)) &&& (\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> box c d \<subseteq> cbox a b) &&& (\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> box c d \<subseteq> box a b)
[PROOF STEP]
unfolding subset_eq[unfolded Ball_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> \<forall>x. x \<in> cbox c d \<longrightarrow> x \<in> cbox a b) &&& (\<forall>i\<in>Basis. a \<bullet> i < c \<bullet> i \<and> d \<bullet> i < b \<bullet> i \<Longrightarrow> \<forall>x. x \<in> cbox c d \<longrightarrow> x \<in> box a b)) &&& (\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> \<forall>x. x \<in> box c d \<longrightarrow> x \<in> cbox a b) &&& (\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> \<forall>x. x \<in> box c d \<longrightarrow> x \<in> box a b)
[PROOF STEP]
unfolding mem_box
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> \<forall>x. (\<forall>i\<in>Basis. c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i) \<longrightarrow> (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)) &&& (\<forall>i\<in>Basis. a \<bullet> i < c \<bullet> i \<and> d \<bullet> i < b \<bullet> i \<Longrightarrow> \<forall>x. (\<forall>i\<in>Basis. c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i) \<longrightarrow> (\<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i))) &&& (\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> \<forall>x. (\<forall>i\<in>Basis. c \<bullet> i < x \<bullet> i \<and> x \<bullet> i < d \<bullet> i) \<longrightarrow> (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)) &&& (\<forall>i\<in>Basis. a \<bullet> i \<le> c \<bullet> i \<and> d \<bullet> i \<le> b \<bullet> i \<Longrightarrow> \<forall>x. (\<forall>i\<in>Basis. c \<bullet> i < x \<bullet> i \<and> x \<bullet> i < d \<bullet> i) \<longrightarrow> (\<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i))
[PROOF STEP]
by (best intro: order_trans less_le_trans le_less_trans less_imp_le)+


[STATEMENT]
lemma per_lemma_comm_pref:
  assumes "u \<le>p r\<^sup>@k" "u \<le>p s\<^sup>@l"
      and len: "\<^bold>|r\<^bold>| + \<^bold>|s\<^bold>| - gcd (\<^bold>|r\<^bold>|) (\<^bold>|s\<^bold>|) \<le> \<^bold>|u\<^bold>|"
    shows "r \<cdot> s = s \<cdot> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<cdot> s = s \<cdot> r
[PROOF STEP]
using  pref_prod_root[OF assms(2)] pref_prod_root[OF assms(1)] per_lemma_comm[OF _ _ len]
[PROOF STATE]
proof (prove)
using this:
u \<le>p s \<cdot> u
u \<le>p r \<cdot> u
\<lbrakk>u \<le>p s \<cdot> u; u \<le>p r \<cdot> u\<rbrakk> \<Longrightarrow> r \<cdot> s = s \<cdot> r

goal (1 subgoal):
 1. r \<cdot> s = s \<cdot> r
[PROOF STEP]
by blast


[STATEMENT]
lemma emeasure_interval_measure_Icc:
  assumes "a \<le> b"
  assumes mono_F: "\<And>x y. x \<le> y \<Longrightarrow> F x \<le> F y"
  assumes cont_F : "continuous_on UNIV F"
  shows "emeasure (interval_measure F) {a .. b} = F b - F a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (interval_measure F) {a..b} = ennreal (F b - F a)
[PROOF STEP]
proof (rule tendsto_unique)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?F \<noteq> bot
 2. (?f \<longlongrightarrow> emeasure (interval_measure F) {a..b}) ?F
 3. (?f \<longlongrightarrow> ennreal (F b - F a)) ?F
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?F \<noteq> bot
 2. (?f \<longlongrightarrow> emeasure (interval_measure F) {a..b}) ?F
 3. (?f \<longlongrightarrow> ennreal (F b - F a)) ?F
[PROOF STEP]
fix a b :: real
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?F \<noteq> bot
 2. (?f \<longlongrightarrow> emeasure (interval_measure F) {a..b}) ?F
 3. (?f \<longlongrightarrow> ennreal (F b - F a)) ?F
[PROOF STEP]
assume "a \<le> b"
[PROOF STATE]
proof (state)
this:
a \<le> b

goal (3 subgoals):
 1. ?F \<noteq> bot
 2. (?f \<longlongrightarrow> emeasure (interval_measure F) {a..b}) ?F
 3. (?f \<longlongrightarrow> ennreal (F b - F a)) ?F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
[PROOF STEP]
have "emeasure (interval_measure F) {a <.. b} = F b - F a"
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. emeasure (interval_measure F) {a<..b} = ennreal (F b - F a)
[PROOF STEP]
using cont_F
[PROOF STATE]
proof (prove)
using this:
a \<le> b
continuous_on UNIV F

goal (1 subgoal):
 1. emeasure (interval_measure F) {a<..b} = ennreal (F b - F a)
[PROOF STEP]
by (subst emeasure_interval_measure_Ioc)
         (auto intro: mono_F continuous_within_subset simp: continuous_on_eq_continuous_within)
[PROOF STATE]
proof (state)
this:
emeasure (interval_measure F) {a<..b} = ennreal (F b - F a)

goal (3 subgoals):
 1. ?F \<noteq> bot
 2. (?f \<longlongrightarrow> emeasure (interval_measure F) {a..b}) ?F
 3. (?f \<longlongrightarrow> ennreal (F b - F a)) ?F
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?aa2 \<le> ?ba2 \<Longrightarrow> emeasure (interval_measure F) {?aa2<..?ba2} = ennreal (F ?ba2 - F ?aa2)

goal (3 subgoals):
 1. ?F \<noteq> bot
 2. (?f \<longlongrightarrow> emeasure (interval_measure F) {a..b}) ?F
 3. (?f \<longlongrightarrow> ennreal (F b - F a)) ?F
[PROOF STEP]
note * = this
[PROOF STATE]
proof (state)
this:
?aa2 \<le> ?ba2 \<Longrightarrow> emeasure (interval_measure F) {?aa2<..?ba2} = ennreal (F ?ba2 - F ?aa2)

goal (3 subgoals):
 1. ?F \<noteq> bot
 2. (?f \<longlongrightarrow> emeasure (interval_measure F) {a..b}) ?F
 3. (?f \<longlongrightarrow> ennreal (F b - F a)) ?F
[PROOF STEP]
let ?F = "interval_measure F"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?F \<noteq> bot
 2. (?f \<longlongrightarrow> emeasure (interval_measure F) {a..b}) ?F
 3. (?f \<longlongrightarrow> ennreal (F b - F a)) ?F
[PROOF STEP]
show "((\<lambda>a. F b - F a) \<longlongrightarrow> emeasure ?F {a..b}) (at_left a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ennreal (F b - F x)) \<longlongrightarrow> emeasure (interval_measure F) {a..b}) (at_left a)
[PROOF STEP]
proof (rule tendsto_at_left_sequentially)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?b < a
 2. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. ?b < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
show "a - 1 < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - 1 < a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a - 1 < a

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. a - 1 < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
fix X
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. a - 1 < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
assume "\<And>n. X n < a" "incseq X" "X \<longlonglongrightarrow> a"
[PROOF STATE]
proof (state)
this:
X ?n < a
incseq X
X \<longlonglongrightarrow> a

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. a - 1 < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
with \<open>a \<le> b\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
X ?n < a
incseq X
X \<longlonglongrightarrow> a
[PROOF STEP]
have "(\<lambda>n. emeasure ?F {X n<..b}) \<longlonglongrightarrow> emeasure ?F (\<Inter>n. {X n <..b})"
[PROOF STATE]
proof (prove)
using this:
a \<le> b
X ?n < a
incseq X
X \<longlonglongrightarrow> a

goal (1 subgoal):
 1. (\<lambda>n. emeasure (interval_measure F) {X n<..b}) \<longlonglongrightarrow> emeasure (interval_measure F) (\<Inter>n. {X n<..b})
[PROOF STEP]
apply (intro Lim_emeasure_decseq)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>a \<le> b; \<And>n. X n < a; incseq X; X \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> range (\<lambda>i. {X i<..b}) \<subseteq> sets (interval_measure F)
 2. \<lbrakk>a \<le> b; \<And>n. X n < a; incseq X; X \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> monotone (\<le>) (\<lambda>x y. y \<subseteq> x) (\<lambda>i. {X i<..b})
 3. \<And>n. \<lbrakk>a \<le> b; \<And>n. X n < a; incseq X; X \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> emeasure (interval_measure F) {X n<..b} \<noteq> \<infinity>
[PROOF STEP]
apply (auto simp: decseq_def incseq_def emeasure_interval_measure_Ioc *)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m n x. \<lbrakk>a \<le> b; \<And>n. X n < a; \<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n; X \<longlonglongrightarrow> a; m \<le> n; X n < x; x \<le> b\<rbrakk> \<Longrightarrow> X m < x
 2. \<And>n. \<lbrakk>a \<le> b; \<And>n. X n < a; \<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n; X \<longlonglongrightarrow> a; emeasure (interval_measure F) {X n<..b} = top\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>a \<le> b; \<And>n. X n < a; \<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n; X \<longlonglongrightarrow> a; emeasure (interval_measure F) {X n<..b} = top\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (subst (asm ) *)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>a \<le> b; \<And>n. X n < a; \<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n; X \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> X n \<le> b
 2. \<And>n. \<lbrakk>a \<le> b; \<And>n. X n < a; \<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n; X \<longlonglongrightarrow> a; ennreal (F b - F (X n)) = top\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (auto intro: less_le_trans less_imp_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<lambda>n. emeasure (interval_measure F) {X n<..b}) \<longlonglongrightarrow> emeasure (interval_measure F) (\<Inter>n. {X n<..b})

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. a - 1 < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. emeasure (interval_measure F) {X n<..b}) \<longlonglongrightarrow> emeasure (interval_measure F) (\<Inter>n. {X n<..b})

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. a - 1 < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
have "(\<Inter>n. {X n <..b}) = {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>n. {X n<..b}) = {a..b}
[PROOF STEP]
using \<open>\<And>n. X n < a\<close>
[PROOF STATE]
proof (prove)
using this:
X ?n < a

goal (1 subgoal):
 1. (\<Inter>n. {X n<..b}) = {a..b}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<And>n. X n < a; \<forall>xa. X xa < x; x \<le> b\<rbrakk> \<Longrightarrow> a \<le> x
 2. \<And>x n. \<lbrakk>\<And>n. X n < a; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> X n < x
[PROOF STEP]
apply (rule LIMSEQ_le_const2[OF \<open>X \<longlonglongrightarrow> a\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<And>n. X n < a; \<forall>xa. X xa < x; x \<le> b\<rbrakk> \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. X n \<le> x
 2. \<And>x n. \<lbrakk>\<And>n. X n < a; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> X n < x
[PROOF STEP]
apply (auto intro: less_imp_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x n. \<lbrakk>\<And>n. X n < a; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> X n < x
[PROOF STEP]
apply (auto intro: less_le_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<Inter>n. {X n<..b}) = {a..b}

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. a - 1 < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Inter>n. {X n<..b}) = {a..b}

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. a - 1 < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
have "(\<lambda>n. emeasure ?F {X n<..b}) = (\<lambda>n. F b - F (X n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. emeasure (interval_measure F) {X n<..b}) = (\<lambda>x. ennreal (F b - F (X x)))
[PROOF STEP]
using \<open>\<And>n. X n < a\<close> \<open>a \<le> b\<close>
[PROOF STATE]
proof (prove)
using this:
X ?n < a
a \<le> b

goal (1 subgoal):
 1. (\<lambda>n. emeasure (interval_measure F) {X n<..b}) = (\<lambda>x. ennreal (F b - F (X x)))
[PROOF STEP]
by (subst *) (auto intro: less_imp_le less_le_trans)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. emeasure (interval_measure F) {X n<..b}) = (\<lambda>x. ennreal (F b - F (X x)))

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < a; \<And>n. a - 1 < S n; incseq S; S \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> (\<lambda>n. ennreal (F b - F (S n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. ennreal (F b - F (X n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
show "(\<lambda>n. F b - F (X n)) \<longlonglongrightarrow> emeasure ?F {a..b}"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ennreal (F b - F (X n))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}

goal (1 subgoal):
 1. (\<lambda>x. ennreal (F b - F (X x))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ennreal (F b - F (X x))) \<longlonglongrightarrow> emeasure (interval_measure F) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ennreal (F b - F x)) \<longlongrightarrow> emeasure (interval_measure F) {a..b}) (at_left a)

goal (2 subgoals):
 1. at_left a \<noteq> bot
 2. ((\<lambda>x. ennreal (F b - F x)) \<longlongrightarrow> ennreal (F b - F a)) (at_left a)
[PROOF STEP]
show "((\<lambda>a. ennreal (F b - F a)) \<longlongrightarrow> F b - F a) (at_left a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>a. ennreal (F b - F a)) \<longlongrightarrow> ennreal (F b - F a)) (at_left a)
[PROOF STEP]
by (rule continuous_on_tendsto_compose[where g="\<lambda>x. x" and s=UNIV])
       (auto simp: continuous_on_ennreal continuous_on_diff cont_F)
[PROOF STATE]
proof (state)
this:
((\<lambda>a. ennreal (F b - F a)) \<longlongrightarrow> ennreal (F b - F a)) (at_left a)

goal (1 subgoal):
 1. at_left a \<noteq> bot
[PROOF STEP]
qed (rule trivial_limit_at_left_real)


[STATEMENT]
lemma n_one [simp]: "n 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (1::'a) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n (1::'a) = (0::'a)
[PROOF STEP]
have "n 1 = n 1 \<cdot> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (1::'a) = n (1::'a) \<cdot> (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n (1::'a) = n (1::'a) \<cdot> (1::'a)

goal (1 subgoal):
 1. n (1::'a) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n (1::'a) = n (1::'a) \<cdot> (1::'a)

goal (1 subgoal):
 1. n (1::'a) = (0::'a)
[PROOF STEP]
have "... = n 1 \<cdot> n n 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (1::'a) \<cdot> (1::'a) = n (1::'a) \<cdot> n n (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n (1::'a) \<cdot> (1::'a) = n (1::'a) \<cdot> n n (1::'a)

goal (1 subgoal):
 1. n (1::'a) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n (1::'a) = n (1::'a) \<cdot> n n (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n (1::'a) = n (1::'a) \<cdot> n n (1::'a)

goal (1 subgoal):
 1. n (1::'a) = (0::'a)
[PROOF STEP]
using test_mult_comp
[PROOF STATE]
proof (prove)
using this:
n (1::'a) = n (1::'a) \<cdot> n n (1::'a)
n ?x \<cdot> n n ?x = (0::'a)

goal (1 subgoal):
 1. n (1::'a) = (0::'a)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
n (1::'a) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma OrdP_IN_SUCC_lemma: "{OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (rule OrdP_linear [of _ "SUCC x" "SUCC y"])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. {OrdP x, y IN x} \<turnstile> OrdP (SUCC x)
 2. {OrdP x, y IN x} \<turnstile> OrdP (SUCC y)
 3. {SUCC x IN SUCC y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 4. {SUCC x EQ SUCC y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 5. {SUCC y IN SUCC x, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (auto intro!: Mem_SUCC_EH  intro: OrdP_SUCC_I Ord_IN_Ord0)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. {SUCC x IN y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 2. {SUCC x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 3. {x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (metis Hyp Mem_SUCC_I1 Mem_not_sym cut_same insertCI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {SUCC x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
 2. {x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (metis Assume EQ_imp_SUBS Mem_SUCC_I1 Mem_non_refl Subset_D thin1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x EQ y, OrdP x, y IN x} \<turnstile> SUCC y IN SUCC x
[PROOF STEP]
apply (blast intro: cut_same [OF Mem_cong [THEN Iff_MP2_same]])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ord_of_nat_inject [iff]: "ord_of_nat i = ord_of_nat j \<longleftrightarrow> i=j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ord_of_nat i = ord_of_nat j) = (i = j)
[PROOF STEP]
proof (induct i arbitrary: j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>j. (ord_of_nat 0 = ord_of_nat j) = (0 = j)
 2. \<And>i j. (\<And>j. (ord_of_nat i = ord_of_nat j) = (i = j)) \<Longrightarrow> (ord_of_nat (Suc i) = ord_of_nat j) = (Suc i = j)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>j. (ord_of_nat 0 = ord_of_nat j) = (0 = j)
 2. \<And>i j. (\<And>j. (ord_of_nat i = ord_of_nat j) = (i = j)) \<Longrightarrow> (ord_of_nat (Suc i) = ord_of_nat j) = (Suc i = j)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ord_of_nat 0 = ord_of_nat j) = (0 = j)
[PROOF STEP]
using ord_of_eq_0
[PROOF STATE]
proof (prove)
using this:
ord_of_nat ?j = 0 \<Longrightarrow> ?j = 0

goal (1 subgoal):
 1. (ord_of_nat 0 = ord_of_nat j) = (0 = j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(ord_of_nat 0 = ord_of_nat j) = (0 = j)

goal (1 subgoal):
 1. \<And>i j. (\<And>j. (ord_of_nat i = ord_of_nat j) = (i = j)) \<Longrightarrow> (ord_of_nat (Suc i) = ord_of_nat j) = (Suc i = j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. (\<And>j. (ord_of_nat i = ord_of_nat j) = (i = j)) \<Longrightarrow> (ord_of_nat (Suc i) = ord_of_nat j) = (Suc i = j)
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
(ord_of_nat i = ord_of_nat ?j) = (i = ?j)

goal (1 subgoal):
 1. \<And>i j. (\<And>j. (ord_of_nat i = ord_of_nat j) = (i = j)) \<Longrightarrow> (ord_of_nat (Suc i) = ord_of_nat j) = (Suc i = j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(ord_of_nat i = ord_of_nat ?j) = (i = ?j)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(ord_of_nat i = ord_of_nat ?j) = (i = ?j)

goal (1 subgoal):
 1. (ord_of_nat (Suc i) = ord_of_nat j) = (Suc i = j)
[PROOF STEP]
by auto (metis elts_0 elts_succ insert_not_empty not0_implies_Suc ord_of_nat.simps succ_inject_iff)
[PROOF STATE]
proof (state)
this:
(ord_of_nat (Suc i) = ord_of_nat j) = (Suc i = j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nfa_reach_subset_memb:
  assumes R: "nfa_reach A q0 bss q"
  and Q0: "nfa_is_node A q0"
  and X: "list_all (is_alph n) bss"
  shows "subset_memb q (subset_dfs A q0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subset_memb q (subset_dfs A q0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subset_memb q (subset_dfs A q0)
[PROOF STEP]
from assms well_formed
[PROOF STATE]
proof (chain)
picking this:
nfa_reach A q0 bss q
nfa_is_node A q0
list_all (is_alph n) bss
wf_nfa A n
[PROOF STEP]
have Q: "nfa_is_node A q"
[PROOF STATE]
proof (prove)
using this:
nfa_reach A q0 bss q
nfa_is_node A q0
list_all (is_alph n) bss
wf_nfa A n

goal (1 subgoal):
 1. nfa_is_node A q
[PROOF STEP]
by (simp add: nfa_reach_is_node)
[PROOF STATE]
proof (state)
this:
nfa_is_node A q

goal (1 subgoal):
 1. subset_memb q (subset_dfs A q0)
[PROOF STEP]
from R X
[PROOF STATE]
proof (chain)
picking this:
nfa_reach A q0 bss q
list_all (is_alph n) bss
[PROOF STEP]
have "\<exists>bs. nfa_reach A q0 bs q \<and> list_all (is_alph n) bs"
[PROOF STATE]
proof (prove)
using this:
nfa_reach A q0 bss q
list_all (is_alph n) bss

goal (1 subgoal):
 1. \<exists>bs. nfa_reach A q0 bs q \<and> list_all (is_alph n) bs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>bs. nfa_reach A q0 bs q \<and> list_all (is_alph n) bs

goal (1 subgoal):
 1. subset_memb q (subset_dfs A q0)
[PROOF STEP]
with Q0
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node A q0
\<exists>bs. nfa_reach A q0 bs q \<and> list_all (is_alph n) bs
[PROOF STEP]
have "(q0,q) \<in> (succsr (subset_succs A))\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A q0
\<exists>bs. nfa_reach A q0 bs q \<and> list_all (is_alph n) bs

goal (1 subgoal):
 1. (q0, q) \<in> (succsr (subset_succs A))\<^sup>*
[PROOF STEP]
by (simp add: nfa_reach_rtrancl)
[PROOF STATE]
proof (state)
this:
(q0, q) \<in> (succsr (subset_succs A))\<^sup>*

goal (1 subgoal):
 1. subset_memb q (subset_dfs A q0)
[PROOF STEP]
with Q0 Q
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node A q0
nfa_is_node A q
(q0, q) \<in> (succsr (subset_succs A))\<^sup>*
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A q0
nfa_is_node A q
(q0, q) \<in> (succsr (subset_succs A))\<^sup>*

goal (1 subgoal):
 1. subset_memb q (subset_dfs A q0)
[PROOF STEP]
by (simp add: dfs_eq_rtrancl)
[PROOF STATE]
proof (state)
this:
subset_memb q (subset_dfs A q0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hahn_decomp_ess_unique:
  assumes "hahn_space_decomp M1 M2"
    and "hahn_space_decomp N1 N2"
    and "C \<subseteq> sym_diff M1 N1 \<union> sym_diff M2 N2"
    and "C\<in> sets M"
  shows "\<mu> C = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> C = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<mu> C = 0
[PROOF STEP]
have "C\<subseteq> (sym_diff M1 N1 \<union> sym_diff M2 N2) \<inter> space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<subseteq> (sym_diff M1 N1 \<union> sym_diff M2 N2) \<inter> space M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hahn_space_decomp M1 M2
hahn_space_decomp N1 N2
C \<subseteq> sym_diff M1 N1 \<union> sym_diff M2 N2
C \<in> sets M

goal (1 subgoal):
 1. C \<subseteq> (sym_diff M1 N1 \<union> sym_diff M2 N2) \<inter> space M
[PROOF STEP]
by (simp add: sets.sets_into_space)
[PROOF STATE]
proof (state)
this:
C \<subseteq> (sym_diff M1 N1 \<union> sym_diff M2 N2) \<inter> space M

goal (1 subgoal):
 1. \<mu> C = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> (sym_diff M1 N1 \<union> sym_diff M2 N2) \<inter> space M

goal (1 subgoal):
 1. \<mu> C = 0
[PROOF STEP]
using assms hahn_decomp_space_diff pos_neg_null_set
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> (sym_diff M1 N1 \<union> sym_diff M2 N2) \<inter> space M
hahn_space_decomp M1 M2
hahn_space_decomp N1 N2
C \<subseteq> sym_diff M1 N1 \<union> sym_diff M2 N2
C \<in> sets M
\<lbrakk>hahn_space_decomp ?M1.0 ?M2.0; hahn_space_decomp ?N1.0 ?N2.0\<rbrakk> \<Longrightarrow> pos_meas_set ((sym_diff ?M1.0 ?N1.0 \<union> sym_diff ?M2.0 ?N2.0) \<inter> space M)
\<lbrakk>hahn_space_decomp ?M1.0 ?M2.0; hahn_space_decomp ?N1.0 ?N2.0\<rbrakk> \<Longrightarrow> neg_meas_set ((sym_diff ?M1.0 ?N1.0 \<union> sym_diff ?M2.0 ?N2.0) \<inter> space M)
\<lbrakk>pos_meas_set ?A; neg_meas_set ?A\<rbrakk> \<Longrightarrow> \<mu> ?A = 0

goal (1 subgoal):
 1. \<mu> C = 0
[PROOF STEP]
by (meson neg_meas_subset pos_meas_subset)
[PROOF STATE]
proof (state)
this:
\<mu> C = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in prob_space) indep_vars_subset:
  assumes "indep_vars M' X I" "J \<subseteq> I"
  shows "indep_vars M' X J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_vars M' X J
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
indep_vars M' X I
J \<subseteq> I

goal (1 subgoal):
 1. indep_vars M' X J
[PROOF STEP]
unfolding indep_vars_def indep_sets_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>i\<in>I. random_variable (M' i) (X i)) \<and> (\<forall>i\<in>I. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)} \<subseteq> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<forall>A\<in>\<Pi> i\<in>J. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))
J \<subseteq> I

goal (1 subgoal):
 1. (\<forall>i\<in>J. random_variable (M' i) (X i)) \<and> (\<forall>i\<in>J. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)} \<subseteq> events) \<and> (\<forall>Ja\<subseteq>J. Ja \<noteq> {} \<longrightarrow> finite Ja \<longrightarrow> (\<forall>A\<in>\<Pi> i\<in>Ja. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}. prob (\<Inter> (A ` Ja)) = (\<Prod>j\<in>Ja. prob (A j))))
[PROOF STEP]
by auto


[STATEMENT]
lemma set_sublist_list: "
  list_all (\<lambda>i. i < length xs) ys \<Longrightarrow>
  set (sublist_list xs ys) = {xs ! i |i. i < length xs \<and> i \<in> set ys}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all (\<lambda>i. i < length xs) ys \<Longrightarrow> set (sublist_list xs ys) = {xs ! i |i. i < length xs \<and> i \<in> set ys}
[PROOF STEP]
by (simp add: sublist_list_if_sublist_list_eq[symmetric] set_sublist_list_if)


[STATEMENT]
lemma carrier_conv_generator: "carrier G = (\<lambda>n. \<^bold>g [^] n) ` {..<order G}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier G = ([^]) \<^bold>g ` {..<order G}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. carrier G = ([^]) \<^bold>g ` {..<order G}
[PROOF STEP]
have "(\<lambda>n. \<^bold>g [^] n) ` {..<order G} \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([^]) \<^bold>g ` {..<order G} \<subseteq> carrier G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
([^]) \<^bold>g ` {..<order G} \<subseteq> carrier G

goal (1 subgoal):
 1. carrier G = ([^]) \<^bold>g ` {..<order G}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
([^]) \<^bold>g ` {..<order G} \<subseteq> carrier G

goal (1 subgoal):
 1. carrier G = ([^]) \<^bold>g ` {..<order G}
[PROOF STEP]
have "card ((\<lambda>n. \<^bold>g [^] n) ` {..<order G}) \<ge> order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order G \<le> card (([^]) \<^bold>g ` {..<order G})
[PROOF STEP]
using inj_on_generator
[PROOF STATE]
proof (prove)
using this:
inj_on (([^]) \<^bold>g) {..<order G}

goal (1 subgoal):
 1. order G \<le> card (([^]) \<^bold>g ` {..<order G})
[PROOF STEP]
by(simp add: card_image)
[PROOF STATE]
proof (state)
this:
order G \<le> card (([^]) \<^bold>g ` {..<order G})

goal (1 subgoal):
 1. carrier G = ([^]) \<^bold>g ` {..<order G}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
([^]) \<^bold>g ` {..<order G} \<subseteq> carrier G
order G \<le> card (([^]) \<^bold>g ` {..<order G})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
([^]) \<^bold>g ` {..<order G} \<subseteq> carrier G
order G \<le> card (([^]) \<^bold>g ` {..<order G})

goal (1 subgoal):
 1. carrier G = ([^]) \<^bold>g ` {..<order G}
[PROOF STEP]
using finite_carrier
[PROOF STATE]
proof (prove)
using this:
([^]) \<^bold>g ` {..<order G} \<subseteq> carrier G
order G \<le> card (([^]) \<^bold>g ` {..<order G})
finite (carrier G)

goal (1 subgoal):
 1. carrier G = ([^]) \<^bold>g ` {..<order G}
[PROOF STEP]
unfolding order_def
[PROOF STATE]
proof (prove)
using this:
([^]) \<^bold>g ` {..<card (carrier G)} \<subseteq> carrier G
card (carrier G) \<le> card (([^]) \<^bold>g ` {..<card (carrier G)})
finite (carrier G)

goal (1 subgoal):
 1. carrier G = ([^]) \<^bold>g ` {..<card (carrier G)}
[PROOF STEP]
by(rule card_seteq[symmetric, rotated])
[PROOF STATE]
proof (state)
this:
carrier G = ([^]) \<^bold>g ` {..<order G}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in jozsa) jozsa_transform_is_unitary_index_odd:
  fixes i j:: nat
  assumes "i < dim_row U\<^sub>f" and "j < dim_col U\<^sub>f" and "odd i"
  shows "(U\<^sub>f * U\<^sub>f) $$ (i,j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
have f0: "i \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> i
[PROOF STEP]
using linorder_not_less assms(3)
[PROOF STATE]
proof (prove)
using this:
(\<not> ?x < ?y) = (?y \<le> ?x)
odd i

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

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
have "(U\<^sub>f * U\<^sub>f) $$ (i,j) = (\<Sum>k \<in> {i-1,i}. U\<^sub>f $$ (i,k) * U\<^sub>f $$ (k,j)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j))
[PROOF STEP]
using U\<^sub>f_mult_without_empty_summands_odd[of i j U\<^sub>f ] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < dim_row U\<^sub>f; j < dim_col U\<^sub>f; odd i; dim_col U\<^sub>f = dim_row U\<^sub>f\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j))
i < dim_row U\<^sub>f
j < dim_col U\<^sub>f
odd i

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j))

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j))

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
have "(\<Sum>k \<in> {i-1,i}. U\<^sub>f $$ (i,k) * U\<^sub>f $$ (k,j))
                 = U\<^sub>f $$ (i,i-1) * U\<^sub>f $$ (i-1,j) +  U\<^sub>f $$ (i,i) * U\<^sub>f $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j)) = U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) + U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j)
[PROOF STEP]
using f0
[PROOF STATE]
proof (prove)
using this:
1 \<le> i

goal (1 subgoal):
 1. (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j)) = U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) + U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j)) = U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) + U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j)) = U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) + U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
have "U\<^sub>f $$ (i,i) * U\<^sub>f $$ (i,j) = (1-f(i div 2)) * U\<^sub>f $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
i < dim_row U\<^sub>f
j < dim_col U\<^sub>f

goal (1 subgoal):
 1. U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
have f1: "U\<^sub>f $$ (i,i-1) * U\<^sub>f $$ (i-1,j) = f(i div 2) * U\<^sub>f $$ (i-1,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j)
[PROOF STEP]
using assms(1) assms(3)
[PROOF STATE]
proof (prove)
using this:
i < dim_row U\<^sub>f
odd i

goal (1 subgoal):
 1. U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j))
(\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j)) = U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) + U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j)
U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)
U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j)
[PROOF STEP]
have f2: "(U\<^sub>f * U\<^sub>f) $$ (i,j) = f(i div 2) * U\<^sub>f $$ (i-1,j) + (1-f(i div 2)) * U\<^sub>f $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = (\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j))
(\<Sum>k\<in>{i - 1, i}. U\<^sub>f $$ (i, k) * U\<^sub>f $$ (k, j)) = U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) + U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j)
U\<^sub>f $$ (i, i) * U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)
U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)
[PROOF STEP]
show "?thesis"
[PROOF STATE]
proof (prove)
using this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
proof (induct rule: disj_four_cases)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. ?A2 \<or> ?B2 \<or> ?C2 \<or> ?D2
 2. \<lbrakk>?A2; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>?B2; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>?C2; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 5. \<lbrakk>?D2; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
show "j=i \<or> (j=i+1 \<and> odd j) \<or> (j=i-1 \<and> even j \<and> i\<ge>1) \<or> (j\<noteq>i \<and> \<not>(j=i+1 \<and> odd j) \<and> \<not> (j=i-1 \<and> even j \<and> i\<ge>1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j = i \<or> j = i + 1 \<and> odd j \<or> j = i - 1 \<and> even j \<and> 1 \<le> i \<or> j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
j = i \<or> j = i + 1 \<and> odd j \<or> j = i - 1 \<and> even j \<and> 1 \<le> i \<or> j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i)

goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
assume a0:"j=i"
[PROOF STATE]
proof (state)
this:
j = i

goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j = i
[PROOF STEP]
have "U\<^sub>f $$ (i,j) = (1-f(i div 2))"
[PROOF STATE]
proof (prove)
using this:
j = i

goal (1 subgoal):
 1. U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2))
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
j = i
i < dim_row U\<^sub>f
j < dim_col U\<^sub>f

goal (1 subgoal):
 1. U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2))

goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2))

goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
have "U\<^sub>f $$ (i-1,j) = f(i div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2))
[PROOF STEP]
using a0 assms
[PROOF STATE]
proof (prove)
using this:
j = i
i < dim_row U\<^sub>f
j < dim_col U\<^sub>f
odd i

goal (1 subgoal):
 1. U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2))
[PROOF STEP]
by (metis index_transpose_mat(1) jozsa_transform_coeff(2) less_imp_diff_less odd_two_times_div_two_nat
          odd_two_times_div_two_succ transpose_of_jozsa_transform)
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2))

goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2))
U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2))
[PROOF STEP]
have "(U\<^sub>f * U\<^sub>f) $$ (i,j) = f(i div 2) * f(i div 2) + (1-f(i div 2)) * (1-f(i div 2))"
[PROOF STATE]
proof (prove)
using this:
U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2))
U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2))

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)))
[PROOF STEP]
using f2
[PROOF STATE]
proof (prove)
using this:
U\<^sub>f $$ (i, j) = of_nat (1 - f (i div 2))
U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2))
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)))

goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)))

goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
have "f(i div 2) * f(i div 2) + (1-f(i div 2)) * (1-f(i div 2)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)) = 1
[PROOF STEP]
using f_values assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{i. i < 2 ^ n}. f x = 0 \<or> f x = 1
i < dim_row U\<^sub>f

goal (1 subgoal):
 1. f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)) = 1
[PROOF STEP]
by (metis (no_types, lifting) Nat.minus_nat.diff_0 diff_add_0 diff_add_inverse jozsa_transform_dim(1)
          less_power_add_imp_div_less mem_Collect_eq mult_eq_if one_power2 power2_eq_square power_one_right)
[PROOF STATE]
proof (state)
this:
f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)) = 1

goal (4 subgoals):
 1. \<lbrakk>j = i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 4. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)))
f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)) = 1
[PROOF STEP]
show "(U\<^sub>f * U\<^sub>f) $$ (i,j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)))
f (i div 2) * f (i div 2) + (1 - f (i div 2)) * (1 - f (i div 2)) = 1

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
by(metis assms(2) a0 index_one_mat(1) of_nat_1)
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)

goal (3 subgoals):
 1. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
assume a0:"(j=i+1 \<and> odd j)"
[PROOF STATE]
proof (state)
this:
j = i + 1 \<and> odd j

goal (3 subgoals):
 1. \<lbrakk>j = i + 1 \<and> odd j; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 3. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j = i + 1 \<and> odd j
[PROOF STEP]
show "(U\<^sub>f * U\<^sub>f) $$ (i,j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
j = i + 1 \<and> odd j

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
using assms(3) dvd_diffD1 odd_one even_plus_one_iff
[PROOF STATE]
proof (prove)
using this:
j = i + 1 \<and> odd j
odd i
\<lbrakk>?k dvd ?m - ?n; ?k dvd ?m; ?n \<le> ?m\<rbrakk> \<Longrightarrow> ?k dvd ?n
odd (1::?'a)
even (?a + (1::?'a)) = odd ?a

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)

goal (2 subgoals):
 1. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
assume a0:"(j=i-1 \<and> even j \<and> i\<ge>1)"
[PROOF STATE]
proof (state)
this:
j = i - 1 \<and> even j \<and> 1 \<le> i

goal (2 subgoals):
 1. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j = i - 1 \<and> even j \<and> 1 \<le> i
[PROOF STEP]
have "(U\<^sub>f * U\<^sub>f) $$ (i,j) = f(i div 2) * (1-f(i div 2)) + (1-f(i div 2)) * f(i div 2)"
[PROOF STATE]
proof (prove)
using this:
j = i - 1 \<and> even j \<and> 1 \<le> i

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * (1 - f (i div 2)) + (1 - f (i div 2)) * f (i div 2))
[PROOF STEP]
using f0 f1 f2 assms
[PROOF STATE]
proof (prove)
using this:
j = i - 1 \<and> even j \<and> 1 \<le> i
1 \<le> i
U\<^sub>f $$ (i, i - 1) * U\<^sub>f $$ (i - 1, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j)
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)
i < dim_row U\<^sub>f
j < dim_col U\<^sub>f
odd i

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * (1 - f (i div 2)) + (1 - f (i div 2)) * f (i div 2))
[PROOF STEP]
by (metis jozsa_transform_coeff(1) Groups.ab_semigroup_mult_class.mult.commute even_succ_div_two f2
          jozsa_transform_dim odd_two_times_div_two_nat odd_two_times_div_two_succ of_nat_add of_nat_mult)
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * (1 - f (i div 2)) + (1 - f (i div 2)) * f (i div 2))

goal (2 subgoals):
 1. \<lbrakk>j = i - 1 \<and> even j \<and> 1 \<le> i; (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
 2. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * (1 - f (i div 2)) + (1 - f (i div 2)) * f (i div 2))
[PROOF STEP]
show "(U\<^sub>f * U\<^sub>f) $$ (i,j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * (1 - f (i div 2)) + (1 - f (i div 2)) * f (i div 2))

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
using assms(1) a0
[PROOF STATE]
proof (prove)
using this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2) * (1 - f (i div 2)) + (1 - f (i div 2)) * f (i div 2))
i < dim_row U\<^sub>f
j = i - 1 \<and> even j \<and> 1 \<le> i

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)

goal (1 subgoal):
 1. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
assume a0:"j\<noteq>i \<and> \<not>(j=i+1 \<and> odd j) \<and> \<not> (j=i-1 \<and> even j \<and> i\<ge>1)"
[PROOF STATE]
proof (state)
this:
j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i)

goal (1 subgoal):
 1. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i)
[PROOF STEP]
have "U\<^sub>f $$ (i,j) = 0"
[PROOF STATE]
proof (prove)
using this:
j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i)

goal (1 subgoal):
 1. U\<^sub>f $$ (i, j) = 0
[PROOF STEP]
by (metis assms(1,2) index_transpose_mat(1) jozsa_transform_coeff_is_zero jozsa_transform_dim transpose_of_jozsa_transform)
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i, j) = 0

goal (1 subgoal):
 1. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i, j) = 0

goal (1 subgoal):
 1. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
have "U\<^sub>f $$ (i-1,j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sub>f $$ (i - 1, j) = 0
[PROOF STEP]
using assms a0 f0
[PROOF STATE]
proof (prove)
using this:
i < dim_row U\<^sub>f
j < dim_col U\<^sub>f
odd i
j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i)
1 \<le> i

goal (1 subgoal):
 1. U\<^sub>f $$ (i - 1, j) = 0
[PROOF STEP]
by auto (smt One_nat_def Suc_n_not_le_n add_diff_inverse_nat assms(1) assms(2) diff_Suc_less even_add
jozsa_transform_coeff_is_zero jozsa_axioms less_imp_le less_le_trans less_one odd_one)
[PROOF STATE]
proof (state)
this:
U\<^sub>f $$ (i - 1, j) = 0

goal (1 subgoal):
 1. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
U\<^sub>f $$ (i, j) = 0
U\<^sub>f $$ (i - 1, j) = 0
[PROOF STEP]
have "(U\<^sub>f * U\<^sub>f) $$ (i,j) = (1-f(i div 2)) * 0 +  f(i div 2) * 0"
[PROOF STATE]
proof (prove)
using this:
U\<^sub>f $$ (i, j) = 0
U\<^sub>f $$ (i - 1, j) = 0

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat ((1 - f (i div 2)) * 0 + f (i div 2) * 0)
[PROOF STEP]
using f2
[PROOF STATE]
proof (prove)
using this:
U\<^sub>f $$ (i, j) = 0
U\<^sub>f $$ (i - 1, j) = 0
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat ((1 - f (i div 2)) * 0 + f (i div 2) * 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat ((1 - f (i div 2)) * 0 + f (i div 2) * 0)

goal (1 subgoal):
 1. \<lbrakk>j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i); (U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat (f (i div 2)) * U\<^sub>f $$ (i - 1, j) + of_nat (1 - f (i div 2)) * U\<^sub>f $$ (i, j)\<rbrakk> \<Longrightarrow> (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat ((1 - f (i div 2)) * 0 + f (i div 2) * 0)
[PROOF STEP]
show "(U\<^sub>f * U\<^sub>f) $$ (i,j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat ((1 - f (i div 2)) * 0 + f (i div 2) * 0)

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
using a0 assms
[PROOF STATE]
proof (prove)
using this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = of_nat ((1 - f (i div 2)) * 0 + f (i div 2) * 0)
j \<noteq> i \<and> \<not> (j = i + 1 \<and> odd j) \<and> \<not> (j = i - 1 \<and> even j \<and> 1 \<le> i)
i < dim_row U\<^sub>f
j < dim_col U\<^sub>f
odd i

goal (1 subgoal):
 1. (U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)
[PROOF STEP]
by (metis add.left_neutral index_one_mat(1) jozsa_transform_dim mult_0_right of_nat_0)
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(U\<^sub>f * U\<^sub>f) $$ (i, j) = 1\<^sub>m (dim_col U\<^sub>f) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dbm_not_lt_impl: "\<not> a \<prec> b \<Longrightarrow> b \<prec> a \<or> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> a \<prec> b \<Longrightarrow> b \<prec> a \<or> a = b
[PROOF STEP]
using dbm_not_lt_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> ?a \<prec> ?b; \<not> ?b \<prec> ?a\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. \<not> a \<prec> b \<Longrightarrow> b \<prec> a \<or> a = b
[PROOF STEP]
by auto