[STATEMENT]
lemma (in information_space)
  fixes Pxy :: "'b \<times> 'c \<Rightarrow> real" and Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real"
  assumes "sigma_finite_measure S" "sigma_finite_measure T"
  assumes Px: "distributed M S X Px" and Px_nn: "\<And>x. x \<in> space S \<Longrightarrow> 0 \<le> Px x"
    and Py: "distributed M T Y Py" and Py_nn: "\<And>y. y \<in> space T \<Longrightarrow> 0 \<le> Py y"
    and Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"
    and Pxy_nn: "\<And>x y. x \<in> space S \<Longrightarrow> y \<in> space T \<Longrightarrow> 0 \<le> Pxy (x, y)"
  defines "f \<equiv> \<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x)))"
  shows mutual_information_distr: "mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f" (is "?M = ?R")
    and mutual_information_nonneg: "integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f &&& (integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have X[measurable]: "random_variable S X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable S X
[PROOF STEP]
using Px
[PROOF STATE]
proof (prove)
using this:
distributed M S X (\<lambda>x. ennreal (Px x))

goal (1 subgoal):
 1. random_variable S X
[PROOF STEP]
by (auto simp: distributed_def)
[PROOF STATE]
proof (state)
this:
random_variable S X

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have Y[measurable]: "random_variable T Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable T Y
[PROOF STEP]
using Py
[PROOF STATE]
proof (prove)
using this:
distributed M T Y (\<lambda>x. ennreal (Py x))

goal (1 subgoal):
 1. random_variable T Y
[PROOF STEP]
by (auto simp: distributed_def)
[PROOF STATE]
proof (state)
this:
random_variable T Y

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have [measurable]: "Px \<in> S \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Px \<in> borel_measurable S
[PROOF STEP]
using Px Px_nn
[PROOF STATE]
proof (prove)
using this:
distributed M S X (\<lambda>x. ennreal (Px x))
?x10 \<in> space S \<Longrightarrow> 0 \<le> Px ?x10

goal (1 subgoal):
 1. Px \<in> borel_measurable S
[PROOF STEP]
by (intro distributed_real_measurable)
[PROOF STATE]
proof (state)
this:
Px \<in> borel_measurable S

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have [measurable]: "Py \<in> T \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Py \<in> borel_measurable T
[PROOF STEP]
using Py Py_nn
[PROOF STATE]
proof (prove)
using this:
distributed M T Y (\<lambda>x. ennreal (Py x))
?y10 \<in> space T \<Longrightarrow> 0 \<le> Py ?y10

goal (1 subgoal):
 1. Py \<in> borel_measurable T
[PROOF STEP]
by (intro distributed_real_measurable)
[PROOF STATE]
proof (state)
this:
Py \<in> borel_measurable T

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have measurable_Pxy[measurable]: "Pxy \<in> (S \<Otimes>\<^sub>M T) \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pxy \<in> borel_measurable (S \<Otimes>\<^sub>M T)
[PROOF STEP]
using Pxy Pxy_nn
[PROOF STATE]
proof (prove)
using this:
distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>x. ennreal (Pxy x))
\<lbrakk>?x10 \<in> space S; ?y10 \<in> space T\<rbrakk> \<Longrightarrow> 0 \<le> Pxy (?x10, ?y10)

goal (1 subgoal):
 1. Pxy \<in> borel_measurable (S \<Otimes>\<^sub>M T)
[PROOF STEP]
by (intro distributed_real_measurable) (auto simp: space_pair_measure)
[PROOF STATE]
proof (state)
this:
Pxy \<in> borel_measurable (S \<Otimes>\<^sub>M T)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
interpret S: sigma_finite_measure S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure S
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
interpret T: sigma_finite_measure T
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure T
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
interpret ST: pair_sigma_finite S T
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pair_sigma_finite S T
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
interpret X: prob_space "distr M S X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (distr M S X)
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
random_variable S X

goal (1 subgoal):
 1. prob_space (distr M S X)
[PROOF STEP]
by (rule prob_space_distr)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
interpret Y: prob_space "distr M T Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (distr M T Y)
[PROOF STEP]
using Y
[PROOF STATE]
proof (prove)
using this:
random_variable T Y

goal (1 subgoal):
 1. prob_space (distr M T Y)
[PROOF STEP]
by (rule prob_space_distr)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
interpret XY: pair_prob_space "distr M S X" "distr M T Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pair_prob_space (distr M S X) (distr M T Y)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
let ?P = "S \<Otimes>\<^sub>M T"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
let ?D = "distr M ?P (\<lambda>x. (X x, Y x))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
assume "A \<in> sets S"
[PROOF STATE]
proof (state)
this:
A \<in> sets S

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
with X[THEN measurable_space] Y[THEN measurable_space]
[PROOF STATE]
proof (chain)
picking this:
?x \<in> space M \<Longrightarrow> X ?x \<in> space S
?x \<in> space M \<Longrightarrow> Y ?x \<in> space T
A \<in> sets S
[PROOF STEP]
have "emeasure (distr M S X) A = emeasure ?D (A \<times> space T)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> space M \<Longrightarrow> X ?x \<in> space S
?x \<in> space M \<Longrightarrow> Y ?x \<in> space T
A \<in> sets S

goal (1 subgoal):
 1. emeasure (distr M S X) A = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (A \<times> space T)
[PROOF STEP]
by (auto simp: emeasure_distr intro!: arg_cong[where f="emeasure M"])
[PROOF STATE]
proof (state)
this:
emeasure (distr M S X) A = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (A \<times> space T)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?A12 \<in> sets S \<Longrightarrow> emeasure (distr M S X) ?A12 = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (?A12 \<times> space T)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
note marginal_eq1 = this
[PROOF STATE]
proof (state)
this:
?A12 \<in> sets S \<Longrightarrow> emeasure (distr M S X) ?A12 = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (?A12 \<times> space T)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?A12 \<in> sets S \<Longrightarrow> emeasure (distr M S X) ?A12 = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (?A12 \<times> space T)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
assume "A \<in> sets T"
[PROOF STATE]
proof (state)
this:
A \<in> sets T

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
with X[THEN measurable_space] Y[THEN measurable_space]
[PROOF STATE]
proof (chain)
picking this:
?x \<in> space M \<Longrightarrow> X ?x \<in> space S
?x \<in> space M \<Longrightarrow> Y ?x \<in> space T
A \<in> sets T
[PROOF STEP]
have "emeasure (distr M T Y) A = emeasure ?D (space S \<times> A)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> space M \<Longrightarrow> X ?x \<in> space S
?x \<in> space M \<Longrightarrow> Y ?x \<in> space T
A \<in> sets T

goal (1 subgoal):
 1. emeasure (distr M T Y) A = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (space S \<times> A)
[PROOF STEP]
by (auto simp: emeasure_distr intro!: arg_cong[where f="emeasure M"])
[PROOF STATE]
proof (state)
this:
emeasure (distr M T Y) A = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (space S \<times> A)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?A12 \<in> sets T \<Longrightarrow> emeasure (distr M T Y) ?A12 = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (space S \<times> ?A12)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
note marginal_eq2 = this
[PROOF STATE]
proof (state)
this:
?A12 \<in> sets T \<Longrightarrow> emeasure (distr M T Y) ?A12 = emeasure (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))) (space S \<times> ?A12)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have distr_eq: "distr M S X \<Otimes>\<^sub>M distr M T Y = density ?P (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr M S X \<Otimes>\<^sub>M distr M T Y = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))
[PROOF STEP]
unfolding Px(1)[THEN distributed_distr_eq_density] Py(1)[THEN distributed_distr_eq_density]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. density S (\<lambda>x. ennreal (Px x)) \<Otimes>\<^sub>M density T (\<lambda>x. ennreal (Py x)) = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))
[PROOF STEP]
proof (subst pair_measure_density)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. (\<lambda>x. ennreal (Px x)) \<in> borel_measurable S
 2. (\<lambda>x. ennreal (Py x)) \<in> borel_measurable T
 3. sigma_finite_measure T
 4. sigma_finite_measure (density T (\<lambda>x. ennreal (Py x)))
 5. density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))
[PROOF STEP]
show "(\<lambda>x. ennreal (Px x)) \<in> borel_measurable S" "(\<lambda>y. ennreal (Py y)) \<in> borel_measurable T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ennreal (Px x)) \<in> borel_measurable S &&& (\<lambda>y. ennreal (Py y)) \<in> borel_measurable T
[PROOF STEP]
using Px Py
[PROOF STATE]
proof (prove)
using this:
distributed M S X (\<lambda>x. ennreal (Px x))
distributed M T Y (\<lambda>x. ennreal (Py x))

goal (1 subgoal):
 1. (\<lambda>x. ennreal (Px x)) \<in> borel_measurable S &&& (\<lambda>y. ennreal (Py y)) \<in> borel_measurable T
[PROOF STEP]
by (auto simp: distributed_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ennreal (Px x)) \<in> borel_measurable S
(\<lambda>y. ennreal (Py y)) \<in> borel_measurable T

goal (3 subgoals):
 1. sigma_finite_measure T
 2. sigma_finite_measure (density T (\<lambda>x. ennreal (Py x)))
 3. density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))
[PROOF STEP]
show "sigma_finite_measure (density T Py)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure (density T (\<lambda>x. ennreal (Py x)))
[PROOF STEP]
unfolding Py(1)[THEN distributed_distr_eq_density, symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure (distr M T Y)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
sigma_finite_measure (density T (\<lambda>x. ennreal (Py x)))

goal (2 subgoals):
 1. sigma_finite_measure T
 2. density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))
[PROOF STEP]
show "density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) =
      density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))
[PROOF STEP]
using Px_nn Py_nn
[PROOF STATE]
proof (prove)
using this:
?x10 \<in> space S \<Longrightarrow> 0 \<le> Px ?x10
?y10 \<in> space T \<Longrightarrow> 0 \<le> Py ?y10

goal (1 subgoal):
 1. density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))
[PROOF STEP]
by (auto intro!: density_cong simp: distributed_def ennreal_mult space_pair_measure)
[PROOF STATE]
proof (state)
this:
density (S \<Otimes>\<^sub>M T) (\<lambda>(x, y). ennreal (Px x) * ennreal (Py y)) = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))

goal (1 subgoal):
 1. sigma_finite_measure T
[PROOF STEP]
qed fact
[PROOF STATE]
proof (state)
this:
distr M S X \<Otimes>\<^sub>M distr M T Y = density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have M: "?M = KL_divergence b (density ?P (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density ?P (\<lambda>x. ennreal (Pxy x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mutual_information b S T X Y = KL_divergence b (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)))
[PROOF STEP]
unfolding mutual_information_def distr_eq Pxy(1)[THEN distributed_distr_eq_density]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KL_divergence b (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x))) = KL_divergence b (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
mutual_information b S T X Y = KL_divergence b (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)))

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
from Px Py
[PROOF STATE]
proof (chain)
picking this:
distributed M S X (\<lambda>x. ennreal (Px x))
distributed M T Y (\<lambda>x. ennreal (Py x))
[PROOF STEP]
have f: "(\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable ?P"
[PROOF STATE]
proof (prove)
using this:
distributed M S X (\<lambda>x. ennreal (Px x))
distributed M T Y (\<lambda>x. ennreal (Py x))

goal (1 subgoal):
 1. (\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable (S \<Otimes>\<^sub>M T)
[PROOF STEP]
by (intro borel_measurable_times) (auto intro: distributed_real_measurable measurable_fst'' measurable_snd'')
[PROOF STATE]
proof (state)
this:
(\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable (S \<Otimes>\<^sub>M T)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have PxPy_nonneg: "AE x in ?P. 0 \<le> Px (fst x) * Py (snd x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x) * Py (snd x)
[PROOF STEP]
using Px_nn Py_nn
[PROOF STATE]
proof (prove)
using this:
?x10 \<in> space S \<Longrightarrow> 0 \<le> Px ?x10
?y10 \<in> space T \<Longrightarrow> 0 \<le> Py ?y10

goal (1 subgoal):
 1. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x) * Py (snd x)
[PROOF STEP]
by (auto simp: space_pair_measure)
[PROOF STATE]
proof (state)
this:
AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x) * Py (snd x)

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have "(AE x in ?P. Px (fst x) = 0 \<longrightarrow> Pxy x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in S \<Otimes>\<^sub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0
[PROOF STEP]
by (rule subdensity_real[OF measurable_fst Pxy Px]) (insert Px_nn Pxy_nn, auto simp: space_pair_measure)
[PROOF STATE]
proof (state)
this:
AE x in S \<Otimes>\<^sub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in S \<Otimes>\<^sub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
have "(AE x in ?P. Py (snd x) = 0 \<longrightarrow> Pxy x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in S \<Otimes>\<^sub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0
[PROOF STEP]
by (rule subdensity_real[OF measurable_snd Pxy Py]) (insert Py_nn Pxy_nn, auto simp: space_pair_measure)
[PROOF STATE]
proof (state)
this:
AE x in S \<Otimes>\<^sub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE x in S \<Otimes>\<^sub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0
AE x in S \<Otimes>\<^sub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0
[PROOF STEP]
have ac: "AE x in ?P. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0"
[PROOF STATE]
proof (prove)
using this:
AE x in S \<Otimes>\<^sub>M T. Px (fst x) = 0 \<longrightarrow> Pxy x = 0
AE x in S \<Otimes>\<^sub>M T. Py (snd x) = 0 \<longrightarrow> Pxy x = 0

goal (1 subgoal):
 1. AE x in S \<Otimes>\<^sub>M T. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0
[PROOF STEP]
by eventually_elim auto
[PROOF STATE]
proof (state)
this:
AE x in S \<Otimes>\<^sub>M T. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0

goal (2 subgoals):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
 2. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
show "?M = ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f
[PROOF STEP]
unfolding M f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KL_divergence b (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x))) = LINT x|(S \<Otimes>\<^sub>M T). Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x)))
[PROOF STEP]
using b_gt_1 f PxPy_nonneg ac Pxy_nn
[PROOF STATE]
proof (prove)
using this:
1 < b
(\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable (S \<Otimes>\<^sub>M T)
AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x) * Py (snd x)
AE x in S \<Otimes>\<^sub>M T. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0
\<lbrakk>?x10 \<in> space S; ?y10 \<in> space T\<rbrakk> \<Longrightarrow> 0 \<le> Pxy (?x10, ?y10)

goal (1 subgoal):
 1. KL_divergence b (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x))) = LINT x|(S \<Otimes>\<^sub>M T). Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x)))
[PROOF STEP]
by (intro ST.KL_density_density) (auto simp: space_pair_measure)
[PROOF STATE]
proof (state)
this:
mutual_information b S T X Y = integral\<^sup>L (S \<Otimes>\<^sub>M T) f

goal (1 subgoal):
 1. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
assume int: "integrable (S \<Otimes>\<^sub>M T) f"
[PROOF STATE]
proof (state)
this:
integrable (S \<Otimes>\<^sub>M T) f

goal (1 subgoal):
 1. integrable (S \<Otimes>\<^sub>M T) f \<Longrightarrow> 0 \<le> mutual_information b S T X Y
[PROOF STEP]
show "0 \<le> ?M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> mutual_information b S T X Y
[PROOF STEP]
unfolding M
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> KL_divergence b (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x)))) (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)))
[PROOF STEP]
proof (intro ST.KL_density_density_nonneg)
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. 1 < b
 2. (\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable (S \<Otimes>\<^sub>M T)
 3. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x) * Py (snd x)
 4. prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x))))
 5. Pxy \<in> borel_measurable (S \<Otimes>\<^sub>M T)
 6. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Pxy x
 7. prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)))
 8. AE x in S \<Otimes>\<^sub>M T. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0
 9. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))
[PROOF STEP]
show "prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x))) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)))
[PROOF STEP]
unfolding distributed_distr_eq_density[OF Pxy, symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)))
[PROOF STEP]
using distributed_measurable[OF Pxy]
[PROOF STATE]
proof (prove)
using this:
random_variable (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))

goal (1 subgoal):
 1. prob_space (distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)))
[PROOF STEP]
by (rule prob_space_distr)
[PROOF STATE]
proof (state)
this:
prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Pxy x)))

goal (8 subgoals):
 1. 1 < b
 2. (\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable (S \<Otimes>\<^sub>M T)
 3. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x) * Py (snd x)
 4. prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x))))
 5. Pxy \<in> borel_measurable (S \<Otimes>\<^sub>M T)
 6. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Pxy x
 7. AE x in S \<Otimes>\<^sub>M T. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0
 8. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))
[PROOF STEP]
show "prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x))))
[PROOF STEP]
unfolding distr_eq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (distr M S X \<Otimes>\<^sub>M distr M T Y)
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
this:
prob_space (density (S \<Otimes>\<^sub>M T) (\<lambda>x. ennreal (Px (fst x) * Py (snd x))))

goal (7 subgoals):
 1. 1 < b
 2. (\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable (S \<Otimes>\<^sub>M T)
 3. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x) * Py (snd x)
 4. Pxy \<in> borel_measurable (S \<Otimes>\<^sub>M T)
 5. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Pxy x
 6. AE x in S \<Otimes>\<^sub>M T. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0
 7. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))
[PROOF STEP]
show "integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))
[PROOF STEP]
using int
[PROOF STATE]
proof (prove)
using this:
integrable (S \<Otimes>\<^sub>M T) f

goal (1 subgoal):
 1. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))

goal (1 subgoal):
 1. integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integrable (S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x / (Px (fst x) * Py (snd x))))

goal (6 subgoals):
 1. 1 < b
 2. (\<lambda>x. Px (fst x) * Py (snd x)) \<in> borel_measurable (S \<Otimes>\<^sub>M T)
 3. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Px (fst x) * Py (snd x)
 4. Pxy \<in> borel_measurable (S \<Otimes>\<^sub>M T)
 5. AE x in S \<Otimes>\<^sub>M T. 0 \<le> Pxy x
 6. AE x in S \<Otimes>\<^sub>M T. Px (fst x) * Py (snd x) = 0 \<longrightarrow> Pxy x = 0
[PROOF STEP]
qed (insert ac, auto simp: b_gt_1 Px_nn Py_nn Pxy_nn space_pair_measure)
[PROOF STATE]
proof (state)
this:
0 \<le> mutual_information b S T X Y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in pair_sigma_finite) Fubini_set_integrable:
  fixes f :: "_ \<Rightarrow> _::{banach, second_countable_topology}"
  assumes f[measurable]: "set_borel_measurable (M1 \<Otimes>\<^sub>M M2) (A \<times> B) f"
    and integ1: "set_integrable M1 A (\<lambda>x. \<integral>y\<in>B. norm (f (x, y)) \<partial>M2)"
    and integ2: "AE x\<in>A in M1. set_integrable M2 B (\<lambda>y. f (x, y))"
  shows "set_integrable (M1 \<Otimes>\<^sub>M M2) (A \<times> B) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable (M1 \<Otimes>\<^sub>M M2) (A \<times> B) f
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (M1 \<Otimes>\<^sub>M M2) (\<lambda>x. indicat_real (A \<times> B) x *\<^sub>R f x)
[PROOF STEP]
proof (rule Fubini_integrable)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<lambda>x. indicat_real (A \<times> B) x *\<^sub>R f x) \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)
 2. integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))
 3. AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
note integ1
[PROOF STATE]
proof (state)
this:
set_integrable M1 A (\<lambda>x. \<integral>y\<in>B. norm (f (x, y))\<partial>M2)

goal (3 subgoals):
 1. (\<lambda>x. indicat_real (A \<times> B) x *\<^sub>R f x) \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)
 2. integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))
 3. AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_integrable M1 A (\<lambda>x. \<integral>y\<in>B. norm (f (x, y))\<partial>M2)

goal (3 subgoals):
 1. (\<lambda>x. indicat_real (A \<times> B) x *\<^sub>R f x) \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)
 2. integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))
 3. AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
have "set_integrable M1 A (\<lambda>x. \<integral>y\<in>B. norm (f (x, y)) \<partial>M2) \<longleftrightarrow>
        integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable M1 A (\<lambda>x. \<integral>y\<in>B. norm (f (x, y))\<partial>M2) = integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M1 (\<lambda>x. indicat_real A x *\<^sub>R (\<integral>y\<in>B. norm (f (x, y))\<partial>M2)) = integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))
[PROOF STEP]
by (intro Bochner_Integration.integrable_cong) (auto simp: indicator_def set_lebesgue_integral_def)
[PROOF STATE]
proof (state)
this:
set_integrable M1 A (\<lambda>x. \<integral>y\<in>B. norm (f (x, y))\<partial>M2) = integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))

goal (3 subgoals):
 1. (\<lambda>x. indicat_real (A \<times> B) x *\<^sub>R f x) \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)
 2. integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))
 3. AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))
[PROOF STEP]
show \<dots>
[PROOF STATE]
proof (prove)
using this:
integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))

goal (1 subgoal):
 1. integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integrable M1 (\<lambda>x. LINT y|M2. norm (indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y)))

goal (2 subgoals):
 1. (\<lambda>x. indicat_real (A \<times> B) x *\<^sub>R f x) \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)
 2. AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. indicat_real (A \<times> B) x *\<^sub>R f x) \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)
 2. AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
from integ2
[PROOF STATE]
proof (chain)
picking this:
AE x\<in>A in M1. set_integrable M2 B (\<lambda>y. f (x, y))
[PROOF STEP]
show "AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))"
[PROOF STATE]
proof (prove)
using this:
AE x\<in>A in M1. set_integrable M2 B (\<lambda>y. f (x, y))

goal (1 subgoal):
 1. AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<longrightarrow> set_integrable M2 B (\<lambda>y. f (x, y)) \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
x \<in> A \<longrightarrow> set_integrable M2 B (\<lambda>y. f (x, y))

goal (1 subgoal):
 1. \<And>x. x \<in> A \<longrightarrow> set_integrable M2 B (\<lambda>y. f (x, y)) \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
show "integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
proof (cases "x \<in> A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
 2. x \<notin> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> A

goal (2 subgoals):
 1. x \<in> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
 2. x \<notin> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
with elim
[PROOF STATE]
proof (chain)
picking this:
x \<in> A \<longrightarrow> set_integrable M2 B (\<lambda>y. f (x, y))
x \<in> A
[PROOF STEP]
have "set_integrable M2 B (\<lambda>y. f (x, y))"
[PROOF STATE]
proof (prove)
using this:
x \<in> A \<longrightarrow> set_integrable M2 B (\<lambda>y. f (x, y))
x \<in> A

goal (1 subgoal):
 1. set_integrable M2 B (\<lambda>y. f (x, y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_integrable M2 B (\<lambda>y. f (x, y))

goal (2 subgoals):
 1. x \<in> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
 2. x \<notin> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_integrable M2 B (\<lambda>y. f (x, y))

goal (2 subgoals):
 1. x \<in> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
 2. x \<notin> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
have "?this \<longleftrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable M2 B (\<lambda>y. f (x, y)) = integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M2 (\<lambda>xa. indicat_real B xa *\<^sub>R f (x, xa)) = integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
x \<in> A

goal (1 subgoal):
 1. integrable M2 (\<lambda>xa. indicat_real B xa *\<^sub>R f (x, xa)) = integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
by (intro Bochner_Integration.integrable_cong) (auto simp: indicator_def)
[PROOF STATE]
proof (state)
this:
set_integrable M2 B (\<lambda>y. f (x, y)) = integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))

goal (2 subgoals):
 1. x \<in> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
 2. x \<notin> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))

goal (1 subgoal):
 1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))

goal (1 subgoal):
 1. x \<notin> A \<Longrightarrow> integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
AE x in M1. integrable M2 (\<lambda>y. indicat_real (A \<times> B) (x, y) *\<^sub>R f (x, y))

goal (1 subgoal):
 1. (\<lambda>x. indicat_real (A \<times> B) x *\<^sub>R f x) \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)
[PROOF STEP]
qed (insert assms, auto simp: set_borel_measurable_def)


[STATEMENT]
lemma Hermite_of_preserves_zero_rows:
  fixes A::"'a::{bezout_ring_div,normalization_semidom,unique_euclidean_ring}^'cols::{mod_type}^'rows::{mod_type}"
  assumes i: "is_zero_row i (echelon_form_of A bezout)"
  and a: "ass_function ass"
  and r: "res_function res"
  and b: "is_bezout_ext bezout"
  shows "is_zero_row i (Hermite_of A ass res bezout)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row i (Hermite_of A ass res bezout)
[PROOF STEP]
unfolding Hermite_of_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row i (Hermite_of_upt_row_i (echelon_form_of A bezout) (nrows A) ass res)
[PROOF STEP]
by (rule Hermite_of_upt_row_preserves_zero_rows[OF i echelon_form_echelon_form_of[OF b] a r])
(auto simp add: nrows_def)


[STATEMENT]
lemma set_restriction_empty: "
  set_restriction f \<Longrightarrow> f {} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_restriction f \<Longrightarrow> f {} = {}
[PROOF STEP]
unfolding set_restriction_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. \<forall>A. f A = {x \<in> A. P x} \<Longrightarrow> f {} = {}
[PROOF STEP]
by blast


[STATEMENT]
lemma closed_atLeastAtMost [continuous_intros, simp]: "closed {a..b}"
  for a b :: "'a::linorder_topology"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {a..b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed {a..b}
[PROOF STEP]
have "{a .. b} = {a ..} \<inter> {.. b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..b} = {a..} \<inter> {..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a..b} = {a..} \<inter> {..b}

goal (1 subgoal):
 1. closed {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{a..b} = {a..} \<inter> {..b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{a..b} = {a..} \<inter> {..b}

goal (1 subgoal):
 1. closed {a..b}
[PROOF STEP]
by (simp add: closed_Int)
[PROOF STATE]
proof (state)
this:
closed {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lift_pref_profile_permute_agents:
  assumes "\<pi> permutes agents" "agents \<subseteq> agents'"
  shows   "lift_pref_profile agents alts agents' alts' (R \<circ> \<pi>) =
             lift_pref_profile agents alts agents' alts' R \<circ> \<pi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lift_pref_profile agents alts agents' alts' (R \<circ> \<pi>) = lift_pref_profile agents alts agents' alts' R \<circ> \<pi>
[PROOF STEP]
using assms permutes_subset[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes agents
agents \<subseteq> agents'
\<pi> permutes agents'

goal (1 subgoal):
 1. lift_pref_profile agents alts agents' alts' (R \<circ> \<pi>) = lift_pref_profile agents alts agents' alts' R \<circ> \<pi>
[PROOF STEP]
by (auto simp add: lift_pref_profile_def o_def permutes_in_image)


[STATEMENT]
lemma succs_set_shift [simp]:
  "(+) i ` succs xs 0 = succs xs i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (+) i ` succs xs 0 = succs xs i
[PROOF STEP]
by (force simp: succs_shift [where n=i, symmetric] intro: set_eqI)


[STATEMENT]
lemma mul_eq_and_ds_imp_ds:
assumes t: "trans r" and "(M,N) \<in> mul_eq r" and "set_mset N \<subseteq> ds r S"
shows "set_mset M \<subseteq> ds r S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset M \<subseteq> r \<down>s S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_mset M \<subseteq> r \<down>s S
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
trans r
(M, N) \<in> mul_eq r
set_mset N \<subseteq> r \<down>s S
[PROOF STEP]
obtain I J K where a: "M = I + K" and "N = I + J" and c: "set_mset K \<subseteq> dm r J"
[PROOF STATE]
proof (prove)
using this:
trans r
(M, N) \<in> mul_eq r
set_mset N \<subseteq> r \<down>s S

goal (1 subgoal):
 1. (\<And>I K J. \<lbrakk>M = I + K; N = I + J; set_mset K \<subseteq> r \<down>m J\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding mul_eq_def
[PROOF STATE]
proof (prove)
using this:
trans r
(M, N) \<in> {(M, N). \<exists>I J K. M = I + K \<and> N = I + J \<and> set_mset K \<subseteq> r \<down>m J}
set_mset N \<subseteq> r \<down>s S

goal (1 subgoal):
 1. (\<And>I K J. \<lbrakk>M = I + K; N = I + J; set_mset K \<subseteq> r \<down>m J\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M = I + K
N = I + J
set_mset K \<subseteq> r \<down>m J

goal (1 subgoal):
 1. set_mset M \<subseteq> r \<down>s S
[PROOF STEP]
hence k1:"set_mset I \<subseteq> ds r S" "set_mset J \<subseteq> ds r S"
[PROOF STATE]
proof (prove)
using this:
M = I + K
N = I + J
set_mset K \<subseteq> r \<down>m J

goal (1 subgoal):
 1. set_mset I \<subseteq> r \<down>s S &&& set_mset J \<subseteq> r \<down>s S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M = I + K
N = I + J
set_mset K \<subseteq> r \<down>m J
trans r
(M, N) \<in> mul_eq r
set_mset N \<subseteq> r \<down>s S

goal (1 subgoal):
 1. set_mset I \<subseteq> r \<down>s S &&& set_mset J \<subseteq> r \<down>s S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_mset I \<subseteq> r \<down>s S
set_mset J \<subseteq> r \<down>s S

goal (1 subgoal):
 1. set_mset M \<subseteq> r \<down>s S
[PROOF STEP]
hence "ds r (set_mset J) \<subseteq> ds r S"
[PROOF STATE]
proof (prove)
using this:
set_mset I \<subseteq> r \<down>s S
set_mset J \<subseteq> r \<down>s S

goal (1 subgoal):
 1. r \<down>s set_mset J \<subseteq> r \<down>s S
[PROOF STEP]
using subset_imp_ds_subset[OF t]
[PROOF STATE]
proof (prove)
using this:
set_mset I \<subseteq> r \<down>s S
set_mset J \<subseteq> r \<down>s S
?S \<subseteq> r \<down>s ?T \<Longrightarrow> r \<down>s ?S \<subseteq> r \<down>s ?T

goal (1 subgoal):
 1. r \<down>s set_mset J \<subseteq> r \<down>s S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r \<down>s set_mset J \<subseteq> r \<down>s S

goal (1 subgoal):
 1. set_mset M \<subseteq> r \<down>s S
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r \<down>s set_mset J \<subseteq> r \<down>s S

goal (1 subgoal):
 1. set_mset M \<subseteq> r \<down>s S
[PROOF STEP]
using k1 a c
[PROOF STATE]
proof (prove)
using this:
r \<down>s set_mset J \<subseteq> r \<down>s S
set_mset I \<subseteq> r \<down>s S
set_mset J \<subseteq> r \<down>s S
M = I + K
set_mset K \<subseteq> r \<down>m J

goal (1 subgoal):
 1. set_mset M \<subseteq> r \<down>s S
[PROOF STEP]
unfolding dm_def
[PROOF STATE]
proof (prove)
using this:
r \<down>s set_mset J \<subseteq> r \<down>s S
set_mset I \<subseteq> r \<down>s S
set_mset J \<subseteq> r \<down>s S
M = I + K
set_mset K \<subseteq> r \<down>s set_mset J

goal (1 subgoal):
 1. set_mset M \<subseteq> r \<down>s S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_mset M \<subseteq> r \<down>s S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compl_le_swap1:
  assumes "y \<le> - x"
  shows "x \<le> -y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> - y
[PROOF STEP]
using assms ortho_antimono
[PROOF STATE]
proof (prove)
using this:
y \<le> - x
?x \<le> ?y \<Longrightarrow> - ?y \<le> - ?x

goal (1 subgoal):
 1. x \<le> - y
[PROOF STEP]
by fastforce


[STATEMENT]
lemma subset_fst_imageI: "A \<times> B \<subseteq> S \<Longrightarrow> y \<in> B \<Longrightarrow> A \<subseteq> fst ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<times> B \<subseteq> S; y \<in> B\<rbrakk> \<Longrightarrow> A \<subseteq> fst ` S
[PROOF STEP]
unfolding image_def subset_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A \<times> B. x \<in> S; y \<in> B\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. x \<in> {y. \<exists>x\<in>S. y = fst x}
[PROOF STEP]
by force


[STATEMENT]
lemma list_nA_lt_refl: "xs \<in> nlists n A \<longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> nlists n A \<longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs \<in> nlists n A \<Longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs
[PROOF STEP]
assume "xs \<in> nlists n A"
[PROOF STATE]
proof (state)
this:
xs \<in> nlists n A

goal (1 subgoal):
 1. xs \<in> nlists n A \<Longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<in> nlists n A
[PROOF STEP]
have "set xs \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
xs \<in> nlists n A

goal (1 subgoal):
 1. set xs \<subseteq> A
[PROOF STEP]
by (rule nlistsE_set)
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> A

goal (1 subgoal):
 1. xs \<in> nlists n A \<Longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set xs \<subseteq> A
[PROOF STEP]
have "\<forall>i<length xs. xs!i \<in> A"
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> A

goal (1 subgoal):
 1. \<forall>i<length xs. xs ! i \<in> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<length xs. xs ! i \<in> A

goal (1 subgoal):
 1. xs \<in> nlists n A \<Longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<length xs. xs ! i \<in> A
[PROOF STEP]
have "\<forall>i<length xs. sorted (rev (xs!i))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length xs. xs ! i \<in> A

goal (1 subgoal):
 1. \<forall>i<length xs. Sorted_Less.sorted (rev (xs ! i))
[PROOF STEP]
by (simp add:inA_is_sorted)
[PROOF STATE]
proof (state)
this:
\<forall>i<length xs. Sorted_Less.sorted (rev (xs ! i))

goal (1 subgoal):
 1. xs \<in> nlists n A \<Longrightarrow> xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<length xs. Sorted_Less.sorted (rev (xs ! i))
[PROOF STEP]
show "xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length xs. Sorted_Less.sorted (rev (xs ! i))

goal (1 subgoal):
 1. xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs
[PROOF STEP]
by(unfold Listn.le_def lesub_def)
     (auto simp add:list_all2_conv_all_nth Listn.le_def r_def nodes_le_def)
[PROOF STATE]
proof (state)
this:
xs [\<sqsubseteq>\<^bsub>r\<^esub>] xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma simple_integral_nonneg:
  assumes f: "simple_function M f" and ae: "AE x in M. 0 \<le> f x"
  shows "0 \<le> integral\<^sup>S M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> integral\<^sup>S M f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> integral\<^sup>S M f
[PROOF STEP]
have "integral\<^sup>S M (\<lambda>x. 0) \<le> integral\<^sup>S M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>S x. 0 \<partial>M \<le> integral\<^sup>S M f
[PROOF STEP]
using simple_integral_mono_AE[OF _ f ae]
[PROOF STATE]
proof (prove)
using this:
simple_function M (\<lambda>x. 0) \<Longrightarrow> \<integral>\<^sup>S x. 0 \<partial>M \<le> integral\<^sup>S M f

goal (1 subgoal):
 1. \<integral>\<^sup>S x. 0 \<partial>M \<le> integral\<^sup>S M f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>S x. 0 \<partial>M \<le> integral\<^sup>S M f

goal (1 subgoal):
 1. 0 \<le> integral\<^sup>S M f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>S x. 0 \<partial>M \<le> integral\<^sup>S M f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>S x. 0 \<partial>M \<le> integral\<^sup>S M f

goal (1 subgoal):
 1. 0 \<le> integral\<^sup>S M f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> integral\<^sup>S M f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma notin_minus_fset:
  shows "x |\<in>| S \<Longrightarrow> x |\<notin>| F - S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x |\<in>| S \<Longrightarrow> x |\<notin>| F - S
[PROOF STEP]
unfolding in_fset minus_fset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> fset S \<Longrightarrow> x \<notin> fset F - fset S
[PROOF STEP]
by blast


[STATEMENT]
lemma KL_div_pos:
  fixes a e::"'b \<Rightarrow> real"
  assumes fin: "finite S"
  assumes nemp: "S \<noteq> {}"
  assumes non_null: "\<And>i. i\<in>S \<Longrightarrow> 0 < a i" "\<And>i. i\<in> S \<Longrightarrow> 0 < e i"
  assumes sum_a_one: "(\<Sum> i \<in> S. a i) = 1"
  assumes sum_c_one: "(\<Sum> i \<in> S. e i) = 1"
shows "0 \<le> KL_div S a e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> KL_div S a e
[PROOF STEP]
unfolding KL_div_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
let ?f = "\<lambda>i. e i / a i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
have f_pos: "\<And>i. i\<in>S \<Longrightarrow> 0 < ?f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> 0 < e i / a i
[PROOF STEP]
using non_null
[PROOF STATE]
proof (prove)
using this:
?i14 \<in> S \<Longrightarrow> 0 < a ?i14
?i14 \<in> S \<Longrightarrow> 0 < e ?i14

goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> 0 < e i / a i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i14 \<in> S \<Longrightarrow> 0 < e ?i14 / a ?i14

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
have a_pos: "\<And>i. i\<in> S \<Longrightarrow> 0 \<le> a i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> 0 \<le> a i
[PROOF STEP]
using non_null
[PROOF STATE]
proof (prove)
using this:
?i14 \<in> S \<Longrightarrow> 0 < a ?i14
?i14 \<in> S \<Longrightarrow> 0 < e ?i14

goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> 0 \<le> a i
[PROOF STEP]
by (simp add: order.strict_implies_order)
[PROOF STATE]
proof (state)
this:
?i14 \<in> S \<Longrightarrow> 0 \<le> a ?i14

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
have "- log b (\<Sum>i\<in>S. a i * e i / a i) \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - log b (\<Sum>i\<in>S. a i * e i / a i) \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))
[PROOF STEP]
using convex_on_sum[OF fin nemp  minus_log_convex[OF b_gt_1] convex_real_interval(3)
                             sum_a_one a_pos, of "\<lambda>i. e i / a i"] f_pos
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i \<in> S \<Longrightarrow> i \<in> S; \<And>i. i \<in> S \<Longrightarrow> e i / a i \<in> {0<..}\<rbrakk> \<Longrightarrow> - log b (\<Sum>i\<in>S. a i *\<^sub>R (e i / a i)) \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))
?i14 \<in> S \<Longrightarrow> 0 < e ?i14 / a ?i14

goal (1 subgoal):
 1. - log b (\<Sum>i\<in>S. a i * e i / a i) \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- log b (\<Sum>i\<in>S. a i * e i / a i) \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- log b (\<Sum>i\<in>S. a i * e i / a i) \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
have "-log b (\<Sum>i\<in>S. a i * e i / a i) = -log b (\<Sum>i\<in>S. e i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - log b (\<Sum>i\<in>S. a i * e i / a i) = - log b (sum e S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - log b (\<Sum>i\<in>S. a i * e i / a i) = - log b (sum e S)
[PROOF STEP]
from non_null(1)
[PROOF STATE]
proof (chain)
picking this:
?i14 \<in> S \<Longrightarrow> 0 < a ?i14
[PROOF STEP]
have "\<And>i. i \<in> S \<Longrightarrow> a i * e i / a i = e i"
[PROOF STATE]
proof (prove)
using this:
?i14 \<in> S \<Longrightarrow> 0 < a ?i14

goal (1 subgoal):
 1. \<And>i. i \<in> S \<Longrightarrow> a i * e i / a i = e i
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
?i14 \<in> S \<Longrightarrow> a ?i14 * e ?i14 / a ?i14 = e ?i14

goal (1 subgoal):
 1. - log b (\<Sum>i\<in>S. a i * e i / a i) = - log b (sum e S)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?i14 \<in> S \<Longrightarrow> a ?i14 * e ?i14 / a ?i14 = e ?i14

goal (1 subgoal):
 1. - log b (\<Sum>i\<in>S. a i * e i / a i) = - log b (sum e S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- log b (\<Sum>i\<in>S. a i * e i / a i) = - log b (sum e S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
- log b (\<Sum>i\<in>S. a i * e i / a i) = - log b (sum e S)

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- log b (sum e S) \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))
[PROOF STEP]
have "0 \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))"
[PROOF STATE]
proof (prove)
using this:
- log b (sum e S) \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))
[PROOF STEP]
by (simp add: sum_c_one)
[PROOF STATE]
proof (state)
this:
0 \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
thus "0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
using b_gt_1 log_divide non_null
[PROOF STATE]
proof (prove)
using this:
0 \<le> (\<Sum>i\<in>S. a i * - log b (e i / a i))
1 < b
\<lbrakk>0 < ?a; ?a \<noteq> 1; 0 < ?x; 0 < ?y\<rbrakk> \<Longrightarrow> log ?a (?x / ?y) = log ?a ?x - log ?a ?y
?i14 \<in> S \<Longrightarrow> 0 < a ?i14
?i14 \<in> S \<Longrightarrow> 0 < e ?i14

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> (\<Sum>i\<in>S. a i * log b (a i / e i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma walk_edges_vertices: assumes "(v, w) \<in> edges_of_walk xs" shows "v \<in> set xs" "w \<in> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> set xs &&& w \<in> set xs
[PROOF STEP]
using assms edges_of_walkE
[PROOF STATE]
proof (prove)
using this:
(v, w) \<in> edges_of_walk xs
(?v, ?w) \<in> edges_of_walk ?xs \<Longrightarrow> \<exists>xs_pre xs_post. ?xs = xs_pre @ ?v # ?w # xs_post

goal (1 subgoal):
 1. v \<in> set xs &&& w \<in> set xs
[PROOF STEP]
by force+


[STATEMENT]
lemma (in is_functor) cf_cf_comp_cf_id_left[cat_cs_simps]: "cf_id \<BB> \<circ>\<^sub>C\<^sub>F \<FF> = \<FF>"
  \<comment>\<open>See Chapter I-3 in \cite{mac_lane_categories_2010}).\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dghm_id \<BB> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF> = \<FF>
[PROOF STEP]
by
    (
      rule cf_eqI,
      unfold dghm_id_components dghm_comp_components dghm_id_components
    )
    (auto intro: cat_cs_intros simp: cf_ArrMap_vrange cf_ObjMap_vrange)


[STATEMENT]
lemma list_all3_mapI: "list_all3 (\<lambda>x y z. P (f x) (g y) (h z)) xs ys zs \<Longrightarrow>
  list_all3 P (map f xs) (map g ys) (map h zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all3 (\<lambda>x y z. P (f x) (g y) (h z)) xs ys zs \<Longrightarrow> list_all3 P (map f xs) (map g ys) (map h zs)
[PROOF STEP]
by (induct xs ys zs rule: list_all3.induct)
    (auto intro: list_all3.intros)


[STATEMENT]
lemma currentLevelPrefixToLevelEq:
assumes
  "level \<le> currentLevel M"
shows
  "currentLevel (prefixToLevel level M) = level"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. currentLevel (prefixToLevel level M) = level
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
level \<le> currentLevel M

goal (1 subgoal):
 1. currentLevel (prefixToLevel level M) = level
[PROOF STEP]
unfolding prefixToLevel_def
[PROOF STATE]
proof (prove)
using this:
level \<le> currentLevel M

goal (1 subgoal):
 1. currentLevel (prefixToLevel_aux M level 0) = level
[PROOF STEP]
using currentLevelPrefixToLevelEq_aux[of "0" "level" "M"]
[PROOF STATE]
proof (prove)
using this:
level \<le> currentLevel M
\<lbrakk>0 \<le> level; level - 0 \<le> currentLevel M\<rbrakk> \<Longrightarrow> currentLevel (prefixToLevel_aux M level 0) = level - 0

goal (1 subgoal):
 1. currentLevel (prefixToLevel_aux M level 0) = level
[PROOF STEP]
by simp


[STATEMENT]
lemma iprod_assoc: "\<langle>x *\<^sub>s xs, ys\<rangle> = x * \<langle>xs,ys\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>x *\<^sub>s xs,ys\<rangle> = x * \<langle>xs,ys\<rangle>
[PROOF STEP]
apply(induct xs arbitrary: ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys. \<langle>x *\<^sub>s [],ys\<rangle> = x * \<langle>[],ys\<rangle>
 2. \<And>a xs ys. (\<And>ys. \<langle>x *\<^sub>s xs,ys\<rangle> = x * \<langle>xs,ys\<rangle>) \<Longrightarrow> \<langle>x *\<^sub>s (a # xs),ys\<rangle> = x * \<langle>a # xs,ys\<rangle>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. \<langle>x *\<^sub>s xs,ys\<rangle> = x * \<langle>xs,ys\<rangle>) \<Longrightarrow> \<langle>x *\<^sub>s (a # xs),ys\<rangle> = x * \<langle>a # xs,ys\<rangle>
[PROOF STEP]
apply(case_tac ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<langle>x *\<^sub>s xs,ys\<rangle> = x * \<langle>xs,ys\<rangle>; ys = []\<rbrakk> \<Longrightarrow> \<langle>x *\<^sub>s (a # xs),ys\<rangle> = x * \<langle>a # xs,ys\<rangle>
 2. \<And>a xs ys aa list. \<lbrakk>\<And>ys. \<langle>x *\<^sub>s xs,ys\<rangle> = x * \<langle>xs,ys\<rangle>; ys = aa # list\<rbrakk> \<Longrightarrow> \<langle>x *\<^sub>s (a # xs),ys\<rangle> = x * \<langle>a # xs,ys\<rangle>
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys aa list. \<lbrakk>\<And>ys. \<langle>x *\<^sub>s xs,ys\<rangle> = x * \<langle>xs,ys\<rangle>; ys = aa # list\<rbrakk> \<Longrightarrow> \<langle>x *\<^sub>s (a # xs),ys\<rangle> = x * \<langle>a # xs,ys\<rangle>
[PROOF STEP]
apply (simp add: distrib_left mult.assoc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma language_prefix_append :
  assumes "io1 @ (p_io p) \<in> L M"
shows   "io1 @ p_io (take i p) \<in> L M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. io1 @ p_io (take i p) \<in> L M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. io1 @ p_io (take i p) \<in> L M
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. io1 @ p_io (take i p) \<in> L M
[PROOF STEP]
have "p_io p = (p_io (take i p)) @ (p_io (drop i p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p_io p = p_io (take i p) @ p_io (drop i p)
[PROOF STEP]
by (metis append_take_drop_id map_append)
[PROOF STATE]
proof (state)
this:
p_io p = p_io (take i p) @ p_io (drop i p)

goal (1 subgoal):
 1. io1 @ p_io (take i p) \<in> L M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p_io p = p_io (take i p) @ p_io (drop i p)
[PROOF STEP]
have "(io1 @ (p_io (take i p))) @ (p_io (drop i p)) \<in> L M"
[PROOF STATE]
proof (prove)
using this:
p_io p = p_io (take i p) @ p_io (drop i p)

goal (1 subgoal):
 1. (io1 @ p_io (take i p)) @ p_io (drop i p) \<in> L M
[PROOF STEP]
using \<open>io1 @ p_io p \<in> L M\<close>
[PROOF STATE]
proof (prove)
using this:
p_io p = p_io (take i p) @ p_io (drop i p)
io1 @ p_io p \<in> L M

goal (1 subgoal):
 1. (io1 @ p_io (take i p)) @ p_io (drop i p) \<in> L M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(io1 @ p_io (take i p)) @ p_io (drop i p) \<in> L M

goal (1 subgoal):
 1. io1 @ p_io (take i p) \<in> L M
[PROOF STEP]
show "io1 @ p_io (take i p) \<in> L M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. io1 @ p_io (take i p) \<in> L M
[PROOF STEP]
using language_prefix[OF \<open>(io1 @ (p_io (take i p))) @ (p_io (drop i p)) \<in> L M\<close>]
[PROOF STATE]
proof (prove)
using this:
io1 @ p_io (take i p) \<in> L M

goal (1 subgoal):
 1. io1 @ p_io (take i p) \<in> L M
[PROOF STEP]
by assumption
[PROOF STATE]
proof (state)
this:
io1 @ p_io (take i p) \<in> L M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma laplace_expansion_row:
  assumes A: "(A :: 'a :: comm_ring_1 mat) \<in> carrier_mat n n"
      and i: "i < n"
    shows "det A = (\<Sum>j<n. A $$ (i,j) * cofactor A i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "det A = det (A\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = det A\<^sup>T
[PROOF STEP]
using det_transpose[OF A]
[PROOF STATE]
proof (prove)
using this:
det A\<^sup>T = det A

goal (1 subgoal):
 1. det A = det A\<^sup>T
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det A = det A\<^sup>T

goal (1 subgoal):
 1. det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A = det A\<^sup>T

goal (1 subgoal):
 1. det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "\<dots> = (\<Sum>j<n. A\<^sup>T $$ (j, i) * cofactor A\<^sup>T j i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A\<^sup>T = (\<Sum>j<n. A\<^sup>T $$ (j, i) * cofactor A\<^sup>T j i)
[PROOF STEP]
by (rule laplace_expansion_column[OF _ i], insert A, auto)
[PROOF STATE]
proof (state)
this:
det A\<^sup>T = (\<Sum>j<n. A\<^sup>T $$ (j, i) * cofactor A\<^sup>T j i)

goal (1 subgoal):
 1. det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A\<^sup>T = (\<Sum>j<n. A\<^sup>T $$ (j, i) * cofactor A\<^sup>T j i)

goal (1 subgoal):
 1. det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
have "\<dots> = (\<Sum>j<n. A $$ (i,j) * cofactor A i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j<n. A\<^sup>T $$ (j, i) * cofactor A\<^sup>T j i) = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
unfolding cofactor_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j<n. A\<^sup>T $$ (j, i) * ((- (1::'a)) ^ (j + i) * det (mat_delete A\<^sup>T j i))) = (\<Sum>j<n. A $$ (i, j) * ((- (1::'a)) ^ (i + j) * det (mat_delete A i j)))
[PROOF STEP]
proof (rule sum.cong[OF refl], rule arg_cong2[of _ _ _ _ "\<lambda> x y. x * y"], goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {..<n} \<Longrightarrow> A\<^sup>T $$ (x, i) = A $$ (i, x)
 2. \<And>x. x \<in> {..<n} \<Longrightarrow> (- (1::'a)) ^ (x + i) * det (mat_delete A\<^sup>T x i) = (- (1::'a)) ^ (i + x) * det (mat_delete A i x)
[PROOF STEP]
case (1 j)
[PROOF STATE]
proof (state)
this:
j \<in> {..<n}

goal (2 subgoals):
 1. \<And>x. x \<in> {..<n} \<Longrightarrow> A\<^sup>T $$ (x, i) = A $$ (i, x)
 2. \<And>x. x \<in> {..<n} \<Longrightarrow> (- (1::'a)) ^ (x + i) * det (mat_delete A\<^sup>T x i) = (- (1::'a)) ^ (i + x) * det (mat_delete A i x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
j \<in> {..<n}

goal (1 subgoal):
 1. A\<^sup>T $$ (j, i) = A $$ (i, j)
[PROOF STEP]
using A i
[PROOF STATE]
proof (prove)
using this:
j \<in> {..<n}
A \<in> carrier_mat n n
i < n

goal (1 subgoal):
 1. A\<^sup>T $$ (j, i) = A $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A\<^sup>T $$ (j, i) = A $$ (i, j)

goal (1 subgoal):
 1. \<And>x. x \<in> {..<n} \<Longrightarrow> (- (1::'a)) ^ (x + i) * det (mat_delete A\<^sup>T x i) = (- (1::'a)) ^ (i + x) * det (mat_delete A i x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<n} \<Longrightarrow> (- (1::'a)) ^ (x + i) * det (mat_delete A\<^sup>T x i) = (- (1::'a)) ^ (i + x) * det (mat_delete A i x)
[PROOF STEP]
case (2 j)
[PROOF STATE]
proof (state)
this:
j \<in> {..<n}

goal (1 subgoal):
 1. \<And>x. x \<in> {..<n} \<Longrightarrow> (- (1::'a)) ^ (x + i) * det (mat_delete A\<^sup>T x i) = (- (1::'a)) ^ (i + x) * det (mat_delete A i x)
[PROOF STEP]
have "det (mat_delete A\<^sup>T j i) = det ((mat_delete A\<^sup>T j i)\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat_delete A\<^sup>T j i) = det (mat_delete A\<^sup>T j i)\<^sup>T
[PROOF STEP]
by (subst det_transpose, insert A, auto simp: mat_delete_def)
[PROOF STATE]
proof (state)
this:
det (mat_delete A\<^sup>T j i) = det (mat_delete A\<^sup>T j i)\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> {..<n} \<Longrightarrow> (- (1::'a)) ^ (x + i) * det (mat_delete A\<^sup>T x i) = (- (1::'a)) ^ (i + x) * det (mat_delete A i x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (mat_delete A\<^sup>T j i) = det (mat_delete A\<^sup>T j i)\<^sup>T

goal (1 subgoal):
 1. \<And>x. x \<in> {..<n} \<Longrightarrow> (- (1::'a)) ^ (x + i) * det (mat_delete A\<^sup>T x i) = (- (1::'a)) ^ (i + x) * det (mat_delete A i x)
[PROOF STEP]
have "(mat_delete A\<^sup>T j i)\<^sup>T = mat_delete A i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_delete A\<^sup>T j i)\<^sup>T = mat_delete A i j
[PROOF STEP]
unfolding mat_delete_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat (dim_row A\<^sup>T - 1) (dim_col A\<^sup>T - 1) (\<lambda>(i', j'). A\<^sup>T $$ (if i' < j then i' else Suc i', if j' < i then j' else Suc j')))\<^sup>T = mat (dim_row A - 1) (dim_col A - 1) (\<lambda>(i', j'). A $$ (if i' < i then i' else Suc i', if j' < j then j' else Suc j'))
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. (mat (dim_row A\<^sup>T - 1) (dim_col A\<^sup>T - 1) (\<lambda>(i', j'). A\<^sup>T $$ (if i' < j then i' else Suc i', if j' < i then j' else Suc j')))\<^sup>T = mat (dim_row A - 1) (dim_col A - 1) (\<lambda>(i', j'). A $$ (if i' < i then i' else Suc i', if j' < j then j' else Suc j'))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_delete A\<^sup>T j i)\<^sup>T = mat_delete A i j

goal (1 subgoal):
 1. \<And>x. x \<in> {..<n} \<Longrightarrow> (- (1::'a)) ^ (x + i) * det (mat_delete A\<^sup>T x i) = (- (1::'a)) ^ (i + x) * det (mat_delete A i x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (mat_delete A\<^sup>T j i) = det (mat_delete A i j)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
det (mat_delete A\<^sup>T j i) = det (mat_delete A i j)

goal (1 subgoal):
 1. (- (1::'a)) ^ (j + i) * det (mat_delete A\<^sup>T j i) = (- (1::'a)) ^ (i + j) * det (mat_delete A i j)
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ (j + i) * det (mat_delete A\<^sup>T j i) = (- (1::'a)) ^ (i + j) * det (mat_delete A i j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>j<n. A\<^sup>T $$ (j, i) * cofactor A\<^sup>T j i) = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)

goal (1 subgoal):
 1. det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)

goal (1 subgoal):
 1. det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det A = (\<Sum>j<n. A $$ (i, j) * cofactor A i j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma oLimit_const [simp]: "oLimit (\<lambda>n. x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oLimit (\<lambda>n. x) = x
[PROOF STEP]
apply (rule order_antisym[OF _ le_oLimit])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oLimit (\<lambda>n. x) \<le> x
[PROOF STEP]
apply (rule oLimit_leI, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cardinalityOneTheElem:
  assumes "card X=1" "X \<subseteq> Y"
  shows "the_elem X \<in> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_elem X \<in> Y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card X = 1
X \<subseteq> Y

goal (1 subgoal):
 1. the_elem X \<in> Y
[PROOF STEP]
by (metis (full_types) insert_subset cardinalityOneTheElemIdentity)


[STATEMENT]
lemma length_preorder[simp]: "length (preorder t) = size t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (preorder t) = size t
[PROOF STEP]
by (induction t) auto


[STATEMENT]
lemma vrestr_union [simp]:
  "f--` (A \<union> B) = f--`A \<union> f--`B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f --` (A \<union> B) = f --` A \<union> f --` B
[PROOF STEP]
using vimage_restr_def
[PROOF STATE]
proof (prove)
using this:
?f --` ?A \<equiv> ?f -` (?A \<inter> space M) \<inter> space M

goal (1 subgoal):
 1. f --` (A \<union> B) = f --` A \<union> f --` B
[PROOF STEP]
by auto


[STATEMENT]
lemma meet_compl2_bot [simp]: "x \<in> carrier L \<Longrightarrow> x \<sqinter> \<^bold>- x = \<bottom>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier L \<Longrightarrow> x \<sqinter> \<^bold>- x = \<bottom>
[PROOF STEP]
by (metis meet_comm meet_compl_bot)


[STATEMENT]
lemma subset_fst_imageI: "A \<times> B \<subseteq> S \<Longrightarrow> y \<in> B \<Longrightarrow> A \<subseteq> fst ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<times> B \<subseteq> S; y \<in> B\<rbrakk> \<Longrightarrow> A \<subseteq> fst ` S
[PROOF STEP]
unfolding image_def subset_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A \<times> B. x \<in> S; y \<in> B\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. x \<in> {y. \<exists>x\<in>S. y = fst x}
[PROOF STEP]
by force


[STATEMENT]
lemma exi_rename2:
"\<phi> \<in> fmla \<Longrightarrow> x \<in> var \<Longrightarrow> y \<in> var \<Longrightarrow> (y = x \<or> y \<notin> Fvars \<phi>) \<Longrightarrow>
  exi x \<phi> = exi y (subst \<phi> (Var y) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; x \<in> var; y \<in> var; y = x \<or> y \<notin> Fvars \<phi>\<rbrakk> \<Longrightarrow> exi x \<phi> = exi y (subst \<phi> (Var y) x)
[PROOF STEP]
using exi_rename
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<phi> \<in> fmla; ?x \<in> var; ?y \<in> var; ?y \<notin> Fvars ?\<phi>\<rbrakk> \<Longrightarrow> exi ?x ?\<phi> = exi ?y (subst ?\<phi> (Var ?y) ?x)

goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; x \<in> var; y \<in> var; y = x \<or> y \<notin> Fvars \<phi>\<rbrakk> \<Longrightarrow> exi x \<phi> = exi y (subst \<phi> (Var y) x)
[PROOF STEP]
by (cases "y = x") (auto simp del: Fvars_subst)


[STATEMENT]
lemma changes_append_replicate_0: "changes (xs @ replicate n 0) = changes xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (xs @ replicate n (0::'a)) = changes xs
[PROOF STEP]
proof (induction xs rule: changes.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. changes ([] @ replicate n (0::'a)) = changes []
 2. \<And>uu_. changes ([uu_] @ replicate n (0::'a)) = changes [uu_]
 3. \<And>x1 x2 xs. \<lbrakk>x1 * x2 < (0::'a) \<Longrightarrow> changes ((x2 # xs) @ replicate n (0::'a)) = changes (x2 # xs); \<lbrakk>\<not> x1 * x2 < (0::'a); x2 = (0::'a)\<rbrakk> \<Longrightarrow> changes ((x1 # xs) @ replicate n (0::'a)) = changes (x1 # xs); \<lbrakk>\<not> x1 * x2 < (0::'a); x2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> changes ((x2 # xs) @ replicate n (0::'a)) = changes (x2 # xs)\<rbrakk> \<Longrightarrow> changes ((x1 # x2 # xs) @ replicate n (0::'a)) = changes (x1 # x2 # xs)
[PROOF STEP]
case (2 uu)
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. changes ([] @ replicate n (0::'a)) = changes []
 2. \<And>uu_. changes ([uu_] @ replicate n (0::'a)) = changes [uu_]
 3. \<And>x1 x2 xs. \<lbrakk>x1 * x2 < (0::'a) \<Longrightarrow> changes ((x2 # xs) @ replicate n (0::'a)) = changes (x2 # xs); \<lbrakk>\<not> x1 * x2 < (0::'a); x2 = (0::'a)\<rbrakk> \<Longrightarrow> changes ((x1 # xs) @ replicate n (0::'a)) = changes (x1 # xs); \<lbrakk>\<not> x1 * x2 < (0::'a); x2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> changes ((x2 # xs) @ replicate n (0::'a)) = changes (x2 # xs)\<rbrakk> \<Longrightarrow> changes ((x1 # x2 # xs) @ replicate n (0::'a)) = changes (x1 # x2 # xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes ([uu] @ replicate n (0::'a)) = changes [uu]
[PROOF STEP]
apply (induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. changes ([uu] @ replicate 0 (0::'a)) = changes [uu]
 2. \<And>n. changes ([uu] @ replicate n (0::'a)) = changes [uu] \<Longrightarrow> changes ([uu] @ replicate (Suc n) (0::'a)) = changes [uu]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
changes ([uu] @ replicate n (0::'a)) = changes [uu]

goal (2 subgoals):
 1. changes ([] @ replicate n (0::'a)) = changes []
 2. \<And>x1 x2 xs. \<lbrakk>x1 * x2 < (0::'a) \<Longrightarrow> changes ((x2 # xs) @ replicate n (0::'a)) = changes (x2 # xs); \<lbrakk>\<not> x1 * x2 < (0::'a); x2 = (0::'a)\<rbrakk> \<Longrightarrow> changes ((x1 # xs) @ replicate n (0::'a)) = changes (x1 # xs); \<lbrakk>\<not> x1 * x2 < (0::'a); x2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> changes ((x2 # xs) @ replicate n (0::'a)) = changes (x2 # xs)\<rbrakk> \<Longrightarrow> changes ((x1 # x2 # xs) @ replicate n (0::'a)) = changes (x1 # x2 # xs)
[PROOF STEP]
qed (auto simp: changes_replicate_0)


[STATEMENT]
lemma approx_unique_complex:
  "\<lbrakk>r \<in> SComplex; s \<in> SComplex; r \<approx> x; s \<approx> x\<rbrakk> \<Longrightarrow> r = s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<in> SComplex; s \<in> SComplex; r \<approx> x; s \<approx> x\<rbrakk> \<Longrightarrow> r = s
[PROOF STEP]
by (blast intro: SComplex_approx_iff [THEN iffD1] approx_trans2)


[STATEMENT]
lemma num_leaves_ge1: "num_leaves t \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> num_leaves t
[PROOF STEP]
proof(induction t)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1a x2a. (\<And>x2aa x2aaa. \<lbrakk>x2aa \<in> fset x2a; x2aaa \<in> Basic_BNFs.fsts x2aa\<rbrakk> \<Longrightarrow> 1 \<le> num_leaves x2aaa) \<Longrightarrow> 1 \<le> num_leaves (Node x1a x2a)
[PROOF STEP]
case (Node r xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x2aa \<in> fset xs; ?x2aaa \<in> Basic_BNFs.fsts ?x2aa\<rbrakk> \<Longrightarrow> 1 \<le> num_leaves ?x2aaa

goal (1 subgoal):
 1. \<And>x1a x2a. (\<And>x2aa x2aaa. \<lbrakk>x2aa \<in> fset x2a; x2aaa \<in> Basic_BNFs.fsts x2aa\<rbrakk> \<Longrightarrow> 1 \<le> num_leaves x2aaa) \<Longrightarrow> 1 \<le> num_leaves (Node x1a x2a)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> num_leaves (Node r xs)
[PROOF STEP]
proof(cases "xs = {||}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
 2. xs \<noteq> {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
xs \<noteq> {||}

goal (2 subgoals):
 1. xs = {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
 2. xs \<noteq> {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> {||}
[PROOF STEP]
obtain t e where t_def: "(t,e) \<in> fset xs"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> {||}

goal (1 subgoal):
 1. (\<And>t e. (t, e) \<in> fset xs \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using notin_fset
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> {||}
(?x |\<notin>| ?S) = (?x \<notin> fset ?S)

goal (1 subgoal):
 1. (\<And>t e. (t, e) \<in> fset xs \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(t, e) \<in> fset xs

goal (2 subgoals):
 1. xs = {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
 2. xs \<noteq> {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(t, e) \<in> fset xs
[PROOF STEP]
have "1 \<le> num_leaves t"
[PROOF STATE]
proof (prove)
using this:
(t, e) \<in> fset xs

goal (1 subgoal):
 1. 1 \<le> num_leaves t
[PROOF STEP]
using Node
[PROOF STATE]
proof (prove)
using this:
(t, e) \<in> fset xs
\<lbrakk>?x2aa \<in> fset xs; ?x2aaa \<in> Basic_BNFs.fsts ?x2aa\<rbrakk> \<Longrightarrow> 1 \<le> num_leaves ?x2aaa

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

goal (2 subgoals):
 1. xs = {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
 2. xs \<noteq> {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> num_leaves t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<le> num_leaves t

goal (1 subgoal):
 1. 1 \<le> num_leaves (Node r xs)
[PROOF STEP]
using fset_sum_ge_elem[OF finite_fset[of xs] t_def, of "\<lambda>(t,e). num_leaves t"]
[PROOF STATE]
proof (prove)
using this:
1 \<le> num_leaves t
(case (t, e) of (t, e) \<Rightarrow> num_leaves t) \<le> (\<Sum>u\<in>fset xs. case u of (t, e) \<Rightarrow> num_leaves t)

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

goal (1 subgoal):
 1. xs = {||} \<Longrightarrow> 1 \<le> num_leaves (Node r xs)
[PROOF STEP]
qed (simp)
[PROOF STATE]
proof (state)
this:
1 \<le> num_leaves (Node r xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccApprox_belowI: "(\<And> xs. xs \<in> paths t \<Longrightarrow> ccFromList xs \<sqsubseteq> G) \<Longrightarrow> ccApprox t \<sqsubseteq> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xs. xs \<in> paths t \<Longrightarrow> ccFromList xs \<sqsubseteq> G) \<Longrightarrow> ccApprox t \<sqsubseteq> G
[PROOF STEP]
unfolding ccApprox_paths
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xs. xs \<in> paths t \<Longrightarrow> ccFromList xs \<sqsubseteq> G) \<Longrightarrow> lub (ccFromList ` paths t) \<sqsubseteq> G
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma fold_fold_prod_conv: "fold (\<lambda>i. fold (f i) l1) l2 s = fold (\<lambda>(i,j). f i j) (List.product l2 l1) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>i. fold (f i) l1) l2 s = fold (\<lambda>(i, j). f i j) (List.product l2 l1) s
[PROOF STEP]
using foldli_foldli_prod_conv[of l2 "\<lambda>_. True" l1 f s]
[PROOF STATE]
proof (prove)
using this:
foldli l2 (\<lambda>_. True) (\<lambda>i. foldli l1 (\<lambda>_. True) (f i)) s = foldli (List.product l2 l1) (\<lambda>_. True) (\<lambda>(i, j). f i j) s

goal (1 subgoal):
 1. fold (\<lambda>i. fold (f i) l1) l2 s = fold (\<lambda>(i, j). f i j) (List.product l2 l1) s
[PROOF STEP]
by (simp add: foldli_foldl foldl_conv_fold)


[STATEMENT]
lemma project_inject_comp_id [statefun_simp]: "project \<circ> inject = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. project \<circ> inject = id
[PROOF STEP]
by (rule ext) (simp add: project_inject_cancel)


[STATEMENT]
lemma regressively_finite_irreflexive:
  assumes "regressively_finite x"
    shows "x \<le> -1'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> - 1'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> - 1'
[PROOF STEP]
have 1: "is_vector ((x\<^sup>T \<cdot> 1');1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_vector ((x\<^sup>T \<cdot> 1') ; 1)
[PROOF STEP]
by (simp add: is_vector_def mult_assoc)
[PROOF STATE]
proof (state)
this:
is_vector ((x\<^sup>T \<cdot> 1') ; 1)

goal (1 subgoal):
 1. x \<le> - 1'
[PROOF STEP]
have "(x\<^sup>T \<cdot> 1');1 = (x\<^sup>T \<cdot> 1');(x\<^sup>T \<cdot> 1');1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x\<^sup>T \<cdot> 1') ; 1 = (x\<^sup>T \<cdot> 1') ; (x\<^sup>T \<cdot> 1') ; 1
[PROOF STEP]
by (simp add: is_test_def test_comp_eq_mult)
[PROOF STATE]
proof (state)
this:
(x\<^sup>T \<cdot> 1') ; 1 = (x\<^sup>T \<cdot> 1') ; (x\<^sup>T \<cdot> 1') ; 1

goal (1 subgoal):
 1. x \<le> - 1'
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
is_vector ((x\<^sup>T \<cdot> 1') ; 1)
(x\<^sup>T \<cdot> 1') ; 1 = (x\<^sup>T \<cdot> 1') ; (x\<^sup>T \<cdot> 1') ; 1
[PROOF STEP]
have "(x\<^sup>T \<cdot> 1');1 = 0"
[PROOF STATE]
proof (prove)
using this:
is_vector ((x\<^sup>T \<cdot> 1') ; 1)
(x\<^sup>T \<cdot> 1') ; 1 = (x\<^sup>T \<cdot> 1') ; (x\<^sup>T \<cdot> 1') ; 1

goal (1 subgoal):
 1. (x\<^sup>T \<cdot> 1') ; 1 = 0
[PROOF STEP]
by (metis assms comp_assoc mult_subdistr)
[PROOF STATE]
proof (state)
this:
(x\<^sup>T \<cdot> 1') ; 1 = 0

goal (1 subgoal):
 1. x \<le> - 1'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(x\<^sup>T \<cdot> 1') ; 1 = 0

goal (1 subgoal):
 1. x \<le> - 1'
[PROOF STEP]
by (metis conv_e conv_invol conv_times conv_zero galois_aux ss_p18)
[PROOF STATE]
proof (state)
this:
x \<le> - 1'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_elem_upto:
  assumes "i < n"
  shows "nth_elem {..<n} i = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_elem {..<n} i = i
[PROOF STEP]
using set_to_list_upto
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set {..<?n} = [0..<?n]

goal (1 subgoal):
 1. nth_elem {..<n} i = i
[PROOF STEP]
by (simp add: assms)


[STATEMENT]
lemma map_nth_eq_conv:
  assumes len: "length xs = length ys"
  shows "(map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = ys ! i)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = ys ! i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = ys ! i)
[PROOF STEP]
have "(map f xs = ys) = (map f xs = map id ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map f xs = ys) = (map f xs = map id ys)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(map f xs = ys) = (map f xs = map id ys)

goal (1 subgoal):
 1. (map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = ys ! i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(map f xs = ys) = (map f xs = map id ys)

goal (1 subgoal):
 1. (map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = ys ! i)
[PROOF STEP]
have "... = (\<forall> i < length ys. f (xs ! i) = id (ys ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map f xs = map id ys) = (\<forall>i<length ys. f (xs ! i) = id (ys ! i))
[PROOF STEP]
using map_nth_conv[of f xs id ys] nth_map_conv[OF len, of f id]
[PROOF STATE]
proof (prove)
using this:
map f xs = map id ys \<Longrightarrow> \<forall>i<length xs. f (xs ! i) = id (ys ! i)
\<forall>i<length xs. f (xs ! i) = id (ys ! i) \<Longrightarrow> map f xs = map id ys

goal (1 subgoal):
 1. (map f xs = map id ys) = (\<forall>i<length ys. f (xs ! i) = id (ys ! i))
[PROOF STEP]
unfolding len
[PROOF STATE]
proof (prove)
using this:
map f xs = map id ys \<Longrightarrow> \<forall>i<length ys. f (xs ! i) = id (ys ! i)
\<forall>i<length ys. f (xs ! i) = id (ys ! i) \<Longrightarrow> map f xs = map id ys

goal (1 subgoal):
 1. (map f xs = map id ys) = (\<forall>i<length ys. f (xs ! i) = id (ys ! i))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(map f xs = map id ys) = (\<forall>i<length ys. f (xs ! i) = id (ys ! i))

goal (1 subgoal):
 1. (map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = ys ! i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = id (ys ! i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = id (ys ! i))

goal (1 subgoal):
 1. (map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = ys ! i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(map f xs = ys) = (\<forall>i<length ys. f (xs ! i) = ys ! i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sym_mpoly_nz [simp]:
  assumes "finite A" "k \<le> card A"
  shows   "sym_mpoly A k \<noteq> (0 :: 'a :: zero_neq_one mpoly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sym_mpoly A k \<noteq> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sym_mpoly A k \<noteq> 0
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
k \<le> card A
[PROOF STEP]
obtain B where B: "B \<subseteq> A" "card B = k"
[PROOF STATE]
proof (prove)
using this:
finite A
k \<le> card A

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<subseteq> A; card B = k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_subset_of_card
[PROOF STATE]
proof (prove)
using this:
finite A
k \<le> card A
\<lbrakk>finite ?A; ?k \<le> card ?A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>?A. card B = ?k

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<subseteq> A; card B = k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B \<subseteq> A
card B = k

goal (1 subgoal):
 1. sym_mpoly A k \<noteq> 0
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite A
k \<le> card A
B \<subseteq> A
card B = k
[PROOF STEP]
have "coeff (sym_mpoly A k :: 'a mpoly) (monom_of_set B) = 1"
[PROOF STATE]
proof (prove)
using this:
finite A
k \<le> card A
B \<subseteq> A
card B = k

goal (1 subgoal):
 1. MPoly_Type.coeff (sym_mpoly A k) (monom_of_set B) = (1::'a)
[PROOF STEP]
by (intro coeff_sym_mpoly_monom_of_set)
[PROOF STATE]
proof (state)
this:
MPoly_Type.coeff (sym_mpoly A k) (monom_of_set B) = (1::'a)

goal (1 subgoal):
 1. sym_mpoly A k \<noteq> 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.coeff (sym_mpoly A k) (monom_of_set B) = (1::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordertype_interval_eq:
  assumes \<alpha>: "Ord \<alpha>" and \<beta>: "Ord \<beta>"
  shows "ordertype ({\<alpha> ..< \<alpha>+\<beta>} \<inter> ON) VWF = \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>
[PROOF STEP]
have ON: "(+) \<alpha> ` elts \<beta> \<subseteq> ON"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (+) \<alpha> ` elts \<beta> \<subseteq> ON
[PROOF STEP]
using assms Ord_add Ord_in_Ord
[PROOF STATE]
proof (prove)
using this:
Ord \<alpha>
Ord \<beta>
\<lbrakk>Ord ?x; Ord ?y\<rbrakk> \<Longrightarrow> Ord (?x + ?y)
\<lbrakk>Ord ?k; ?m \<in> elts ?k\<rbrakk> \<Longrightarrow> Ord ?m

goal (1 subgoal):
 1. (+) \<alpha> ` elts \<beta> \<subseteq> ON
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(+) \<alpha> ` elts \<beta> \<subseteq> ON

goal (1 subgoal):
 1. ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>
[PROOF STEP]
have "({\<alpha> ..< \<alpha>+\<beta>} \<inter> ON) = (+) \<alpha> ` elts \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<alpha>..<\<alpha> + \<beta>} \<inter> ON = (+) \<alpha> ` elts \<beta>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Ord \<alpha>
Ord \<beta>

goal (1 subgoal):
 1. {\<alpha>..<\<alpha> + \<beta>} \<inter> ON = (+) \<alpha> ` elts \<beta>
[PROOF STEP]
apply (simp add: image_def set_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ord \<alpha>; Ord \<beta>\<rbrakk> \<Longrightarrow> \<forall>x. (\<alpha> \<le> x \<and> x < \<alpha> + \<beta> \<and> Ord x) = (\<exists>xa\<in>elts \<beta>. x = \<alpha> + xa)
[PROOF STEP]
by (metis add_less_cancel_left Ord_add Ord_in_Ord Ord_linear2 Ord_mem_iff_lt le_Ord_diff not_add_less_right)
[PROOF STATE]
proof (state)
this:
{\<alpha>..<\<alpha> + \<beta>} \<inter> ON = (+) \<alpha> ` elts \<beta>

goal (1 subgoal):
 1. ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{\<alpha>..<\<alpha> + \<beta>} \<inter> ON = (+) \<alpha> ` elts \<beta>

goal (1 subgoal):
 1. ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>
[PROOF STEP]
have "ordertype (elts \<beta>) VWF = ordertype ((+) \<alpha> ` elts \<beta>) VWF"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordertype (elts \<beta>) VWF = ordertype ((+) \<alpha> ` elts \<beta>) VWF
[PROOF STEP]
using ON \<beta> elts_subset_ON ordertype_VWF_inc_eq
[PROOF STATE]
proof (prove)
using this:
(+) \<alpha> ` elts \<beta> \<subseteq> ON
Ord \<beta>
Ord ?\<alpha> \<Longrightarrow> elts ?\<alpha> \<subseteq> ON
\<lbrakk>?A \<subseteq> ON; ?\<pi> ` ?A \<subseteq> ON; small ?A; \<And>x y. \<lbrakk>x \<in> ?A; y \<in> ?A; x < y\<rbrakk> \<Longrightarrow> ?\<pi> x < ?\<pi> y\<rbrakk> \<Longrightarrow> ordertype (?\<pi> ` ?A) VWF = ordertype ?A VWF

goal (1 subgoal):
 1. ordertype (elts \<beta>) VWF = ordertype ((+) \<alpha> ` elts \<beta>) VWF
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ordertype (elts \<beta>) VWF = ordertype ((+) \<alpha> ` elts \<beta>) VWF

goal (1 subgoal):
 1. ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{\<alpha>..<\<alpha> + \<beta>} \<inter> ON = (+) \<alpha> ` elts \<beta>
ordertype (elts \<beta>) VWF = ordertype ((+) \<alpha> ` elts \<beta>) VWF
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{\<alpha>..<\<alpha> + \<beta>} \<inter> ON = (+) \<alpha> ` elts \<beta>
ordertype (elts \<beta>) VWF = ordertype ((+) \<alpha> ` elts \<beta>) VWF

goal (1 subgoal):
 1. ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>
[PROOF STEP]
using \<beta>
[PROOF STATE]
proof (prove)
using this:
{\<alpha>..<\<alpha> + \<beta>} \<inter> ON = (+) \<alpha> ` elts \<beta>
ordertype (elts \<beta>) VWF = ordertype ((+) \<alpha> ` elts \<beta>) VWF
Ord \<beta>

goal (1 subgoal):
 1. ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ordertype ({\<alpha>..<\<alpha> + \<beta>} \<inter> ON) VWF = \<beta>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cons_notle_Nil [iff]:
  "~ x#xs <=[r] []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> x # xs <=[r] []
[PROOF STEP]
apply (unfold lesub_def Listn.le_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> list_all2 r (x # xs) []
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ASum_eqTr:"(\<forall>j \<le> n. f j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j \<le> n. g j \<in> Z\<^sub>\<infinity>) \<and>
                (\<forall>j \<le> n. f j = g j) \<longrightarrow> ASum f n = ASum g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<le>n. f j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>n. g j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>n. f j = g j) \<longrightarrow> ASum f n = ASum g n
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>0. f j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>0. g j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>0. f j = g j) \<longrightarrow> ASum f 0 = ASum g 0
 2. \<And>n. (\<forall>j\<le>n. f j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>n. g j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>n. f j = g j) \<longrightarrow> ASum f n = ASum g n \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>Suc n. g j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>Suc n. f j = g j) \<longrightarrow> ASum f (Suc n) = ASum g (Suc n)
[PROOF STEP]
apply (rule impI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>j\<le>n. f j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>n. g j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>n. f j = g j) \<longrightarrow> ASum f n = ASum g n \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>Suc n. g j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>Suc n. f j = g j) \<longrightarrow> ASum f (Suc n) = ASum g (Suc n)
[PROOF STEP]
apply (rule impI, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>j\<le>n. f j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>n. g j \<in> Z\<^sub>\<infinity>) \<and> (\<forall>j\<le>n. f j = g j) \<longrightarrow> ASum f n = ASum g n; \<forall>j\<le>Suc n. f j \<in> Z\<^sub>\<infinity>; \<forall>j\<le>Suc n. g j \<in> Z\<^sub>\<infinity>; \<forall>j\<le>Suc n. f j = g j\<rbrakk> \<Longrightarrow> ASum f (Suc n) = ASum g (Suc n)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "\<forall>x y::int. x < y \<longrightarrow> (2 * x + 1) < (2 * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x < y \<longrightarrow> 2 * x + 1 < 2 * y
[PROOF STEP]
by (smt (verit))


[STATEMENT]
lemma sorted_Cons_Min: "sorted (x # xs) \<Longrightarrow> Min (insert x (set xs)) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (x # xs) \<Longrightarrow> Min (insert x (set xs)) = x
[PROOF STEP]
by(auto simp add: intro: Min_eqI)


[STATEMENT]
lemma (in comm_monoid_add) sum_list_map_remove1:
  "x \<in> set xs \<Longrightarrow> sum_list (map f xs) = f x + sum_list (map f (remove1 x xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set xs \<Longrightarrow> sum_list (map f xs) = f x + sum_list (map f (remove1 x xs))
[PROOF STEP]
by (induct xs) (auto simp add: ac_simps)


[STATEMENT]
lemma cil_set_induct[induct set, case_names empty left right]: "!!\<alpha> w1 w2. \<lbrakk>
    w\<in>w1\<otimes>\<^bsub>\<alpha>\<^esub>w2;
    !!\<alpha>. P [] \<alpha> [] [];
    !!\<alpha> e w' w1' w2. \<lbrakk>w'\<in>w1'\<otimes>\<^bsub>\<alpha>\<^esub>w2; fst (\<alpha> e) \<inter> mon_pl (map \<alpha> w2) = {};
                      P w' \<alpha> w1' w2 \<rbrakk> \<Longrightarrow> P (e#w') \<alpha> (e#w1') w2;
    !!\<alpha> e w' w2' w1. \<lbrakk>w'\<in>w1\<otimes>\<^bsub>\<alpha>\<^esub>w2'; fst (\<alpha> e) \<inter> mon_pl (map \<alpha> w1) = {};
                      P w' \<alpha> w1 w2' \<rbrakk> \<Longrightarrow> P (e#w') \<alpha> w1 (e#w2')
  \<rbrakk> \<Longrightarrow> P w \<alpha> w1 w2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>\<alpha> w1 w2. \<lbrakk>w \<in> w1 \<otimes>\<^bsub>\<alpha>\<^esub> w2; \<And>\<alpha>. P [] \<alpha> [] []; \<And>\<alpha> e w' w1' w2. \<lbrakk>w' \<in> w1' \<otimes>\<^bsub>\<alpha>\<^esub> w2; fst (\<alpha> e) \<inter> mon_pl (map \<alpha> w2) = {}; P w' \<alpha> w1' w2\<rbrakk> \<Longrightarrow> P (e # w') \<alpha> (e # w1') w2; \<And>\<alpha> e w' w2' w1. \<lbrakk>w' \<in> w1 \<otimes>\<^bsub>\<alpha>\<^esub> w2'; fst (\<alpha> e) \<inter> mon_pl (map \<alpha> w1) = {}; P w' \<alpha> w1 w2'\<rbrakk> \<Longrightarrow> P (e # w') \<alpha> w1 (e # w2')\<rbrakk> \<Longrightarrow> P w \<alpha> w1 w2
[PROOF STEP]
by (induct w) (auto intro!: cil_contains_empty elim: cil_cons_cases)


[STATEMENT]
lemma darcs_mset_alt:
  "darcs_mset (Node r xs) = (\<Sum>(t,e) \<in> fset xs. {#e#}) + (\<Sum>(t,e) \<in> fset xs. darcs_mset t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. darcs_mset (Node r xs) = (\<Sum>(t, e)\<in>fset xs. {#e#}) + (\<Sum>(t, e)\<in>fset xs. darcs_mset t)
[PROOF STEP]
by (induction xs) (auto simp: notin_fset)


[STATEMENT]
lemma funPair_o_distrib: "(funPair f g) o h = funPair (f o h) (g o h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. funPair f g \<circ> h = funPair (f \<circ> h) (g \<circ> h)
[PROOF STEP]
by (simp add: funPair_def o_def)