[STATEMENT]
lemma certification_via_eq_HNF:
  assumes sound_HNF: "is_sound_HNF HNF associates res"
    and P1_H1: "(P1,H1) = HNF (mat_of_rows n fs_init)"
    and P2_H2: "(P2,H2) = HNF (mat_of_rows n gs)"
    and H1_H2: "H1 = H2" (*The HNF are equal*)
    and gs: "set gs \<subseteq> carrier_vec n" and len_gs: "length gs = m"
  shows "lattice_of gs = lattice_of fs_init" "LLL_with_assms n m gs \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of gs = lattice_of fs_init &&& LLL_with_assms n m gs \<alpha>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lattice_of gs = lattice_of fs_init
 2. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have "lattice_of fs_init = lattice_of (rows H1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of fs_init = lattice_of (rows H1)
[PROOF STEP]
by (rule lattice_of_HNF[OF sound_HNF P1_H1 fs_init], simp add: len)
[PROOF STATE]
proof (state)
this:
lattice_of fs_init = lattice_of (rows H1)

goal (2 subgoals):
 1. lattice_of gs = lattice_of fs_init
 2. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lattice_of fs_init = lattice_of (rows H1)

goal (2 subgoals):
 1. lattice_of gs = lattice_of fs_init
 2. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have "... = lattice_of (rows H2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of (rows H1) = lattice_of (rows H2)
[PROOF STEP]
using H1_H2
[PROOF STATE]
proof (prove)
using this:
H1 = H2

goal (1 subgoal):
 1. lattice_of (rows H1) = lattice_of (rows H2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lattice_of (rows H1) = lattice_of (rows H2)

goal (2 subgoals):
 1. lattice_of gs = lattice_of fs_init
 2. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lattice_of (rows H1) = lattice_of (rows H2)

goal (2 subgoals):
 1. lattice_of gs = lattice_of fs_init
 2. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have "... = lattice_of gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of (rows H2) = lattice_of gs
[PROOF STEP]
by (rule lattice_of_HNF[symmetric, OF sound_HNF P2_H2 gs len_gs])
[PROOF STATE]
proof (state)
this:
lattice_of (rows H2) = lattice_of gs

goal (2 subgoals):
 1. lattice_of gs = lattice_of fs_init
 2. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lattice_of fs_init = lattice_of gs
[PROOF STEP]
show "lattice_of gs = lattice_of fs_init"
[PROOF STATE]
proof (prove)
using this:
lattice_of fs_init = lattice_of gs

goal (1 subgoal):
 1. lattice_of gs = lattice_of fs_init
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
lattice_of gs = lattice_of fs_init

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have invertible_P1: "invertible_mat P1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat P1
[PROOF STEP]
using sound_HNF P1_H1
[PROOF STATE]
proof (prove)
using this:
is_sound_HNF HNF associates res
(P1, H1) = HNF (mat_of_rows n fs_init)

goal (1 subgoal):
 1. invertible_mat P1
[PROOF STEP]
unfolding is_sound_HNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. let (P, H) = HNF A; m = dim_row A; n = dim_col A in P \<in> carrier_mat m m \<and> H \<in> carrier_mat m n \<and> invertible_mat P \<and> A = P * H \<and> Hermite_JNF associates res H
(P1, H1) = HNF (mat_of_rows n fs_init)

goal (1 subgoal):
 1. invertible_mat P1
[PROOF STEP]
by (metis (mono_tags, lifting) case_prodD)
[PROOF STATE]
proof (state)
this:
invertible_mat P1

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have invertible_P2: "invertible_mat P2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat P2
[PROOF STEP]
using sound_HNF P2_H2
[PROOF STATE]
proof (prove)
using this:
is_sound_HNF HNF associates res
(P2, H2) = HNF (mat_of_rows n gs)

goal (1 subgoal):
 1. invertible_mat P2
[PROOF STEP]
unfolding is_sound_HNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. let (P, H) = HNF A; m = dim_row A; n = dim_col A in P \<in> carrier_mat m m \<and> H \<in> carrier_mat m n \<and> invertible_mat P \<and> A = P * H \<and> Hermite_JNF associates res H
(P2, H2) = HNF (mat_of_rows n gs)

goal (1 subgoal):
 1. invertible_mat P2
[PROOF STEP]
by (metis (mono_tags, lifting) case_prodD)
[PROOF STATE]
proof (state)
this:
invertible_mat P2

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have P2: "P2 \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 \<in> carrier_mat m m
[PROOF STEP]
using sound_HNF P2_H2
[PROOF STATE]
proof (prove)
using this:
is_sound_HNF HNF associates res
(P2, H2) = HNF (mat_of_rows n gs)

goal (1 subgoal):
 1. P2 \<in> carrier_mat m m
[PROOF STEP]
unfolding is_sound_HNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. let (P, H) = HNF A; m = dim_row A; n = dim_col A in P \<in> carrier_mat m m \<and> H \<in> carrier_mat m n \<and> invertible_mat P \<and> A = P * H \<and> Hermite_JNF associates res H
(P2, H2) = HNF (mat_of_rows n gs)

goal (1 subgoal):
 1. P2 \<in> carrier_mat m m
[PROOF STEP]
by (metis (no_types, lifting) len_gs case_prodD mat_of_rows_carrier(2))
[PROOF STATE]
proof (state)
this:
P2 \<in> carrier_mat m m

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
obtain inv_P2 where P2_inv_P2: "inverts_mat P2 inv_P2" and inv_P2_P2: "inverts_mat inv_P2 P2"
    and inv_P2: "inv_P2 \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>inv_P2. \<lbrakk>inverts_mat P2 inv_P2; inverts_mat inv_P2 P2; inv_P2 \<in> carrier_mat m m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using P2 invertible_P2 obtain_inverse_matrix
[PROOF STATE]
proof (prove)
using this:
P2 \<in> carrier_mat m m
invertible_mat P2
\<lbrakk>?A \<in> carrier_mat ?n ?n; invertible_mat ?A; \<And>B. \<lbrakk>inverts_mat ?A B; inverts_mat B ?A; B \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>inv_P2. \<lbrakk>inverts_mat P2 inv_P2; inverts_mat inv_P2 P2; inv_P2 \<in> carrier_mat m m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inverts_mat P2 inv_P2
inverts_mat inv_P2 P2
inv_P2 \<in> carrier_mat m m

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have P1: "P1 \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 \<in> carrier_mat m m
[PROOF STEP]
using sound_HNF P1_H1
[PROOF STATE]
proof (prove)
using this:
is_sound_HNF HNF associates res
(P1, H1) = HNF (mat_of_rows n fs_init)

goal (1 subgoal):
 1. P1 \<in> carrier_mat m m
[PROOF STEP]
unfolding is_sound_HNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. let (P, H) = HNF A; m = dim_row A; n = dim_col A in P \<in> carrier_mat m m \<and> H \<in> carrier_mat m n \<and> invertible_mat P \<and> A = P * H \<and> Hermite_JNF associates res H
(P1, H1) = HNF (mat_of_rows n fs_init)

goal (1 subgoal):
 1. P1 \<in> carrier_mat m m
[PROOF STEP]
by (metis (no_types, lifting) len case_prodD mat_of_rows_carrier(2))
[PROOF STATE]
proof (state)
this:
P1 \<in> carrier_mat m m

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have H1: "H1 \<in> carrier_mat m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H1 \<in> carrier_mat m n
[PROOF STEP]
using sound_HNF P1_H1
[PROOF STATE]
proof (prove)
using this:
is_sound_HNF HNF associates res
(P1, H1) = HNF (mat_of_rows n fs_init)

goal (1 subgoal):
 1. H1 \<in> carrier_mat m n
[PROOF STEP]
unfolding is_sound_HNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. let (P, H) = HNF A; m = dim_row A; n = dim_col A in P \<in> carrier_mat m m \<and> H \<in> carrier_mat m n \<and> invertible_mat P \<and> A = P * H \<and> Hermite_JNF associates res H
(P1, H1) = HNF (mat_of_rows n fs_init)

goal (1 subgoal):
 1. H1 \<in> carrier_mat m n
[PROOF STEP]
by (metis (no_types, lifting) case_prodD len mat_of_rows_carrier(2) mat_of_rows_carrier(3))
[PROOF STATE]
proof (state)
this:
H1 \<in> carrier_mat m n

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have H2: "H2 \<in> carrier_mat m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H2 \<in> carrier_mat m n
[PROOF STEP]
using sound_HNF P2_H2
[PROOF STATE]
proof (prove)
using this:
is_sound_HNF HNF associates res
(P2, H2) = HNF (mat_of_rows n gs)

goal (1 subgoal):
 1. H2 \<in> carrier_mat m n
[PROOF STEP]
unfolding is_sound_HNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. let (P, H) = HNF A; m = dim_row A; n = dim_col A in P \<in> carrier_mat m m \<and> H \<in> carrier_mat m n \<and> invertible_mat P \<and> A = P * H \<and> Hermite_JNF associates res H
(P2, H2) = HNF (mat_of_rows n gs)

goal (1 subgoal):
 1. H2 \<in> carrier_mat m n
[PROOF STEP]
by (metis (no_types, lifting) len_gs case_prodD mat_of_rows_carrier(2) mat_of_rows_carrier(3))
[PROOF STATE]
proof (state)
this:
H2 \<in> carrier_mat m n

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have P2_H2: "P2 * H2 = mat_of_rows n gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 * H2 = mat_of_rows n gs
[PROOF STEP]
by (smt P2_H2 sound_HNF case_prodD is_sound_HNF_def)
[PROOF STATE]
proof (state)
this:
P2 * H2 = mat_of_rows n gs

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
have P1_H1_fs: "P1 * H1 = mat_of_rows n fs_init"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 * H1 = mat_of_rows n fs_init
[PROOF STEP]
by (smt P1_H1 sound_HNF case_prodD is_sound_HNF_def)
[PROOF STATE]
proof (state)
this:
P1 * H1 = mat_of_rows n fs_init

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
obtain inv_P1 where P1_inv_P1: "inverts_mat P1 inv_P1" and inv_P1_P1: "inverts_mat inv_P1 P1"
    and inv_P1: "inv_P1 \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>inv_P1. \<lbrakk>inverts_mat P1 inv_P1; inverts_mat inv_P1 P1; inv_P1 \<in> carrier_mat m m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using P1 invertible_P1 obtain_inverse_matrix
[PROOF STATE]
proof (prove)
using this:
P1 \<in> carrier_mat m m
invertible_mat P1
\<lbrakk>?A \<in> carrier_mat ?n ?n; invertible_mat ?A; \<And>B. \<lbrakk>inverts_mat ?A B; inverts_mat B ?A; B \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>inv_P1. \<lbrakk>inverts_mat P1 inv_P1; inverts_mat inv_P1 P1; inv_P1 \<in> carrier_mat m m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inverts_mat P1 inv_P1
inverts_mat inv_P1 P1
inv_P1 \<in> carrier_mat m m

goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
show "LLL_with_assms n m gs \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LLL_with_assms n m gs \<alpha>
[PROOF STEP]
proof (rule LLL_change_basis(2)[OF gs len_gs])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. ?U1.0 \<in> carrier_mat m m
 2. ?U2.0 \<in> carrier_mat m m
 3. mat_of_rows n fs_init = ?U1.0 * mat_of_rows n gs
 4. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
show "P1 * inv_P2 \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 * inv_P2 \<in> carrier_mat m m
[PROOF STEP]
using P1 inv_P2
[PROOF STATE]
proof (prove)
using this:
P1 \<in> carrier_mat m m
inv_P2 \<in> carrier_mat m m

goal (1 subgoal):
 1. P1 * inv_P2 \<in> carrier_mat m m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P1 * inv_P2 \<in> carrier_mat m m

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
have "mat_of_rows n fs_init = P1 * H1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows n fs_init = P1 * H1
[PROOF STEP]
using sound_HNF P2_H2
[PROOF STATE]
proof (prove)
using this:
is_sound_HNF HNF associates res
P2 * H2 = mat_of_rows n gs

goal (1 subgoal):
 1. mat_of_rows n fs_init = P1 * H1
[PROOF STEP]
unfolding is_sound_HNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. let (P, H) = HNF A; m = dim_row A; n = dim_col A in P \<in> carrier_mat m m \<and> H \<in> carrier_mat m n \<and> invertible_mat P \<and> A = P * H \<and> Hermite_JNF associates res H
P2 * H2 = mat_of_rows n gs

goal (1 subgoal):
 1. mat_of_rows n fs_init = P1 * H1
[PROOF STEP]
by (metis (mono_tags, lifting) P1_H1 case_prodD)
[PROOF STATE]
proof (state)
this:
mat_of_rows n fs_init = P1 * H1

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_rows n fs_init = P1 * H1

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P1 * inv_P2 * P2 * H1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 * H1 = P1 * inv_P2 * P2 * H1
[PROOF STEP]
by (smt P1 P2 assoc_mult_mat carrier_matD(1) inv_P2 inv_P2_P2 inverts_mat_def right_mult_one_mat)
[PROOF STATE]
proof (state)
this:
P1 * H1 = P1 * inv_P2 * P2 * H1

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P1 * H1 = P1 * inv_P2 * P2 * H1

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P1 * inv_P2 * P2 * H2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 * inv_P2 * P2 * H1 = P1 * inv_P2 * P2 * H2
[PROOF STEP]
using H1_H2
[PROOF STATE]
proof (prove)
using this:
H1 = H2

goal (1 subgoal):
 1. P1 * inv_P2 * P2 * H1 = P1 * inv_P2 * P2 * H2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P1 * inv_P2 * P2 * H1 = P1 * inv_P2 * P2 * H2

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P1 * inv_P2 * P2 * H1 = P1 * inv_P2 * P2 * H2

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P1 * inv_P2 * (P2 * H2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 * inv_P2 * P2 * H2 = P1 * inv_P2 * (P2 * H2)
[PROOF STEP]
using H2 P2 \<open>P1 * inv_P2 \<in> carrier_mat m m\<close> assoc_mult_mat
[PROOF STATE]
proof (prove)
using this:
H2 \<in> carrier_mat m n
P2 \<in> carrier_mat m m
P1 * inv_P2 \<in> carrier_mat m m
\<lbrakk>?A \<in> carrier_mat ?n\<^sub>1 ?n\<^sub>2; ?B \<in> carrier_mat ?n\<^sub>2 ?n\<^sub>3; ?C \<in> carrier_mat ?n\<^sub>3 ?n\<^sub>4\<rbrakk> \<Longrightarrow> ?A * ?B * ?C = ?A * (?B * ?C)

goal (1 subgoal):
 1. P1 * inv_P2 * P2 * H2 = P1 * inv_P2 * (P2 * H2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P1 * inv_P2 * P2 * H2 = P1 * inv_P2 * (P2 * H2)

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P1 * inv_P2 * P2 * H2 = P1 * inv_P2 * (P2 * H2)

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P1 * (inv_P2 * P2 * H2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 * inv_P2 * (P2 * H2) = P1 * (inv_P2 * P2 * H2)
[PROOF STEP]
by (metis H2 \<open>P1 * H1 = P1 * inv_P2 * P2 * H1\<close> \<open>P1 * inv_P2 * P2 * H2 = P1 * inv_P2 * (P2 * H2)\<close>
          H1_H2 carrier_matD(1) inv_P2 inv_P2_P2 inverts_mat_def left_mult_one_mat)
[PROOF STATE]
proof (state)
this:
P1 * inv_P2 * (P2 * H2) = P1 * (inv_P2 * P2 * H2)

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P1 * inv_P2 * (P2 * H2) = P1 * (inv_P2 * P2 * H2)

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P1 * (inv_P2 * (P2 * H2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 * (inv_P2 * P2 * H2) = P1 * (inv_P2 * (P2 * H2))
[PROOF STEP]
using H2 P2 inv_P2
[PROOF STATE]
proof (prove)
using this:
H2 \<in> carrier_mat m n
P2 \<in> carrier_mat m m
inv_P2 \<in> carrier_mat m m

goal (1 subgoal):
 1. P1 * (inv_P2 * P2 * H2) = P1 * (inv_P2 * (P2 * H2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P1 * (inv_P2 * P2 * H2) = P1 * (inv_P2 * (P2 * H2))

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P1 * (inv_P2 * P2 * H2) = P1 * (inv_P2 * (P2 * H2))

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
have "... =  P1 * inv_P2 * mat_of_rows n gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P1 * (inv_P2 * (P2 * H2)) = P1 * inv_P2 * mat_of_rows n gs
[PROOF STEP]
using P2_H2 \<open>P1 * (inv_P2 * P2 * H2) = P1 * (inv_P2 * (P2 * H2))\<close>
        \<open>P1 * inv_P2 * (P2 * H2) = P1 * (inv_P2 * P2 * H2)\<close>
[PROOF STATE]
proof (prove)
using this:
P2 * H2 = mat_of_rows n gs
P1 * (inv_P2 * P2 * H2) = P1 * (inv_P2 * (P2 * H2))
P1 * inv_P2 * (P2 * H2) = P1 * (inv_P2 * P2 * H2)

goal (1 subgoal):
 1. P1 * (inv_P2 * (P2 * H2)) = P1 * inv_P2 * mat_of_rows n gs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P1 * (inv_P2 * (P2 * H2)) = P1 * inv_P2 * mat_of_rows n gs

goal (3 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
 3. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
[PROOF STEP]
show "mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs"
[PROOF STATE]
proof (prove)
using this:
mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs

goal (1 subgoal):
 1. mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mat_of_rows n fs_init = P1 * inv_P2 * mat_of_rows n gs

goal (2 subgoals):
 1. ?U2.0 \<in> carrier_mat m m
 2. mat_of_rows n gs = ?U2.0 * mat_of_rows n fs_init
[PROOF STEP]
show "P2 * inv_P1 \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 * inv_P1 \<in> carrier_mat m m
[PROOF STEP]
using P2 inv_P1
[PROOF STATE]
proof (prove)
using this:
P2 \<in> carrier_mat m m
inv_P1 \<in> carrier_mat m m

goal (1 subgoal):
 1. P2 * inv_P1 \<in> carrier_mat m m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P2 * inv_P1 \<in> carrier_mat m m

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
have "mat_of_rows n gs = P2 * H2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows n gs = P2 * H2
[PROOF STEP]
using sound_HNF P2_H2
[PROOF STATE]
proof (prove)
using this:
is_sound_HNF HNF associates res
P2 * H2 = mat_of_rows n gs

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * H2
[PROOF STEP]
unfolding is_sound_HNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. let (P, H) = HNF A; m = dim_row A; n = dim_col A in P \<in> carrier_mat m m \<and> H \<in> carrier_mat m n \<and> invertible_mat P \<and> A = P * H \<and> Hermite_JNF associates res H
P2 * H2 = mat_of_rows n gs

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * H2
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mat_of_rows n gs = P2 * H2

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_rows n gs = P2 * H2

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P2 * inv_P1 * P1 * H2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 * H2 = P2 * inv_P1 * P1 * H2
[PROOF STEP]
by (smt P1 P2 assoc_mult_mat carrier_matD(1) inv_P1 inv_P1_P1 inverts_mat_def right_mult_one_mat)
[PROOF STATE]
proof (state)
this:
P2 * H2 = P2 * inv_P1 * P1 * H2

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P2 * H2 = P2 * inv_P1 * P1 * H2

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P2 * inv_P1 * P1 * H1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 * inv_P1 * P1 * H2 = P2 * inv_P1 * P1 * H1
[PROOF STEP]
using H1_H2
[PROOF STATE]
proof (prove)
using this:
H1 = H2

goal (1 subgoal):
 1. P2 * inv_P1 * P1 * H2 = P2 * inv_P1 * P1 * H1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P2 * inv_P1 * P1 * H2 = P2 * inv_P1 * P1 * H1

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P2 * inv_P1 * P1 * H2 = P2 * inv_P1 * P1 * H1

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P2 * inv_P1 * (P1 * H1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 * inv_P1 * P1 * H1 = P2 * inv_P1 * (P1 * H1)
[PROOF STEP]
using H1 P1 \<open>P2 * inv_P1 \<in> carrier_mat m m\<close> assoc_mult_mat
[PROOF STATE]
proof (prove)
using this:
H1 \<in> carrier_mat m n
P1 \<in> carrier_mat m m
P2 * inv_P1 \<in> carrier_mat m m
\<lbrakk>?A \<in> carrier_mat ?n\<^sub>1 ?n\<^sub>2; ?B \<in> carrier_mat ?n\<^sub>2 ?n\<^sub>3; ?C \<in> carrier_mat ?n\<^sub>3 ?n\<^sub>4\<rbrakk> \<Longrightarrow> ?A * ?B * ?C = ?A * (?B * ?C)

goal (1 subgoal):
 1. P2 * inv_P1 * P1 * H1 = P2 * inv_P1 * (P1 * H1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P2 * inv_P1 * P1 * H1 = P2 * inv_P1 * (P1 * H1)

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P2 * inv_P1 * P1 * H1 = P2 * inv_P1 * (P1 * H1)

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P2 * (inv_P1 * P1 * H1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 * inv_P1 * (P1 * H1) = P2 * (inv_P1 * P1 * H1)
[PROOF STEP]
by (metis H2 \<open>P2 * H2 = P2 * inv_P1 * P1 * H2\<close> \<open>P2 * inv_P1 * P1 * H1 = P2 * inv_P1 * (P1 * H1)\<close>
          H1_H2 carrier_matD(1) inv_P1 inv_P1_P1 inverts_mat_def left_mult_one_mat)
[PROOF STATE]
proof (state)
this:
P2 * inv_P1 * (P1 * H1) = P2 * (inv_P1 * P1 * H1)

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P2 * inv_P1 * (P1 * H1) = P2 * (inv_P1 * P1 * H1)

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
have "... = P2 * (inv_P1 * (P1 * H1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 * (inv_P1 * P1 * H1) = P2 * (inv_P1 * (P1 * H1))
[PROOF STEP]
using H1 P1 inv_P1
[PROOF STATE]
proof (prove)
using this:
H1 \<in> carrier_mat m n
P1 \<in> carrier_mat m m
inv_P1 \<in> carrier_mat m m

goal (1 subgoal):
 1. P2 * (inv_P1 * P1 * H1) = P2 * (inv_P1 * (P1 * H1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P2 * (inv_P1 * P1 * H1) = P2 * (inv_P1 * (P1 * H1))

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P2 * (inv_P1 * P1 * H1) = P2 * (inv_P1 * (P1 * H1))

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
have "... =  P2 * inv_P1 * mat_of_rows n fs_init"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P2 * (inv_P1 * (P1 * H1)) = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
using P1_H1_fs \<open>P2 * (inv_P1 * P1 * H1) = P2 * (inv_P1 * (P1 * H1))\<close>
        \<open>P2 * inv_P1 * (P1 * H1) = P2 * (inv_P1 * P1 * H1)\<close>
[PROOF STATE]
proof (prove)
using this:
P1 * H1 = mat_of_rows n fs_init
P2 * (inv_P1 * P1 * H1) = P2 * (inv_P1 * (P1 * H1))
P2 * inv_P1 * (P1 * H1) = P2 * (inv_P1 * P1 * H1)

goal (1 subgoal):
 1. P2 * (inv_P1 * (P1 * H1)) = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P2 * (inv_P1 * (P1 * H1)) = P2 * inv_P1 * mat_of_rows n fs_init

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
show "mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init"
[PROOF STATE]
proof (prove)
using this:
mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init

goal (1 subgoal):
 1. mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mat_of_rows n gs = P2 * inv_P1 * mat_of_rows n fs_init

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LLL_with_assms n m gs \<alpha>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tup_hat_content:
  assumes "tup \<in> gamma_set"
  assumes "tup x = HAT a"
  shows "a \<in> \<Gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> \<Gamma>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<in> \<Gamma>
[PROOF STEP]
have "range tup \<subseteq> NO_HAT ` \<Gamma> \<union> HAT ` \<Gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range tup \<subseteq> NO_HAT ` \<Gamma> \<union> HAT ` \<Gamma>
[PROOF STEP]
using assms gamma_set_def
[PROOF STATE]
proof (prove)
using this:
tup \<in> gamma_set
tup x = HAT a
gamma_set = UNIV \<rightarrow> NO_HAT ` \<Gamma> \<union> HAT ` \<Gamma>

goal (1 subgoal):
 1. range tup \<subseteq> NO_HAT ` \<Gamma> \<union> HAT ` \<Gamma>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range tup \<subseteq> NO_HAT ` \<Gamma> \<union> HAT ` \<Gamma>

goal (1 subgoal):
 1. a \<in> \<Gamma>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
range tup \<subseteq> NO_HAT ` \<Gamma> \<union> HAT ` \<Gamma>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
range tup \<subseteq> NO_HAT ` \<Gamma> \<union> HAT ` \<Gamma>

goal (1 subgoal):
 1. a \<in> \<Gamma>
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
range tup \<subseteq> NO_HAT ` \<Gamma> \<union> HAT ` \<Gamma>
tup x = HAT a

goal (1 subgoal):
 1. a \<in> \<Gamma>
[PROOF STEP]
by (metis UNIV_I Un_iff image_iff image_subset_iff tuple_symbol.distinct(1) tuple_symbol.inject(2))
[PROOF STATE]
proof (state)
this:
a \<in> \<Gamma>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Integral_mult:
     "[| a \<le> b; Integral(a,b) f k |] ==> Integral(a,b) (%x. c * f x) (c * k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; Integral (a, b) f k\<rbrakk> \<Longrightarrow> Integral (a, b) (\<lambda>x. c * f x) (c * k)
[PROOF STEP]
apply (auto simp add: order_le_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Integral (a, b) f k; a < b\<rbrakk> \<Longrightarrow> Integral (a, b) (\<lambda>x. c * f x) (c * k)
[PROOF STEP]
apply (cases "c = 0", simp add: Integral_zero_fun)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Integral (a, b) f k; a < b; c \<noteq> 0\<rbrakk> \<Longrightarrow> Integral (a, b) (\<lambda>x. c * f x) (c * k)
[PROOF STEP]
apply (rule IntegralI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>Integral (a, b) f k; a < b; c \<noteq> 0; 0 < e\<rbrakk> \<Longrightarrow> \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D (\<lambda>x. c * f x) - c * k\<bar> < e)
[PROOF STEP]
apply (erule_tac e="e / \<bar>c\<bar>" in IntegralE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e \<delta>. \<lbrakk>a < b; c \<noteq> 0; 0 < e; gauge {a..b} \<delta>; \<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e / \<bar>c\<bar>\<rbrakk> \<Longrightarrow> \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D (\<lambda>x. c * f x) - c * k\<bar> < e)
[PROOF STEP]
apply (rule_tac x="\<delta>" in exI, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e \<delta> D. \<lbrakk>a < b; c \<noteq> 0; 0 < e; gauge {a..b} \<delta>; \<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e / \<bar>c\<bar>; fine \<delta> (a, b) D\<rbrakk> \<Longrightarrow> \<bar>rsum D (\<lambda>x. c * f x) - c * k\<bar> < e
[PROOF STEP]
apply (drule_tac x="D" in spec, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e \<delta> D. \<lbrakk>a < b; c \<noteq> 0; 0 < e; gauge {a..b} \<delta>; fine \<delta> (a, b) D; \<bar>rsum D f - k\<bar> < e / \<bar>c\<bar>\<rbrakk> \<Longrightarrow> \<bar>rsum D (\<lambda>x. c * f x) - c * k\<bar> < e
[PROOF STEP]
apply (simp add: pos_less_divide_eq abs_mult [symmetric]
                 algebra_simps rsum_right_distrib)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cr_scalar_right_total[transfer_rule]:
  assumes "right_total R"
  shows "right_total (cr_scalar R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_total (cr_scalar R)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
right_total R

goal (1 subgoal):
 1. right_total (cr_scalar R)
[PROOF STEP]
unfolding cr_scalar_def right_total_def
[PROOF STATE]
proof (prove)
using this:
\<forall>y. \<exists>x. R x y

goal (1 subgoal):
 1. \<forall>y. \<exists>x a. x = [a]\<^sub>\<circ> \<and> R a y
[PROOF STEP]
by simp


[STATEMENT]
lemma rel_fun_comp:
  "\<And>f g h. rel_fun A B (f \<circ> g) h = rel_fun A (\<lambda>x. B (f x)) g h"
  "\<And>f g h. rel_fun A B f (g \<circ> h) = rel_fun A (\<lambda>x y. B x (g y)) f h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g h. rel_fun A B (f \<circ> g) h = rel_fun A (\<lambda>x. B (f x)) g h) &&& (\<And>f g h. rel_fun A B f (g \<circ> h) = rel_fun A (\<lambda>x y. B x (g y)) f h)
[PROOF STEP]
by(auto simp add: rel_fun_def)


[STATEMENT]
lemma uminus_l_inv_mat[simp]:
  "(A :: 'a :: group_add mat) \<in> carrier_mat nr nc \<Longrightarrow> (- A + A) = 0\<^sub>m nr nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat nr nc \<Longrightarrow> - A + A = 0\<^sub>m nr nc
[PROOF STEP]
by (intro eq_matI, auto)


[STATEMENT]
lemma wand_elim: "(P -* Q) * (Q -* R) \<Longrightarrow>\<^sub>A (P -* R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P -* Q) * (Q -* R) \<Longrightarrow>\<^sub>A P -* R
[PROOF STEP]
by (metis ent_wand ent_frame_fwd ent_mp ent_refl star_assoc)


[STATEMENT]
lemma coeff_minus [simp]: "coeff (- p) n = - coeff p n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (- p) n = - coeff p n
[PROOF STEP]
by (simp add: uminus_poly.rep_eq)


[STATEMENT]
lemma div_is_floor_divide_rat: "n div y = \<lfloor>rat_of_int n / rat_of_int y\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div y = \<lfloor>rat_of_int n / rat_of_int y\<rfloor>
[PROOF STEP]
unfolding Fract_of_int_quotient[symmetric] floor_Fract
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div y = n div y
[PROOF STEP]
by simp


[STATEMENT]
lemma GrD1: "(x, fx) \<in> Gr A f \<Longrightarrow> x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, fx) \<in> Gr A f \<Longrightarrow> x \<in> A
[PROOF STEP]
unfolding Gr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, fx) \<in> {(a, f a) |a. a \<in> A} \<Longrightarrow> x \<in> A
[PROOF STEP]
by simp


[STATEMENT]
lemma is_red_map_scale_iff: "is_red F (c \<cdot> p) \<longleftrightarrow> (c \<noteq> 0 \<and> is_red F p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_red F (c \<cdot> p) = (c \<noteq> (0::'b) \<and> is_red F p)
[PROOF STEP]
proof (intro iffI conjI notI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>is_red F (c \<cdot> p); c = (0::'b)\<rbrakk> \<Longrightarrow> False
 2. is_red F (c \<cdot> p) \<Longrightarrow> is_red F p
 3. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
assume "is_red F (c \<cdot> p)" and "c = 0"
[PROOF STATE]
proof (state)
this:
is_red F (c \<cdot> p)
c = (0::'b)

goal (3 subgoals):
 1. \<lbrakk>is_red F (c \<cdot> p); c = (0::'b)\<rbrakk> \<Longrightarrow> False
 2. is_red F (c \<cdot> p) \<Longrightarrow> is_red F p
 3. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
is_red F (c \<cdot> p)
c = (0::'b)

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

goal (2 subgoals):
 1. is_red F (c \<cdot> p) \<Longrightarrow> is_red F p
 2. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_red F (c \<cdot> p) \<Longrightarrow> is_red F p
 2. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
assume "is_red F (c \<cdot> p)"
[PROOF STATE]
proof (state)
this:
is_red F (c \<cdot> p)

goal (2 subgoals):
 1. is_red F (c \<cdot> p) \<Longrightarrow> is_red F p
 2. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
thus "is_red F p"
[PROOF STATE]
proof (prove)
using this:
is_red F (c \<cdot> p)

goal (1 subgoal):
 1. is_red F p
[PROOF STEP]
by (rule is_red_map_scale)
[PROOF STATE]
proof (state)
this:
is_red F p

goal (1 subgoal):
 1. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
assume "c \<noteq> 0 \<and> is_red F p"
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'b) \<and> is_red F p

goal (1 subgoal):
 1. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
hence "is_red F (inverse c \<cdot> c \<cdot> p)"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<and> is_red F p

goal (1 subgoal):
 1. is_red F (inverse c \<cdot> c \<cdot> p)
[PROOF STEP]
by (simp add: map_scale_assoc)
[PROOF STATE]
proof (state)
this:
is_red F (inverse c \<cdot> c \<cdot> p)

goal (1 subgoal):
 1. c \<noteq> (0::'b) \<and> is_red F p \<Longrightarrow> is_red F (c \<cdot> p)
[PROOF STEP]
thus "is_red F (c \<cdot> p)"
[PROOF STATE]
proof (prove)
using this:
is_red F (inverse c \<cdot> c \<cdot> p)

goal (1 subgoal):
 1. is_red F (c \<cdot> p)
[PROOF STEP]
by (rule is_red_map_scale)
[PROOF STATE]
proof (state)
this:
is_red F (c \<cdot> p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arc_to_ends_to_block: "arc_to_block e = {x, y} \<Longrightarrow>
  arc_to_ends G e = (x, y) \<or> arc_to_ends G e = (y, x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arc_to_block e = {x, y} \<Longrightarrow> arc_to_ends G e = (x, y) \<or> arc_to_ends G e = (y, x)
[PROOF STEP]
by (metis arc_to_block_def arc_to_ends_def doubleton_eq_iff)


[STATEMENT]
lemma nummul_nb: "numbound0 t \<Longrightarrow> numbound0 (nummul i t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numbound0 t \<Longrightarrow> numbound0 (nummul i t)
[PROOF STEP]
by (induct t arbitrary: i rule: nummul.induct) (simp_all add: numadd_nb)


[STATEMENT]
lemma pderiv_0 [simp]: "pderiv 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv 0 = 0
[PROOF STEP]
using pderiv.simps [of 0 0]
[PROOF STATE]
proof (prove)
using this:
pderiv [:0::?'b1:] = (if 0 = 0 then 0 else 0 + pCons (0::?'b1) (pderiv 0))

goal (1 subgoal):
 1. pderiv 0 = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma strassen_cost_pos: "n \<ge> 1 \<Longrightarrow> strassen_cost n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> n \<Longrightarrow> 0 < strassen_cost n
[PROOF STEP]
by (cases n rule: strassen_cost.cases) (simp_all add: add_nonneg_pos del: One_nat_def)


[STATEMENT]
lemma zpos_nat:"0 \<le> (z::int) \<Longrightarrow> \<exists>n. z = int n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> z \<Longrightarrow> \<exists>n. z = int n
[PROOF STEP]
apply (subgoal_tac "z = int (nat z)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 \<le> z; z = int (nat z)\<rbrakk> \<Longrightarrow> \<exists>n. z = int n
 2. 0 \<le> z \<Longrightarrow> z = int (nat z)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> z \<Longrightarrow> z = int (nat z)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nths_cut_less_eq: "
  length xs \<le> n \<Longrightarrow> nths xs (I \<down>< n) = nths xs I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> n \<Longrightarrow> nths xs (I \<down>< n) = nths xs I
[PROOF STEP]
apply (simp add: nths_def cut_less_mem_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> n \<Longrightarrow> map fst (filter (\<lambda>p. snd p \<in> I \<and> snd p < n) (zip xs [0..<length xs])) = map fst (filter (\<lambda>p. snd p \<in> I) (zip xs [0..<length xs]))
[PROOF STEP]
apply (rule_tac f="\<lambda>xs. map fst xs" in arg_cong)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> n \<Longrightarrow> filter (\<lambda>p. snd p \<in> I \<and> snd p < n) (zip xs [0..<length xs]) = filter (\<lambda>p. snd p \<in> I) (zip xs [0..<length xs])
[PROOF STEP]
apply (rule filter_filter_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> n \<Longrightarrow> list_all (\<lambda>x. (snd x \<in> I \<and> snd x < n) = (snd x \<in> I)) (zip xs [0..<length xs])
[PROOF STEP]
apply (simp add: list_all_conv)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dg_FUNCT_is_arrI':
  assumes "\<NN>' = ntcf_arrow \<NN>"
    and "\<NN> : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
    and "\<FF>' = cf_map \<FF>"
    and "\<GG>' = cf_map \<GG>"
  shows "\<NN>' : \<FF>' \<mapsto>\<^bsub>dg_FUNCT \<alpha> \<AA> \<BB>\<^esub> \<GG>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<NN>' : \<FF>' \<mapsto>\<^bsub>dg_FUNCT \<alpha> \<AA> \<BB>\<^esub> \<GG>'
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<NN> : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. \<NN>' : \<FF>' \<mapsto>\<^bsub>dg_FUNCT \<alpha> \<AA> \<BB>\<^esub> \<GG>'
[PROOF STEP]
unfolding assms(1,3,4)
[PROOF STATE]
proof (prove)
using this:
\<NN> : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. ntcf_arrow \<NN> : cf_map \<FF> \<mapsto>\<^bsub>dg_FUNCT \<alpha> \<AA> \<BB>\<^esub> cf_map \<GG>
[PROOF STEP]
by (rule dg_FUNCT_is_arrI)


[STATEMENT]
lemma finsum_index:
  assumes i: "i < n"
    and f: "f \<in> A \<rightarrow> carrier_vec n"
    and A: "A \<subseteq> carrier_vec n"
  shows "finsum V f A $ i = sum (\<lambda>x. f x $ i) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
[PROOF STEP]
using A f
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier_vec n
f \<in> A \<rightarrow> carrier_vec n

goal (1 subgoal):
 1. finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
[PROOF STEP]
proof (induct A rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
 2. \<lbrakk>{} \<subseteq> carrier_vec n; f \<in> {} \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f {} $v i = (\<Sum>x\<in>{}. f x $v i)
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f F $v i = (\<Sum>x\<in>F. f x $v i); insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f (insert x F) $v i = (\<Sum>x\<in>insert x F. f x $v i)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
{} \<subseteq> carrier_vec n
f \<in> {} \<rightarrow> carrier_vec n

goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
 2. \<lbrakk>{} \<subseteq> carrier_vec n; f \<in> {} \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f {} $v i = (\<Sum>x\<in>{}. f x $v i)
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f F $v i = (\<Sum>x\<in>F. f x $v i); insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f (insert x F) $v i = (\<Sum>x\<in>insert x F. f x $v i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{} \<subseteq> carrier_vec n
f \<in> {} \<rightarrow> carrier_vec n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> carrier_vec n
f \<in> {} \<rightarrow> carrier_vec n

goal (1 subgoal):
 1. finsum V f {} $v i = (\<Sum>x\<in>{}. f x $v i)
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> carrier_vec n
f \<in> {} \<rightarrow> carrier_vec n
i < n

goal (1 subgoal):
 1. finsum V f {} $v i = (\<Sum>x\<in>{}. f x $v i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finsum V f {} $v i = (\<Sum>x\<in>{}. f x $v i)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f F $v i = (\<Sum>x\<in>F. f x $v i); insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f (insert x F) $v i = (\<Sum>x\<in>insert x F. f x $v i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f F $v i = (\<Sum>x\<in>F. f x $v i); insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f (insert x F) $v i = (\<Sum>x\<in>insert x F. f x $v i)
[PROOF STEP]
case (insert x X)
[PROOF STATE]
proof (state)
this:
finite X
x \<notin> X
\<lbrakk>X \<subseteq> carrier_vec n; f \<in> X \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f X $v i = (\<Sum>x\<in>X. f x $v i)
insert x X \<subseteq> carrier_vec n
f \<in> insert x X \<rightarrow> carrier_vec n

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f F $v i = (\<Sum>x\<in>F. f x $v i); insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f (insert x F) $v i = (\<Sum>x\<in>insert x F. f x $v i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite X
x \<notin> X
\<lbrakk>X \<subseteq> carrier_vec n; f \<in> X \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f X $v i = (\<Sum>x\<in>X. f x $v i)
insert x X \<subseteq> carrier_vec n
f \<in> insert x X \<rightarrow> carrier_vec n
[PROOF STEP]
have Xf: "finite X"
      and xX: "x \<notin> X"
      and x: "x \<in> carrier_vec n"
      and X: "X \<subseteq> carrier_vec n"
      and fx: "f x \<in> carrier_vec n"
      and f: "f \<in> X \<rightarrow> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
finite X
x \<notin> X
\<lbrakk>X \<subseteq> carrier_vec n; f \<in> X \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f X $v i = (\<Sum>x\<in>X. f x $v i)
insert x X \<subseteq> carrier_vec n
f \<in> insert x X \<rightarrow> carrier_vec n

goal (1 subgoal):
 1. (finite X &&& x \<notin> X &&& x \<in> carrier_vec n) &&& X \<subseteq> carrier_vec n &&& f x \<in> carrier_vec n &&& f \<in> X \<rightarrow> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite X
x \<notin> X
x \<in> carrier_vec n
X \<subseteq> carrier_vec n
f x \<in> carrier_vec n
f \<in> X \<rightarrow> carrier_vec n

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f F $v i = (\<Sum>x\<in>F. f x $v i); insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f (insert x F) $v i = (\<Sum>x\<in>insert x F. f x $v i)
[PROOF STEP]
have i2: "i < dim_vec (finsum V f X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec (finsum V f X)
[PROOF STEP]
using i finsum_closed[OF f]
[PROOF STATE]
proof (prove)
using this:
i < n
finsum V f X \<in> carrier_vec n

goal (1 subgoal):
 1. i < dim_vec (finsum V f X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < dim_vec (finsum V f X)

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f F $v i = (\<Sum>x\<in>F. f x $v i); insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f (insert x F) $v i = (\<Sum>x\<in>insert x F. f x $v i)
[PROOF STEP]
have ix: "i < dim_vec x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec x
[PROOF STEP]
using x i
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier_vec n
i < n

goal (1 subgoal):
 1. i < dim_vec x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < dim_vec x

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f F $v i = (\<Sum>x\<in>F. f x $v i); insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f (insert x F) $v i = (\<Sum>x\<in>insert x F. f x $v i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum V f (insert x X) $v i = (\<Sum>x\<in>insert x X. f x $v i)
[PROOF STEP]
unfolding finsum_insert[OF Xf xX f fx]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f x + finsum V f X) $v i = (\<Sum>x\<in>insert x X. f x $v i)
[PROOF STEP]
unfolding sum.insert[OF Xf xX]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f x + finsum V f X) $v i = f x $v i + (\<Sum>x\<in>X. f x $v i)
[PROOF STEP]
unfolding index_add_vec(1)[OF i2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x $v i + finsum V f X $v i = f x $v i + (\<Sum>x\<in>X. f x $v i)
[PROOF STEP]
using insert lincomb_def
[PROOF STATE]
proof (prove)
using this:
finite X
x \<notin> X
\<lbrakk>X \<subseteq> carrier_vec n; f \<in> X \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f X $v i = (\<Sum>x\<in>X. f x $v i)
insert x X \<subseteq> carrier_vec n
f \<in> insert x X \<rightarrow> carrier_vec n
lincomb ?a ?A = (\<Oplus>\<^bsub>V\<^esub>v\<in>?A. ?a v \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. f x $v i + finsum V f X $v i = f x $v i + (\<Sum>x\<in>X. f x $v i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finsum V f (insert x X) $v i = (\<Sum>x\<in>insert x X. f x $v i)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>infinite A; A \<subseteq> carrier_vec n; f \<in> A \<rightarrow> carrier_vec n\<rbrakk> \<Longrightarrow> finsum V f A $v i = (\<Sum>x\<in>A. f x $v i)
[PROOF STEP]
qed (insert i, auto)


[STATEMENT]
lemma inv_Z_imp_inv_Q:
  fixes A :: "int^'n::mod_type^'n::mod_type"
  assumes inv_A: "invertible A"
  shows "invertible (map_matrix rat_of_int A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (map_matrix rat_of_int A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible (map_matrix rat_of_int A)
[PROOF STEP]
have "is_unit (det A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (det A)
[PROOF STEP]
using inv_A invertible_iff_is_unit
[PROOF STATE]
proof (prove)
using this:
invertible A
invertible ?A = (det ?A dvd (1::?'a))

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

goal (1 subgoal):
 1. invertible (map_matrix rat_of_int A)
[PROOF STEP]
hence "is_unit (det (map_matrix rat_of_int A))"
[PROOF STATE]
proof (prove)
using this:
is_unit (det A)

goal (1 subgoal):
 1. is_unit (det (map_matrix rat_of_int A))
[PROOF STEP]
by (simp add: det_map_matrix dvd_if_abs_eq)
[PROOF STATE]
proof (state)
this:
is_unit (det (map_matrix rat_of_int A))

goal (1 subgoal):
 1. invertible (map_matrix rat_of_int A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
is_unit (det (map_matrix rat_of_int A))

goal (1 subgoal):
 1. invertible (map_matrix rat_of_int A)
[PROOF STEP]
using invertible_iff_is_unit
[PROOF STATE]
proof (prove)
using this:
is_unit (det (map_matrix rat_of_int A))
invertible ?A = (det ?A dvd (1::?'a))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma right_unique_rel_pred: "right_total A \<Longrightarrow> right_unique (rel_pred A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_total A \<Longrightarrow> right_unique (rel_pred A)
[PROOF STEP]
unfolding rel_pred_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_total A \<Longrightarrow> right_unique (A ===> (=))
[PROOF STEP]
by (erule right_unique_fun) (rule right_unique_eq)


[STATEMENT]
lemma measure_measure_pmf_finite: "finite S \<Longrightarrow> measure (measure_pmf M) S = sum (pmf M) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> measure_pmf.prob M S = sum (pmf M) S
[PROOF STEP]
using emeasure_measure_pmf_finite[of S M]
[PROOF STATE]
proof (prove)
using this:
finite S \<Longrightarrow> emeasure (measure_pmf M) S = ennreal (sum (pmf M) S)

goal (1 subgoal):
 1. finite S \<Longrightarrow> measure_pmf.prob M S = sum (pmf M) S
[PROOF STEP]
by (simp add: measure_pmf.emeasure_eq_measure measure_nonneg sum_nonneg pmf_nonneg)


[STATEMENT]
lemma is_parser_length:
  assumes "is_parser p" and "p s = Inr (x, r)"
  shows "length s \<ge> length r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length r \<le> length s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_parser p
p s = Inr (x, r)

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


[STATEMENT]
lemma lrange_filter_sorted: "sorted_less (xs@x#ys) \<Longrightarrow>
  lrange_filter l (xs@x#ys) =
  (if l < x then (lrange_filter l xs)@x#ys else lrange_filter l (x#ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_less (xs @ x # ys) \<Longrightarrow> lrange_filter l (xs @ x # ys) = (if l < x then lrange_filter l xs @ x # ys else lrange_filter l (x # ys))
[PROOF STEP]
by (metis lrange_list_sorted sorted_less_lrange sorted_wrt_append)


[STATEMENT]
lemma (in Module) l_span_cont_H:"H \<subseteq> carrier M \<Longrightarrow>
                      H \<subseteq> linear_span R M (carrier R) H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<subseteq> carrier M \<Longrightarrow> H \<subseteq> linear_span R M (carrier R) H
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H\<rbrakk> \<Longrightarrow> x \<in> linear_span R M (carrier R) H
[PROOF STEP]
apply (cut_tac sc_Ring,
       cut_tac Ring.whole_ideal[of R])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H; Ring R; ideal R (carrier R)\<rbrakk> \<Longrightarrow> x \<in> linear_span R M (carrier R) H
 2. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H; Ring R\<rbrakk> \<Longrightarrow> Ring R
[PROOF STEP]
apply (frule_tac A = "carrier R" and H = H and a = "1\<^sub>r\<^bsub>R\<^esub>"
       and h = x in sc_linear_span, assumption+)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H; Ring R; ideal R (carrier R)\<rbrakk> \<Longrightarrow> 1\<^sub>r\<^bsub>R\<^esub> \<in> carrier R
 2. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H; Ring R; ideal R (carrier R)\<rbrakk> \<Longrightarrow> x \<in> H
 3. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H; Ring R; ideal R (carrier R); 1\<^sub>r\<^bsub>R\<^esub> \<cdot>\<^sub>s x \<in> linear_span R M (carrier R) H\<rbrakk> \<Longrightarrow> x \<in> linear_span R M (carrier R) H
 4. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H; Ring R\<rbrakk> \<Longrightarrow> Ring R
[PROOF STEP]
apply (simp add:Ring.ring_one, assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H; Ring R; ideal R (carrier R); 1\<^sub>r\<^bsub>R\<^esub> \<cdot>\<^sub>s x \<in> linear_span R M (carrier R) H\<rbrakk> \<Longrightarrow> x \<in> linear_span R M (carrier R) H
 2. \<And>x. \<lbrakk>H \<subseteq> carrier M; x \<in> H; Ring R\<rbrakk> \<Longrightarrow> Ring R
[PROOF STEP]
apply (frule_tac c = x in subsetD[of H "carrier M"], assumption+,
        simp add:sprod_one, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma basis_expansion_unique:
  "sum (\<lambda>i. f i *s axis (i::'n::finite) 1) UNIV = (x::('a::comm_ring_1) ^'n) \<longleftrightarrow> (\<forall>i. f i = x$i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) = x) = (\<forall>i. f i = x $ i)
[PROOF STEP]
proof (auto simp add: basis_expansion)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. x = (\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) \<Longrightarrow> f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
fix i::"'n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. x = (\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) \<Longrightarrow> f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
have univ_rw: "UNIV = (UNIV - {i}) \<union> {i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = UNIV - {i} \<union> {i}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
UNIV = UNIV - {i} \<union> {i}

goal (1 subgoal):
 1. \<And>i. x = (\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) \<Longrightarrow> f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
have "(\<Sum>x\<in>UNIV. f x * axis x 1 $ i) = sum (\<lambda>x.  f x * axis x 1 $ i) (UNIV - {i} \<union> {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i) = (\<Sum>x\<in>UNIV - {i} \<union> {i}. f x * axis x (1::'a) $ i)
[PROOF STEP]
using univ_rw
[PROOF STATE]
proof (prove)
using this:
UNIV = UNIV - {i} \<union> {i}

goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i) = (\<Sum>x\<in>UNIV - {i} \<union> {i}. f x * axis x (1::'a) $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i) = (\<Sum>x\<in>UNIV - {i} \<union> {i}. f x * axis x (1::'a) $ i)

goal (1 subgoal):
 1. \<And>i. x = (\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) \<Longrightarrow> f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i) = (\<Sum>x\<in>UNIV - {i} \<union> {i}. f x * axis x (1::'a) $ i)

goal (1 subgoal):
 1. \<And>i. x = (\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) \<Longrightarrow> f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
have "... = sum (\<lambda>x.  f x * axis x 1 $ i) (UNIV - {i}) +  sum (\<lambda>x.  f x * axis x 1 $ i) {i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV - {i} \<union> {i}. f x * axis x (1::'a) $ i) = (\<Sum>x\<in>UNIV - {i}. f x * axis x (1::'a) $ i) + (\<Sum>x\<in>{i}. f x * axis x (1::'a) $ i)
[PROOF STEP]
by (rule sum.union_disjoint, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV - {i} \<union> {i}. f x * axis x (1::'a) $ i) = (\<Sum>x\<in>UNIV - {i}. f x * axis x (1::'a) $ i) + (\<Sum>x\<in>{i}. f x * axis x (1::'a) $ i)

goal (1 subgoal):
 1. \<And>i. x = (\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) \<Longrightarrow> f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV - {i} \<union> {i}. f x * axis x (1::'a) $ i) = (\<Sum>x\<in>UNIV - {i}. f x * axis x (1::'a) $ i) + (\<Sum>x\<in>{i}. f x * axis x (1::'a) $ i)

goal (1 subgoal):
 1. \<And>i. x = (\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) \<Longrightarrow> f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
have "... = f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV - {i}. f x * axis x (1::'a) $ i) + (\<Sum>x\<in>{i}. f x * axis x (1::'a) $ i) = f i
[PROOF STEP]
unfolding axis_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>UNIV - {i}. f x * (\<chi>i. if i = x then 1::'a else (0::'a)) $ i) + (\<Sum>x\<in>{i}. f x * (\<chi>i. if i = x then 1::'a else (0::'a)) $ i) = f i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>UNIV - {i}. f x * axis x (1::'a) $ i) + (\<Sum>x\<in>{i}. f x * axis x (1::'a) $ i) = f i

goal (1 subgoal):
 1. \<And>i. x = (\<Sum>i\<in>UNIV. f i *s axis i (1::'a)) \<Longrightarrow> f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i) = f i
[PROOF STEP]
show "f i = (\<Sum>x\<in>UNIV. f x * axis x 1 $ i)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i) = f i

goal (1 subgoal):
 1. f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
f i = (\<Sum>x\<in>UNIV. f x * axis x (1::'a) $ i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_node_impl[code]: "max_node l = fold (\<lambda>(u,_,w) x. max u (max w x)) l 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_node l = fold (\<lambda>(u, uu_, w) x. max u (max w x)) l (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. max_node l = fold (\<lambda>(u, uu_, w) x. max u (max w x)) l (0::'a)
[PROOF STEP]
have "fold (\<lambda>(u,_,w) x. max u (max w x)) l a = Max (insert a (fst`set l \<union> (snd o snd)`set l))" for a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>(u, uu_, w) x. max u (max w x)) l a = Max (insert a (fst ` set l \<union> (snd \<circ> snd) ` set l))
[PROOF STEP]
apply (induction l arbitrary: a)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. fold (\<lambda>(u, uu_, w) x. max u (max w x)) [] a = Max (insert a (fst ` set [] \<union> (snd \<circ> snd) ` set []))
 2. \<And>a l aa. (\<And>a. fold (\<lambda>(u, uu_, w) x. max u (max w x)) l a = Max (insert a (fst ` set l \<union> (snd \<circ> snd) ` set l))) \<Longrightarrow> fold (\<lambda>(u, uu_, w) x. max u (max w x)) (a # l) aa = Max (insert aa (fst ` set (a # l) \<union> (snd \<circ> snd) ` set (a # l)))
[PROOF STEP]
apply (auto simp:  )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b l aa. (\<And>a. fold (\<lambda>(u, uu_, w) x. max u (max w x)) l a = Max (insert a (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l))) \<Longrightarrow> Max (insert (max a (max b aa)) (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l)) = max aa (max b (Max (insert a (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l))))
[PROOF STEP]
subgoal for a b l aa
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. fold (\<lambda>(u, uu_, w) x. max u (max w x)) l a = Max (insert a (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l))) \<Longrightarrow> Max (insert (max a (max b aa)) (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l)) = max aa (max b (Max (insert a (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l))))
[PROOF STEP]
apply (cases l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<And>a. fold (\<lambda>(u, uu_, w) x. max u (max w x)) l a = Max (insert a (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l)); l = []\<rbrakk> \<Longrightarrow> Max (insert (max a (max b aa)) (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l)) = max aa (max b (Max (insert a (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l))))
 2. \<And>a list. \<lbrakk>\<And>a. fold (\<lambda>(u, uu_, w) x. max u (max w x)) l a = Max (insert a (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l)); l = a # list\<rbrakk> \<Longrightarrow> Max (insert (max a (max b aa)) (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l)) = max aa (max b (Max (insert a (fst ` set l \<union> (\<lambda>x. snd (snd x)) ` set l))))
[PROOF STEP]
by (auto simp: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
fold (\<lambda>(u, uu_, w) x. max u (max w x)) l ?a = Max (insert ?a (fst ` set l \<union> (snd \<circ> snd) ` set l))

goal (1 subgoal):
 1. max_node l = fold (\<lambda>(u, uu_, w) x. max u (max w x)) l (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fold (\<lambda>(u, uu_, w) x. max u (max w x)) l ?a = Max (insert ?a (fst ` set l \<union> (snd \<circ> snd) ` set l))

goal (1 subgoal):
 1. max_node l = fold (\<lambda>(u, uu_, w) x. max u (max w x)) l (0::'a)
[PROOF STEP]
unfolding max_node_def
[PROOF STATE]
proof (prove)
using this:
fold (\<lambda>(u, uu_, w) x. max u (max w x)) l ?a = Max (insert ?a (fst ` set l \<union> (snd \<circ> snd) ` set l))

goal (1 subgoal):
 1. Max (insert (0::'a) (fst ` set l \<union> (snd \<circ> snd) ` set l)) = fold (\<lambda>(u, uu_, w) x. max u (max w x)) l (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
max_node l = fold (\<lambda>(u, uu_, w) x. max u (max w x)) l (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_field_derivative_powr:
  fixes z :: complex
  assumes "z \<notin> \<real>\<^sub>\<le>\<^sub>0"
  shows "((\<lambda>z. z powr s) has_field_derivative (s * z powr (s - 1))) (at z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
[PROOF STEP]
proof (cases "z=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z = 0 \<Longrightarrow> ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
 2. z \<noteq> 0 \<Longrightarrow> ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z \<noteq> 0

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
 2. z \<noteq> 0 \<Longrightarrow> ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<noteq> 0
[PROOF STEP]
have \<section>: "exp (s * Ln z) * inverse z = exp ((s - 1) * Ln z)"
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0

goal (1 subgoal):
 1. exp (s * Ln z) * inverse z = exp ((s - 1) * Ln z)
[PROOF STEP]
by (simp add: divide_complex_def exp_diff left_diff_distrib')
[PROOF STATE]
proof (state)
this:
exp (s * Ln z) * inverse z = exp ((s - 1) * Ln z)

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
 2. z \<noteq> 0 \<Longrightarrow> ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
[PROOF STEP]
unfolding powr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. if z = 0 then 0 else exp (s * Ln z)) has_field_derivative s * (if z = 0 then 0 else exp ((s - 1) * Ln z))) (at z)
[PROOF STEP]
proof (rule has_field_derivative_transform_within)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (?f has_field_derivative s * (if z = 0 then 0 else exp ((s - 1) * Ln z))) (at z)
 2. 0 < ?d
 3. z \<in> UNIV
 4. \<And>x. \<lbrakk>x \<in> UNIV; dist x z < ?d\<rbrakk> \<Longrightarrow> ?f x = (if x = 0 then 0 else exp (s * Ln x))
[PROOF STEP]
show "((\<lambda>z. exp (s * Ln z)) has_field_derivative s * (if z = 0 then 0 else exp ((s - 1) * Ln z)))
           (at z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. exp (s * Ln z)) has_field_derivative s * (if z = 0 then 0 else exp ((s - 1) * Ln z))) (at z)
[PROOF STEP]
by (intro derivative_eq_intros | simp add: assms False \<section>)+
[PROOF STATE]
proof (state)
this:
((\<lambda>z. exp (s * Ln z)) has_field_derivative s * (if z = 0 then 0 else exp ((s - 1) * Ln z))) (at z)

goal (3 subgoals):
 1. 0 < ?d
 2. z \<in> UNIV
 3. \<And>x. \<lbrakk>x \<in> UNIV; dist x z < ?d\<rbrakk> \<Longrightarrow> exp (s * Ln x) = (if x = 0 then 0 else exp (s * Ln x))
[PROOF STEP]
qed (use False in auto)
[PROOF STATE]
proof (state)
this:
((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)

goal (1 subgoal):
 1. z = 0 \<Longrightarrow> ((\<lambda>z. z powr s) has_field_derivative s * z powr (s - 1)) (at z)
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma face_distance_eq_chamber_distance_map:
  assumes "domain.chamber C" "domain.chamber D" "C\<noteq>D" "z\<subseteq>C"
          "codomain.face_distance (f`z) (f`D) = domain.face_distance z D"
          "domain.face_distance z D = domain.chamber_distance C D"
  shows   "codomain.face_distance (f`z) (f`D) =
            codomain.chamber_distance (f`C) (f`D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. codomain.face_distance (f ` z) (f ` D) = codomain.chamber_distance (f ` C) (f ` D)
[PROOF STEP]
using   assms codomain.face_distance_le[of "f`C" "f`z" "f`D"] chamber_map
          codomain.chamber_distance_le
          gallery_betw_map[OF domain.gallery_least_length, of C D]
          domain.chamber_distance_def
[PROOF STATE]
proof (prove)
using this:
domain.chamber C
domain.chamber D
C \<noteq> D
z \<subseteq> C
codomain.face_distance (f ` z) (f ` D) = domain.face_distance z D
domain.face_distance z D = domain.chamber_distance C D
\<lbrakk>codomain.chamber (f ` C); f ` z \<subseteq> f ` C\<rbrakk> \<Longrightarrow> codomain.face_distance (f ` z) (f ` D) \<le> codomain.chamber_distance (f ` C) (f ` D)
domain.chamber ?C \<Longrightarrow> codomain.chamber (f ` ?C)
codomain.gallery (?C # ?Cs @ [?D]) \<Longrightarrow> codomain.chamber_distance ?C ?D \<le> Suc (length ?Cs)
\<lbrakk>domain.chamber C; domain.chamber D; C \<noteq> D\<rbrakk> \<Longrightarrow> codomain.gallery (f ` C # f \<Turnstile> (ARG_MIN length Cs. domain.gallery (C # Cs @ [D])) @ [f ` D])
domain.chamber_distance ?C ?D = (if ?C = ?D then 0 else Suc (length (ARG_MIN length Cs. domain.gallery (?C # Cs @ [?D]))))

goal (1 subgoal):
 1. codomain.face_distance (f ` z) (f ` D) = codomain.chamber_distance (f ` C) (f ` D)
[PROOF STEP]
by      force


[STATEMENT]
lemma exists_pos_meas_subset:
  assumes "E \<in> sets M"
    and "\<bar>\<mu> E\<bar> < \<infinity>"
    and "0 < \<mu> E"
  shows "\<exists>A. A \<subseteq> E \<and> pos_meas_set A \<and> 0 < \<mu> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
proof (cases "\<forall>n. 0 < num_wtn E n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>n. 0 < num_wtn E n \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
 2. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<forall>n. 0 < num_wtn E n

goal (2 subgoals):
 1. \<forall>n. 0 < num_wtn E n \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
 2. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
have "pos_meas_set (pos_sub E)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pos_meas_set (pos_sub E)
[PROOF STEP]
proof (rule pos_meas_setI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pos_sub E \<in> sets M
 2. \<And>A. \<lbrakk>A \<in> sets M; A \<subseteq> pos_sub E\<rbrakk> \<Longrightarrow> 0 \<le> \<mu> A
[PROOF STEP]
show "pos_sub E \<in> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pos_sub E \<in> sets M
[PROOF STEP]
by (simp add: assms(1) pos_sub_sets)
[PROOF STATE]
proof (state)
this:
pos_sub E \<in> sets M

goal (1 subgoal):
 1. \<And>A. \<lbrakk>A \<in> sets M; A \<subseteq> pos_sub E\<rbrakk> \<Longrightarrow> 0 \<le> \<mu> A
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>A \<in> sets M; A \<subseteq> pos_sub E\<rbrakk> \<Longrightarrow> 0 \<le> \<mu> A
[PROOF STEP]
assume "A \<in> sets M" and "A\<subseteq> pos_sub E"
[PROOF STATE]
proof (state)
this:
A \<in> sets M
A \<subseteq> pos_sub E

goal (1 subgoal):
 1. \<And>A. \<lbrakk>A \<in> sets M; A \<subseteq> pos_sub E\<rbrakk> \<Longrightarrow> 0 \<le> \<mu> A
[PROOF STEP]
thus "0 \<le> \<mu> A"
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
A \<subseteq> pos_sub E

goal (1 subgoal):
 1. 0 \<le> \<mu> A
[PROOF STEP]
using assms True pos_sub_pos_meas_subset[of E]
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
A \<subseteq> pos_sub E
E \<in> sets M
\<bar>\<mu> E\<bar> < \<infinity>
0 < \<mu> E
\<forall>n. 0 < num_wtn E n
\<lbrakk>E \<in> sets M; \<bar>\<mu> E\<bar> < \<infinity>; ?C \<in> sets M; ?C \<subseteq> pos_sub E; \<And>n. 0 < num_wtn E n\<rbrakk> \<Longrightarrow> 0 \<le> \<mu> ?C

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pos_meas_set (pos_sub E)

goal (2 subgoals):
 1. \<forall>n. 0 < num_wtn E n \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
 2. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
pos_meas_set (pos_sub E)

goal (2 subgoals):
 1. \<forall>n. 0 < num_wtn E n \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
 2. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
have "0 < \<mu> (pos_sub E)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<mu> (pos_sub E)
[PROOF STEP]
using pos_sub_pos_meas'[of E] True assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>E \<in> sets M; \<bar>\<mu> E\<bar> < \<infinity>; 0 < \<mu> E; \<forall>n. 0 < num_wtn E n\<rbrakk> \<Longrightarrow> 0 < \<mu> (pos_sub E)
\<forall>n. 0 < num_wtn E n
E \<in> sets M
\<bar>\<mu> E\<bar> < \<infinity>
0 < \<mu> E

goal (1 subgoal):
 1. 0 < \<mu> (pos_sub E)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < \<mu> (pos_sub E)

goal (2 subgoals):
 1. \<forall>n. 0 < num_wtn E n \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
 2. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
pos_meas_set (pos_sub E)
0 < \<mu> (pos_sub E)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pos_meas_set (pos_sub E)
0 < \<mu> (pos_sub E)

goal (1 subgoal):
 1. \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
using pos_meas_set_def
[PROOF STATE]
proof (prove)
using this:
pos_meas_set (pos_sub E)
0 < \<mu> (pos_sub E)
pos_meas_set ?E = (?E \<in> sets M \<and> (\<forall>A\<in>sets M. A \<subseteq> ?E \<longrightarrow> 0 \<le> \<mu> A))

goal (1 subgoal):
 1. \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
by (metis pos_sub_subset)
[PROOF STATE]
proof (state)
this:
\<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A

goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>n. 0 < num_wtn E n)

goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
hence "\<exists>n. num_wtn E n = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>n. 0 < num_wtn E n)

goal (1 subgoal):
 1. \<exists>n. num_wtn E n = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>n. num_wtn E n = 0

goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>n. num_wtn E n = 0
[PROOF STEP]
obtain n where "num_wtn E n = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>n. num_wtn E n = 0

goal (1 subgoal):
 1. (\<And>n. num_wtn E n = 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
num_wtn E n = 0

goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
hence "pos_wtn E n \<notin> sets M \<or> pos_meas_set (pos_wtn E n)"
[PROOF STATE]
proof (prove)
using this:
num_wtn E n = 0

goal (1 subgoal):
 1. pos_wtn E n \<notin> sets M \<or> pos_meas_set (pos_wtn E n)
[PROOF STEP]
using inf_neg_ge_1
[PROOF STATE]
proof (prove)
using this:
num_wtn E n = 0
\<lbrakk>?A \<in> sets M; \<not> pos_meas_set ?A\<rbrakk> \<Longrightarrow> 1 \<le> inf_neg ?A

goal (1 subgoal):
 1. pos_wtn E n \<notin> sets M \<or> pos_meas_set (pos_wtn E n)
[PROOF STEP]
unfolding num_wtn_def
[PROOF STATE]
proof (prove)
using this:
inf_neg (pos_wtn E n) = 0
\<lbrakk>?A \<in> sets M; \<not> pos_meas_set ?A\<rbrakk> \<Longrightarrow> 1 \<le> inf_neg ?A

goal (1 subgoal):
 1. pos_wtn E n \<notin> sets M \<or> pos_meas_set (pos_wtn E n)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
pos_wtn E n \<notin> sets M \<or> pos_meas_set (pos_wtn E n)

goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
hence "pos_meas_set (pos_wtn E n)"
[PROOF STATE]
proof (prove)
using this:
pos_wtn E n \<notin> sets M \<or> pos_meas_set (pos_wtn E n)

goal (1 subgoal):
 1. pos_meas_set (pos_wtn E n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pos_wtn E n \<notin> sets M \<or> pos_meas_set (pos_wtn E n)
E \<in> sets M
\<bar>\<mu> E\<bar> < \<infinity>
0 < \<mu> E

goal (1 subgoal):
 1. pos_meas_set (pos_wtn E n)
[PROOF STEP]
by (simp add: \<open>E \<in> sets M\<close> pos_wtn_sets)
[PROOF STATE]
proof (state)
this:
pos_meas_set (pos_wtn E n)

goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
pos_meas_set (pos_wtn E n)

goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
have "0 < \<mu> (pos_wtn E n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<mu> (pos_wtn E n)
[PROOF STEP]
using pos_wtn_meas_gt assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < \<mu> ?E; ?E \<in> sets M\<rbrakk> \<Longrightarrow> 0 < \<mu> (pos_wtn ?E ?n)
E \<in> sets M
\<bar>\<mu> E\<bar> < \<infinity>
0 < \<mu> E

goal (1 subgoal):
 1. 0 < \<mu> (pos_wtn E n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < \<mu> (pos_wtn E n)

goal (1 subgoal):
 1. \<not> (\<forall>n. 0 < num_wtn E n) \<Longrightarrow> \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
pos_meas_set (pos_wtn E n)
0 < \<mu> (pos_wtn E n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pos_meas_set (pos_wtn E n)
0 < \<mu> (pos_wtn E n)

goal (1 subgoal):
 1. \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
using pos_meas_set_def
[PROOF STATE]
proof (prove)
using this:
pos_meas_set (pos_wtn E n)
0 < \<mu> (pos_wtn E n)
pos_meas_set ?E = (?E \<in> sets M \<and> (\<forall>A\<in>sets M. A \<subseteq> ?E \<longrightarrow> 0 \<le> \<mu> A))

goal (1 subgoal):
 1. \<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A
[PROOF STEP]
by (meson pos_wtn_subset)
[PROOF STATE]
proof (state)
this:
\<exists>A\<subseteq>E. pos_meas_set A \<and> 0 < \<mu> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma shiftl_less_t2n':
  "(x::'a::len word) < 2 ^ m \<Longrightarrow> m+n < LENGTH('a) \<Longrightarrow> x << n < 2 ^ (m + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < 2 ^ m; m + n < LENGTH('a)\<rbrakk> \<Longrightarrow> x << n < 2 ^ (m + n)
[PROOF STEP]
by (rule shiftl_less_t2n) simp_all


[STATEMENT]
lemma rsum_Cons [simp]: "rsum ((u, x, v) # D) f = f x * (v - u) + rsum D f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rsum ((u, x, v) # D) f = f x * (v - u) + rsum D f
[PROOF STEP]
unfolding rsum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(u, x, v)\<leftarrow>(u, x, v) # D. f x * (v - u)) = f x * (v - u) + (\<Sum>(u, x, v)\<leftarrow>D. f x * (v - u))
[PROOF STEP]
by simp


[STATEMENT]
lemma continuous_map_euclidean_top_of_set:
  assumes eq: "f -` S = UNIV" and cont: "continuous_on UNIV f"
  shows "continuous_map euclidean (top_of_set S) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map euclidean (top_of_set S) f
[PROOF STEP]
by (simp add: cont continuous_map_into_subtopology eq image_subset_iff_subset_vimage)


[STATEMENT]
lemma delete_idem: "delete k (delete k al) = delete k al"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. delete k (delete k al) = delete k al
[PROOF STEP]
by (simp add: delete_eq)


[STATEMENT]
lemma indoc_Cons[simp]: "indoc a (b # v) \<longleftrightarrow> a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
have "indoc a (b # v) \<longleftrightarrow> indoc a ([b] @ v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indoc a (b # v) = indoc a ([b] @ v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
indoc a (b # v) = indoc a ([b] @ v)

goal (1 subgoal):
 1. indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
indoc a (b # v) = indoc a ([b] @ v)

goal (1 subgoal):
 1. indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> indoc a [b] \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indoc a ([b] @ v) = (indoc a [b] \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v)
[PROOF STEP]
unfolding indoc_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (indoc a [b] \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v) = (indoc a [b] \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v)
[PROOF STEP]
by rule
[PROOF STATE]
proof (state)
this:
indoc a ([b] @ v) = (indoc a [b] \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v)

goal (1 subgoal):
 1. indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
indoc a ([b] @ v) = (indoc a [b] \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v)

goal (1 subgoal):
 1. indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (indoc a [b] \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
unfolding indoc_single
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a = b \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(indoc a [b] \<or> a \<notin> set [b] \<and> Ind {a} (set [b]) \<and> indoc a v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)

goal (1 subgoal):
 1. indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)

goal (1 subgoal):
 1. indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
indoc a (b # v) = (a = b \<or> a \<noteq> b \<and> ind a b \<and> indoc a v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fst_set_map_charpair_un_uminus:
  fixes ss :: "'a::group_add list"
  shows "ss\<in>lists (S \<union> uminus ` S) \<Longrightarrow> fst ` set (map (charpair S) ss) \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ss \<in> lists (S \<union> uminus ` S) \<Longrightarrow> fst ` set (map (charpair S) ss) \<subseteq> S
[PROOF STEP]
by (induct ss) auto


[STATEMENT]
lemma weight_spmf_le_0: "weight_spmf p \<le> 0 \<longleftrightarrow> weight_spmf p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (weight_spmf p \<le> 0) = (weight_spmf p = 0)
[PROOF STEP]
by(rule measure_le_0_iff)


[STATEMENT]
lemma andalso_eq_TT_iff [simp]:
  "(x andalso y) = TT \<longleftrightarrow> x = TT \<and> y = TT"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x andalso y) = TT) = (x = TT \<and> y = TT)
[PROOF STEP]
by (cases x, simp_all)


[STATEMENT]
lemma abelian_relcycle_group [simp]:
   "comm_group(relcycle_group p X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_group (relcycle_group p X S)
[PROOF STEP]
unfolding relcycle_group_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_group (subgroup_generated (chain_group p X) (singular_relcycle_set p X S))
[PROOF STEP]
by (intro group.abelian_subgroup_generated group_chain_group) (auto simp: abelian_chain_group singular_relcycle)


[STATEMENT]
lemma ldropWhile_simps [simp, code]:
  shows ldropWhile_LNil: "ldropWhile P LNil = LNil"
  and ldropWhile_LCons: "ldropWhile P (LCons x xs) = (if P x then ldropWhile P xs else LCons x xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldropWhile P LNil = LNil &&& ldropWhile P (LCons x xs) = (if P x then ldropWhile P xs else LCons x xs)
[PROOF STEP]
by(simp_all add: ldropWhile.simps)


[STATEMENT]
lemma set_less_eq_total: "A \<sqsubseteq> B \<or> B \<sqsubseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<sqsubseteq> B \<or> B \<sqsubseteq> A
[PROOF STEP]
by(auto simp add: set_less_eq_def2 set_less_eq_aux''_finite not_in_complement_partition not_in_complement_partition_False intro: set_less_eq_aux_finite_total2 finite_subset[OF subset_UNIV] del: disjCI dest: set_less_eq_aux''_total)


[STATEMENT]
lemma eexp_continuous:
  "continuous_on UNIV eexp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on UNIV eexp
[PROOF STEP]
unfolding eexp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on UNIV (\<lambda>x. enn2ereal (ennexp x))
[PROOF STEP]
by (rule continuous_on_compose2[of UNIV enn2ereal], auto simp: continuous_on_enn2ereal ennexp_continuous)


[STATEMENT]
lemma linear_independent_extend_subspace:
  \<comment> \<open>legacy: use \<^term>\<open>construct\<close> instead\<close>
  assumes "vs1.independent B"
  shows "\<exists>g. linear s1 s2 g \<and> (\<forall>x\<in>B. g x = f x) \<and> range g = vs2.span (f`B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. linear (*a) (*b) g \<and> (\<forall>x\<in>B. g x = f x) \<and> range g = vs2.span (f ` B)
[PROOF STEP]
by (rule exI[where x="construct B f"])
    (auto simp: linear_construct assms construct_basis range_construct_eq_span)


[STATEMENT]
lemma list_take_eq_conv: "(xs = ys) = (\<forall>n. xs \<down> n = ys \<down> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs = ys) = (\<forall>n. xs \<down> n = ys \<down> n)
[PROOF STEP]
apply (rule iffI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. xs \<down> n = ys \<down> n \<Longrightarrow> xs = ys
[PROOF STEP]
apply (drule_tac x="max (length xs) (length ys)" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<down> max (length xs) (length ys) = ys \<down> max (length xs) (length ys) \<Longrightarrow> xs = ys
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma frange_vunion: "\<R>\<^sub>\<bullet> (r \<union>\<^sub>\<circ> s) = \<R>\<^sub>\<bullet> r \<union>\<^sub>\<circ> \<R>\<^sub>\<bullet> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<bullet> (r \<union>\<^sub>\<circ> s) = \<R>\<^sub>\<bullet> r \<union>\<^sub>\<circ> \<R>\<^sub>\<bullet> s
[PROOF STEP]
by auto


[STATEMENT]
lemma idiff_0 [simp]: "(0::enat) - n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 - n = 0
[PROOF STEP]
by (cases n, simp_all add: zero_enat_def)


[STATEMENT]
theorem hyp2_axiom1: "\<forall> a b. a b \<congruent>\<^sub>K b a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a b. a b \<congruent>\<^sub>K b a
[PROOF STEP]
proof standard+
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. a b \<congruent>\<^sub>K b a
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. a b \<congruent>\<^sub>K b a
[PROOF STEP]
let ?a' = "Rep_hyp2 a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. a b \<congruent>\<^sub>K b a
[PROOF STEP]
let ?b' = "Rep_hyp2 b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. a b \<congruent>\<^sub>K b a
[PROOF STEP]
from Rep_hyp2 and K2_isometry_swap [of ?a' ?b']
[PROOF STATE]
proof (chain)
picking this:
Rep_hyp2 ?x \<in> hyp2
\<lbrakk>Rep_hyp2 a \<in> hyp2; Rep_hyp2 b \<in> hyp2\<rbrakk> \<Longrightarrow> \<exists>J. is_K2_isometry J \<and> apply_cltn2 (Rep_hyp2 a) J = Rep_hyp2 b \<and> apply_cltn2 (Rep_hyp2 b) J = Rep_hyp2 a
[PROOF STEP]
obtain J where "is_K2_isometry J" and "apply_cltn2 ?a' J = ?b'"
    and "apply_cltn2 ?b' J = ?a'"
[PROOF STATE]
proof (prove)
using this:
Rep_hyp2 ?x \<in> hyp2
\<lbrakk>Rep_hyp2 a \<in> hyp2; Rep_hyp2 b \<in> hyp2\<rbrakk> \<Longrightarrow> \<exists>J. is_K2_isometry J \<and> apply_cltn2 (Rep_hyp2 a) J = Rep_hyp2 b \<and> apply_cltn2 (Rep_hyp2 b) J = Rep_hyp2 a

goal (1 subgoal):
 1. (\<And>J. \<lbrakk>is_K2_isometry J; apply_cltn2 (Rep_hyp2 a) J = Rep_hyp2 b; apply_cltn2 (Rep_hyp2 b) J = Rep_hyp2 a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_K2_isometry J
apply_cltn2 (Rep_hyp2 a) J = Rep_hyp2 b
apply_cltn2 (Rep_hyp2 b) J = Rep_hyp2 a

goal (1 subgoal):
 1. \<And>a b. a b \<congruent>\<^sub>K b a
[PROOF STEP]
from \<open>apply_cltn2 ?a' J = ?b'\<close> and \<open>apply_cltn2 ?b' J = ?a'\<close>
[PROOF STATE]
proof (chain)
picking this:
apply_cltn2 (Rep_hyp2 a) J = Rep_hyp2 b
apply_cltn2 (Rep_hyp2 b) J = Rep_hyp2 a
[PROOF STEP]
have "hyp2_cltn2 a J = b" and "hyp2_cltn2 b J = a"
[PROOF STATE]
proof (prove)
using this:
apply_cltn2 (Rep_hyp2 a) J = Rep_hyp2 b
apply_cltn2 (Rep_hyp2 b) J = Rep_hyp2 a

goal (1 subgoal):
 1. hyp2_cltn2 a J = b &&& hyp2_cltn2 b J = a
[PROOF STEP]
unfolding hyp2_cltn2_def
[PROOF STATE]
proof (prove)
using this:
apply_cltn2 (Rep_hyp2 a) J = Rep_hyp2 b
apply_cltn2 (Rep_hyp2 b) J = Rep_hyp2 a

goal (1 subgoal):
 1. Abs_hyp2 (apply_cltn2 (Rep_hyp2 a) J) = b &&& Abs_hyp2 (apply_cltn2 (Rep_hyp2 b) J) = a
[PROOF STEP]
by (simp_all add: Rep_hyp2_inverse)
[PROOF STATE]
proof (state)
this:
hyp2_cltn2 a J = b
hyp2_cltn2 b J = a

goal (1 subgoal):
 1. \<And>a b. a b \<congruent>\<^sub>K b a
[PROOF STEP]
with \<open>is_K2_isometry J\<close>
[PROOF STATE]
proof (chain)
picking this:
is_K2_isometry J
hyp2_cltn2 a J = b
hyp2_cltn2 b J = a
[PROOF STEP]
show "a b \<congruent>\<^sub>K b a"
[PROOF STATE]
proof (prove)
using this:
is_K2_isometry J
hyp2_cltn2 a J = b
hyp2_cltn2 b J = a

goal (1 subgoal):
 1. a b \<congruent>\<^sub>K b a
[PROOF STEP]
by (unfold real_hyp2_C_def) (simp add: exI [of _ J])
[PROOF STATE]
proof (state)
this:
a b \<congruent>\<^sub>K b a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_rcoset_replist_imp_nrelated_nth :
  assumes "Subgroup H" "is_rcoset_replist H gs"
  shows   "\<And>i j. i < length gs \<Longrightarrow> j < length gs \<Longrightarrow> i \<noteq> j \<Longrightarrow> gs!i - gs!j \<notin> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < length gs; j < length gs; i \<noteq> j\<rbrakk> \<Longrightarrow> gs ! i - gs ! j \<notin> H
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < length gs; j < length gs; i \<noteq> j; gs ! i - gs ! j \<in> H\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < length gs; j < length gs; i \<noteq> j; gs ! i - gs ! j \<in> H\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume ij: "i < length gs" "j < length gs" "i\<noteq>j" "gs!i - gs!j \<in> H"
[PROOF STATE]
proof (state)
this:
i < length gs
j < length gs
i \<noteq> j
gs ! i - gs ! j \<in> H

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < length gs; j < length gs; i \<noteq> j; gs ! i - gs ! j \<in> H\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from assms(2) ij(1,2,4)
[PROOF STATE]
proof (chain)
picking this:
is_rcoset_replist H gs
i < length gs
j < length gs
gs ! i - gs ! j \<in> H
[PROOF STEP]
have "(gs!i,gs!j) \<in> rcoset_rel H"
[PROOF STATE]
proof (prove)
using this:
is_rcoset_replist H gs
i < length gs
j < length gs
gs ! i - gs ! j \<in> H

goal (1 subgoal):
 1. (gs ! i, gs ! j) \<in> rcoset_rel H
[PROOF STEP]
using set_conv_nth is_rcoset_replistD_set rcoset_rel_def
[PROOF STATE]
proof (prove)
using this:
is_rcoset_replist H gs
i < length gs
j < length gs
gs ! i - gs ! j \<in> H
set ?xs = {?xs ! i |i. i < length ?xs}
is_rcoset_replist ?H ?gs \<Longrightarrow> set ?gs \<subseteq> G
rcoset_rel ?H \<equiv> {(g, g'). g \<in> G \<and> g' \<in> G \<and> g - g' \<in> ?H}

goal (1 subgoal):
 1. (gs ! i, gs ! j) \<in> rcoset_rel H
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(gs ! i, gs ! j) \<in> rcoset_rel H

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < length gs; j < length gs; i \<noteq> j; gs ! i - gs ! j \<in> H\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with assms(1) ij(1,2)
[PROOF STATE]
proof (chain)
picking this:
Subgroup H
i < length gs
j < length gs
(gs ! i, gs ! j) \<in> rcoset_rel H
[PROOF STEP]
have  "(map (\<lambda>g. (rcoset_rel H)``{g}) gs)!i
                = (map (\<lambda>g. (rcoset_rel H)``{g}) gs)!j"
[PROOF STATE]
proof (prove)
using this:
Subgroup H
i < length gs
j < length gs
(gs ! i, gs ! j) \<in> rcoset_rel H

goal (1 subgoal):
 1. map (\<lambda>g. rcoset_rel H `` {g}) gs ! i = map (\<lambda>g. rcoset_rel H `` {g}) gs ! j
[PROOF STEP]
using rcoset_equiv equiv_class_eq
[PROOF STATE]
proof (prove)
using this:
Subgroup H
i < length gs
j < length gs
(gs ! i, gs ! j) \<in> rcoset_rel H
Subgroup ?H \<Longrightarrow> equiv G (rcoset_rel ?H)
\<lbrakk>equiv ?A ?r; (?a, ?b) \<in> ?r\<rbrakk> \<Longrightarrow> ?r `` {?a} = ?r `` {?b}

goal (1 subgoal):
 1. map (\<lambda>g. rcoset_rel H `` {g}) gs ! i = map (\<lambda>g. rcoset_rel H `` {g}) gs ! j
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
map (\<lambda>g. rcoset_rel H `` {g}) gs ! i = map (\<lambda>g. rcoset_rel H `` {g}) gs ! j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < length gs; j < length gs; i \<noteq> j; gs ! i - gs ! j \<in> H\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
with assms(2) ij(1-3)
[PROOF STATE]
proof (chain)
picking this:
is_rcoset_replist H gs
i < length gs
j < length gs
i \<noteq> j
map (\<lambda>g. rcoset_rel H `` {g}) gs ! i = map (\<lambda>g. rcoset_rel H `` {g}) gs ! j
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
is_rcoset_replist H gs
i < length gs
j < length gs
i \<noteq> j
map (\<lambda>g. rcoset_rel H `` {g}) gs ! i = map (\<lambda>g. rcoset_rel H `` {g}) gs ! j

goal (1 subgoal):
 1. False
[PROOF STEP]
using is_rcoset_replistD_distinct distinct_conv_nth[
            of "map (\<lambda>g. (rcoset_rel H)``{g}) gs"
          ]
[PROOF STATE]
proof (prove)
using this:
is_rcoset_replist H gs
i < length gs
j < length gs
i \<noteq> j
map (\<lambda>g. rcoset_rel H `` {g}) gs ! i = map (\<lambda>g. rcoset_rel H `` {g}) gs ! j
is_rcoset_replist ?H ?gs \<Longrightarrow> distinct (map (\<lambda>g. rcoset_rel ?H `` {g}) ?gs)
distinct (map (\<lambda>g. rcoset_rel H `` {g}) gs) = (\<forall>i<length (map (\<lambda>g. rcoset_rel H `` {g}) gs). \<forall>j<length (map (\<lambda>g. rcoset_rel H `` {g}) gs). i \<noteq> j \<longrightarrow> map (\<lambda>g. rcoset_rel H `` {g}) gs ! i \<noteq> map (\<lambda>g. rcoset_rel H `` {g}) gs ! j)

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

goal:
No subgoals!
[PROOF STEP]
qed