[STATEMENT]
lemma circuit_iff_rank_of:
  assumes "X \<subseteq> carrier"
  shows "circuit X \<longleftrightarrow> X \<noteq> {} \<and> (\<forall>x \<in> X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circuit X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
proof (standard, goal_cases LTR RTL)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. circuit X \<Longrightarrow> X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
 2. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
case LTR
[PROOF STATE]
proof (state)
this:
circuit X

goal (2 subgoals):
 1. circuit X \<Longrightarrow> X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
 2. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
circuit X
[PROOF STEP]
have "X \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
circuit X

goal (1 subgoal):
 1. X \<noteq> {}
[PROOF STEP]
using circuit_nonempty
[PROOF STATE]
proof (prove)
using this:
circuit X
circuit ?X \<Longrightarrow> ?X \<noteq> {}

goal (1 subgoal):
 1. X \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<noteq> {}

goal (2 subgoals):
 1. circuit X \<Longrightarrow> X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
 2. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
X \<noteq> {}

goal (2 subgoals):
 1. circuit X \<Longrightarrow> X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
 2. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
have indep_remove: "\<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
assume "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> X
[PROOF STEP]
have "indep (X - {x})"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. indep (X - {x})
[PROOF STEP]
using circuit_min_dep[OF LTR]
[PROOF STATE]
proof (prove)
using this:
x \<in> X
?x \<in> X \<Longrightarrow> indep (X - {?x})

goal (1 subgoal):
 1. indep (X - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
indep (X - {x})

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
indep (X - {x})

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
have "X - {x} \<subseteq> carrier"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X - {x} \<subseteq> carrier
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> carrier

goal (1 subgoal):
 1. X - {x} \<subseteq> carrier
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X - {x} \<subseteq> carrier

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
indep (X - {x})
X - {x} \<subseteq> carrier
[PROOF STEP]
show "rank_of (X - {x}) = card (X - {x})"
[PROOF STATE]
proof (prove)
using this:
indep (X - {x})
X - {x} \<subseteq> carrier

goal (1 subgoal):
 1. rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
using indep_iff_rank_of
[PROOF STATE]
proof (prove)
using this:
indep (X - {x})
X - {x} \<subseteq> carrier
?X \<subseteq> carrier \<Longrightarrow> indep ?X = (rank_of ?X = card ?X)

goal (1 subgoal):
 1. rank_of (X - {x}) = card (X - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank_of (X - {x}) = card (X - {x})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = card (X - {?x})

goal (2 subgoals):
 1. circuit X \<Longrightarrow> X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
 2. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = card (X - {?x})

goal (2 subgoals):
 1. circuit X \<Longrightarrow> X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
 2. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
have "\<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
assume *: "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
have "rank_of X \<le> card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_of X \<le> card X
[PROOF STEP]
using assms rank_of_le
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> carrier
?\<E> \<subseteq> carrier \<Longrightarrow> rank_of ?\<E> \<le> card ?\<E>

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

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rank_of X \<le> card X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
have "rank_of X \<noteq> card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_of X \<noteq> card X
[PROOF STEP]
using assms LTR circuitD indep_iff_rank_of[of X]
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> carrier
circuit X
circuit ?X \<Longrightarrow> ?X \<subseteq> carrier
circuit ?X \<Longrightarrow> \<not> indep ?X
\<lbrakk>circuit ?X; ?x \<in> ?X\<rbrakk> \<Longrightarrow> indep (?X - {?x})
X \<subseteq> carrier \<Longrightarrow> indep X = (rank_of X = card X)

goal (1 subgoal):
 1. rank_of X \<noteq> card X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank_of X \<noteq> card X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rank_of X \<le> card X
rank_of X \<noteq> card X
[PROOF STEP]
have "rank_of X < card X"
[PROOF STATE]
proof (prove)
using this:
rank_of X \<le> card X
rank_of X \<noteq> card X

goal (1 subgoal):
 1. rank_of X < card X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank_of X < card X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rank_of X < card X
[PROOF STEP]
have "rank_of X \<le> card (X - {x})"
[PROOF STATE]
proof (prove)
using this:
rank_of X < card X

goal (1 subgoal):
 1. rank_of X \<le> card (X - {x})
[PROOF STEP]
using * finite_subset[OF assms] carrier_finite
[PROOF STATE]
proof (prove)
using this:
rank_of X < card X
x \<in> X
finite carrier \<Longrightarrow> finite X
finite carrier

goal (1 subgoal):
 1. rank_of X \<le> card (X - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank_of X \<le> card (X - {x})

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rank_of X \<le> card (X - {x})

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
have "\<dots> = rank_of (X - {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (X - {x}) = rank_of (X - {x})
[PROOF STEP]
using indep_remove \<open>x \<in> X\<close>
[PROOF STATE]
proof (prove)
using this:
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = card (X - {?x})
x \<in> X

goal (1 subgoal):
 1. card (X - {x}) = rank_of (X - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (X - {x}) = rank_of (X - {x})

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rank_of X \<le> rank_of (X - {x})
[PROOF STEP]
show "rank_of (X - {x}) = rank_of X"
[PROOF STATE]
proof (prove)
using this:
rank_of X \<le> rank_of (X - {x})

goal (1 subgoal):
 1. rank_of (X - {x}) = rank_of X
[PROOF STEP]
using assms rank_of_mono[of "X - {x}" X]
[PROOF STATE]
proof (prove)
using this:
rank_of X \<le> rank_of (X - {x})
X \<subseteq> carrier
\<lbrakk>X - {x} \<subseteq> X; X \<subseteq> carrier\<rbrakk> \<Longrightarrow> rank_of (X - {x}) \<le> rank_of X

goal (1 subgoal):
 1. rank_of (X - {x}) = rank_of X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank_of (X - {x}) = rank_of X

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = rank_of X

goal (2 subgoals):
 1. circuit X \<Longrightarrow> X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
 2. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
X \<noteq> {}
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = card (X - {?x})
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = rank_of X
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = card (X - {?x})
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = rank_of X

goal (1 subgoal):
 1. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)

goal (1 subgoal):
 1. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
case RTL
[PROOF STATE]
proof (state)
this:
X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)

goal (1 subgoal):
 1. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
[PROOF STEP]
have "X \<noteq> {}"
    and indep_remove: "\<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})"
    and dep: "\<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X"
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)

goal (1 subgoal):
 1. X \<noteq> {} &&& (\<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})) &&& (\<And>x. x \<in> X \<Longrightarrow> rank_of (X - {x}) = rank_of X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<noteq> {}
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = card (X - {?x})
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = rank_of X

goal (1 subgoal):
 1. X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X) \<Longrightarrow> circuit X
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circuit X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> carrier

goal (1 subgoal):
 1. circuit X
[PROOF STEP]
proof (rule circuitI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> indep X
 2. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
obtain x where x: "x \<in> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>X \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}

goal (1 subgoal):
 1. (\<And>x. x \<in> X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (2 subgoals):
 1. \<not> indep X
 2. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> X
[PROOF STEP]
have "rank_of X = card (X - {x})"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. rank_of X = card (X - {x})
[PROOF STEP]
using dep indep_remove
[PROOF STATE]
proof (prove)
using this:
x \<in> X
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = rank_of X
?x \<in> X \<Longrightarrow> rank_of (X - {?x}) = card (X - {?x})

goal (1 subgoal):
 1. rank_of X = card (X - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank_of X = card (X - {x})

goal (2 subgoals):
 1. \<not> indep X
 2. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rank_of X = card (X - {x})

goal (2 subgoals):
 1. \<not> indep X
 2. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
have "\<dots> < card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (X - {x}) < card X
[PROOF STEP]
using card_Diff1_less[OF finite_subset[OF assms carrier_finite] x]
[PROOF STATE]
proof (prove)
using this:
card (X - {x}) < card X

goal (1 subgoal):
 1. card (X - {x}) < card X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (X - {x}) < card X

goal (2 subgoals):
 1. \<not> indep X
 2. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rank_of X < card X
[PROOF STEP]
show "\<not> indep X"
[PROOF STATE]
proof (prove)
using this:
rank_of X < card X

goal (1 subgoal):
 1. \<not> indep X
[PROOF STEP]
using indep_iff_rank_of[OF assms]
[PROOF STATE]
proof (prove)
using this:
rank_of X < card X
indep X = (rank_of X = card X)

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

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
assume "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> indep (X - {x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> X
[PROOF STEP]
show "indep (X - {x})"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. indep (X - {x})
[PROOF STEP]
using assms indep_remove[of x] indep_iff_rank_of[of "X - {x}"]
[PROOF STATE]
proof (prove)
using this:
x \<in> X
X \<subseteq> carrier
x \<in> X \<Longrightarrow> rank_of (X - {x}) = card (X - {x})
X - {x} \<subseteq> carrier \<Longrightarrow> indep (X - {x}) = (rank_of (X - {x}) = card (X - {x}))

goal (1 subgoal):
 1. indep (X - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
indep (X - {x})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
circuit X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_divide_unit_factor_denom_conv_times_fps_X_power:
  fixes   f g :: "'a::{semiring_1,inverse,uminus} fps"
  assumes "subdegree g \<le> subdegree f"
  shows   "f / unit_factor g = f / g * fps_X ^ subdegree g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f / unit_factor g = f / g * fps_X ^ subdegree g
[PROOF STEP]
by      (simp add: assms fps_divide_shift_denom_conv_times_fps_X_power)


[STATEMENT]
lemma fconverse_vdoubleton: "(set {[a, b]\<^sub>\<circ>, [c, d]\<^sub>\<circ>})\<inverse>\<^sub>\<bullet> = set {[b, a]\<^sub>\<circ>, [d, c]\<^sub>\<circ>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set {[a, b]\<^sub>\<circ>, [c, d]\<^sub>\<circ>})\<inverse>\<^sub>\<bullet> = set {[b, a]\<^sub>\<circ>, [d, c]\<^sub>\<circ>}
[PROOF STEP]
by force


[STATEMENT]
lemma power_mod_div:
  fixes x :: "nat"
  shows "x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)" (is "?LHS = ?RHS")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
proof (cases "n \<le> m")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
 2. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n \<le> m

goal (2 subgoals):
 1. n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
 2. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<le> m
[PROOF STEP]
have "?LHS = 0"
[PROOF STATE]
proof (prove)
using this:
n \<le> m

goal (1 subgoal):
 1. x mod 2 ^ n div 2 ^ m = 0
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = 0
[PROOF STEP]
apply (rule div_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> m \<Longrightarrow> x mod 2 ^ n < 2 ^ m
[PROOF STEP]
apply (rule order_less_le_trans [OF mod_less_divisor]; simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
x mod 2 ^ n div 2 ^ m = 0

goal (2 subgoals):
 1. n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
 2. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x mod 2 ^ n div 2 ^ m = 0

goal (2 subgoals):
 1. n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
 2. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
have "\<dots> = ?RHS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
n \<le> m

goal (1 subgoal):
 1. 0 = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 = x div 2 ^ m mod 2 ^ (n - m)

goal (2 subgoals):
 1. n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
 2. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)

goal (1 subgoal):
 1. x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> n \<le> m

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> m
[PROOF STEP]
have lt: "m < n"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> m

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

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m < n
[PROOF STEP]
obtain q where nv: "n = m + q" and "0 < q"
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>n = m + q; 0 < q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto dest: less_imp_Suc_add)
[PROOF STATE]
proof (state)
this:
n = m + q
0 < q

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = m + q
0 < q
[PROOF STEP]
have "x mod 2 ^ n = 2 ^ m * (x div 2 ^ m mod 2 ^ q) + x mod 2 ^ m"
[PROOF STATE]
proof (prove)
using this:
n = m + q
0 < q

goal (1 subgoal):
 1. x mod 2 ^ n = 2 ^ m * (x div 2 ^ m mod 2 ^ q) + x mod 2 ^ m
[PROOF STEP]
by (simp add: power_add mod_mult2_eq)
[PROOF STATE]
proof (state)
this:
x mod 2 ^ n = 2 ^ m * (x div 2 ^ m mod 2 ^ q) + x mod 2 ^ m

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x mod 2 ^ n = 2 ^ m * (x div 2 ^ m mod 2 ^ q) + x mod 2 ^ m
[PROOF STEP]
have "?LHS = x div 2 ^ m mod 2 ^ q"
[PROOF STATE]
proof (prove)
using this:
x mod 2 ^ n = 2 ^ m * (x div 2 ^ m mod 2 ^ q) + x mod 2 ^ m

goal (1 subgoal):
 1. x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ q
[PROOF STEP]
by (simp add: div_add1_eq)
[PROOF STATE]
proof (state)
this:
x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ q

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ q

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
have "\<dots> = ?RHS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x div 2 ^ m mod 2 ^ q = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
using nv
[PROOF STATE]
proof (prove)
using this:
n = m + q

goal (1 subgoal):
 1. x div 2 ^ m mod 2 ^ q = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x div 2 ^ m mod 2 ^ q = x div 2 ^ m mod 2 ^ (n - m)

goal (1 subgoal):
 1. \<not> n \<le> m \<Longrightarrow> x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)

goal (1 subgoal):
 1. x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x mod 2 ^ n div 2 ^ m = x div 2 ^ m mod 2 ^ (n - m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transpos_noteqTr:"\<lbrakk>0 < n; k \<le> (n - Suc 0); j \<le> n; j \<noteq> n\<rbrakk>
                    \<Longrightarrow> j \<noteq> (\<tau>\<^bsub>j n\<^esub>) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; k \<le> n - Suc 0; j \<le> n; j \<noteq> n\<rbrakk> \<Longrightarrow> j \<noteq> (\<tau>\<^bsub>j n\<^esub>) k
[PROOF STEP]
apply (rule contrapos_pp, simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<le> n - Suc 0; j \<le> n; j \<noteq> n; j = (\<tau>\<^bsub>j n\<^esub>) k\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (simp add:transpos_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<le> n - Suc 0; j \<le> n; j \<noteq> n; j = (if k = j then n else if k = n then j else k)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (case_tac "k = j", simp, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<le> n - Suc 0; j \<le> n; j \<noteq> n; j = (if k = n then j else k); k \<noteq> j\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (case_tac "k = n", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<le> n - Suc 0; j \<le> n; j \<noteq> n; j = (if k = n then j else k); k \<noteq> j; k \<noteq> n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (simp add:n_notin_Nset_pred)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bij_betw_inv_into_RIGHT_LEFT:
assumes BIJ: "bij_betw f A A'" and SUB: "B' \<le> A'" and
        IM: "(inv_into A f) ` B' = B"
shows "f ` B = B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` B = B'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` B = B'
[PROOF STEP]
have "f`((inv_into A f)` B') = B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` inv_into A f ` B' = B'
[PROOF STEP]
using assms bij_betw_inv_into_RIGHT[of f A A' B']
[PROOF STATE]
proof (prove)
using this:
bij_betw f A A'
B' \<subseteq> A'
inv_into A f ` B' = B
\<lbrakk>bij_betw f A A'; B' \<subseteq> A'\<rbrakk> \<Longrightarrow> f ` inv_into A f ` B' = B'

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

goal (1 subgoal):
 1. f ` B = B'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` inv_into A f ` B' = B'

goal (1 subgoal):
 1. f ` B = B'
[PROOF STEP]
using IM
[PROOF STATE]
proof (prove)
using this:
f ` inv_into A f ` B' = B'
inv_into A f ` B' = B

goal (1 subgoal):
 1. f ` B = B'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` B = B'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma append_vec_add:
  assumes [simp]: "v : carrier_vec n" "v' : carrier_vec n"
      and [simp]: "w : carrier_vec m" "w' : carrier_vec m"
  shows "(v @\<^sub>v w) + (v' @\<^sub>v w') = (v + v') @\<^sub>v (w + w')" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v @\<^sub>v w + (v' @\<^sub>v w') = (v + v') @\<^sub>v w + w'
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec ((v + v') @\<^sub>v w + w') \<Longrightarrow> (v @\<^sub>v w + (v' @\<^sub>v w')) $ i = ((v + v') @\<^sub>v w + w') $ i
 2. dim_vec (v @\<^sub>v w + (v' @\<^sub>v w')) = dim_vec ((v + v') @\<^sub>v w + w')
[PROOF STEP]
have [simp]: "dim_vec v = n" "dim_vec v' = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec v = n &&& dim_vec v' = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_vec v = n
dim_vec v' = n

goal (2 subgoals):
 1. \<And>i. i < dim_vec ((v + v') @\<^sub>v w + w') \<Longrightarrow> (v @\<^sub>v w + (v' @\<^sub>v w')) $ i = ((v + v') @\<^sub>v w + w') $ i
 2. dim_vec (v @\<^sub>v w + (v' @\<^sub>v w')) = dim_vec ((v + v') @\<^sub>v w + w')
[PROOF STEP]
have [simp]: "dim_vec w = m" "dim_vec w' = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec w = m &&& dim_vec w' = m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_vec w = m
dim_vec w' = m

goal (2 subgoals):
 1. \<And>i. i < dim_vec ((v + v') @\<^sub>v w + w') \<Longrightarrow> (v @\<^sub>v w + (v' @\<^sub>v w')) $ i = ((v + v') @\<^sub>v w + w') $ i
 2. dim_vec (v @\<^sub>v w + (v' @\<^sub>v w')) = dim_vec ((v + v') @\<^sub>v w + w')
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec ((v + v') @\<^sub>v w + w') \<Longrightarrow> (v @\<^sub>v w + (v' @\<^sub>v w')) $ i = ((v + v') @\<^sub>v w + w') $ i
 2. dim_vec (v @\<^sub>v w + (v' @\<^sub>v w')) = dim_vec ((v + v') @\<^sub>v w + w')
[PROOF STEP]
assume i: "i < dim_vec ?R"
[PROOF STATE]
proof (state)
this:
i < dim_vec ((v + v') @\<^sub>v w + w')

goal (2 subgoals):
 1. \<And>i. i < dim_vec ((v + v') @\<^sub>v w + w') \<Longrightarrow> (v @\<^sub>v w + (v' @\<^sub>v w')) $ i = ((v + v') @\<^sub>v w + w') $ i
 2. dim_vec (v @\<^sub>v w + (v' @\<^sub>v w')) = dim_vec ((v + v') @\<^sub>v w + w')
[PROOF STEP]
thus "?L $ i = ?R $ i"
[PROOF STATE]
proof (prove)
using this:
i < dim_vec ((v + v') @\<^sub>v w + w')

goal (1 subgoal):
 1. (v @\<^sub>v w + (v' @\<^sub>v w')) $ i = ((v + v') @\<^sub>v w + w') $ i
[PROOF STEP]
by (cases "i < n",auto)
[PROOF STATE]
proof (state)
this:
(v @\<^sub>v w + (v' @\<^sub>v w')) $ i = ((v + v') @\<^sub>v w + w') $ i

goal (1 subgoal):
 1. dim_vec (v @\<^sub>v w + (v' @\<^sub>v w')) = dim_vec ((v + v') @\<^sub>v w + w')
[PROOF STEP]
qed auto


[STATEMENT]
lemma aux1_digit_wise_gen_equiv:
  assumes "b>1"
  shows "(\<forall>k.(nth_digit a k b = 0)) \<longleftrightarrow> a = 0" (is "?P \<longleftrightarrow> ?Q")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. nth_digit a k b = 0) = (a = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
 2. a = 0 \<Longrightarrow> \<forall>k. nth_digit a k b = 0
[PROOF STEP]
assume "?Q"
[PROOF STATE]
proof (state)
this:
a = 0

goal (2 subgoals):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
 2. a = 0 \<Longrightarrow> \<forall>k. nth_digit a k b = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = 0
[PROOF STEP]
show "?P"
[PROOF STATE]
proof (prove)
using this:
a = 0

goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0
[PROOF STEP]
by (simp add: nth_digit_def)
[PROOF STATE]
proof (state)
this:
\<forall>k. nth_digit a k b = 0

goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
[PROOF STEP]
assume a_neq_0:"\<not>?Q"
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
[PROOF STEP]
hence "a > 0"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

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

goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
[PROOF STEP]
hence "\<not>?P"
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. \<not> (\<forall>k. nth_digit a k b = 0)
[PROOF STEP]
using aux0_digit_wise_gen_equiv \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < a
\<lbrakk>1 < ?b; 0 < ?a\<rbrakk> \<Longrightarrow> \<exists>k. nth_digit ?a k ?b \<noteq> 0
1 < b

goal (1 subgoal):
 1. \<not> (\<forall>k. nth_digit a k b = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>k. nth_digit a k b = 0)

goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
a \<noteq> 0 \<Longrightarrow> \<not> (\<forall>k. nth_digit a k b = 0)

goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0 \<Longrightarrow> \<not> (\<forall>k. nth_digit a k b = 0)
[PROOF STEP]
show "?P \<Longrightarrow> ?Q"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0 \<Longrightarrow> \<not> (\<forall>k. nth_digit a k b = 0)

goal (1 subgoal):
 1. \<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>k. nth_digit a k b = 0 \<Longrightarrow> a = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma octo_of_real_diff [simp]: "octo_of_real (x - y) = octo_of_real x - octo_of_real y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. octo_of_real (x - y) = octo_of_real x - octo_of_real y
[PROOF STEP]
by (simp add: octo_of_real_def scaleR_left_diff_distrib)


[STATEMENT]
lemma list_all2_nthD2:
  "\<lbrakk>list_all2 P xs ys; p < size ys\<rbrakk> \<Longrightarrow> P (xs!p) (ys!p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 P xs ys; p < length ys\<rbrakk> \<Longrightarrow> P (xs ! p) (ys ! p)
[PROOF STEP]
by (frule list_all2_lengthD) (auto intro: list_all2_nthD)


[STATEMENT]
lemma keys_rbt_joinL: "bheight l \<le> bheight r \<Longrightarrow>
  RBT_Impl.keys (rbt_joinL l a b r) = RBT_Impl.keys l @ a # RBT_Impl.keys r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bheight l \<le> bheight r \<Longrightarrow> keys (rbt_joinL l a b r) = keys l @ a # keys r
[PROOF STEP]
proof (induction l a b r rule: rbt_joinL.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l a b r. \<lbrakk>\<And>x21 x22 x23 x24 x25. \<lbrakk>\<not> bheight r \<le> bheight l; r = Branch x21 x22 x23 x24 x25; x21 = R; bheight l \<le> bheight x22\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b x22) = keys l @ a # keys x22; \<And>x21 x22 x23 x24 x25. \<lbrakk>\<not> bheight r \<le> bheight l; r = Branch x21 x22 x23 x24 x25; x21 = B; bheight l \<le> bheight x22\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b x22) = keys l @ a # keys x22; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b r) = keys l @ a # keys r
[PROOF STEP]
case (1 l a b r)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> bheight r \<le> bheight l; r = Branch ?x21.0 ?x22.0 ?x23.0 ?x24.0 ?x25.0; ?x21.0 = R; bheight l \<le> bheight ?x22.0\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b ?x22.0) = keys l @ a # keys ?x22.0
\<lbrakk>\<not> bheight r \<le> bheight l; r = Branch ?x21.0 ?x22.0 ?x23.0 ?x24.0 ?x25.0; ?x21.0 = B; bheight l \<le> bheight ?x22.0\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b ?x22.0) = keys l @ a # keys ?x22.0
bheight l \<le> bheight r

goal (1 subgoal):
 1. \<And>l a b r. \<lbrakk>\<And>x21 x22 x23 x24 x25. \<lbrakk>\<not> bheight r \<le> bheight l; r = Branch x21 x22 x23 x24 x25; x21 = R; bheight l \<le> bheight x22\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b x22) = keys l @ a # keys x22; \<And>x21 x22 x23 x24 x25. \<lbrakk>\<not> bheight r \<le> bheight l; r = Branch x21 x22 x23 x24 x25; x21 = B; bheight l \<le> bheight x22\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b x22) = keys l @ a # keys x22; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b r) = keys l @ a # keys r
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> bheight r \<le> bheight l; r = Branch ?x21.0 ?x22.0 ?x23.0 ?x24.0 ?x25.0; ?x21.0 = R; bheight l \<le> bheight ?x22.0\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b ?x22.0) = keys l @ a # keys ?x22.0
\<lbrakk>\<not> bheight r \<le> bheight l; r = Branch ?x21.0 ?x22.0 ?x23.0 ?x24.0 ?x25.0; ?x21.0 = B; bheight l \<le> bheight ?x22.0\<rbrakk> \<Longrightarrow> keys (rbt_joinL l a b ?x22.0) = keys l @ a # keys ?x22.0
bheight l \<le> bheight r

goal (1 subgoal):
 1. keys (rbt_joinL l a b r) = keys l @ a # keys r
[PROOF STEP]
by (auto simp: keys_rbt_baliL rbt_joinL.simps[of l a b r]
        split!: RBT_Impl.rbt.splits RBT_Impl.color.splits)
[PROOF STATE]
proof (state)
this:
keys (rbt_joinL l a b r) = keys l @ a # keys r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma locally_finite_on_closure_Union:
  "(\<Union>i\<in>I. closure (U i)) = closure (\<Union>i\<in>I. (U i)) \<inter> X"
  if "locally_finite_on X I U" "\<And>i. i \<in> I \<Longrightarrow> closure (U i) \<subseteq> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i\<in>I. closure (U i)) = closure (\<Union> (U ` I)) \<inter> X
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>i\<in>I. closure (U i)) \<subseteq> closure (\<Union> (U ` I)) \<inter> X
 2. closure (\<Union> (U ` I)) \<inter> X \<subseteq> (\<Union>i\<in>I. closure (U i))
[PROOF STEP]
show "(\<Union>i\<in>I. closure (U i)) \<subseteq> closure (\<Union>i\<in>I. U i) \<inter> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i\<in>I. closure (U i)) \<subseteq> closure (\<Union> (U ` I)) \<inter> X
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
locally_finite_on X I U
?i \<in> I \<Longrightarrow> closure (U ?i) \<subseteq> X

goal (1 subgoal):
 1. (\<Union>i\<in>I. closure (U i)) \<subseteq> closure (\<Union> (U ` I)) \<inter> X
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x i. \<lbrakk>locally_finite_on X I U; \<And>i. i \<in> I \<Longrightarrow> closure (U i) \<subseteq> X; i \<in> I; x \<in> closure (U i)\<rbrakk> \<Longrightarrow> x \<in> closure (\<Union> (U ` I))
[PROOF STEP]
by (metis (no_types, lifting) SUP_le_iff closed_closure closure_minimal closure_subset subsetCE)
[PROOF STATE]
proof (state)
this:
(\<Union>i\<in>I. closure (U i)) \<subseteq> closure (\<Union> (U ` I)) \<inter> X

goal (1 subgoal):
 1. closure (\<Union> (U ` I)) \<inter> X \<subseteq> (\<Union>i\<in>I. closure (U i))
[PROOF STEP]
show "closure (\<Union>i\<in>I. U i) \<inter> X \<subseteq> (\<Union>i\<in>I. closure (U i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (\<Union> (U ` I)) \<inter> X \<subseteq> (\<Union>i\<in>I. closure (U i))
[PROOF STEP]
apply (rule closure_subtopology_minimal)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Union> (U ` I) \<subseteq> (\<Union>i\<in>I. closure (U i))
 2. closedin (top_of_set X) (\<Union>i\<in>I. closure (U i))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set X) (\<Union>i\<in>I. closure (U i))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
locally_finite_on X I U
?i \<in> I \<Longrightarrow> closure (U ?i) \<subseteq> X

goal (1 subgoal):
 1. closedin (top_of_set X) (\<Union>i\<in>I. closure (U i))
[PROOF STEP]
by (auto intro!: locally_finite_on_closedin_Union_closure)
[PROOF STATE]
proof (state)
this:
closure (\<Union> (U ` I)) \<inter> X \<subseteq> (\<Union>i\<in>I. closure (U i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pred_mapping_le:
  "pred_mapping ((\<le>) i) P1 \<Longrightarrow> rel_mapping (\<le>) P1 P2 \<Longrightarrow> pred_mapping ((\<le>) (i :: nat)) P2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pred_mapping ((\<le>) i) P1; rel_mapping (\<le>) P1 P2\<rbrakk> \<Longrightarrow> pred_mapping ((\<le>) i) P2
[PROOF STEP]
by (force simp: rel_mapping_alt pred_mapping_alt dom_def set_eq_iff)


[STATEMENT]
lemma isometry_classical_operator[simp]:
  fixes \<pi>::"'a \<Rightarrow> 'b"
  assumes a1: "inj \<pi>"
  shows "isometry (classical_operator (Some o \<pi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry (classical_operator (Some \<circ> \<pi>))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isometry (classical_operator (Some \<circ> \<pi>))
[PROOF STEP]
have b0: "inj_map (Some \<circ> \<pi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_map (Some \<circ> \<pi>)
[PROOF STEP]
by (simp add: a1)
[PROOF STATE]
proof (state)
this:
inj_map (Some \<circ> \<pi>)

goal (1 subgoal):
 1. isometry (classical_operator (Some \<circ> \<pi>))
[PROOF STEP]
have b0': "inj_map (inv_map (Some \<circ> \<pi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_map (inv_map (Some \<circ> \<pi>))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj_map (inv_map (Some \<circ> \<pi>))

goal (1 subgoal):
 1. isometry (classical_operator (Some \<circ> \<pi>))
[PROOF STEP]
have b1: "inv_map (Some \<circ> \<pi>) \<circ>\<^sub>m (Some \<circ> \<pi>) = Some"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_map (Some \<circ> \<pi>) \<circ>\<^sub>m (Some \<circ> \<pi>) = Some
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (inv_map (Some \<circ> \<pi>) \<circ>\<^sub>m (Some \<circ> \<pi>)) x = Some x
[PROOF STEP]
unfolding inv_map_def o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. ((\<lambda>y. if Some y \<in> range (\<lambda>x. Some (\<pi> x)) then Some (inv (\<lambda>x. Some (\<pi> x)) (Some y)) else None) \<circ>\<^sub>m (\<lambda>x. Some (\<pi> x))) x = Some x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj \<pi>

goal (1 subgoal):
 1. \<And>x. ((\<lambda>y. if Some y \<in> range (\<lambda>x. Some (\<pi> x)) then Some (inv (\<lambda>x. Some (\<pi> x)) (Some y)) else None) \<circ>\<^sub>m (\<lambda>x. Some (\<pi> x))) x = Some x
[PROOF STEP]
unfolding inj_def inv_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. \<pi> x = \<pi> y \<longrightarrow> x = y

goal (1 subgoal):
 1. \<And>x. ((\<lambda>y. if Some y \<in> range (\<lambda>x. Some (\<pi> x)) then Some (SOME x. Some (\<pi> x) = Some y) else None) \<circ>\<^sub>m (\<lambda>x. Some (\<pi> x))) x = Some x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv_map (Some \<circ> \<pi>) \<circ>\<^sub>m (Some \<circ> \<pi>) = Some

goal (1 subgoal):
 1. isometry (classical_operator (Some \<circ> \<pi>))
[PROOF STEP]
have b3: "classical_operator (inv_map (Some \<circ> \<pi>)) o\<^sub>C\<^sub>L
            classical_operator (Some \<circ> \<pi>) = classical_operator (inv_map (Some \<circ> \<pi>) \<circ>\<^sub>m (Some \<circ> \<pi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. classical_operator (inv_map (Some \<circ> \<pi>)) o\<^sub>C\<^sub>L classical_operator (Some \<circ> \<pi>) = classical_operator (inv_map (Some \<circ> \<pi>) \<circ>\<^sub>m (Some \<circ> \<pi>))
[PROOF STEP]
by (metis b0 b0' b1 classical_operator_Some classical_operator_exists_inj
        classical_operator_mult)
[PROOF STATE]
proof (state)
this:
classical_operator (inv_map (Some \<circ> \<pi>)) o\<^sub>C\<^sub>L classical_operator (Some \<circ> \<pi>) = classical_operator (inv_map (Some \<circ> \<pi>) \<circ>\<^sub>m (Some \<circ> \<pi>))

goal (1 subgoal):
 1. isometry (classical_operator (Some \<circ> \<pi>))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry (classical_operator (Some \<circ> \<pi>))
[PROOF STEP]
unfolding isometry_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. classical_operator (Some \<circ> \<pi>)* o\<^sub>C\<^sub>L classical_operator (Some \<circ> \<pi>) = id_cblinfun
[PROOF STEP]
apply (subst classical_operator_adjoint)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_map (Some \<circ> \<pi>)
 2. classical_operator (inv_map (Some \<circ> \<pi>)) o\<^sub>C\<^sub>L classical_operator (Some \<circ> \<pi>) = id_cblinfun
[PROOF STEP]
using b0
[PROOF STATE]
proof (prove)
using this:
inj_map (Some \<circ> \<pi>)

goal (2 subgoals):
 1. inj_map (Some \<circ> \<pi>)
 2. classical_operator (inv_map (Some \<circ> \<pi>)) o\<^sub>C\<^sub>L classical_operator (Some \<circ> \<pi>) = id_cblinfun
[PROOF STEP]
by (auto simp add: b1 b3)
[PROOF STATE]
proof (state)
this:
isometry (classical_operator (Some \<circ> \<pi>))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cinner_scaleR_left [simp]: "cinner (scaleR r x) y = of_real r * (cinner x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r *\<^sub>R x \<bullet>\<^sub>C y = complex_of_real r * (x \<bullet>\<^sub>C y)
[PROOF STEP]
by (simp add: scaleR_scaleC)


[STATEMENT]
lemma not_singleton_existence[simp]:
  \<open>\<exists> x::('a::not_singleton). x \<noteq> t\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. x \<noteq> t
[PROOF STEP]
using not_singleton_card[where ?'a = 'a]
[PROOF STATE]
proof (prove)
using this:
\<exists>x y. x \<noteq> y

goal (1 subgoal):
 1. \<exists>x. x \<noteq> t
[PROOF STEP]
by (metis (full_types))


[STATEMENT]
lemma list_update1: "\<lbrakk> braun t;  n \<in> {1.. size t} \<rbrakk> \<Longrightarrow> list(update1 n x t) = (list t)[n-1 := x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>braun t; n \<in> {1..size t}\<rbrakk> \<Longrightarrow> list (update1 n x t) = (list t)[n - 1 := x]
[PROOF STEP]
by(auto simp add: list_eq_map_lookup1 list_eq_iff_nth_eq lookup1_update1 size_update1 braun_update1)


[STATEMENT]
lemma divisors_base_zero:
  fixes a b :: "('a :: ring_no_zero_divisors) hyperdual"
  assumes "Base (a * b) = 0"
  shows "Base a = 0 \<or> Base b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Base a = (0::'a) \<or> Base b = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Base (a * b) = (0::'a)

goal (1 subgoal):
 1. Base a = (0::'a) \<or> Base b = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in comp_fun_idem) fold_set_union:
  "\<lbrakk> finite A; finite B \<rbrakk> \<Longrightarrow> Finite_Set.fold f x (A \<union> B) = Finite_Set.fold f (Finite_Set.fold f x A) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B\<rbrakk> \<Longrightarrow> Finite_Set.fold f x (A \<union> B) = Finite_Set.fold f (Finite_Set.fold f x A) B
[PROOF STEP]
by(induction A arbitrary: x rule: finite_induct)(simp_all add: fold_insert_idem2 del: fold_insert_idem)


[STATEMENT]
lemma islimpt_eq_acc_point:
  fixes l :: "'a :: t1_space"
  shows "l islimpt S \<longleftrightarrow> (\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l islimpt S = (\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S))
[PROOF STEP]
proof (safe intro!: islimptI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>U. \<lbrakk>l islimpt S; l \<in> U; open U; finite (U \<inter> S)\<rbrakk> \<Longrightarrow> False
 2. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
fix U
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>U. \<lbrakk>l islimpt S; l \<in> U; open U; finite (U \<inter> S)\<rbrakk> \<Longrightarrow> False
 2. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
assume "l islimpt S" "l \<in> U" "open U" "finite (U \<inter> S)"
[PROOF STATE]
proof (state)
this:
l islimpt S
l \<in> U
open U
finite (U \<inter> S)

goal (2 subgoals):
 1. \<And>U. \<lbrakk>l islimpt S; l \<in> U; open U; finite (U \<inter> S)\<rbrakk> \<Longrightarrow> False
 2. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l islimpt S
l \<in> U
open U
finite (U \<inter> S)
[PROOF STEP]
have "l islimpt S" "l \<in> (U - (U \<inter> S - {l}))" "open (U - (U \<inter> S - {l}))"
[PROOF STATE]
proof (prove)
using this:
l islimpt S
l \<in> U
open U
finite (U \<inter> S)

goal (1 subgoal):
 1. l islimpt S &&& l \<in> U - (U \<inter> S - {l}) &&& open (U - (U \<inter> S - {l}))
[PROOF STEP]
by (auto intro: finite_imp_closed)
[PROOF STATE]
proof (state)
this:
l islimpt S
l \<in> U - (U \<inter> S - {l})
open (U - (U \<inter> S - {l}))

goal (2 subgoals):
 1. \<And>U. \<lbrakk>l islimpt S; l \<in> U; open U; finite (U \<inter> S)\<rbrakk> \<Longrightarrow> False
 2. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l islimpt S
l \<in> U - (U \<inter> S - {l})
open (U - (U \<inter> S - {l}))
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
l islimpt S
l \<in> U - (U \<inter> S - {l})
open (U - (U \<inter> S - {l}))

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

goal (1 subgoal):
 1. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
fix T
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
assume *: "\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S)" "l \<in> T" "open T"
[PROOF STATE]
proof (state)
this:
\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S)
l \<in> T
open T

goal (1 subgoal):
 1. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S)
l \<in> T
open T
[PROOF STEP]
have "infinite (T \<inter> S - {l})"
[PROOF STATE]
proof (prove)
using this:
\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S)
l \<in> T
open T

goal (1 subgoal):
 1. infinite (T \<inter> S - {l})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
infinite (T \<inter> S - {l})

goal (1 subgoal):
 1. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite (T \<inter> S - {l})
[PROOF STEP]
have "\<exists>x. x \<in> (T \<inter> S - {l})"
[PROOF STATE]
proof (prove)
using this:
infinite (T \<inter> S - {l})

goal (1 subgoal):
 1. \<exists>x. x \<in> T \<inter> S - {l}
[PROOF STEP]
unfolding ex_in_conv
[PROOF STATE]
proof (prove)
using this:
infinite (T \<inter> S - {l})

goal (1 subgoal):
 1. T \<inter> S - {l} \<noteq> {}
[PROOF STEP]
by (intro notI) simp
[PROOF STATE]
proof (state)
this:
\<exists>x. x \<in> T \<inter> S - {l}

goal (1 subgoal):
 1. \<And>T. \<lbrakk>\<forall>U. l \<in> U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S); l \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. x \<in> T \<inter> S - {l}
[PROOF STEP]
show "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> l"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x \<in> T \<inter> S - {l}

goal (1 subgoal):
 1. \<exists>y\<in>S. y \<in> T \<and> y \<noteq> l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>y\<in>S. y \<in> T \<and> y \<noteq> l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_mult_append_cols: fixes A :: "'a :: comm_semiring_0 mat"
  assumes A: "A \<in> carrier_mat nr nc1"
    and B: "B \<in> carrier_mat nr nc2"
    and v1: "v1 \<in> carrier_vec nc1"
    and v2: "v2 \<in> carrier_vec nc2"
  shows "(A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "(A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = (A @\<^sub>c B) *\<^sub>v col (mat_of_col (v1 @\<^sub>v v2)) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = (A @\<^sub>c B) *\<^sub>v col (mat_of_col (v1 @\<^sub>v v2)) 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = (A @\<^sub>c B) *\<^sub>v col (mat_of_col (v1 @\<^sub>v v2)) 0

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = (A @\<^sub>c B) *\<^sub>v col (mat_of_col (v1 @\<^sub>v v2)) 0

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "\<dots> = col ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2)) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v col (mat_of_col (v1 @\<^sub>v v2)) 0 = col ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2)) 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A @\<^sub>c B) *\<^sub>v col (mat_of_col (v1 @\<^sub>v v2)) 0 = col ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2)) 0

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A @\<^sub>c B) *\<^sub>v col (mat_of_col (v1 @\<^sub>v v2)) 0 = col ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2)) 0

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "(A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2) = ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2))\<^sup>T\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2) = ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2))\<^sup>T\<^sup>T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2) = ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2))\<^sup>T\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2) = ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2))\<^sup>T\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2))\<^sup>T =
             (mat_of_row (v1 @\<^sub>v v2))\<^sup>T\<^sup>T * (A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2))\<^sup>T = (mat_of_row (v1 @\<^sub>v v2))\<^sup>T\<^sup>T * (A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T\<^sup>T
[PROOF STEP]
unfolding append_cols_def mat_of_col_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T * (mat_of_row (v1 @\<^sub>v v2))\<^sup>T)\<^sup>T = (mat_of_row (v1 @\<^sub>v v2))\<^sup>T\<^sup>T * (A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T\<^sup>T
[PROOF STEP]
proof (rule transpose_mult, force, unfold transpose_carrier_mat, rule mat_of_row_carrier)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))
[PROOF STEP]
have "A\<^sup>T \<in> carrier_mat nc1 nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>T \<in> carrier_mat nc1 nr
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc1

goal (1 subgoal):
 1. A\<^sup>T \<in> carrier_mat nc1 nr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A\<^sup>T \<in> carrier_mat nc1 nr

goal (1 subgoal):
 1. v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A\<^sup>T \<in> carrier_mat nc1 nr

goal (1 subgoal):
 1. v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))
[PROOF STEP]
have "B\<^sup>T \<in> carrier_mat nc2 nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^sup>T \<in> carrier_mat nc2 nr
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat nr nc2

goal (1 subgoal):
 1. B\<^sup>T \<in> carrier_mat nc2 nr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B\<^sup>T \<in> carrier_mat nc2 nr

goal (1 subgoal):
 1. v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A\<^sup>T \<in> carrier_mat nc1 nr
B\<^sup>T \<in> carrier_mat nc2 nr
[PROOF STEP]
have "A\<^sup>T @\<^sub>r B\<^sup>T \<in> carrier_mat (nc1 + nc2) nr"
[PROOF STATE]
proof (prove)
using this:
A\<^sup>T \<in> carrier_mat nc1 nr
B\<^sup>T \<in> carrier_mat nc2 nr

goal (1 subgoal):
 1. A\<^sup>T @\<^sub>r B\<^sup>T \<in> carrier_mat (nc1 + nc2) nr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A\<^sup>T @\<^sub>r B\<^sup>T \<in> carrier_mat (nc1 + nc2) nr

goal (1 subgoal):
 1. v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))
[PROOF STEP]
hence "dim_row (A\<^sup>T @\<^sub>r B\<^sup>T) = nc1 + nc2"
[PROOF STATE]
proof (prove)
using this:
A\<^sup>T @\<^sub>r B\<^sup>T \<in> carrier_mat (nc1 + nc2) nr

goal (1 subgoal):
 1. dim_row (A\<^sup>T @\<^sub>r B\<^sup>T) = nc1 + nc2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (A\<^sup>T @\<^sub>r B\<^sup>T) = nc1 + nc2

goal (1 subgoal):
 1. v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))
[PROOF STEP]
thus "v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))"
[PROOF STATE]
proof (prove)
using this:
dim_row (A\<^sup>T @\<^sub>r B\<^sup>T) = nc1 + nc2

goal (1 subgoal):
 1. v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))
[PROOF STEP]
using v1 v2
[PROOF STATE]
proof (prove)
using this:
dim_row (A\<^sup>T @\<^sub>r B\<^sup>T) = nc1 + nc2
v1 \<in> carrier_vec nc1
v2 \<in> carrier_vec nc2

goal (1 subgoal):
 1. v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v1 @\<^sub>v v2 \<in> carrier_vec (dim_row (A\<^sup>T @\<^sub>r B\<^sup>T))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2))\<^sup>T = (mat_of_row (v1 @\<^sub>v v2))\<^sup>T\<^sup>T * (A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((A @\<^sub>c B) * mat_of_col (v1 @\<^sub>v v2))\<^sup>T = (mat_of_row (v1 @\<^sub>v v2))\<^sup>T\<^sup>T * (A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "\<dots> = (mat_of_row (v1 @\<^sub>v v2)) * (A\<^sup>T @\<^sub>r B\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_row (v1 @\<^sub>v v2))\<^sup>T\<^sup>T * (A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T\<^sup>T = mat_of_row (v1 @\<^sub>v v2) * (A\<^sup>T @\<^sub>r B\<^sup>T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_of_row (v1 @\<^sub>v v2))\<^sup>T\<^sup>T * (A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T\<^sup>T = mat_of_row (v1 @\<^sub>v v2) * (A\<^sup>T @\<^sub>r B\<^sup>T)

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(mat_of_row (v1 @\<^sub>v v2))\<^sup>T\<^sup>T * (A\<^sup>T @\<^sub>r B\<^sup>T)\<^sup>T\<^sup>T = mat_of_row (v1 @\<^sub>v v2) * (A\<^sup>T @\<^sub>r B\<^sup>T)

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "\<dots> = mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_row (v1 @\<^sub>v v2) * (A\<^sup>T @\<^sub>r B\<^sup>T) = mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T
[PROOF STEP]
using mat_of_row_mult_append_rows[OF v1 v2] A B
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A1.0 \<in> carrier_mat nc1 ?nc; ?A2.0 \<in> carrier_mat nc2 ?nc\<rbrakk> \<Longrightarrow> mat_of_row (v1 @\<^sub>v v2) * (?A1.0 @\<^sub>r ?A2.0) = mat_of_row v1 * ?A1.0 + mat_of_row v2 * ?A2.0
A \<in> carrier_mat nr nc1
B \<in> carrier_mat nr nc2

goal (1 subgoal):
 1. mat_of_row (v1 @\<^sub>v v2) * (A\<^sup>T @\<^sub>r B\<^sup>T) = mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_of_row (v1 @\<^sub>v v2) * (A\<^sup>T @\<^sub>r B\<^sup>T) = mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_row (v1 @\<^sub>v v2) * (A\<^sup>T @\<^sub>r B\<^sup>T) = mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "\<dots>\<^sup>T = (mat_of_row v1 * A\<^sup>T)\<^sup>T + (mat_of_row v2 * B\<^sup>T)\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T)\<^sup>T = (mat_of_row v1 * A\<^sup>T)\<^sup>T + (mat_of_row v2 * B\<^sup>T)\<^sup>T
[PROOF STEP]
using transpose_add A B
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?nr ?nc; ?B \<in> carrier_mat ?nr ?nc\<rbrakk> \<Longrightarrow> (?A + ?B)\<^sup>T = ?A\<^sup>T + ?B\<^sup>T
A \<in> carrier_mat nr nc1
B \<in> carrier_mat nr nc2

goal (1 subgoal):
 1. (mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T)\<^sup>T = (mat_of_row v1 * A\<^sup>T)\<^sup>T + (mat_of_row v2 * B\<^sup>T)\<^sup>T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T)\<^sup>T = (mat_of_row v1 * A\<^sup>T)\<^sup>T + (mat_of_row v2 * B\<^sup>T)\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(mat_of_row v1 * A\<^sup>T + mat_of_row v2 * B\<^sup>T)\<^sup>T = (mat_of_row v1 * A\<^sup>T)\<^sup>T + (mat_of_row v2 * B\<^sup>T)\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "(mat_of_row v1 * A\<^sup>T)\<^sup>T = A\<^sup>T\<^sup>T * ((mat_of_row v1)\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_row v1 * A\<^sup>T)\<^sup>T = A\<^sup>T\<^sup>T * (mat_of_row v1)\<^sup>T
[PROOF STEP]
using transpose_mult A v1 transpose_carrier_mat mat_of_row_carrier(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?nr ?n; ?B \<in> carrier_mat ?n ?nc\<rbrakk> \<Longrightarrow> (?A * ?B)\<^sup>T = ?B\<^sup>T * ?A\<^sup>T
A \<in> carrier_mat nr nc1
v1 \<in> carrier_vec nc1
(?A\<^sup>T \<in> carrier_mat ?nc ?nr) = (?A \<in> carrier_mat ?nr ?nc)
?y \<in> carrier_vec ?n \<Longrightarrow> mat_of_row ?y \<in> carrier_mat 1 ?n

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

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(mat_of_row v1 * A\<^sup>T)\<^sup>T = A\<^sup>T\<^sup>T * (mat_of_row v1)\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "(mat_of_row v2 * B\<^sup>T)\<^sup>T = B\<^sup>T\<^sup>T * ((mat_of_row v2)\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_row v2 * B\<^sup>T)\<^sup>T = B\<^sup>T\<^sup>T * (mat_of_row v2)\<^sup>T
[PROOF STEP]
using transpose_mult B v2 transpose_carrier_mat mat_of_row_carrier(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?nr ?n; ?B \<in> carrier_mat ?n ?nc\<rbrakk> \<Longrightarrow> (?A * ?B)\<^sup>T = ?B\<^sup>T * ?A\<^sup>T
B \<in> carrier_mat nr nc2
v2 \<in> carrier_vec nc2
(?A\<^sup>T \<in> carrier_mat ?nc ?nr) = (?A \<in> carrier_mat ?nr ?nc)
?y \<in> carrier_vec ?n \<Longrightarrow> mat_of_row ?y \<in> carrier_mat 1 ?n

goal (1 subgoal):
 1. (mat_of_row v2 * B\<^sup>T)\<^sup>T = B\<^sup>T\<^sup>T * (mat_of_row v2)\<^sup>T
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(mat_of_row v2 * B\<^sup>T)\<^sup>T = B\<^sup>T\<^sup>T * (mat_of_row v2)\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(mat_of_row v2 * B\<^sup>T)\<^sup>T = B\<^sup>T\<^sup>T * (mat_of_row v2)\<^sup>T

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "A\<^sup>T\<^sup>T * ((mat_of_row v1)\<^sup>T) + B\<^sup>T\<^sup>T * ((mat_of_row v2)\<^sup>T) =
             A * mat_of_col v1 + B * mat_of_col v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>T\<^sup>T * (mat_of_row v1)\<^sup>T + B\<^sup>T\<^sup>T * (mat_of_row v2)\<^sup>T = A * mat_of_col v1 + B * mat_of_col v2
[PROOF STEP]
unfolding mat_of_col_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A\<^sup>T\<^sup>T * (mat_of_row v1)\<^sup>T + B\<^sup>T\<^sup>T * (mat_of_row v2)\<^sup>T = A * (mat_of_row v1)\<^sup>T + B * (mat_of_row v2)\<^sup>T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A\<^sup>T\<^sup>T * (mat_of_row v1)\<^sup>T + B\<^sup>T\<^sup>T * (mat_of_row v2)\<^sup>T = A * mat_of_col v1 + B * mat_of_col v2

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A\<^sup>T\<^sup>T * (mat_of_row v1)\<^sup>T + B\<^sup>T\<^sup>T * (mat_of_row v2)\<^sup>T = A * mat_of_col v1 + B * mat_of_col v2

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "col \<dots> 0 = col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (A * mat_of_col v1 + B * mat_of_col v2) 0 = col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc1
B \<in> carrier_mat nr nc2
v1 \<in> carrier_vec nc1
v2 \<in> carrier_vec nc2

goal (1 subgoal):
 1. col (A * mat_of_col v1 + B * mat_of_col v2) 0 = col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
col (A * mat_of_col v1 + B * mat_of_col v2) 0 = col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
col (A * mat_of_col v1 + B * mat_of_col v2) 0 = col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "\<dots> = col (mat_of_col (A *\<^sub>v v1)) 0 + col (mat_of_col (B *\<^sub>v v2)) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0 = col (mat_of_col (A *\<^sub>v v1)) 0 + col (mat_of_col (B *\<^sub>v v2)) 0
[PROOF STEP]
using mult_mat_of_col assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?nr ?nc; ?v \<in> carrier_vec ?nc\<rbrakk> \<Longrightarrow> ?A * mat_of_col ?v = mat_of_col (?A *\<^sub>v ?v)
A \<in> carrier_mat nr nc1
B \<in> carrier_mat nr nc2
v1 \<in> carrier_vec nc1
v2 \<in> carrier_vec nc2

goal (1 subgoal):
 1. col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0 = col (mat_of_col (A *\<^sub>v v1)) 0 + col (mat_of_col (B *\<^sub>v v2)) 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0 = col (mat_of_col (A *\<^sub>v v1)) 0 + col (mat_of_col (B *\<^sub>v v2)) 0

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
col (A * mat_of_col v1) 0 + col (B * mat_of_col v2) 0 = col (mat_of_col (A *\<^sub>v v1)) 0 + col (mat_of_col (B *\<^sub>v v2)) 0

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
have "\<dots> = A *\<^sub>v v1 + B *\<^sub>v v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (mat_of_col (A *\<^sub>v v1)) 0 + col (mat_of_col (B *\<^sub>v v2)) 0 = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
col (mat_of_col (A *\<^sub>v v1)) 0 + col (mat_of_col (B *\<^sub>v v2)) 0 = A *\<^sub>v v1 + B *\<^sub>v v2

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2

goal (1 subgoal):
 1. (A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A @\<^sub>c B) *\<^sub>v (v1 @\<^sub>v v2) = A *\<^sub>v v1 + B *\<^sub>v v2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma theFTOne_intro[intro]:
assumes "\<And> n. (n < length cl \<and> finished (cl!n)) \<or> (n < length dl \<and> finished (dl!n))"
shows "n \<in> theFTOne cl dl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<in> theFTOne cl dl
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?n1 < length cl \<and> finished (cl ! ?n1) \<or> ?n1 < length dl \<and> finished (dl ! ?n1)

goal (1 subgoal):
 1. n \<in> theFTOne cl dl
[PROOF STEP]
unfolding theFTOne_def
[PROOF STATE]
proof (prove)
using this:
?n1 < length cl \<and> finished (cl ! ?n1) \<or> ?n1 < length dl \<and> finished (dl ! ?n1)

goal (1 subgoal):
 1. n \<in> theFT cl \<union> theFT dl
[PROOF STEP]
by auto


[STATEMENT]
lemma sdrop_cycle: "u \<noteq> [] \<Longrightarrow> sdrop n (cycle u) = cycle (rotate (n mod length u) u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<noteq> [] \<Longrightarrow> sdrop n (cycle u) = cycle (rotate (n mod length u) u)
[PROOF STEP]
by (induct n arbitrary: u) (auto simp: rotate1_rotate_swap rotate1_hd_tl rotate_conv_mod[symmetric])


[STATEMENT]
lemma point_mult_add:
  "on_curve a b p \<Longrightarrow> nonsingular a b \<Longrightarrow>
   point_mult a (m + n) p = add a (point_mult a m p) (point_mult a n p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>on_curve a b p; nonsingular a b\<rbrakk> \<Longrightarrow> point_mult a (m + n) p = ell_field_class.add a (point_mult a m p) (point_mult a n p)
[PROOF STEP]
by (induct m) (simp_all add: add_assoc point_mult_closed add_0_l)


[STATEMENT]
lemma normalize_quotE:
  assumes "b \<noteq> 0"
  obtains d where "a = fst (normalize_quot (a,b)) * d" "b = snd (normalize_quot (a,b)) * d"
                  "d dvd a" "d dvd b" "d \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>a = fst (normalize_quot (a, b)) * d; b = snd (normalize_quot (a, b)) * d; d dvd a; d dvd b; d \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using that[OF normalize_quot_aux[OF assms]]
[PROOF STATE]
proof (prove)
using this:
thesis

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>a = fst (normalize_quot (a, b)) * d; b = snd (normalize_quot (a, b)) * d; d dvd a; d dvd b; d \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
.


[STATEMENT]
lemma unity_div_num:
  assumes "k > 0" "d > 0" "d dvd k"
  shows "unity_root k (x * (k div d)) = unity_root d x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unity_root k (int (x * (k div d))) = unity_root d (int x)
[PROOF STEP]
using assms dvd_div_mult_self unity_div
[PROOF STATE]
proof (prove)
using this:
0 < k
0 < d
d dvd k
?a dvd ?b \<Longrightarrow> ?b div ?a * ?a = ?b
?d dvd ?k \<Longrightarrow> unity_root ?k (?a * int ?d) = unity_root (?k div ?d) ?a

goal (1 subgoal):
 1. unity_root k (int (x * (k div d))) = unity_root d (int x)
[PROOF STEP]
by auto


[STATEMENT]
lemma permutes_UNIV_permutation: "permutation p \<longleftrightarrow> p permutes (UNIV::_::finite)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation p = (p permutes UNIV)
[PROOF STEP]
by (auto simp: permutation_permutes permutes_def)


[STATEMENT]
lemma symmetric_linorder_matrix:
  fixes f :: "('a::finite,'b::linorder_stone_relation_algebra_expansion) square"
  shows "matrix_stone_relation_algebra.symmetric f \<longleftrightarrow> (\<forall>i j . f (i,j) = f (j,i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_stone_relation_algebra.symmetric f = (\<forall>i j. f (i, j) = f (j, i))
[PROOF STEP]
by (metis (mono_tags, lifting) case_prod_conv cond_case_prod_eta conv_matrix_def conv_def)


[STATEMENT]
lemma (in padic_integers) residue_of_diff:
  assumes "b \<in> carrier Zp"
  shows "(a \<ominus> b) k = (a k) \<ominus>\<^bsub>Zp_res_ring k\<^esub> (b k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<ominus> b) k = a k \<ominus>\<^bsub>residue_ring (p ^ k)\<^esub> b k
[PROOF STEP]
unfolding a_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<oplus> \<ominus> b) k = a k \<oplus>\<^bsub>residue_ring (p ^ k)\<^esub> \<ominus>\<^bsub>residue_ring (p ^ k)\<^esub> b k
[PROOF STEP]
using Zp_def add.inv_closed assms(1) padic_a_inv prime residue_of_sum
[PROOF STATE]
proof (prove)
using this:
Zp \<equiv> padic_int p
?x \<in> carrier (UP Zp) \<Longrightarrow> \<ominus>\<^bsub>UP Zp\<^esub> ?x \<in> carrier (UP Zp)
b \<in> carrier Zp
\<lbrakk>prime ?p; ?a \<in> carrier (padic_int ?p)\<rbrakk> \<Longrightarrow> \<ominus>\<^bsub>padic_int ?p\<^esub> ?a = (\<lambda>n. \<ominus>\<^bsub>residue_ring (?p ^ n)\<^esub> ?a n)
prime p
(?a \<oplus> ?b) ?k = ?a ?k \<oplus>\<^bsub>residue_ring (p ^ ?k)\<^esub> ?b ?k

goal (1 subgoal):
 1. (a \<oplus> \<ominus> b) k = a k \<oplus>\<^bsub>residue_ring (p ^ k)\<^esub> \<ominus>\<^bsub>residue_ring (p ^ k)\<^esub> b k
[PROOF STEP]
by auto


[STATEMENT]
lemma affine_Int[intro]: "affine s \<Longrightarrow> affine t \<Longrightarrow> affine (s \<inter> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>affine s; affine t\<rbrakk> \<Longrightarrow> affine (s \<inter> t)
[PROOF STEP]
unfolding affine_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>s. \<forall>y\<in>s. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s; \<forall>x\<in>t. \<forall>y\<in>t. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> t\<rbrakk> \<Longrightarrow> \<forall>x\<in>s \<inter> t. \<forall>y\<in>s \<inter> t. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s \<inter> t
[PROOF STEP]
by auto


[STATEMENT]
lemma shows alpha_pos: "0 < \<alpha>" and alpha_ub: "\<alpha> \<le> 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<alpha> &&& \<alpha> \<le> 1 / 2
[PROOF STEP]
unfolding \<alpha>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 / (\<Delta> + 1) &&& 1 / (\<Delta> + 1) \<le> 1 / 2
[PROOF STEP]
using Delta
[PROOF STATE]
proof (prove)
using this:
1 \<le> \<Delta>

goal (1 subgoal):
 1. 0 < 1 / (\<Delta> + 1) &&& 1 / (\<Delta> + 1) \<le> 1 / 2
[PROOF STEP]
by auto


[STATEMENT]
lemma strict_mono_comp:
  assumes g: "strict_mono (g::'a::order \<Rightarrow> 'b::order)"
      and f: "strict_mono (f::'b::order \<Rightarrow> 'c::order)"
  shows "strict_mono (f \<circ> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono (f \<circ> g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_mono g
strict_mono f

goal (1 subgoal):
 1. strict_mono (f \<circ> g)
[PROOF STEP]
by (auto simp: strict_mono_def)


[STATEMENT]
lemma effective_scalar_product_times:
 assumes "(length w1 = length w2)"
 shows "(f (x*y) (scalar_product w1 w2))
                       = (scalar_product (times x w1) ( times y w2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y * scalar_product w1 w2 = scalar_product (local.times x w1) (local.times y w2)
[PROOF STEP]
using scalar_product_times assms
[PROOF STATE]
proof (prove)
using this:
\<forall>w1 w2. length w1 = length w2 \<and> length w1 = ?n \<longrightarrow> ?x * ?y * scalar_product w1 w2 = scalar_product (local.times ?x w1) (local.times ?y w2)
length w1 = length w2

goal (1 subgoal):
 1. x * y * scalar_product w1 w2 = scalar_product (local.times x w1) (local.times y w2)
[PROOF STEP]
by auto


[STATEMENT]
lemma fls_deriv_X_inv [simp]: "fls_deriv fls_X_inv = - (fls_X_inv\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv fls_X_inv = - fls_X_inv\<^sup>2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fls_deriv fls_X_inv = - fls_X_inv\<^sup>2
[PROOF STEP]
have "fls_deriv fls_X_inv = - (fls_shift 2 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv fls_X_inv = - fls_shift 2 1
[PROOF STEP]
by (simp add: fls_X_inv_conv_shift_1 fls_deriv_shift)
[PROOF STATE]
proof (state)
this:
fls_deriv fls_X_inv = - fls_shift 2 1

goal (1 subgoal):
 1. fls_deriv fls_X_inv = - fls_X_inv\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
fls_deriv fls_X_inv = - fls_shift 2 1

goal (1 subgoal):
 1. fls_deriv fls_X_inv = - fls_X_inv\<^sup>2
[PROOF STEP]
by (simp add: fls_X_inv_power_conv_shift_1)
[PROOF STATE]
proof (state)
this:
fls_deriv fls_X_inv = - fls_X_inv\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ideal_points_moebius_circline [simp]:
  assumes  "unit_circle_fix M" "is_poincare_line H"
  shows "ideal_points (moebius_circline M H) = (moebius_pt M) ` (ideal_points H)" (is "?I' = ?M ` ?I")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
obtain i1 i2 where *: "i1 \<noteq> i2" "?I = {i1, i2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i1 i2. \<lbrakk>i1 \<noteq> i2; ideal_points H = {i1, i2}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H

goal (1 subgoal):
 1. (\<And>i1 i2. \<lbrakk>i1 \<noteq> i2; ideal_points H = {i1, i2}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule obtain_ideal_points)
[PROOF STATE]
proof (state)
this:
i1 \<noteq> i2
ideal_points H = {i1, i2}

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
let ?Mi1 = "?M i1" and ?Mi2 = "?M i2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
have "?Mi1 \<in> ?M ` (circline_set H)"
       "?Mi2 \<in> ?M ` (circline_set H)"
       "?Mi1 \<in> ?M ` (circline_set unit_circle)"
       "?Mi2 \<in> ?M ` (circline_set unit_circle)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (moebius_pt M i1 \<in> moebius_pt M ` circline_set H &&& moebius_pt M i2 \<in> moebius_pt M ` circline_set H) &&& moebius_pt M i1 \<in> moebius_pt M ` circline_set unit_circle &&& moebius_pt M i2 \<in> moebius_pt M ` circline_set unit_circle
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
i1 \<noteq> i2
ideal_points H = {i1, i2}

goal (1 subgoal):
 1. (moebius_pt M i1 \<in> moebius_pt M ` circline_set H &&& moebius_pt M i2 \<in> moebius_pt M ` circline_set H) &&& moebius_pt M i1 \<in> moebius_pt M ` circline_set unit_circle &&& moebius_pt M i2 \<in> moebius_pt M ` circline_set unit_circle
[PROOF STEP]
unfolding ideal_points_def circline_intersection_def circline_set_def
[PROOF STATE]
proof (prove)
using this:
i1 \<noteq> i2
{z. on_circline H z \<and> on_circline unit_circle z} = {i1, i2}

goal (1 subgoal):
 1. (moebius_pt M i1 \<in> moebius_pt M ` Collect (on_circline H) &&& moebius_pt M i2 \<in> moebius_pt M ` Collect (on_circline H)) &&& moebius_pt M i1 \<in> moebius_pt M ` Collect (on_circline unit_circle) &&& moebius_pt M i2 \<in> moebius_pt M ` Collect (on_circline unit_circle)
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
moebius_pt M i1 \<in> moebius_pt M ` circline_set H
moebius_pt M i2 \<in> moebius_pt M ` circline_set H
moebius_pt M i1 \<in> moebius_pt M ` circline_set unit_circle
moebius_pt M i2 \<in> moebius_pt M ` circline_set unit_circle

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
hence "?Mi1 \<in> ?I'"
        "?Mi2 \<in> ?I'"
[PROOF STATE]
proof (prove)
using this:
moebius_pt M i1 \<in> moebius_pt M ` circline_set H
moebius_pt M i2 \<in> moebius_pt M ` circline_set H
moebius_pt M i1 \<in> moebius_pt M ` circline_set unit_circle
moebius_pt M i2 \<in> moebius_pt M ` circline_set unit_circle

goal (1 subgoal):
 1. moebius_pt M i1 \<in> ideal_points (moebius_circline M H) &&& moebius_pt M i2 \<in> ideal_points (moebius_circline M H)
[PROOF STEP]
using unit_circle_fix_iff[of M] assms
[PROOF STATE]
proof (prove)
using this:
moebius_pt M i1 \<in> moebius_pt M ` circline_set H
moebius_pt M i2 \<in> moebius_pt M ` circline_set H
moebius_pt M i1 \<in> moebius_pt M ` circline_set unit_circle
moebius_pt M i2 \<in> moebius_pt M ` circline_set unit_circle
unit_circle_fix M = (moebius_circline M unit_circle = unit_circle)
unit_circle_fix M
is_poincare_line H

goal (1 subgoal):
 1. moebius_pt M i1 \<in> ideal_points (moebius_circline M H) &&& moebius_pt M i2 \<in> ideal_points (moebius_circline M H)
[PROOF STEP]
unfolding ideal_points_def circline_intersection_def circline_set_def
[PROOF STATE]
proof (prove)
using this:
moebius_pt M i1 \<in> moebius_pt M ` Collect (on_circline H)
moebius_pt M i2 \<in> moebius_pt M ` Collect (on_circline H)
moebius_pt M i1 \<in> moebius_pt M ` Collect (on_circline unit_circle)
moebius_pt M i2 \<in> moebius_pt M ` Collect (on_circline unit_circle)
unit_circle_fix M = (moebius_circline M unit_circle = unit_circle)
unit_circle_fix M
is_poincare_line H

goal (1 subgoal):
 1. moebius_pt M i1 \<in> {z. on_circline (moebius_circline M H) z \<and> on_circline unit_circle z} &&& moebius_pt M i2 \<in> {z. on_circline (moebius_circline M H) z \<and> on_circline unit_circle z}
[PROOF STEP]
by (metis mem_Collect_eq moebius_circline)+
[PROOF STATE]
proof (state)
this:
moebius_pt M i1 \<in> ideal_points (moebius_circline M H)
moebius_pt M i2 \<in> ideal_points (moebius_circline M H)

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
moebius_pt M i1 \<in> ideal_points (moebius_circline M H)
moebius_pt M i2 \<in> ideal_points (moebius_circline M H)

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
have "?Mi1 \<noteq> ?Mi2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt M i1 \<noteq> moebius_pt M i2
[PROOF STEP]
using bij_moebius_pt[of M] *
[PROOF STATE]
proof (prove)
using this:
bij (moebius_pt M)
i1 \<noteq> i2
ideal_points H = {i1, i2}

goal (1 subgoal):
 1. moebius_pt M i1 \<noteq> moebius_pt M i2
[PROOF STEP]
using moebius_pt_invert
[PROOF STATE]
proof (prove)
using this:
bij (moebius_pt M)
i1 \<noteq> i2
ideal_points H = {i1, i2}
moebius_pt ?M ?z1.0 = ?z2.0 \<Longrightarrow> moebius_pt (moebius_inv ?M) ?z2.0 = ?z1.0

goal (1 subgoal):
 1. moebius_pt M i1 \<noteq> moebius_pt M i2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
moebius_pt M i1 \<noteq> moebius_pt M i2

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
moebius_pt M i1 \<noteq> moebius_pt M i2

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
have "is_poincare_line (moebius_circline M H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_poincare_line (moebius_circline M H)
[PROOF STEP]
using assms unit_circle_fix_preserve_is_poincare_line
[PROOF STATE]
proof (prove)
using this:
unit_circle_fix M
is_poincare_line H
\<lbrakk>unit_circle_fix ?M; is_poincare_line ?H\<rbrakk> \<Longrightarrow> is_poincare_line (moebius_circline ?M ?H)

goal (1 subgoal):
 1. is_poincare_line (moebius_circline M H)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_poincare_line (moebius_circline M H)

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
moebius_pt M i1 \<in> ideal_points (moebius_circline M H)
moebius_pt M i2 \<in> ideal_points (moebius_circline M H)
moebius_pt M i1 \<noteq> moebius_pt M i2
is_poincare_line (moebius_circline M H)
[PROOF STEP]
have "?I' = {?Mi1, ?Mi2}"
[PROOF STATE]
proof (prove)
using this:
moebius_pt M i1 \<in> ideal_points (moebius_circline M H)
moebius_pt M i2 \<in> ideal_points (moebius_circline M H)
moebius_pt M i1 \<noteq> moebius_pt M i2
is_poincare_line (moebius_circline M H)

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = {moebius_pt M i1, moebius_pt M i2}
[PROOF STEP]
using two_ideal_points[of "moebius_circline M H"]
[PROOF STATE]
proof (prove)
using this:
moebius_pt M i1 \<in> ideal_points (moebius_circline M H)
moebius_pt M i2 \<in> ideal_points (moebius_circline M H)
moebius_pt M i1 \<noteq> moebius_pt M i2
is_poincare_line (moebius_circline M H)
is_poincare_line (moebius_circline M H) \<Longrightarrow> card (ideal_points (moebius_circline M H)) = 2

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = {moebius_pt M i1, moebius_pt M i2}
[PROOF STEP]
using card_eq_2_doubleton[of ?I' ?Mi1 ?Mi2]
[PROOF STATE]
proof (prove)
using this:
moebius_pt M i1 \<in> ideal_points (moebius_circline M H)
moebius_pt M i2 \<in> ideal_points (moebius_circline M H)
moebius_pt M i1 \<noteq> moebius_pt M i2
is_poincare_line (moebius_circline M H)
is_poincare_line (moebius_circline M H) \<Longrightarrow> card (ideal_points (moebius_circline M H)) = 2
\<lbrakk>card (ideal_points (moebius_circline M H)) = 2; moebius_pt M i1 \<noteq> moebius_pt M i2; moebius_pt M i1 \<in> ideal_points (moebius_circline M H); moebius_pt M i2 \<in> ideal_points (moebius_circline M H)\<rbrakk> \<Longrightarrow> ideal_points (moebius_circline M H) = {moebius_pt M i1, moebius_pt M i2}

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = {moebius_pt M i1, moebius_pt M i2}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ideal_points (moebius_circline M H) = {moebius_pt M i1, moebius_pt M i2}

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ideal_points (moebius_circline M H) = {moebius_pt M i1, moebius_pt M i2}

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
using *(2)
[PROOF STATE]
proof (prove)
using this:
ideal_points (moebius_circline M H) = {moebius_pt M i1, moebius_pt M i2}
ideal_points H = {i1, i2}

goal (1 subgoal):
 1. ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ideal_points (moebius_circline M H) = moebius_pt M ` ideal_points H

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma heapify_heap_is_heap:
  "is_heap (heapify t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_heap (heapify t)
[PROOF STEP]
proof(induct t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_heap (heapify E)
 2. \<And>x1 t1 t2. \<lbrakk>is_heap (heapify t1); is_heap (heapify t2)\<rbrakk> \<Longrightarrow> is_heap (heapify (T x1 t1 t2))
[PROOF STEP]
case E
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. is_heap (heapify E)
 2. \<And>x1 t1 t2. \<lbrakk>is_heap (heapify t1); is_heap (heapify t2)\<rbrakk> \<Longrightarrow> is_heap (heapify (T x1 t1 t2))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_heap (heapify E)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_heap (heapify E)

goal (1 subgoal):
 1. \<And>x1 t1 t2. \<lbrakk>is_heap (heapify t1); is_heap (heapify t2)\<rbrakk> \<Longrightarrow> is_heap (heapify (T x1 t1 t2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 t1 t2. \<lbrakk>is_heap (heapify t1); is_heap (heapify t2)\<rbrakk> \<Longrightarrow> is_heap (heapify (T x1 t1 t2))
[PROOF STEP]
case (T v l r)
[PROOF STATE]
proof (state)
this:
is_heap (heapify l)
is_heap (heapify r)

goal (1 subgoal):
 1. \<And>x1 t1 t2. \<lbrakk>is_heap (heapify t1); is_heap (heapify t2)\<rbrakk> \<Longrightarrow> is_heap (heapify (T x1 t1 t2))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
is_heap (heapify l)
is_heap (heapify r)

goal (1 subgoal):
 1. is_heap (heapify (T v l r))
[PROOF STEP]
using siftDown_heap_is_heap[of "heapify l" "heapify r" "T v (heapify l) (heapify r)" v]
[PROOF STATE]
proof (prove)
using this:
is_heap (heapify l)
is_heap (heapify r)
\<lbrakk>is_heap (heapify l); is_heap (heapify r); T v (heapify l) (heapify r) = T v (heapify l) (heapify r)\<rbrakk> \<Longrightarrow> is_heap (siftDown (T v (heapify l) (heapify r)))

goal (1 subgoal):
 1. is_heap (heapify (T v l r))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_heap (heapify (T v l r))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nonneg_Reals_cmod_eq_Re: "z \<in> \<real>\<^sub>\<ge>\<^sub>0 \<Longrightarrow> norm z = Re z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<ge>\<^sub>0 \<Longrightarrow> cmod z = Re z
[PROOF STEP]
by (simp add: complex_nonneg_Reals_iff cmod_eq_Re)