[STATEMENT]
lemma homeomorphic_rel_interiors:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "S homeomorphic T" "rel_interior S = {} \<longleftrightarrow> rel_interior T = {}"
    shows "(rel_interior S) homeomorphic (rel_interior T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior S homeomorphic rel_interior T
[PROOF STEP]
proof (cases "rel_interior T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel_interior T = {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
 2. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
rel_interior T = {}

goal (2 subgoals):
 1. rel_interior T = {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
 2. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
rel_interior T = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
rel_interior T = {}

goal (1 subgoal):
 1. rel_interior S homeomorphic rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior S homeomorphic rel_interior T

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
rel_interior T \<noteq> {}

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
obtain f g
    where S: "\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x" and T: "\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y"
      and contf: "continuous_on S f" and contg: "continuous_on T g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using  assms [unfolded homeomorphic_minimal]
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
(rel_interior S = {}) = (rel_interior T = {})

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
have "aff_dim (affine hull S) \<le> aff_dim (affine hull T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
apply (rule invariance_of_dimension_affine_sets [of _ "rel_interior S" _ f])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
 2. affine (affine hull S)
 3. affine (affine hull T)
 4. continuous_on (rel_interior S) f
 5. f ` rel_interior S \<subseteq> affine hull T
 6. inj_on f (rel_interior S)
 7. rel_interior S \<noteq> {}
[PROOF STEP]
apply (simp_all add: openin_rel_interior False assms)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. continuous_on (rel_interior S) f
 2. f ` rel_interior S \<subseteq> affine hull T
 3. inj_on f (rel_interior S)
[PROOF STEP]
using contf continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (3 subgoals):
 1. continuous_on (rel_interior S) f
 2. f ` rel_interior S \<subseteq> affine hull T
 3. inj_on f (rel_interior S)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f ` rel_interior S \<subseteq> affine hull T
 2. inj_on f (rel_interior S)
[PROOF STEP]
apply (meson S hull_subset image_subsetI rel_interior_subset rev_subsetD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (rel_interior S)
[PROOF STEP]
apply (metis S inj_on_inverseI inj_on_subset rel_interior_subset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
have "aff_dim (affine hull T) \<le> aff_dim (affine hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
apply (rule invariance_of_dimension_affine_sets [of _ "rel_interior T" _ g])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. openin (top_of_set (affine hull T)) (rel_interior T)
 2. affine (affine hull T)
 3. affine (affine hull S)
 4. continuous_on (rel_interior T) g
 5. g ` rel_interior T \<subseteq> affine hull S
 6. inj_on g (rel_interior T)
 7. rel_interior T \<noteq> {}
[PROOF STEP]
apply (simp_all add: openin_rel_interior False assms)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. continuous_on (rel_interior T) g
 2. g ` rel_interior T \<subseteq> affine hull S
 3. inj_on g (rel_interior T)
[PROOF STEP]
using contg continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on T g
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (3 subgoals):
 1. continuous_on (rel_interior T) g
 2. g ` rel_interior T \<subseteq> affine hull S
 3. inj_on g (rel_interior T)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g ` rel_interior T \<subseteq> affine hull S
 2. inj_on g (rel_interior T)
[PROOF STEP]
apply (meson T hull_subset image_subsetI rel_interior_subset rev_subsetD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on g (rel_interior T)
[PROOF STEP]
apply (metis T inj_on_inverseI inj_on_subset rel_interior_subset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull T) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
have "aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
using this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
aff_dim (affine hull T) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. aff_dim S = aff_dim T
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
aff_dim S = aff_dim T

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> rel_interior S homeomorphic rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim S = aff_dim T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim S = aff_dim T

goal (1 subgoal):
 1. rel_interior S homeomorphic rel_interior T
[PROOF STEP]
by (rule homeomorphic_rel_interiors_same_dimension [OF \<open>S homeomorphic T\<close>])
[PROOF STATE]
proof (state)
this:
rel_interior S homeomorphic rel_interior T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_less_rsqrt: "x\<^sup>2 < y \<Longrightarrow> x < sqrt y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 < y \<Longrightarrow> x < sqrt y
[PROOF STEP]
using real_sqrt_less_mono[of "x\<^sup>2" y]
[PROOF STATE]
proof (prove)
using this:
x\<^sup>2 < y \<Longrightarrow> sqrt (x\<^sup>2) < sqrt y

goal (1 subgoal):
 1. x\<^sup>2 < y \<Longrightarrow> x < sqrt y
[PROOF STEP]
by simp


[STATEMENT]
lemma le_infI[intro 0]:
      assumes "\<And> v\<^sub>1. v\<^sub>1 \<le>\<^sub>F\<^sub>I w\<^sub>1 \<Longrightarrow> v\<^sub>1 \<preceq>\<^sub>F\<^sub>I w\<^sub>2"
      shows "w\<^sub>1 \<preceq>\<^sub>I w\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w\<^sub>1 \<preceq>\<^sub>I w\<^sub>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?v\<^sub>1 \<le>\<^sub>F\<^sub>I w\<^sub>1 \<Longrightarrow> ?v\<^sub>1 \<preceq>\<^sub>F\<^sub>I w\<^sub>2

goal (1 subgoal):
 1. w\<^sub>1 \<preceq>\<^sub>I w\<^sub>2
[PROOF STEP]
unfolding le_inf_def
[PROOF STATE]
proof (prove)
using this:
?v\<^sub>1 \<le>\<^sub>F\<^sub>I w\<^sub>1 \<Longrightarrow> ?v\<^sub>1 \<preceq>\<^sub>F\<^sub>I w\<^sub>2

goal (1 subgoal):
 1. \<forall>v\<^sub>1. v\<^sub>1 \<le>\<^sub>F\<^sub>I w\<^sub>1 \<longrightarrow> v\<^sub>1 \<preceq>\<^sub>F\<^sub>I w\<^sub>2
[PROOF STEP]
by auto


[STATEMENT]
lemma Join_project_stable:
     "extend h F\<squnion>G \<in> stable C
      ==> (F\<squnion>project h C G \<in> stable A)  =
          (extend h F\<squnion>G \<in> stable (C \<inter> extend_set h A) &
           F \<in> stable A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extend h F \<squnion> G \<in> UNITY.stable C \<Longrightarrow> (F \<squnion> project h C G \<in> UNITY.stable A) = (extend h F \<squnion> G \<in> UNITY.stable (C \<inter> extend_set h A) \<and> F \<in> UNITY.stable A)
[PROOF STEP]
apply (unfold stable_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extend h F \<squnion> G \<in> C co C \<Longrightarrow> (F \<squnion> project h C G \<in> A co A) = (extend h F \<squnion> G \<in> C \<inter> extend_set h A co C \<inter> extend_set h A \<and> F \<in> A co A)
[PROOF STEP]
apply (simp only: Join_project_constrains)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extend h F \<squnion> G \<in> C co C \<Longrightarrow> (extend h F \<squnion> G \<in> C \<inter> extend_set h A co extend_set h A \<and> F \<in> A co A) = (extend h F \<squnion> G \<in> C \<inter> extend_set h A co C \<inter> extend_set h A \<and> F \<in> A co A)
[PROOF STEP]
apply (blast intro: constrains_weaken dest: constrains_Int)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Max_start:
  "(MAX t\<in>\<S>. (indicator {t} s :: ennreal)) = 1" if "s \<in> \<S>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MAX t\<in>\<S>. indicator {t} s) = 1
[PROOF STEP]
using states_finite that
[PROOF STATE]
proof (prove)
using this:
finite \<S>
s \<in> \<S>

goal (1 subgoal):
 1. (MAX t\<in>\<S>. indicator {t} s) = 1
[PROOF STEP]
by (auto simp: indicator_def intro: Max_eqI)


[STATEMENT]
lemma homeomorphic_affinity:
  fixes S :: "'a::real_normed_vector set"
  assumes "c \<noteq> 0"
  shows "S homeomorphic ((\<lambda>x. a + c *\<^sub>R x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic (\<lambda>x. a + c *\<^sub>R x) ` S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S homeomorphic (\<lambda>x. a + c *\<^sub>R x) ` S
[PROOF STEP]
have *: "(+) a ` (*\<^sub>R) c ` S = (\<lambda>x. a + c *\<^sub>R x) ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (+) a ` (*\<^sub>R) c ` S = (\<lambda>x. a + c *\<^sub>R x) ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(+) a ` (*\<^sub>R) c ` S = (\<lambda>x. a + c *\<^sub>R x) ` S

goal (1 subgoal):
 1. S homeomorphic (\<lambda>x. a + c *\<^sub>R x) ` S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic (\<lambda>x. a + c *\<^sub>R x) ` S
[PROOF STEP]
by (metis "*" assms homeomorphic_scaling homeomorphic_trans homeomorphic_translation)
[PROOF STATE]
proof (state)
this:
S homeomorphic (\<lambda>x. a + c *\<^sub>R x) ` S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nullable_satisfies_bounded: "Length \<AA> = 0 \<Longrightarrow> nullable \<phi> \<longleftrightarrow> \<AA> \<Turnstile>\<^sub>b \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Length \<AA> = 0 \<Longrightarrow> nullable \<phi> = (\<AA> \<Turnstile>\<^sub>b \<phi>)
[PROOF STEP]
by (induct \<phi>) (auto simp: nullable0_satisfies0 Extend_empty_satisfies_bounded len_cut_0
    intro: exI[of _ "cut 0 P" for P])


[STATEMENT]
lemma Inf_subdistl_iso:
  fixes f :: "'a \<Rightarrow> 'b::complete_lattice"
  shows "f \<circ> Inf \<le> Inf \<circ> (`) f \<Longrightarrow> mono f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> Inf \<le> Inf \<circ> (`) f \<Longrightarrow> mono f
[PROOF STEP]
unfolding mono_def le_fun_def comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f (\<Sqinter> x) \<le> \<Sqinter> (f ` x) \<Longrightarrow> \<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y
[PROOF STEP]
by (metis complete_lattice_class.le_INF_iff Inf_atLeast atLeast_iff)


[STATEMENT]
lemma mantissa_nonneg_iff: "0 \<le> mantissa x \<longleftrightarrow> 0 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> mantissa x) = (0 \<le> x)
[PROOF STEP]
by (auto simp: mantissa_exponent algebra_split_simps)


[STATEMENT]
lemma add_nrows: "nrows (A::('a::monoid_add) matrix) <= u \<Longrightarrow> nrows B <= u \<Longrightarrow> nrows (A + B) <= u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nrows A \<le> u; nrows B \<le> u\<rbrakk> \<Longrightarrow> nrows (A + B) \<le> u
[PROOF STEP]
apply (simp add: plus_matrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nrows A \<le> u; nrows B \<le> u\<rbrakk> \<Longrightarrow> nrows (combine_matrix (+) A B) \<le> u
[PROOF STEP]
apply (rule combine_nrows)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>nrows A \<le> u; nrows B \<le> u\<rbrakk> \<Longrightarrow> (0::'a) + (0::'a) = (0::'a)
 2. \<lbrakk>nrows A \<le> u; nrows B \<le> u\<rbrakk> \<Longrightarrow> nrows A \<le> u
 3. \<lbrakk>nrows A \<le> u; nrows B \<le> u\<rbrakk> \<Longrightarrow> nrows B \<le> u
[PROOF STEP]
apply (simp_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gcard_Times [simp]: "gcard (X \<times> Y) = gcard X \<otimes> gcard Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
proof (cases "small X \<and> small Y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. small X \<and> small Y \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
 2. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
small X \<and> small Y

goal (2 subgoals):
 1. small X \<and> small Y \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
 2. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
have "elts (gcard (X \<times> Y)) \<approx> X \<times> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (gcard (X \<times> Y)) \<approx> X \<times> Y
[PROOF STEP]
by (simp add: True gcard_eqpoll)
[PROOF STATE]
proof (state)
this:
elts (gcard (X \<times> Y)) \<approx> X \<times> Y

goal (2 subgoals):
 1. small X \<and> small Y \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
 2. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
elts (gcard (X \<times> Y)) \<approx> X \<times> Y

goal (2 subgoals):
 1. small X \<and> small Y \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
 2. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
have "... \<approx> elts (gcard X) \<times> elts (gcard Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<times> Y \<approx> elts (gcard X) \<times> elts (gcard Y)
[PROOF STEP]
by (simp add: True eqpoll_sym gcard_eqpoll times_eqpoll_cong)
[PROOF STATE]
proof (state)
this:
X \<times> Y \<approx> elts (gcard X) \<times> elts (gcard Y)

goal (2 subgoals):
 1. small X \<and> small Y \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
 2. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
X \<times> Y \<approx> elts (gcard X) \<times> elts (gcard Y)

goal (2 subgoals):
 1. small X \<and> small Y \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
 2. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
have "... \<approx> elts (gcard X \<otimes> gcard Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (gcard X) \<times> elts (gcard Y) \<approx> elts (gcard X \<otimes> gcard Y)
[PROOF STEP]
by (simp add: elts_cmult eqpoll_sym)
[PROOF STATE]
proof (state)
this:
elts (gcard X) \<times> elts (gcard Y) \<approx> elts (gcard X \<otimes> gcard Y)

goal (2 subgoals):
 1. small X \<and> small Y \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
 2. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
elts (gcard (X \<times> Y)) \<approx> elts (gcard X \<otimes> gcard Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
elts (gcard (X \<times> Y)) \<approx> elts (gcard X \<otimes> gcard Y)

goal (1 subgoal):
 1. gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
using Card_cardinal_eq cmult_def gcardinal_cong
[PROOF STATE]
proof (prove)
using this:
elts (gcard (X \<times> Y)) \<approx> elts (gcard X \<otimes> gcard Y)
Card ?\<kappa> \<Longrightarrow> vcard ?\<kappa> = ?\<kappa>
?\<kappa> \<otimes> ?\<mu> \<equiv> vcard (vtimes ?\<kappa> ?\<mu>)
?X \<approx> ?Y \<Longrightarrow> gcard ?X = gcard ?Y

goal (1 subgoal):
 1. gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
gcard (X \<times> Y) = gcard X \<otimes> gcard Y

goal (1 subgoal):
 1. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (small X \<and> small Y)

goal (1 subgoal):
 1. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
have "gcard (X \<times> Y) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcard (X \<times> Y) = 0
[PROOF STEP]
by (metis False Times_empty gcard_big_0 gcard_empty_0 small_Times_iff)
[PROOF STATE]
proof (state)
this:
gcard (X \<times> Y) = 0

goal (1 subgoal):
 1. \<not> (small X \<and> small Y) \<Longrightarrow> gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
gcard (X \<times> Y) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gcard (X \<times> Y) = 0

goal (1 subgoal):
 1. gcard (X \<times> Y) = gcard X \<otimes> gcard Y
[PROOF STEP]
by (metis False cmult_0 cmult_commute gcard_big_0)
[PROOF STATE]
proof (state)
this:
gcard (X \<times> Y) = gcard X \<otimes> gcard Y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma remove_key_add: "remove_key v m + remove_key v m' = remove_key v (m + m')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. remove_key v m + remove_key v m' = remove_key v (m + m')
[PROOF STEP]
by (rule poly_mapping_eqI; simp add: lookup_add remove_key_lookup when_add_distrib)


[STATEMENT]
lemma iterate_add_eq_add_iff2:
   \<open>i \<le> j \<Longrightarrow> (iterate_add i u + m = iterate_add j u + n) = (m = iterate_add (j - i) u + n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> (iterate_add i u + m = iterate_add j u + n) = (m = iterate_add (j - i) u + n)
[PROOF STEP]
by (auto dest!: le_Suc_ex add_right_imp_eq simp: ab_semigroup_add_class.add_ac(1))


[STATEMENT]
lemma fps_power_nth:
  fixes m :: nat
    and a :: "'a::comm_ring_1 fps"
  shows "(a ^m)$n =
    (if m=0 then 1$n else sum (\<lambda>v. prod (\<lambda>j. a $ (v!j)) {0..m - 1}) (natpermute n m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ m $ n = (if m = 0 then 1 $ n else \<Sum>v\<in>natpermute n m. \<Prod>j = 0..m - 1. a $ v ! j)
[PROOF STEP]
by (cases m) (simp_all add: fps_power_nth_Suc del: power_Suc)


[STATEMENT]
lemma bst_join2: "\<lbrakk> bst l; bst r; \<forall>x \<in> set_tree l. \<forall>y \<in> set_tree r. x < y \<rbrakk>
  \<Longrightarrow> bst (join2 l r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Tree2.bst l; Tree2.bst r; \<forall>x\<in>Tree2.set_tree l. \<forall>y\<in>Tree2.set_tree r. x < y\<rbrakk> \<Longrightarrow> Tree2.bst (join2 l r)
[PROOF STEP]
by(cases r)(simp_all add: bst_join split_min_set split_min_bst split: prod.split)


[STATEMENT]
lemma prime_factorization_mult:
  assumes "x \<noteq> 0" "y \<noteq> 0"
  shows   "prime_factorization (x * y) = prime_factorization x + prime_factorization y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (x * y) = prime_factorization x + prime_factorization y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factorization (x * y) = prime_factorization x + prime_factorization y
[PROOF STEP]
have "normalize (prod_mset (prime_factorization x) * prod_mset (prime_factorization y)) =
          normalize (normalize (prod_mset (prime_factorization x)) *
                     normalize (prod_mset (prime_factorization y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (\<Prod>\<^sub># (prime_factorization x) * \<Prod>\<^sub># (prime_factorization y)) = normalize (normalize (\<Prod>\<^sub># (prime_factorization x)) * normalize (\<Prod>\<^sub># (prime_factorization y)))
[PROOF STEP]
by (simp only: normalize_mult_normalize_left normalize_mult_normalize_right)
[PROOF STATE]
proof (state)
this:
normalize (\<Prod>\<^sub># (prime_factorization x) * \<Prod>\<^sub># (prime_factorization y)) = normalize (normalize (\<Prod>\<^sub># (prime_factorization x)) * normalize (\<Prod>\<^sub># (prime_factorization y)))

goal (1 subgoal):
 1. prime_factorization (x * y) = prime_factorization x + prime_factorization y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
normalize (\<Prod>\<^sub># (prime_factorization x) * \<Prod>\<^sub># (prime_factorization y)) = normalize (normalize (\<Prod>\<^sub># (prime_factorization x)) * normalize (\<Prod>\<^sub># (prime_factorization y)))

goal (1 subgoal):
 1. prime_factorization (x * y) = prime_factorization x + prime_factorization y
[PROOF STEP]
have "\<dots> = normalize (x * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (normalize (\<Prod>\<^sub># (prime_factorization x)) * normalize (\<Prod>\<^sub># (prime_factorization y))) = normalize (x * y)
[PROOF STEP]
by (subst (1 2) prod_mset_prime_factorization_weak) (use assms in auto)
[PROOF STATE]
proof (state)
this:
normalize (normalize (\<Prod>\<^sub># (prime_factorization x)) * normalize (\<Prod>\<^sub># (prime_factorization y))) = normalize (x * y)

goal (1 subgoal):
 1. prime_factorization (x * y) = prime_factorization x + prime_factorization y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
normalize (\<Prod>\<^sub># (prime_factorization x) * \<Prod>\<^sub># (prime_factorization y)) = normalize (x * y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
normalize (\<Prod>\<^sub># (prime_factorization x) * \<Prod>\<^sub># (prime_factorization y)) = normalize (x * y)

goal (1 subgoal):
 1. prime_factorization (x * y) = prime_factorization x + prime_factorization y
[PROOF STEP]
by (intro prime_factorization_eqI) auto
[PROOF STATE]
proof (state)
this:
prime_factorization (x * y) = prime_factorization x + prime_factorization y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma log_eq_one [simp]: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> log a a = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1\<rbrakk> \<Longrightarrow> log a a = 1
[PROOF STEP]
by (simp add: log_def)


[STATEMENT]
lemma itrev: "itrev xs ys = rev xs @ ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. itrev xs ys = rev xs @ ys
[PROOF STEP]
by(induction xs arbitrary: ys) auto


[STATEMENT]
lemma gauss_jordan_main_i:
  "nr = dim_row A' \<Longrightarrow> nc = dim_col A' \<Longrightarrow> mat_rel R A A' \<Longrightarrow> i \<le> nr \<Longrightarrow> j \<le> nc \<Longrightarrow>
    mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
obtain P where P: "P = (A',i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. P = (A', i, j) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P = (A', i, j)

goal (1 subgoal):
 1. \<lbrakk>nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
let ?Rel = "measures [\<lambda> (A' :: 'a mat,i,j). nc - j, \<lambda> (A',i,j). if A' $$ (i,j) = 0 then 1 else 0]"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
have wf: "wf ?Rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
wf (measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0])

goal (1 subgoal):
 1. \<lbrakk>nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show "nr = dim_row A' \<Longrightarrow> nc = dim_col A' \<Longrightarrow> mat_rel R A A' \<Longrightarrow> i \<le> nr \<Longrightarrow> j \<le> nc \<Longrightarrow>
    mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
using P
[PROOF STATE]
proof (prove)
using this:
P = (A', i, j)

goal (1 subgoal):
 1. \<lbrakk>nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
proof (induct P arbitrary: A' B' A i j rule: wf_induct[OF wf])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x A' B' A i j. \<lbrakk>\<forall>y. (y, x) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0] \<longrightarrow> (\<forall>x. nr = dim_row x \<longrightarrow> nc = dim_col x \<longrightarrow> (\<forall>xa xb. mat_rel R xb x \<longrightarrow> (\<forall>xc\<le>nr. \<forall>xd\<le>nc. y = (x, xc, xd) \<longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc xb xc xd) (fst (gauss_jordan_main x xa xc xd))))); nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc; x = (A', i, j)\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case (1 P A' B' A i j)
[PROOF STATE]
proof (state)
this:
\<forall>y. (y, P) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0] \<longrightarrow> (\<forall>x. nr = dim_row x \<longrightarrow> nc = dim_col x \<longrightarrow> (\<forall>xa xb. mat_rel R xb x \<longrightarrow> (\<forall>xc\<le>nr. \<forall>xd\<le>nc. y = (x, xc, xd) \<longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc xb xc xd) (fst (gauss_jordan_main x xa xc xd)))))
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc
P = (A', i, j)

goal (1 subgoal):
 1. \<And>x A' B' A i j. \<lbrakk>\<forall>y. (y, x) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0] \<longrightarrow> (\<forall>x. nr = dim_row x \<longrightarrow> nc = dim_col x \<longrightarrow> (\<forall>xa xb. mat_rel R xb x \<longrightarrow> (\<forall>xc\<le>nr. \<forall>xd\<le>nc. y = (x, xc, xd) \<longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc xb xc xd) (fst (gauss_jordan_main x xa xc xd))))); nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc; x = (A', i, j)\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note prems = 1(2-6)
[PROOF STATE]
proof (state)
this:
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc

goal (1 subgoal):
 1. \<And>x A' B' A i j. \<lbrakk>\<forall>y. (y, x) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0] \<longrightarrow> (\<forall>x. nr = dim_row x \<longrightarrow> nc = dim_col x \<longrightarrow> (\<forall>xa xb. mat_rel R xb x \<longrightarrow> (\<forall>xc\<le>nr. \<forall>xd\<le>nc. y = (x, xc, xd) \<longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc xb xc xd) (fst (gauss_jordan_main x xa xc xd))))); nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc; x = (A', i, j)\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note P = 1(7)
[PROOF STATE]
proof (state)
this:
P = (A', i, j)

goal (1 subgoal):
 1. \<And>x A' B' A i j. \<lbrakk>\<forall>y. (y, x) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0] \<longrightarrow> (\<forall>x. nr = dim_row x \<longrightarrow> nc = dim_col x \<longrightarrow> (\<forall>xa xb. mat_rel R xb x \<longrightarrow> (\<forall>xc\<le>nr. \<forall>xd\<le>nc. y = (x, xc, xd) \<longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc xb xc xd) (fst (gauss_jordan_main x xa xc xd))))); nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc; x = (A', i, j)\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note A[transfer_rule] = prems(3)
[PROOF STATE]
proof (state)
this:
mat_rel R A A'

goal (1 subgoal):
 1. \<And>x A' B' A i j. \<lbrakk>\<forall>y. (y, x) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0] \<longrightarrow> (\<forall>x. nr = dim_row x \<longrightarrow> nc = dim_col x \<longrightarrow> (\<forall>xa xb. mat_rel R xb x \<longrightarrow> (\<forall>xc\<le>nr. \<forall>xd\<le>nc. y = (x, xc, xd) \<longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc xb xc xd) (fst (gauss_jordan_main x xa xc xd))))); nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc; x = (A', i, j)\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note IH = 1(1)[rule_format, OF _ _ _ _ _ _ refl]
[PROOF STATE]
proof (state)
this:
\<lbrakk>((?x, ?xc, ?xd), P) \<in> measures [\<lambda>(A', i, y). nc - y, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0]; nr = dim_row ?x; nc = dim_col ?x; mat_rel R ?xb ?x; ?xc \<le> nr; ?xd \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc ?xb ?xc ?xd) (fst (gauss_jordan_main ?x ?xa ?xc ?xd))

goal (1 subgoal):
 1. \<And>x A' B' A i j. \<lbrakk>\<forall>y. (y, x) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0] \<longrightarrow> (\<forall>x. nr = dim_row x \<longrightarrow> nc = dim_col x \<longrightarrow> (\<forall>xa xb. mat_rel R xb x \<longrightarrow> (\<forall>xc\<le>nr. \<forall>xd\<le>nc. y = (x, xc, xd) \<longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc xb xc xd) (fst (gauss_jordan_main x xa xc xd))))); nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc; x = (A', i, j)\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note simps = gauss_jordan_main_code[of A' B' i j, unfolded Let_def, folded prems(1-2)]
      gauss_jordan_main_i.simps[of ops nr nc A i j] Let_def if_True if_False
[PROOF STATE]
proof (state)
this:
gauss_jordan_main A' B' i j = (if i < nr \<and> j < nc then if A' $$ (i, j) = (0::'a) then case concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) of [] \<Rightarrow> gauss_jordan_main A' B' i (Suc j) | i' # x \<Rightarrow> gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j else if A' $$ (i, j) = (1::'a) then gauss_jordan_main (eliminate_entries (\<lambda>i. A' $$ (i, j)) A' i j) (eliminate_entries (\<lambda>i. A' $$ (i, j)) B' i j) (Suc i) (Suc j) else gauss_jordan_main (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j) (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) B') i j) (Suc i) (Suc j) else (A', B'))
gauss_jordan_main_i ops nr nc A i j = (if i < nr \<and> j < nc then let aij = A $$ (i, j) in if aij = arith_ops_record.zero ops then case concat (map (\<lambda>i'. if A $$ (i', j) \<noteq> arith_ops_record.zero ops then [i'] else []) [Suc i..<nr]) of [] \<Rightarrow> gauss_jordan_main_i ops nr nc A i (Suc j) | i' # x \<Rightarrow> gauss_jordan_main_i ops nr nc (swaprows i i' A) i j else if aij = arith_ops_record.one ops then let v = \<lambda>i. A $$ (nat_of_integer i, j) in gauss_jordan_main_i ops nr nc (eliminate_entries_i ops v A i j) (Suc i) (Suc j) else let iaij = arith_ops_record.inverse ops aij; A' = multrow_i ops i iaij A; v = \<lambda>i. A' $$ (nat_of_integer i, j) in gauss_jordan_main_i ops nr nc (eliminate_entries_i ops v A' i j) (Suc i) (Suc j) else A)
Let ?s ?f \<equiv> ?f ?s
(if True then ?x else ?y) = ?x
(if False then ?x else ?y) = ?y

goal (1 subgoal):
 1. \<And>x A' B' A i j. \<lbrakk>\<forall>y. (y, x) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0] \<longrightarrow> (\<forall>x. nr = dim_row x \<longrightarrow> nc = dim_col x \<longrightarrow> (\<forall>xa xb. mat_rel R xb x \<longrightarrow> (\<forall>xc\<le>nr. \<forall>xd\<le>nc. y = (x, xc, xd) \<longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc xb xc xd) (fst (gauss_jordan_main x xa xc xd))))); nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc; x = (A', i, j)\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
proof (cases "i < nr \<and> j < nc")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. \<not> (i < nr \<and> j < nc) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (i < nr \<and> j < nc)

goal (2 subgoals):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. \<not> (i < nr \<and> j < nc) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
hence id: "(i < nr \<and> j < nc) = False"
[PROOF STATE]
proof (prove)
using this:
\<not> (i < nr \<and> j < nc)

goal (1 subgoal):
 1. (i < nr \<and> j < nc) = False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(i < nr \<and> j < nc) = False

goal (2 subgoals):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. \<not> (i < nr \<and> j < nc) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
unfolding simps id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R A (fst (A', B'))
[PROOF STEP]
by simp transfer_prover
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i < nr \<and> j < nc

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note ij' = this
[PROOF STATE]
proof (state)
this:
i < nr \<and> j < nc

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
hence id: "(i < nr \<and> j < nc) = True" "\<And> x y z. (if x = x then y else z) = y"
[PROOF STATE]
proof (prove)
using this:
i < nr \<and> j < nc

goal (1 subgoal):
 1. (i < nr \<and> j < nc) = True &&& (\<And>x y z. (if x = x then y else z) = y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(i < nr \<and> j < nc) = True
(if ?x = ?x then ?y else ?z) = ?y

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
from True prems
[PROOF STATE]
proof (chain)
picking this:
i < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc
[PROOF STEP]
have ij [transfer_rule]:"R (A $$ (i,j)) (A' $$ (i,j))"
[PROOF STATE]
proof (prove)
using this:
i < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc

goal (1 subgoal):
 1. R (A $$ (i, j)) (A' $$ (i, j))
[PROOF STEP]
unfolding mat_rel_def
[PROOF STATE]
proof (prove)
using this:
i < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
dim_row A = dim_row A' \<and> dim_col A = dim_col A' \<and> (\<forall>i j. i < dim_row A' \<longrightarrow> j < dim_col A' \<longrightarrow> R (A $$ (i, j)) (A' $$ (i, j)))
i \<le> nr
j \<le> nc

goal (1 subgoal):
 1. R (A $$ (i, j)) (A' $$ (i, j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
R (A $$ (i, j)) (A' $$ (i, j))

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
from True prems
[PROOF STATE]
proof (chain)
picking this:
i < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc
[PROOF STEP]
have i: "i < dim_row A'" "j < dim_col A'" and i': "i < nr" "j < nc"
[PROOF STATE]
proof (prove)
using this:
i < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc

goal (1 subgoal):
 1. (i < dim_row A' &&& j < dim_col A') &&& i < nr &&& j < nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < dim_row A'
j < dim_col A'
i < nr
j < nc

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
i < dim_row A'
j < dim_col A'
i < nr
j < nc

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ia__ < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B' ia__ j))
[PROOF STEP]
assume "i < dim_row A'"
[PROOF STATE]
proof (state)
this:
i < dim_row A'

goal (1 subgoal):
 1. ia__ < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B' ia__ j))
[PROOF STEP]
with i True prems
[PROOF STATE]
proof (chain)
picking this:
ia__ < dim_row A'
j < dim_col A'
ia__ < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
ia__ \<le> nr
j \<le> nc
i < dim_row A'
[PROOF STEP]
have R[transfer_rule]:"R (A $$ (i,j)) (A' $$ (i,j))"
[PROOF STATE]
proof (prove)
using this:
ia__ < dim_row A'
j < dim_col A'
ia__ < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
ia__ \<le> nr
j \<le> nc
i < dim_row A'

goal (1 subgoal):
 1. R (A $$ (i, j)) (A' $$ (i, j))
[PROOF STEP]
unfolding mat_rel_def
[PROOF STATE]
proof (prove)
using this:
ia__ < dim_row A'
j < dim_col A'
ia__ < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
dim_row A = dim_row A' \<and> dim_col A = dim_col A' \<and> (\<forall>i j. i < dim_row A' \<longrightarrow> j < dim_col A' \<longrightarrow> R (A $$ (i, j)) (A' $$ (i, j)))
ia__ \<le> nr
j \<le> nc
i < dim_row A'

goal (1 subgoal):
 1. R (A $$ (i, j)) (A' $$ (i, j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
R (A $$ (i, j)) (A' $$ (i, j))

goal (1 subgoal):
 1. ia__ < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B' ia__ j))
[PROOF STEP]
have "(A $$ (i,j) = zero) = (A' $$ (i,j) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
[PROOF STEP]
by transfer_prover
[PROOF STATE]
proof (state)
this:
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))

goal (1 subgoal):
 1. ia__ < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B' ia__ j))
[PROOF STEP]
note this R
[PROOF STATE]
proof (state)
this:
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
R (A $$ (i, j)) (A' $$ (i, j))

goal (1 subgoal):
 1. ia__ < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B' ia__ j))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?ib3 < dim_row A' \<Longrightarrow> (A $$ (?ib3, j) = arith_ops_record.zero ops) = (A' $$ (?ib3, j) = (0::'a))
?ib3 < dim_row A' \<Longrightarrow> R (A $$ (?ib3, j)) (A' $$ (?ib3, j))

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note eq_gen = this
[PROOF STATE]
proof (state)
this:
?ib3 < dim_row A' \<Longrightarrow> (A $$ (?ib3, j) = arith_ops_record.zero ops) = (A' $$ (?ib3, j) = (0::'a))
?ib3 < dim_row A' \<Longrightarrow> R (A $$ (?ib3, j)) (A' $$ (?ib3, j))

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
have eq: "(A $$ (i,j) = zero) = (A' $$ (i,j) = 0)"
        "(A $$ (i,j) = one) = (A' $$ (i,j) = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a)) &&& (A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))
[PROOF STEP]
by transfer_prover+
[PROOF STATE]
proof (state)
this:
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
(A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))

goal (1 subgoal):
 1. i < nr \<and> j < nc \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
proof (cases "A' $$ (i, j) = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A' $$ (i, j) = (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A' $$ (i, j) = (0::'a)

goal (2 subgoals):
 1. A' $$ (i, j) = (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
hence eq: "A $$ (i,j) = zero"
[PROOF STATE]
proof (prove)
using this:
A' $$ (i, j) = (0::'a)

goal (1 subgoal):
 1. A $$ (i, j) = arith_ops_record.zero ops
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
A' $$ (i, j) = (0::'a)
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
(A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))

goal (1 subgoal):
 1. A $$ (i, j) = arith_ops_record.zero ops
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A $$ (i, j) = arith_ops_record.zero ops

goal (2 subgoals):
 1. A' $$ (i, j) = (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
let ?is = "[ i' . i' <- [Suc i ..< nr],  A $$ (i',j) \<noteq> zero]"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A' $$ (i, j) = (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
let ?is' = "[ i' . i' <- [Suc i ..< nr],  A' $$ (i',j) \<noteq> 0]"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A' $$ (i, j) = (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
define xs where "xs = [Suc i..<nr]"
[PROOF STATE]
proof (state)
this:
xs = [Suc i..<nr]

goal (2 subgoals):
 1. A' $$ (i, j) = (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
have xs: "set xs \<subseteq> {0 ..< dim_row A'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set xs \<subseteq> {0..<dim_row A'}
[PROOF STEP]
unfolding xs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [Suc i..<nr] \<subseteq> {0..<dim_row A'}
[PROOF STEP]
using prems
[PROOF STATE]
proof (prove)
using this:
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc

goal (1 subgoal):
 1. set [Suc i..<nr] \<subseteq> {0..<dim_row A'}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> {0..<dim_row A'}

goal (2 subgoals):
 1. A' $$ (i, j) = (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
hence id': "?is = ?is'"
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> {0..<dim_row A'}

goal (1 subgoal):
 1. concat (map (\<lambda>i'. if A $$ (i', j) \<noteq> arith_ops_record.zero ops then [i'] else []) [Suc i..<nr]) = concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr])
[PROOF STEP]
unfolding xs_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> {0..<dim_row A'}

goal (1 subgoal):
 1. concat (map (\<lambda>i'. if A $$ (i', j) \<noteq> arith_ops_record.zero ops then [i'] else []) xs) = concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) xs)
[PROOF STEP]
by (induct xs, insert eq_gen, auto)
[PROOF STATE]
proof (state)
this:
concat (map (\<lambda>i'. if A $$ (i', j) \<noteq> arith_ops_record.zero ops then [i'] else []) [Suc i..<nr]) = concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr])

goal (2 subgoals):
 1. A' $$ (i, j) = (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
proof (cases ?is')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = [] \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = []

goal (2 subgoals):
 1. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = [] \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
have "?thesis = (mat_rel R (gauss_jordan_main_i ops nr nc A i (Suc j))
            (fst (gauss_jordan_main A' B' i (Suc j))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j)) = mat_rel R (gauss_jordan_main_i ops nr nc A i (Suc j)) (fst (gauss_jordan_main A' B' i (Suc j)))
[PROOF STEP]
unfolding True simps id eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (case concat (map (\<lambda>i'. if A $$ (i', j) \<noteq> arith_ops_record.zero ops then [i'] else []) [Suc i..<nr]) of [] \<Rightarrow> gauss_jordan_main_i ops nr nc A i (Suc j) | i' # x \<Rightarrow> gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (case concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) of [] \<Rightarrow> gauss_jordan_main A' B' i (Suc j) | i' # x \<Rightarrow> gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j)) = mat_rel R (gauss_jordan_main_i ops nr nc A i (Suc j)) (fst (gauss_jordan_main A' B' i (Suc j)))
[PROOF STEP]
unfolding Nil id'[unfolded Nil]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (case [] of [] \<Rightarrow> gauss_jordan_main_i ops nr nc A i (Suc j) | i' # x \<Rightarrow> gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (case [] of [] \<Rightarrow> gauss_jordan_main A' B' i (Suc j) | i' # x \<Rightarrow> gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j)) = mat_rel R (gauss_jordan_main_i ops nr nc A i (Suc j)) (fst (gauss_jordan_main A' B' i (Suc j)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j)) = mat_rel R (gauss_jordan_main_i ops nr nc A i (Suc j)) (fst (gauss_jordan_main A' B' i (Suc j)))

goal (2 subgoals):
 1. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = [] \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j)) = mat_rel R (gauss_jordan_main_i ops nr nc A i (Suc j)) (fst (gauss_jordan_main A' B' i (Suc j)))

goal (2 subgoals):
 1. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = [] \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
have "\<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i (Suc j)) (fst (gauss_jordan_main A' B' i (Suc j)))
[PROOF STEP]
by (rule IH, insert i prems P, auto)
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i (Suc j)) (fst (gauss_jordan_main A' B' i (Suc j)))

goal (2 subgoals):
 1. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = [] \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case (Cons i' idx')
[PROOF STATE]
proof (state)
this:
concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = i' # idx'

goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
from arg_cong[OF this, of set] i
[PROOF STATE]
proof (chain)
picking this:
set (concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr])) = set (i' # idx')
i < dim_row A'
j < dim_col A'
[PROOF STEP]
have i': "i' < nr" "A' $$ (i', j) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
set (concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr])) = set (i' # idx')
i < dim_row A'
j < dim_col A'

goal (1 subgoal):
 1. i' < nr &&& A' $$ (i', j) \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i' < nr
A' $$ (i', j) \<noteq> (0::'a)

goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
with ij' prems(1-2)
[PROOF STATE]
proof (chain)
picking this:
i < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
i' < nr
A' $$ (i', j) \<noteq> (0::'a)
[PROOF STEP]
have *: "i' < dim_row A'" "i < dim_row A'" "j < dim_col A'"
[PROOF STATE]
proof (prove)
using this:
i < nr \<and> j < nc
nr = dim_row A'
nc = dim_col A'
i' < nr
A' $$ (i', j) \<noteq> (0::'a)

goal (1 subgoal):
 1. i' < dim_row A' &&& i < dim_row A' &&& j < dim_col A'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i' < dim_row A'
i < dim_row A'
j < dim_col A'

goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
have rel: "((swaprows i i' A', i, j), P) \<in> ?Rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((swaprows i i' A', i, j), P) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0]
[PROOF STEP]
by (simp add: P True * i')
[PROOF STATE]
proof (state)
this:
((swaprows i i' A', i, j), P) \<in> measures [\<lambda>(A', i, j). nc - j, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0]

goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
have "?thesis = (mat_rel R (gauss_jordan_main_i ops nr nc (swaprows i i' A) i j)
            (fst (gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j)) = mat_rel R (gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j))
[PROOF STEP]
unfolding True simps id eq Cons id'[unfolded Cons]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (case i' # idx' of [] \<Rightarrow> gauss_jordan_main_i ops nr nc A i (Suc j) | i' # x \<Rightarrow> gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (case i' # idx' of [] \<Rightarrow> gauss_jordan_main A' B' i (Suc j) | i' # x \<Rightarrow> gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j)) = mat_rel R (gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j)) = mat_rel R (gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j))

goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j)) = mat_rel R (gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j))

goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
have "\<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j))
[PROOF STEP]
by (rule IH[OF rel _ _ swap_rows_transfer], insert i i' prems P True, auto)
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc (swaprows i i' A) i j) (fst (gauss_jordan_main (swaprows i i' A') (swaprows i i' B') i j))

goal (1 subgoal):
 1. \<And>a list. concat (map (\<lambda>i'. if A' $$ (i', j) \<noteq> (0::'a) then [i'] else []) [Suc i..<nr]) = a # list \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A' $$ (i, j) \<noteq> (0::'a)

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
from False eq
[PROOF STATE]
proof (chain)
picking this:
A' $$ (i, j) \<noteq> (0::'a)
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
(A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))
[PROOF STEP]
have neq: "(A $$ (i, j) = zero) = False" "(A' $$ (i, j) = 0) = False"
[PROOF STATE]
proof (prove)
using this:
A' $$ (i, j) \<noteq> (0::'a)
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
(A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))

goal (1 subgoal):
 1. (A $$ (i, j) = arith_ops_record.zero ops) = False &&& (A' $$ (i, j) = (0::'a)) = False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A $$ (i, j) = arith_ops_record.zero ops) = False
(A' $$ (i, j) = (0::'a)) = False

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(A $$ (i, j) = arith_ops_record.zero ops) = False
(A' $$ (i, j) = (0::'a)) = False

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
fix B B' i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A' $$ (ia__, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B'a__ ia__ j))
[PROOF STEP]
assume B[transfer_rule]: "mat_rel R B B'" and dim: "dim_col B' = nc" and i: "i < dim_row B'"
[PROOF STATE]
proof (state)
this:
mat_rel R B B'
dim_col B' = nc
i < dim_row B'

goal (1 subgoal):
 1. A' $$ (ia__, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B'a__ ia__ j))
[PROOF STEP]
from dim i True
[PROOF STATE]
proof (chain)
picking this:
dim_col B' = nc
i < dim_row B'
ia__ < nr \<and> j < nc
[PROOF STEP]
have "j < dim_col B'"
[PROOF STATE]
proof (prove)
using this:
dim_col B' = nc
i < dim_row B'
ia__ < nr \<and> j < nc

goal (1 subgoal):
 1. j < dim_col B'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j < dim_col B'

goal (1 subgoal):
 1. A' $$ (ia__, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B'a__ ia__ j))
[PROOF STEP]
with B i
[PROOF STATE]
proof (chain)
picking this:
mat_rel R B B'
i < dim_row B'
j < dim_col B'
[PROOF STEP]
have "R (B $$ (i,j)) (B' $$ (i,j))"
[PROOF STATE]
proof (prove)
using this:
mat_rel R B B'
i < dim_row B'
j < dim_col B'

goal (1 subgoal):
 1. R (B $$ (i, j)) (B' $$ (i, j))
[PROOF STEP]
by (simp add: mat_rel_def)
[PROOF STATE]
proof (state)
this:
R (B $$ (i, j)) (B' $$ (i, j))

goal (1 subgoal):
 1. A' $$ (ia__, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A ia__ j) (fst (gauss_jordan_main A' B'a__ ia__ j))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>mat_rel R ?B3 ?B'b3; dim_col ?B'b3 = nc; ?ib3 < dim_row ?B'b3\<rbrakk> \<Longrightarrow> R (?B3 $$ (?ib3, j)) (?B'b3 $$ (?ib3, j))

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note vec_rel = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>mat_rel R ?B3 ?B'b3; dim_col ?B'b3 = nc; ?ib3 < dim_row ?B'b3\<rbrakk> \<Longrightarrow> R (?B3 $$ (?ib3, j)) (?B'b3 $$ (?ib3, j))

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
from prems
[PROOF STATE]
proof (chain)
picking this:
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc
[PROOF STEP]
have dim: "dim_row A = dim_row A'"
[PROOF STATE]
proof (prove)
using this:
nr = dim_row A'
nc = dim_col A'
mat_rel R A A'
i \<le> nr
j \<le> nc

goal (1 subgoal):
 1. dim_row A = dim_row A'
[PROOF STEP]
unfolding mat_rel_def
[PROOF STATE]
proof (prove)
using this:
nr = dim_row A'
nc = dim_col A'
dim_row A = dim_row A' \<and> dim_col A = dim_col A' \<and> (\<forall>i j. i < dim_row A' \<longrightarrow> j < dim_col A' \<longrightarrow> R (A $$ (i, j)) (A' $$ (i, j)))
i \<le> nr
j \<le> nc

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

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (0::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
proof (cases "A' $$ (i, j) = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A' $$ (i, j) = (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A' $$ (i, j) = (1::'a)

goal (2 subgoals):
 1. A' $$ (i, j) = (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
from True eq
[PROOF STATE]
proof (chain)
picking this:
A' $$ (i, j) = (1::'a)
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
(A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))
[PROOF STEP]
have eq: "(A $$ (i,j) = one) = True" "(A' $$ (i,j) = 1) = True"
[PROOF STATE]
proof (prove)
using this:
A' $$ (i, j) = (1::'a)
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
(A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))

goal (1 subgoal):
 1. (A $$ (i, j) = arith_ops_record.one ops) = True &&& (A' $$ (i, j) = (1::'a)) = True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A $$ (i, j) = arith_ops_record.one ops) = True
(A' $$ (i, j) = (1::'a)) = True

goal (2 subgoals):
 1. A' $$ (i, j) = (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
note rel = vec_rel[OF A]
[PROOF STATE]
proof (state)
this:
\<lbrakk>dim_col A' = nc; ?ib3 < dim_row A'\<rbrakk> \<Longrightarrow> R (A $$ (?ib3, j)) (A' $$ (?ib3, j))

goal (2 subgoals):
 1. A' $$ (i, j) = (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
 2. A' $$ (i, j) \<noteq> (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
unfolding simps id neq eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc (eliminate_entries_i ops (\<lambda>i. A $$ (nat_of_integer i, j)) A i j) (Suc i) (Suc j)) (fst (gauss_jordan_main (eliminate_entries (\<lambda>i. A' $$ (i, j)) A' i j) (eliminate_entries (\<lambda>i. A' $$ (i, j)) B' i j) (Suc i) (Suc j)))
[PROOF STEP]
by (rule IH[OF _ _ _ eliminate_entries_i], insert rel prems ij i P dim, auto)
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A' $$ (i, j) \<noteq> (1::'a)

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
from False eq
[PROOF STATE]
proof (chain)
picking this:
A' $$ (i, j) \<noteq> (1::'a)
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
(A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))
[PROOF STEP]
have eq: "(A $$ (i,j) = one) = False" "(A' $$ (i,j) = 1) = False"
[PROOF STATE]
proof (prove)
using this:
A' $$ (i, j) \<noteq> (1::'a)
(A $$ (i, j) = arith_ops_record.zero ops) = (A' $$ (i, j) = (0::'a))
(A $$ (i, j) = arith_ops_record.one ops) = (A' $$ (i, j) = (1::'a))

goal (1 subgoal):
 1. (A $$ (i, j) = arith_ops_record.one ops) = False &&& (A' $$ (i, j) = (1::'a)) = False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A $$ (i, j) = arith_ops_record.one ops) = False
(A' $$ (i, j) = (1::'a)) = False

goal (1 subgoal):
 1. A' $$ (i, j) \<noteq> (1::'a) \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))
[PROOF STEP]
unfolding simps id neq eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (gauss_jordan_main_i ops nr nc (eliminate_entries_i ops (\<lambda>i. multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A $$ (nat_of_integer i, j)) (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) i j) (Suc i) (Suc j)) (fst (gauss_jordan_main (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j) (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) B') i j) (Suc i) (Suc j)))
[PROOF STEP]
proof (rule IH, goal_cases)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. ((eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j, Suc i, Suc j), P) \<in> measures [\<lambda>(A', i, y). nc - y, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0]
 2. nr = dim_row (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 3. nc = dim_col (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 4. mat_rel R (eliminate_entries_i ops (\<lambda>i. multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A $$ (nat_of_integer i, j)) (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) i j) (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 5. Suc i \<le> nr
 6. Suc j \<le> nc
[PROOF STEP]
case 4
[PROOF STATE]
proof (state)
this:

goal (6 subgoals):
 1. ((eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j, Suc i, Suc j), P) \<in> measures [\<lambda>(A', i, y). nc - y, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0]
 2. nr = dim_row (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 3. nc = dim_col (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 4. mat_rel R (eliminate_entries_i ops (\<lambda>i. multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A $$ (nat_of_integer i, j)) (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) i j) (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 5. Suc i \<le> nr
 6. Suc j \<le> nc
[PROOF STEP]
have A': "mat_rel R (multrow_i ops i (inverse (A $$ (i, j))) A)
              (multrow i (inverse_class.inverse (A' $$ (i, j))) A')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) (multrow i (inverse_class.inverse (A' $$ (i, j))) A')
[PROOF STEP]
by transfer_prover
[PROOF STATE]
proof (state)
this:
mat_rel R (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) (multrow i (inverse_class.inverse (A' $$ (i, j))) A')

goal (6 subgoals):
 1. ((eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j, Suc i, Suc j), P) \<in> measures [\<lambda>(A', i, y). nc - y, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0]
 2. nr = dim_row (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 3. nc = dim_col (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 4. mat_rel R (eliminate_entries_i ops (\<lambda>i. multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A $$ (nat_of_integer i, j)) (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) i j) (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 5. Suc i \<le> nr
 6. Suc j \<le> nc
[PROOF STEP]
note rel = vec_rel[OF A']
[PROOF STATE]
proof (state)
this:
\<lbrakk>dim_col (multrow i (inverse_class.inverse (A' $$ (i, j))) A') = nc; ?ib3 < dim_row (multrow i (inverse_class.inverse (A' $$ (i, j))) A')\<rbrakk> \<Longrightarrow> R (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A $$ (?ib3, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (?ib3, j))

goal (6 subgoals):
 1. ((eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j, Suc i, Suc j), P) \<in> measures [\<lambda>(A', i, y). nc - y, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0]
 2. nr = dim_row (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 3. nc = dim_col (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 4. mat_rel R (eliminate_entries_i ops (\<lambda>i. multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A $$ (nat_of_integer i, j)) (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) i j) (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 5. Suc i \<le> nr
 6. Suc j \<le> nc
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_rel R (eliminate_entries_i ops (\<lambda>i. multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A $$ (nat_of_integer i, j)) (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) i j) (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
[PROOF STEP]
by (rule eliminate_entries_i[OF _ _ A'], insert rel prems i dim, auto)
[PROOF STATE]
proof (state)
this:
mat_rel R (eliminate_entries_i ops (\<lambda>i. multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A $$ (nat_of_integer i, j)) (multrow_i ops i (arith_ops_record.inverse ops (A $$ (i, j))) A) i j) (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)

goal (5 subgoals):
 1. ((eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j, Suc i, Suc j), P) \<in> measures [\<lambda>(A', i, y). nc - y, \<lambda>(A', i, j). if A' $$ (i, j) = (0::'a) then 1 else 0]
 2. nr = dim_row (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 3. nc = dim_col (eliminate_entries (\<lambda>i. multrow i (inverse_class.inverse (A' $$ (i, j))) A' $$ (i, j)) (multrow i (inverse_class.inverse (A' $$ (i, j))) A') i j)
 4. Suc i \<le> nr
 5. Suc j \<le> nc
[PROOF STEP]
qed (insert prems i P, auto)
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>nr = dim_row A'; nc = dim_col A'; mat_rel R A A'; i \<le> nr; j \<le> nc\<rbrakk> \<Longrightarrow> mat_rel R (gauss_jordan_main_i ops nr nc A i j) (fst (gauss_jordan_main A' B' i j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_strict_mono:
  fixes f::"nat \<Rightarrow> nat"
  assumes  strictf: "strict_mono f" and i: "i<n"
shows "f i = (sorted_list_of_set (f`{0..<n})) ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
let ?I = "f`{0..<n}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
have "length (sorted_list_of_set (f ` {0..<n})) = card ?I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (sorted_list_of_set (f ` {0..<n})) = card (f ` {0..<n})
[PROOF STEP]
by (metis distinct_card finite_atLeastLessThan finite_imageI
        sorted_list_of_set(1) sorted_list_of_set(3))
[PROOF STATE]
proof (state)
this:
length (sorted_list_of_set (f ` {0..<n})) = card (f ` {0..<n})

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (sorted_list_of_set (f ` {0..<n})) = card (f ` {0..<n})

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
have "... = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (f ` {0..<n}) = n
[PROOF STEP]
by (simp add: card_image strict_mono_imp_inj_on strictf)
[PROOF STATE]
proof (state)
this:
card (f ` {0..<n}) = n

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length (sorted_list_of_set (f ` {0..<n})) = n
[PROOF STEP]
have length_I: "length (sorted_list_of_set ?I) = n"
[PROOF STATE]
proof (prove)
using this:
length (sorted_list_of_set (f ` {0..<n})) = n

goal (1 subgoal):
 1. length (sorted_list_of_set (f ` {0..<n})) = n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length (sorted_list_of_set (f ` {0..<n})) = n

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
have card_eq: "card {a \<in> ?I. a < f i} = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {a \<in> f ` {0..<n}. a < f i} = i
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. card {a \<in> f ` {0..<n}. a < f i} = i
[PROOF STEP]
proof (induct i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f 0} = 0
 2. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f 0} = 0
 2. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. card {a \<in> f ` {0..<n}. a < f 0} = 0
[PROOF STEP]
by (auto simp add: strict_mono_less strictf)
[PROOF STATE]
proof (state)
this:
card {a \<in> f ` {0..<n}. a < f 0} = 0

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i
Suc i < n

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
have i: "i < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < n
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc i < n

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

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
let ?J'="{a \<in> f ` {0..<n}. a < f i}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
let ?J = "{a \<in> f ` {0..<n}. a < f (Suc i)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
have cardJ': "card ?J' = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {a \<in> f ` {0..<n}. a < f i} = i
[PROOF STEP]
by (rule Suc.hyps[OF i])
[PROOF STATE]
proof (state)
this:
card {a \<in> f ` {0..<n}. a < f i} = i

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
have J: "?J = insert (f i) ?J'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a \<in> f ` {0..<n}. a < f (Suc i)} = insert (f i) {a \<in> f ` {0..<n}. a < f i}
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>xa. \<lbrakk>f xa \<noteq> f i; f xa < f (Suc i); xa < n\<rbrakk> \<Longrightarrow> f xa < f i
 2. f i \<in> f ` {0..<n}
 3. f i < f (Suc i)
 4. \<And>xa. \<lbrakk>f xa < f i; xa < n\<rbrakk> \<Longrightarrow> f xa < f (Suc i)
[PROOF STEP]
fix xa
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>xa. \<lbrakk>f xa \<noteq> f i; f xa < f (Suc i); xa < n\<rbrakk> \<Longrightarrow> f xa < f i
 2. f i \<in> f ` {0..<n}
 3. f i < f (Suc i)
 4. \<And>xa. \<lbrakk>f xa < f i; xa < n\<rbrakk> \<Longrightarrow> f xa < f (Suc i)
[PROOF STEP]
assume 1: "f xa \<noteq> f i" and 2: "f xa < f (Suc i)"
[PROOF STATE]
proof (state)
this:
f xa \<noteq> f i
f xa < f (Suc i)

goal (4 subgoals):
 1. \<And>xa. \<lbrakk>f xa \<noteq> f i; f xa < f (Suc i); xa < n\<rbrakk> \<Longrightarrow> f xa < f i
 2. f i \<in> f ` {0..<n}
 3. f i < f (Suc i)
 4. \<And>xa. \<lbrakk>f xa < f i; xa < n\<rbrakk> \<Longrightarrow> f xa < f (Suc i)
[PROOF STEP]
show "f xa < f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f xa < f i
[PROOF STEP]
using 1 2 not_less_less_Suc_eq strict_mono_less strictf
[PROOF STATE]
proof (prove)
using this:
f xa \<noteq> f i
f xa < f (Suc i)
\<not> ?n < ?m \<Longrightarrow> (?n < Suc ?m) = (?n = ?m)
strict_mono ?f \<Longrightarrow> (?f ?x < ?f ?y) = (?x < ?y)
strict_mono f

goal (1 subgoal):
 1. f xa < f i
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f xa < f i

goal (3 subgoals):
 1. f i \<in> f ` {0..<n}
 2. f i < f (Suc i)
 3. \<And>xa. \<lbrakk>f xa < f i; xa < n\<rbrakk> \<Longrightarrow> f xa < f (Suc i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f i \<in> f ` {0..<n}
 2. f i < f (Suc i)
 3. \<And>xa. \<lbrakk>f xa < f i; xa < n\<rbrakk> \<Longrightarrow> f xa < f (Suc i)
[PROOF STEP]
fix xa
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f i \<in> f ` {0..<n}
 2. f i < f (Suc i)
 3. \<And>xa. \<lbrakk>f xa < f i; xa < n\<rbrakk> \<Longrightarrow> f xa < f (Suc i)
[PROOF STEP]
assume "f xa < f i"
[PROOF STATE]
proof (state)
this:
f xa < f i

goal (3 subgoals):
 1. f i \<in> f ` {0..<n}
 2. f i < f (Suc i)
 3. \<And>xa. \<lbrakk>f xa < f i; xa < n\<rbrakk> \<Longrightarrow> f xa < f (Suc i)
[PROOF STEP]
thus "f xa < f (Suc i)"
[PROOF STATE]
proof (prove)
using this:
f xa < f i

goal (1 subgoal):
 1. f xa < f (Suc i)
[PROOF STEP]
using less_SucI strict_mono_less strictf
[PROOF STATE]
proof (prove)
using this:
f xa < f i
?m < ?n \<Longrightarrow> ?m < Suc ?n
strict_mono ?f \<Longrightarrow> (?f ?x < ?f ?y) = (?x < ?y)
strict_mono f

goal (1 subgoal):
 1. f xa < f (Suc i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f xa < f (Suc i)

goal (2 subgoals):
 1. f i \<in> f ` {0..<n}
 2. f i < f (Suc i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f i \<in> f ` {0..<n}
 2. f i < f (Suc i)
[PROOF STEP]
show "f i \<in> f ` {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i \<in> f ` {0..<n}
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. f i \<in> f ` {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f i \<in> f ` {0..<n}

goal (1 subgoal):
 1. f i < f (Suc i)
[PROOF STEP]
show "f i < f (Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i < f (Suc i)
[PROOF STEP]
using strictf strict_mono_less
[PROOF STATE]
proof (prove)
using this:
strict_mono f
strict_mono ?f \<Longrightarrow> (?f ?x < ?f ?y) = (?x < ?y)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{a \<in> f ` {0..<n}. a < f (Suc i)} = insert (f i) {a \<in> f ` {0..<n}. a < f i}

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
have "card ?J = Suc (card ?J')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc (card {a \<in> f ` {0..<n}. a < f i})
[PROOF STEP]
by (unfold J, rule card_insert_disjoint, auto)
[PROOF STATE]
proof (state)
this:
card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc (card {a \<in> f ` {0..<n}. a < f i})

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < n \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f i} = i; Suc i < n\<rbrakk> \<Longrightarrow> card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc (card {a \<in> f ` {0..<n}. a < f i})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc (card {a \<in> f ` {0..<n}. a < f i})

goal (1 subgoal):
 1. card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
using cardJ'
[PROOF STATE]
proof (prove)
using this:
card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc (card {a \<in> f ` {0..<n}. a < f i})
card {a \<in> f ` {0..<n}. a < f i} = i

goal (1 subgoal):
 1. card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {a \<in> f ` {0..<n}. a < f (Suc i)} = Suc i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {a \<in> f ` {0..<n}. a < f i} = i

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
have "sorted_list_of_set ?I ! i = pick ?I i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set (f ` {0..<n}) ! i = pick (f ` {0..<n}) i
[PROOF STEP]
by (rule sorted_list_of_set_eq_pick, simp add: \<open>card (f ` {0..<n}) = n\<close> i)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (f ` {0..<n}) ! i = pick (f ` {0..<n}) i

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (f ` {0..<n}) ! i = pick (f ` {0..<n}) i

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
have "... =  pick ?I (card {a \<in> ?I. a < f i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pick (f ` {0..<n}) i = pick (f ` {0..<n}) (card {a \<in> f ` {0..<n}. a < f i})
[PROOF STEP]
unfolding card_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pick (f ` {0..<n}) i = pick (f ` {0..<n}) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pick (f ` {0..<n}) i = pick (f ` {0..<n}) (card {a \<in> f ` {0..<n}. a < f i})

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pick (f ` {0..<n}) i = pick (f ` {0..<n}) (card {a \<in> f ` {0..<n}. a < f i})

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
have "... = f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pick (f ` {0..<n}) (card {a \<in> f ` {0..<n}. a < f i}) = f i
[PROOF STEP]
by (rule pick_card_in_set, simp add: i)
[PROOF STATE]
proof (state)
this:
pick (f ` {0..<n}) (card {a \<in> f ` {0..<n}. a < f i}) = f i

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sorted_list_of_set (f ` {0..<n}) ! i = f i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set (f ` {0..<n}) ! i = f i

goal (1 subgoal):
 1. f i = sorted_list_of_set (f ` {0..<n}) ! i
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
f i = sorted_list_of_set (f ` {0..<n}) ! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_anti_symmetry:
  assumes "A B Le C D" and
    "C D Le A B"
  shows "Cong A B C D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cong A B C D
[PROOF STEP]
by (smt Le_def Tarski_neutral_dimensionless.between_exchange4 Tarski_neutral_dimensionless_axioms assms(1) assms(2) bet_neq21__neq between_cong between_exchange3 cong_transitivity l5_5_1 not_cong_3421)


[STATEMENT]
lemma tlset_TLCons: "tlset1 (TLCons x xs) = {x} \<union> tlset1 xs" "tlset2 (TLCons x xs) = tlset2 xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tlset1 (TLCons x xs) = {x} \<union> tlset1 xs &&& tlset2 (TLCons x xs) = tlset2 xs
[PROOF STEP]
by (transfer; auto simp: eq_tllist_def split: if_splits)+


[STATEMENT]
lemma map_partial_pullback_intersect:
"map_partial_pullback m f l (S1 \<inter> S2) = (map_partial_pullback m f l S1) \<inter> (map_partial_pullback m f l S2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_partial_pullback m f l (S1 \<inter> S2) = map_partial_pullback m f l S1 \<inter> map_partial_pullback m f l S2
[PROOF STEP]
unfolding map_partial_pullback_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_partial_image m f \<inverse>\<^bsub>m + l\<^esub> (S1 \<inter> S2) = map_partial_image m f \<inverse>\<^bsub>m + l\<^esub> S1 \<inter> map_partial_image m f \<inverse>\<^bsub>m + l\<^esub> S2
[PROOF STEP]
by simp


[STATEMENT]
lemma Eps12_hypext_sqrt_extract [simp]:
  "x > 0 \<Longrightarrow> Eps12 ((*h* sqrt) (\<beta> x)) = - (inverse (sqrt x ^ 3) / 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> Eps12 ((*h* sqrt) (\<beta> x)) = - (inverse (sqrt x ^ 3) / 4)
[PROOF STEP]
using Eps12_hypext[of sqrt]
[PROOF STATE]
proof (prove)
using this:
Eps12 ((*h* sqrt) (\<beta> ?x)) = deriv (deriv sqrt) ?x

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> Eps12 ((*h* sqrt) (\<beta> x)) = - (inverse (sqrt x ^ 3) / 4)
[PROOF STEP]
by simp


[STATEMENT]
lemma topology_eq_iff: "t = s \<longleftrightarrow> (topspace t = topspace s \<and>
  (\<forall>x\<subseteq>topspace t. openin t x = openin s x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t = s) = (topspace t = topspace s \<and> (\<forall>x\<subseteq>topspace t. openin t x = openin s x))
[PROOF STEP]
by (metis (full_types) openin_subset topology_eq)


[STATEMENT]
lemma swap_swap_id[simp]: "(x \<rightleftharpoons>\<^sub>F y) ((x \<rightleftharpoons>\<^sub>F y) z) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<rightleftharpoons>\<^sub>F y) ((x \<rightleftharpoons>\<^sub>F y) z) = z
[PROOF STEP]
by (fact transpose_involutory)


[STATEMENT]
theorem Shuffle_PlusL[simp]: "Shuffle (Plus r s) t = Plus (Shuffle r t) (Shuffle s t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Shuffle (Plus r s) t = Plus (Shuffle r t) (Shuffle s t)
[PROOF STEP]
by (coinduction arbitrary: r s t rule: language_coinduct_upto_Plus)
    (force intro!: Trans[OF Plus[OF Base Base] Refl])


[STATEMENT]
lemma under_succ[simp]:
assumes "aboveS i \<noteq> {}"
shows "under (succ i) = insert (succ i) (under i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.under (succ i) = insert (succ i) (local.under i)
[PROOF STEP]
using less_succ[OF assms]
[PROOF STATE]
proof (prove)
using this:
((?j, succ i) \<in> r) = ((?j, i) \<in> r \<or> ?j = succ i)

goal (1 subgoal):
 1. local.under (succ i) = insert (succ i) (local.under i)
[PROOF STEP]
unfolding under_def
[PROOF STATE]
proof (prove)
using this:
((?j, succ i) \<in> r) = ((?j, i) \<in> r \<or> ?j = succ i)

goal (1 subgoal):
 1. {b. (b, succ i) \<in> r} = insert (succ i) {b. (b, i) \<in> r}
[PROOF STEP]
by auto


[STATEMENT]
lemma iT_Plus_icard: "icard (I \<oplus> k) = icard I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard (I \<oplus> k) = icard I
[PROOF STEP]
by (simp add: iT_Plus_def icard_image)


[STATEMENT]
lemma dim_row_of_dagger [simp]:
  "dim_row (M\<^sup>\<dagger>) = dim_col M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row M\<^sup>\<dagger> = dim_col M
[PROOF STEP]
using dagger_def
[PROOF STATE]
proof (prove)
using this:
?M\<^sup>\<dagger> \<equiv> mat (dim_col ?M) (dim_row ?M) (\<lambda>(i, j). cnj (?M $$ (j, i)))

goal (1 subgoal):
 1. dim_row M\<^sup>\<dagger> = dim_col M
[PROOF STEP]
by simp


[STATEMENT]
lemma GDERIV_norm:
  assumes "x \<noteq> 0" shows "GDERIV (\<lambda>x. norm x) x :> sgn x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GDERIV norm x :> sgn x
[PROOF STEP]
unfolding gderiv_def norm_eq_sqrt_inner
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. sqrt (inner x x)) has_derivative (\<lambda>h. inner h (sgn x))) (at x)
[PROOF STEP]
by (rule derivative_eq_intros | force simp add: inner_commute sgn_div_norm norm_eq_sqrt_inner assms)+


[STATEMENT]
lemma (in ideal) a_rcos_sum:
  assumes "a \<in> carrier R" and "b \<in> carrier R" shows "(I +> a) <+> (I +> b) = I +> (a \<oplus> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I +> a <+> (I +> b) = I +> a \<oplus> b
[PROOF STEP]
using normal.rcos_sum[OF ideal_is_normal[OF ideal_axioms]] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier (add_monoid R); ?y \<in> carrier (add_monoid R)\<rbrakk> \<Longrightarrow> I #>\<^bsub>add_monoid R\<^esub> ?x <#>\<^bsub>add_monoid R\<^esub> (I #>\<^bsub>add_monoid R\<^esub> ?y) = I #>\<^bsub>add_monoid R\<^esub> ?x \<otimes>\<^bsub>add_monoid R\<^esub> ?y
a \<in> carrier R
b \<in> carrier R

goal (1 subgoal):
 1. I +> a <+> (I +> b) = I +> a \<oplus> b
[PROOF STEP]
unfolding set_add_def a_r_coset_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier (add_monoid R); ?y \<in> carrier (add_monoid R)\<rbrakk> \<Longrightarrow> I #>\<^bsub>add_monoid R\<^esub> ?x <#>\<^bsub>add_monoid R\<^esub> (I #>\<^bsub>add_monoid R\<^esub> ?y) = I #>\<^bsub>add_monoid R\<^esub> ?x \<otimes>\<^bsub>add_monoid R\<^esub> ?y
a \<in> carrier R
b \<in> carrier R

goal (1 subgoal):
 1. I #>\<^bsub>add_monoid R\<^esub> a <#>\<^bsub>add_monoid R\<^esub> (I #>\<^bsub>add_monoid R\<^esub> b) = I #>\<^bsub>add_monoid R\<^esub> a \<oplus> b
[PROOF STEP]
by simp