[STATEMENT]
lemma padd_correct:
  assumes p\<^sub>1: "on_curvep a b p\<^sub>1" and p\<^sub>2: "on_curvep a b p\<^sub>2"
  shows "make_affine (padd a p\<^sub>1 p\<^sub>2) = add a (make_affine p\<^sub>1) (make_affine p\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. make_affine (padd a p\<^sub>1 p\<^sub>2) = ell_field_class.add a (make_affine p\<^sub>1) (make_affine p\<^sub>2)
[PROOF STEP]
using p\<^sub>1
[PROOF STATE]
proof (prove)
using this:
on_curvep a b p\<^sub>1

goal (1 subgoal):
 1. make_affine (padd a p\<^sub>1 p\<^sub>2) = ell_field_class.add a (make_affine p\<^sub>1) (make_affine p\<^sub>2)
[PROOF STEP]
proof (induct p\<^sub>1 rule: prod_induct3)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa ba c. on_curvep a b (aa, ba, c) \<Longrightarrow> make_affine (padd a (aa, ba, c) p\<^sub>2) = ell_field_class.add a (make_affine (aa, ba, c)) (make_affine p\<^sub>2)
[PROOF STEP]
case (fields x\<^sub>1 y\<^sub>1 z\<^sub>1)
[PROOF STATE]
proof (state)
this:
on_curvep a b (x\<^sub>1, y\<^sub>1, z\<^sub>1)

goal (1 subgoal):
 1. \<And>aa ba c. on_curvep a b (aa, ba, c) \<Longrightarrow> make_affine (padd a (aa, ba, c) p\<^sub>2) = ell_field_class.add a (make_affine (aa, ba, c)) (make_affine p\<^sub>2)
[PROOF STEP]
note p\<^sub>1' = fields
[PROOF STATE]
proof (state)
this:
on_curvep a b (x\<^sub>1, y\<^sub>1, z\<^sub>1)

goal (1 subgoal):
 1. \<And>aa ba c. on_curvep a b (aa, ba, c) \<Longrightarrow> make_affine (padd a (aa, ba, c) p\<^sub>2) = ell_field_class.add a (make_affine (aa, ba, c)) (make_affine p\<^sub>2)
[PROOF STEP]
from p\<^sub>2
[PROOF STATE]
proof (chain)
picking this:
on_curvep a b p\<^sub>2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
on_curvep a b p\<^sub>2

goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) p\<^sub>2) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine p\<^sub>2)
[PROOF STEP]
proof (induct p\<^sub>2 rule: prod_induct3)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa ba c. on_curvep a b (aa, ba, c) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (aa, ba, c)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (aa, ba, c))
[PROOF STEP]
case (fields x\<^sub>2 y\<^sub>2 z\<^sub>2)
[PROOF STATE]
proof (state)
this:
on_curvep a b (x\<^sub>2, y\<^sub>2, z\<^sub>2)

goal (1 subgoal):
 1. \<And>aa ba c. on_curvep a b (aa, ba, c) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (aa, ba, c)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (aa, ba, c))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
on_curvep a b (x\<^sub>2, y\<^sub>2, z\<^sub>2)
[PROOF STEP]
have
      yz\<^sub>2: "z\<^sub>2 \<noteq> 0 \<Longrightarrow> y\<^sub>2 ^ 2 * z\<^sub>2 * z\<^sub>1 ^ 3 =
        (x\<^sub>2 ^ 3 + a * x\<^sub>2 * z\<^sub>2 ^ 2 + b * z\<^sub>2 ^ 3) * z\<^sub>1 ^ 3"
[PROOF STATE]
proof (prove)
using this:
on_curvep a b (x\<^sub>2, y\<^sub>2, z\<^sub>2)

goal (1 subgoal):
 1. z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> y\<^sub>2\<^sup>2 * z\<^sub>2 * z\<^sub>1 ^ 3 = (x\<^sub>2 ^ 3 + a * x\<^sub>2 * z\<^sub>2\<^sup>2 + b * z\<^sub>2 ^ 3) * z\<^sub>1 ^ 3
[PROOF STEP]
by (simp_all add: on_curvep_def)
[PROOF STATE]
proof (state)
this:
z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> y\<^sub>2\<^sup>2 * z\<^sub>2 * z\<^sub>1 ^ 3 = (x\<^sub>2 ^ 3 + a * x\<^sub>2 * z\<^sub>2\<^sup>2 + b * z\<^sub>2 ^ 3) * z\<^sub>1 ^ 3

goal (1 subgoal):
 1. \<And>aa ba c. on_curvep a b (aa, ba, c) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (aa, ba, c)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (aa, ba, c))
[PROOF STEP]
from p\<^sub>1'
[PROOF STATE]
proof (chain)
picking this:
on_curvep a b (x\<^sub>1, y\<^sub>1, z\<^sub>1)
[PROOF STEP]
have
      yz\<^sub>1: "z\<^sub>1 \<noteq> 0 \<Longrightarrow> y\<^sub>1 ^ 2 * z\<^sub>1 * z\<^sub>2 ^ 3 =
        (x\<^sub>1 ^ 3 + a * x\<^sub>1 * z\<^sub>1 ^ 2 + b * z\<^sub>1 ^ 3) * z\<^sub>2 ^ 3"
[PROOF STATE]
proof (prove)
using this:
on_curvep a b (x\<^sub>1, y\<^sub>1, z\<^sub>1)

goal (1 subgoal):
 1. z\<^sub>1 \<noteq> (0::'a) \<Longrightarrow> y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3 = (x\<^sub>1 ^ 3 + a * x\<^sub>1 * z\<^sub>1\<^sup>2 + b * z\<^sub>1 ^ 3) * z\<^sub>2 ^ 3
[PROOF STEP]
by (simp_all add: on_curvep_def)
[PROOF STATE]
proof (state)
this:
z\<^sub>1 \<noteq> (0::'a) \<Longrightarrow> y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3 = (x\<^sub>1 ^ 3 + a * x\<^sub>1 * z\<^sub>1\<^sup>2 + b * z\<^sub>1 ^ 3) * z\<^sub>2 ^ 3

goal (1 subgoal):
 1. \<And>aa ba c. on_curvep a b (aa, ba, c) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (aa, ba, c)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (aa, ba, c))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
proof (cases "z\<^sub>1 = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z\<^sub>1 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. z\<^sub>1 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z\<^sub>1 = (0::'a)

goal (2 subgoals):
 1. z\<^sub>1 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. z\<^sub>1 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z\<^sub>1 = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z\<^sub>1 = (0::'a)

goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
by (simp add: add_def padd_def make_affine_def)
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal (1 subgoal):
 1. z\<^sub>1 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z\<^sub>1 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z\<^sub>1 \<noteq> (0::'a)

goal (1 subgoal):
 1. z\<^sub>1 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
proof (cases "z\<^sub>2 = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z\<^sub>2 = (0::'a)

goal (2 subgoals):
 1. z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z\<^sub>2 = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z\<^sub>2 = (0::'a)

goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
by (simp add: add_def padd_def make_affine_def)
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal (1 subgoal):
 1. z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z\<^sub>2 \<noteq> (0::'a)

goal (1 subgoal):
 1. z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
proof (cases "x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)

goal (2 subgoals):
 1. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
note x = this
[PROOF STATE]
proof (state)
this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)

goal (2 subgoals):
 1. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
[PROOF STEP]
have x': "x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)

goal (1 subgoal):
 1. x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2

goal (2 subgoals):
 1. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
proof (cases "y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a)

goal (2 subgoals):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a)
[PROOF STEP]
have y: "y\<^sub>2 * z\<^sub>1 = y\<^sub>1 * z\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a)

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 = y\<^sub>1 * z\<^sub>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y\<^sub>2 * z\<^sub>1 = y\<^sub>1 * z\<^sub>2

goal (2 subgoals):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
from \<open>z\<^sub>1 \<noteq> 0\<close> \<open>z\<^sub>2 \<noteq> 0\<close> x
[PROOF STATE]
proof (chain)
picking this:
z\<^sub>1 \<noteq> (0::'a)
z\<^sub>2 \<noteq> (0::'a)
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
[PROOF STEP]
have "make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2) = make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)"
[PROOF STATE]
proof (prove)
using this:
z\<^sub>1 \<noteq> (0::'a)
z\<^sub>2 \<noteq> (0::'a)
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)

goal (1 subgoal):
 1. make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2) = make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)
[PROOF STEP]
apply (simp add: make_affine_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2\<rbrakk> \<Longrightarrow> x\<^sub>2 / z\<^sub>2 = x\<^sub>1 / z\<^sub>1 \<and> y\<^sub>2 / z\<^sub>2 = y\<^sub>1 / z\<^sub>1
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2\<rbrakk> \<Longrightarrow> x\<^sub>2 / z\<^sub>2 = x\<^sub>1 / z\<^sub>1
 2. \<lbrakk>z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2\<rbrakk> \<Longrightarrow> y\<^sub>2 / z\<^sub>2 = y\<^sub>1 / z\<^sub>1
[PROOF STEP]
apply (field x')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2\<rbrakk> \<Longrightarrow> z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a)
 2. \<lbrakk>z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2\<rbrakk> \<Longrightarrow> y\<^sub>2 / z\<^sub>2 = y\<^sub>1 / z\<^sub>1
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2\<rbrakk> \<Longrightarrow> y\<^sub>2 / z\<^sub>2 = y\<^sub>1 / z\<^sub>1
[PROOF STEP]
apply (field y)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2\<rbrakk> \<Longrightarrow> z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2) = make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)

goal (2 subgoals):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
 2. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
with True x \<open>z\<^sub>1 \<noteq> 0\<close> \<open>z\<^sub>2 \<noteq> 0\<close> p\<^sub>1' fields
[PROOF STATE]
proof (chain)
picking this:
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a)
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
z\<^sub>1 \<noteq> (0::'a)
z\<^sub>2 \<noteq> (0::'a)
on_curvep a b (x\<^sub>1, y\<^sub>1, z\<^sub>1)
on_curvep a b (x\<^sub>2, y\<^sub>2, z\<^sub>2)
make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2) = make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 = (0::'a)
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
z\<^sub>1 \<noteq> (0::'a)
z\<^sub>2 \<noteq> (0::'a)
on_curvep a b (x\<^sub>1, y\<^sub>1, z\<^sub>1)
on_curvep a b (x\<^sub>2, y\<^sub>2, z\<^sub>2)
make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2) = make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)

goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
by (simp add: padd_def pdouble_correct)
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
have "y\<^sub>2 ^ 2 * z\<^sub>1 ^ 3 * z\<^sub>2 = y\<^sub>1 ^ 2 * z\<^sub>1 * z\<^sub>2 ^ 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y\<^sub>2\<^sup>2 * z\<^sub>1 ^ 3 * z\<^sub>2 = y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3
[PROOF STEP]
by (ring yz\<^sub>1 [OF \<open>z\<^sub>1 \<noteq> 0\<close>] yz\<^sub>2 [OF \<open>z\<^sub>2 \<noteq> 0\<close>] x')
[PROOF STATE]
proof (state)
this:
y\<^sub>2\<^sup>2 * z\<^sub>1 ^ 3 * z\<^sub>2 = y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y\<^sub>2\<^sup>2 * z\<^sub>1 ^ 3 * z\<^sub>2 = y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3
[PROOF STEP]
have "y\<^sub>2 ^ 2 * z\<^sub>1 ^ 3 * z\<^sub>2 / z\<^sub>1 / z\<^sub>2 =
              y\<^sub>1 ^ 2 * z\<^sub>1 * z\<^sub>2 ^ 3 / z\<^sub>1 / z\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
y\<^sub>2\<^sup>2 * z\<^sub>1 ^ 3 * z\<^sub>2 = y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3

goal (1 subgoal):
 1. y\<^sub>2\<^sup>2 * z\<^sub>1 ^ 3 * z\<^sub>2 / z\<^sub>1 / z\<^sub>2 = y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3 / z\<^sub>1 / z\<^sub>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y\<^sub>2\<^sup>2 * z\<^sub>1 ^ 3 * z\<^sub>2 / z\<^sub>1 / z\<^sub>2 = y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3 / z\<^sub>1 / z\<^sub>2

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y\<^sub>2\<^sup>2 * z\<^sub>1 ^ 3 * z\<^sub>2 / z\<^sub>1 / z\<^sub>2 = y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3 / z\<^sub>1 / z\<^sub>2
[PROOF STEP]
have "(y\<^sub>2 * z\<^sub>1) * (y\<^sub>2 * z\<^sub>1) = (y\<^sub>1 * z\<^sub>2) * (y\<^sub>1 * z\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
y\<^sub>2\<^sup>2 * z\<^sub>1 ^ 3 * z\<^sub>2 / z\<^sub>1 / z\<^sub>2 = y\<^sub>1\<^sup>2 * z\<^sub>1 * z\<^sub>2 ^ 3 / z\<^sub>1 / z\<^sub>2

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 * (y\<^sub>2 * z\<^sub>1) = y\<^sub>1 * z\<^sub>2 * (y\<^sub>1 * z\<^sub>2)
[PROOF STEP]
apply (field (prems))
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((1::'a) * z\<^sub>1\<^sup>2 + (0::'a)) * y\<^sub>2\<^sup>2 + ((of_int (- 1) * z\<^sub>2\<^sup>2 + (0::'a)) * y\<^sub>1\<^sup>2 + (0::'a)) = (0::'a) \<Longrightarrow> y\<^sub>2 * z\<^sub>1 * (y\<^sub>2 * z\<^sub>1) = y\<^sub>1 * z\<^sub>2 * (y\<^sub>1 * z\<^sub>2)
 2. z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a)
[PROOF STEP]
apply (field)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((1::'a) * z\<^sub>1\<^sup>2 + (0::'a)) * y\<^sub>2\<^sup>2 + ((of_int (- 1) * z\<^sub>2\<^sup>2 + (0::'a)) * y\<^sub>1\<^sup>2 + (0::'a)) = (0::'a) \<Longrightarrow> True
 2. z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a)
[PROOF STEP]
apply (rule TrueI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a)
[PROOF STEP]
apply (simp add: \<open>z\<^sub>1 \<noteq> 0\<close> \<open>z\<^sub>2 \<noteq> 0\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
y\<^sub>2 * z\<^sub>1 * (y\<^sub>2 * z\<^sub>1) = y\<^sub>1 * z\<^sub>2 * (y\<^sub>1 * z\<^sub>2)

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)
y\<^sub>2 * z\<^sub>1 * (y\<^sub>2 * z\<^sub>1) = y\<^sub>1 * z\<^sub>2 * (y\<^sub>1 * z\<^sub>2)
[PROOF STEP]
have y\<^sub>2z\<^sub>1: "y\<^sub>2 * z\<^sub>1 = - (y\<^sub>1 * z\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)
y\<^sub>2 * z\<^sub>1 * (y\<^sub>2 * z\<^sub>1) = y\<^sub>1 * z\<^sub>2 * (y\<^sub>1 * z\<^sub>2)

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 = - (y\<^sub>1 * z\<^sub>2)
[PROOF STEP]
by (simp add: square_eq_iff)
[PROOF STATE]
proof (state)
this:
y\<^sub>2 * z\<^sub>1 = - (y\<^sub>1 * z\<^sub>2)

goal (1 subgoal):
 1. y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
from x False \<open>z\<^sub>1 \<noteq> 0\<close> \<open>z\<^sub>2 \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)
z\<^sub>1 \<noteq> (0::'a)
z\<^sub>2 \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)
z\<^sub>1 \<noteq> (0::'a)
z\<^sub>2 \<noteq> (0::'a)

goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
apply (simp add: padd_def add_def make_affine_def Let_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> (y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2) \<longrightarrow> x\<^sub>1 / z\<^sub>1 = x\<^sub>2 / z\<^sub>2) \<and> y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2) \<longrightarrow> x\<^sub>1 / z\<^sub>1 = x\<^sub>2 / z\<^sub>2
 2. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2)
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2)\<rbrakk> \<Longrightarrow> x\<^sub>1 / z\<^sub>1 = x\<^sub>2 / z\<^sub>2
 2. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2)
[PROOF STEP]
apply (field x')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2)\<rbrakk> \<Longrightarrow> z\<^sub>1 \<noteq> (0::'a) \<and> z\<^sub>2 \<noteq> (0::'a)
 2. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> y\<^sub>1 / z\<^sub>1 = - (y\<^sub>2 / z\<^sub>2)
[PROOF STEP]
apply (field y\<^sub>2z\<^sub>1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 = x\<^sub>1 * z\<^sub>2; y\<^sub>2 * z\<^sub>1 \<noteq> y\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> z\<^sub>1 \<noteq> (0::'a) \<and> z\<^sub>2 \<noteq> (0::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal (1 subgoal):
 1. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)

goal (1 subgoal):
 1. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)
[PROOF STEP]
have "x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)

goal (1 subgoal):
 1. x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2
[PROOF STEP]
apply (rule_tac notI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a); x\<^sub>1 / z\<^sub>1 = x\<^sub>2 / z\<^sub>2\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (erule notE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sub>1 / z\<^sub>1 = x\<^sub>2 / z\<^sub>2 \<Longrightarrow> x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
[PROOF STEP]
apply (drule sym)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sub>2 / z\<^sub>2 = x\<^sub>1 / z\<^sub>1 \<Longrightarrow> x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
[PROOF STEP]
apply (field (prems))
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((1::'a) * z\<^sub>1 ^ 1 + (0::'a)) * x\<^sub>2 ^ 1 + ((of_int (- 1) * z\<^sub>2 ^ 1 + (0::'a)) * x\<^sub>1 ^ 1 + (0::'a)) = (0::'a) \<Longrightarrow> x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 = (0::'a)
 2. z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a)
[PROOF STEP]
apply ring
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a)
[PROOF STEP]
apply (simp add: \<open>z\<^sub>1 \<noteq> 0\<close> \<open>z\<^sub>2 \<noteq> 0\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2

goal (1 subgoal):
 1. x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<Longrightarrow> make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
with False \<open>z\<^sub>1 \<noteq> 0\<close> \<open>z\<^sub>2 \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)
z\<^sub>1 \<noteq> (0::'a)
z\<^sub>2 \<noteq> (0::'a)
x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a)
z\<^sub>1 \<noteq> (0::'a)
z\<^sub>2 \<noteq> (0::'a)
x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2

goal (1 subgoal):
 1. make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))
[PROOF STEP]
apply (auto simp add: padd_def add_def make_affine_def Let_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 \<noteq> x\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2\<rbrakk> \<Longrightarrow> (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) * ((y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2)\<^sup>2 * z\<^sub>1 * z\<^sub>2 - (x\<^sub>2 * z\<^sub>1 + x\<^sub>1 * z\<^sub>2) * (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2)\<^sup>2) / ((x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * z\<^sub>1 * z\<^sub>2) = ((y\<^sub>2 / z\<^sub>2 - y\<^sub>1 / z\<^sub>1) / (x\<^sub>2 / z\<^sub>2 - x\<^sub>1 / z\<^sub>1))\<^sup>2 - x\<^sub>1 / z\<^sub>1 - x\<^sub>2 / z\<^sub>2
 2. \<lbrakk>x\<^sub>2 * z\<^sub>1 \<noteq> x\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2\<rbrakk> \<Longrightarrow> ((x\<^sub>1 * z\<^sub>2 * (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2)\<^sup>2 - ((y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2)\<^sup>2 * z\<^sub>1 * z\<^sub>2 - (x\<^sub>2 * z\<^sub>1 + x\<^sub>1 * z\<^sub>2) * (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2)\<^sup>2)) * (y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2) - (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * y\<^sub>1 * z\<^sub>2) / ((x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * z\<^sub>1 * z\<^sub>2) = - (y\<^sub>1 / z\<^sub>1) - (y\<^sub>2 / z\<^sub>2 - y\<^sub>1 / z\<^sub>1) * (((y\<^sub>2 / z\<^sub>2 - y\<^sub>1 / z\<^sub>1) / (x\<^sub>2 / z\<^sub>2 - x\<^sub>1 / z\<^sub>1))\<^sup>2 - x\<^sub>2 / z\<^sub>2 - (2::'a) * x\<^sub>1 / z\<^sub>1) / (x\<^sub>2 / z\<^sub>2 - x\<^sub>1 / z\<^sub>1)
[PROOF STEP]
apply field
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 \<noteq> x\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2\<rbrakk> \<Longrightarrow> (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * z\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a) \<and> x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>2 \<noteq> (0::'a)
 2. \<lbrakk>x\<^sub>2 * z\<^sub>1 \<noteq> x\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2\<rbrakk> \<Longrightarrow> ((x\<^sub>1 * z\<^sub>2 * (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2)\<^sup>2 - ((y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2)\<^sup>2 * z\<^sub>1 * z\<^sub>2 - (x\<^sub>2 * z\<^sub>1 + x\<^sub>1 * z\<^sub>2) * (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2)\<^sup>2)) * (y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2) - (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * y\<^sub>1 * z\<^sub>2) / ((x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * z\<^sub>1 * z\<^sub>2) = - (y\<^sub>1 / z\<^sub>1) - (y\<^sub>2 / z\<^sub>2 - y\<^sub>1 / z\<^sub>1) * (((y\<^sub>2 / z\<^sub>2 - y\<^sub>1 / z\<^sub>1) / (x\<^sub>2 / z\<^sub>2 - x\<^sub>1 / z\<^sub>1))\<^sup>2 - x\<^sub>2 / z\<^sub>2 - (2::'a) * x\<^sub>1 / z\<^sub>1) / (x\<^sub>2 / z\<^sub>2 - x\<^sub>1 / z\<^sub>1)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 \<noteq> x\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2\<rbrakk> \<Longrightarrow> ((x\<^sub>1 * z\<^sub>2 * (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2)\<^sup>2 - ((y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2)\<^sup>2 * z\<^sub>1 * z\<^sub>2 - (x\<^sub>2 * z\<^sub>1 + x\<^sub>1 * z\<^sub>2) * (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2)\<^sup>2)) * (y\<^sub>2 * z\<^sub>1 - y\<^sub>1 * z\<^sub>2) - (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * y\<^sub>1 * z\<^sub>2) / ((x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * z\<^sub>1 * z\<^sub>2) = - (y\<^sub>1 / z\<^sub>1) - (y\<^sub>2 / z\<^sub>2 - y\<^sub>1 / z\<^sub>1) * (((y\<^sub>2 / z\<^sub>2 - y\<^sub>1 / z\<^sub>1) / (x\<^sub>2 / z\<^sub>2 - x\<^sub>1 / z\<^sub>1))\<^sup>2 - x\<^sub>2 / z\<^sub>2 - (2::'a) * x\<^sub>1 / z\<^sub>1) / (x\<^sub>2 / z\<^sub>2 - x\<^sub>1 / z\<^sub>1)
[PROOF STEP]
apply field
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x\<^sub>2 * z\<^sub>1 \<noteq> x\<^sub>1 * z\<^sub>2; z\<^sub>1 \<noteq> (0::'a); z\<^sub>2 \<noteq> (0::'a); x\<^sub>1 / z\<^sub>1 \<noteq> x\<^sub>2 / z\<^sub>2\<rbrakk> \<Longrightarrow> (x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2) ^ 3 * z\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<and> x\<^sub>2 * z\<^sub>1 - x\<^sub>1 * z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>2 \<noteq> (0::'a) \<and> z\<^sub>1 \<noteq> (0::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) (x\<^sub>2, y\<^sub>2, z\<^sub>2)) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine (x\<^sub>2, y\<^sub>2, z\<^sub>2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
make_affine (padd a (x\<^sub>1, y\<^sub>1, z\<^sub>1) p\<^sub>2) = ell_field_class.add a (make_affine (x\<^sub>1, y\<^sub>1, z\<^sub>1)) (make_affine p\<^sub>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsum_comm_additive_general:
  fixes f :: \<open>'b :: {comm_monoid_add,t2_space} \<Rightarrow> 'c :: {comm_monoid_add,t2_space}\<close>
  assumes f_sum: \<open>\<And>F. finite F \<Longrightarrow> F \<subseteq> S \<Longrightarrow> sum (f o g) F = f (sum g F)\<close>
      \<comment> \<open>Not using \<^const>\<open>additive\<close> because it would add sort constraint \<^class>\<open>ab_group_add\<close>\<close>
  assumes \<open>isCont f (infsum g S)\<close>
  assumes \<open>g summable_on S\<close>
  shows \<open>infsum (f o g) S = f (infsum g S)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsum (f \<circ> g) S = f (infsum g S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?F; ?F \<subseteq> S\<rbrakk> \<Longrightarrow> sum (f \<circ> g) ?F = f (sum g ?F)
isCont f (infsum g S)
g summable_on S

goal (1 subgoal):
 1. infsum (f \<circ> g) S = f (infsum g S)
[PROOF STEP]
by (intro infsumI has_sum_comm_additive_general has_sum_infsum) (auto simp: isCont_def)


[STATEMENT]
lemma upset_to_downset: "(`) \<partial> \<circ> \<up> = \<down> \<circ> \<partial>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (`) \<partial> \<circ> \<up> = \<down> \<circ> \<partial>
[PROOF STEP]
by (metis comp_assoc id_apply ord.downset_def ord.upset_def power_set_func_nat_trans upset_set_downset_set_dual)


[STATEMENT]
lemma Sup_pres_ladj_eq:
  fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual"
  shows  "(Sup_pres f) = (\<exists>g. f \<stileturn> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup_pres f = (\<exists>g. f \<stileturn> g)
[PROOF STEP]
using Sup_pres_ladj ladj_Sup_pres
[PROOF STATE]
proof (prove)
using this:
Sup_pres ?f \<Longrightarrow> \<exists>g. ?f \<stileturn> g
\<exists>g. ?f \<stileturn> g \<Longrightarrow> Sup_pres ?f

goal (1 subgoal):
 1. Sup_pres f = (\<exists>g. f \<stileturn> g)
[PROOF STEP]
by blast


[STATEMENT]
lemma filter_diff_mset [simp]: "filter_mset P (M - N) = filter_mset P M - filter_mset P N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset P (M - N) = filter_mset P M - filter_mset P N
[PROOF STEP]
by (rule multiset_eqI) simp


[STATEMENT]
lemma gbinomial_addition_formula:
  "a gchoose (Suc k) = ((a - 1) gchoose (Suc k)) + ((a - 1) gchoose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a gchoose Suc k = a - (1::'a) gchoose Suc k + (a - (1::'a) gchoose k)
[PROOF STEP]
using gbinomial_Suc_Suc[of "a - 1" k]
[PROOF STATE]
proof (prove)
using this:
a - (1::'a) + (1::'a) gchoose Suc k = a - (1::'a) gchoose k + (a - (1::'a) gchoose Suc k)

goal (1 subgoal):
 1. a gchoose Suc k = a - (1::'a) gchoose Suc k + (a - (1::'a) gchoose k)
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma nl4: assumes "(l'::real) \<ge> 1" "r' \<ge> 1" "ll \<ge> 1" "r \<ge> 1"
shows "4 * (l' + r')^2 * (l' + ll) * (r' + r)
    \<le> (l' + ll + r') * (l' + ll + r' + r)^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (l' + ll) * (r' + r) \<le> (l' + ll + r') * (l' + ll + r' + r) ^ 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (l' + ll) * (r' + r) \<le> (l' + ll + r') * (l' + ll + r' + r) ^ 3
[PROOF STEP]
have 1: "l' + r' \<le> l' + ll + r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l' + r' \<le> l' + ll + r'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> l'
1 \<le> r'
1 \<le> ll
1 \<le> r

goal (1 subgoal):
 1. l' + r' \<le> l' + ll + r'
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
l' + r' \<le> l' + ll + r'

goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (l' + ll) * (r' + r) \<le> (l' + ll + r') * (l' + ll + r' + r) ^ 3
[PROOF STEP]
have 2: "0 \<le> (l' + ll + r' + r)^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (l' + ll + r' + r) ^ 3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> l'
1 \<le> r'
1 \<le> ll
1 \<le> r

goal (1 subgoal):
 1. 0 \<le> (l' + ll + r' + r) ^ 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> (l' + ll + r' + r) ^ 3

goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (l' + ll) * (r' + r) \<le> (l' + ll + r') * (l' + ll + r' + r) ^ 3
[PROOF STEP]
have 3: "0 \<le> l' + r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> l' + r'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> l'
1 \<le> r'
1 \<le> ll
1 \<le> r

goal (1 subgoal):
 1. 0 \<le> l' + r'
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
0 \<le> l' + r'

goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (l' + ll) * (r' + r) \<le> (l' + ll + r') * (l' + ll + r' + r) ^ 3
[PROOF STEP]
from mult_mono[OF nl42[OF assms] 1 2 3]
[PROOF STATE]
proof (chain)
picking this:
4 * (l' + r') * (l' + ll) * (r' + r) * (l' + r') \<le> (l' + ll + r' + r) ^ 3 * (l' + ll + r')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
4 * (l' + r') * (l' + ll) * (r' + r) * (l' + r') \<le> (l' + ll + r' + r) ^ 3 * (l' + ll + r')

goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (l' + ll) * (r' + r) \<le> (l' + ll + r') * (l' + ll + r' + r) ^ 3
[PROOF STEP]
unfolding power2_eq_square
[PROOF STATE]
proof (prove)
using this:
4 * (l' + r') * (l' + ll) * (r' + r) * (l' + r') \<le> (l' + ll + r' + r) ^ 3 * (l' + ll + r')

goal (1 subgoal):
 1. 4 * ((l' + r') * (l' + r')) * (l' + ll) * (r' + r) \<le> (l' + ll + r') * (l' + ll + r' + r) ^ 3
[PROOF STEP]
by (simp only: ac_simps)
[PROOF STATE]
proof (state)
this:
4 * (l' + r')\<^sup>2 * (l' + ll) * (r' + r) \<le> (l' + ll + r') * (l' + ll + r' + r) ^ 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wp_while:
 "wp (WHILE b DO c) Q =
           (\<lambda>s. if b s then wp (c;WHILE b DO c) Q s else Q s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wp (WHILE b DO c) Q = (\<lambda>s. if b s then wp (c; WHILE b DO c) Q s else Q s)
[PROOF STEP]
apply(rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. wp (WHILE b DO c) Q s = (if b s then wp (c; WHILE b DO c) Q s else Q s)
[PROOF STEP]
apply(unfold wp_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. (\<forall>t. s -WHILE b DO c\<rightarrow> t \<longrightarrow> Q t) = (if b s then \<forall>t. s -c; WHILE b DO c\<rightarrow> t \<longrightarrow> Q t else Q s)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>s t ta. \<lbrakk>b s; \<forall>t. s -WHILE b DO c\<rightarrow> t \<longrightarrow> Q t; s -c\<rightarrow> ta; ta -WHILE b DO c\<rightarrow> t\<rbrakk> \<Longrightarrow> Q t
 2. \<And>s t. \<lbrakk>b s; \<forall>t. (\<exists>ta. s -c\<rightarrow> ta \<and> ta -WHILE b DO c\<rightarrow> t) \<longrightarrow> Q t; s -WHILE b DO c\<rightarrow> t\<rbrakk> \<Longrightarrow> Q t
 3. \<And>s. \<lbrakk>\<not> b s; \<forall>t. s -WHILE b DO c\<rightarrow> t \<longrightarrow> Q t\<rbrakk> \<Longrightarrow> Q s
 4. \<And>s t. \<lbrakk>\<not> b s; Q s; s -WHILE b DO c\<rightarrow> t\<rbrakk> \<Longrightarrow> Q t
[PROOF STEP]
apply(blast intro:exec.intros)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>s t. \<lbrakk>b s; \<forall>t. (\<exists>ta. s -c\<rightarrow> ta \<and> ta -WHILE b DO c\<rightarrow> t) \<longrightarrow> Q t; s -WHILE b DO c\<rightarrow> t\<rbrakk> \<Longrightarrow> Q t
 2. \<And>s. \<lbrakk>\<not> b s; \<forall>t. s -WHILE b DO c\<rightarrow> t \<longrightarrow> Q t\<rbrakk> \<Longrightarrow> Q s
 3. \<And>s t. \<lbrakk>\<not> b s; Q s; s -WHILE b DO c\<rightarrow> t\<rbrakk> \<Longrightarrow> Q t
[PROOF STEP]
apply(simp add:unfold_while)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s. \<lbrakk>\<not> b s; \<forall>t. s -WHILE b DO c\<rightarrow> t \<longrightarrow> Q t\<rbrakk> \<Longrightarrow> Q s
 2. \<And>s t. \<lbrakk>\<not> b s; Q s; s -WHILE b DO c\<rightarrow> t\<rbrakk> \<Longrightarrow> Q t
[PROOF STEP]
apply(blast intro:exec.intros)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s t. \<lbrakk>\<not> b s; Q s; s -WHILE b DO c\<rightarrow> t\<rbrakk> \<Longrightarrow> Q t
[PROOF STEP]
apply(simp add:unfold_while)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma omega_mono: "x \<le> y \<Longrightarrow> x ^ \<omega> \<le> y ^ \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x ^ \<omega> \<le> y ^ \<omega>
[PROOF STEP]
apply (cut_tac x = x and y = 1 and z = "y ^ \<omega>" in omega_least, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x * y ^ \<omega> \<sqinter> (1::'a) \<le> y ^ \<omega>
[PROOF STEP]
apply (subst (2) omega_fix, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x * y ^ \<omega> \<sqinter> (1::'a) \<le> y * y ^ \<omega>
[PROOF STEP]
apply (rule_tac y = "x * y ^ \<omega>" in order_trans, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x * y ^ \<omega> \<le> y * y ^ \<omega>
[PROOF STEP]
by (rule le_comp_right, simp)


[STATEMENT]
lemma ordinal_modI: "\<lbrakk>x = y * q + r; r < y\<rbrakk> \<Longrightarrow> x mod y = (r::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x = y * q + r; r < y\<rbrakk> \<Longrightarrow> x mod y = r
[PROOF STEP]
apply (unfold mod_ordinal_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x = y * q + r; r < y\<rbrakk> \<Longrightarrow> x - y * (x div y) = r
[PROOF STEP]
apply (rule ordinal_minusI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x = y * q + r; r < y\<rbrakk> \<Longrightarrow> x = y * (x div y) + r
[PROOF STEP]
apply (simp add: ordinal_divI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma assoc'_apply[simp]: \<open>assoc' (a \<otimes>\<^sub>u (b \<otimes>\<^sub>u c)) =  ((a \<otimes>\<^sub>u b) \<otimes>\<^sub>u c)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. assoc' (a \<otimes>\<^sub>u b \<otimes>\<^sub>u c) = (a \<otimes>\<^sub>u b) \<otimes>\<^sub>u c
[PROOF STEP]
by (auto simp: assoc'_def register_pair_apply Fst_def Snd_def tensor_update_mult)


[STATEMENT]
lemma lem15: "N x \<longrightarrow> M x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N x \<longrightarrow> M x
[PROOF STEP]
by (metis N_def induct_def lem10 lem14 mem_Collect_eq)


[STATEMENT]
lemma HNatInfinite_diff: "\<lbrakk>x \<in> HNatInfinite; y \<in> Nats\<rbrakk> \<Longrightarrow> x - y \<in> HNatInfinite"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> HNatInfinite; y \<in> \<nat>\<rbrakk> \<Longrightarrow> x - y \<in> HNatInfinite
[PROOF STEP]
by (metis HNatInfinite_not_Nats_iff Nats_add Nats_le_HNatInfinite le_add_diff_inverse)


[STATEMENT]
lemma ALLC_LIST_eval:  "eval ([\<forall> in L] DF) a = (\<forall>k<length L. eval (DF (L!k)) a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval [\<forall> in L] DF a = (\<forall>k<length L. eval (DF (L ! k)) a)
[PROOF STEP]
by (simp add: ALLC_LIST_eval_list_all list_all_length)


[STATEMENT]
lemma compute_real_of_float[code]:
  "real_of_float (Float m e) = (if e \<ge> 0 then m * 2 ^ nat e else m / 2 ^ (nat (-e)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (Float m e) = (if 0 \<le> e then real_of_int m * 2 ^ nat e else real_of_int m / 2 ^ nat (- e))
[PROOF STEP]
by (simp add: powr_int)


[STATEMENT]
theorem insert_bound_size_univ: "invar_vebt t n \<Longrightarrow> u =  2^n \<Longrightarrow>   T\<^sub>i\<^sub>n\<^sub>s\<^sub>e\<^sub>r\<^sub>t t x \<le> 46 + 23 * lb (lb u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>i\<^sub>n\<^sub>s\<^sub>e\<^sub>r\<^sub>t t x) \<le> 46 + 23 * log 2 (log 2 u)
[PROOF STEP]
using insert_bound_height[of t n x]  height_double_log_univ_size[of u n t] algebra_simps
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n \<Longrightarrow> T\<^sub>i\<^sub>n\<^sub>s\<^sub>e\<^sub>r\<^sub>t t x \<le> (1 + height t) * 23
\<lbrakk>u = 2 ^ n; invar_vebt t n\<rbrakk> \<Longrightarrow> real (height t) \<le> 1 + log 2 (log 2 u)
?a + ?b + ?c = ?a + (?b + ?c)
?a + ?b = ?b + ?a
?b + (?a + ?c) = ?a + (?b + ?c)
?a * ?b * ?c = ?a * (?b * ?c)
?a * ?b = ?b * ?a
?b * (?a * ?c) = ?a * (?b * ?c)
?a - ?b - ?c = ?a - (?b + ?c)
?a + (?b - ?c) = ?a + ?b - ?c
(?a - ?b = ?c) = (?a = ?c + ?b)
(?a = ?c - ?b) = (?a + ?b = ?c)
?a - (?b - ?c) = ?a + ?c - ?b
?a - ?b + ?c = ?a + ?c - ?b
(?a - ?b < ?c) = (?a < ?c + ?b)
(?a < ?c - ?b) = (?a + ?b < ?c)
(?a - ?b \<le> ?c) = (?a \<le> ?c + ?b)
(?a \<le> ?c - ?b) = (?a + ?b \<le> ?c)
(?a + ?b) * ?c = ?a * ?c + ?b * ?c
?a * (?b + ?c) = ?a * ?b + ?a * ?c
?a * (?b - ?c) = ?a * ?b - ?a * ?c
(?b - ?c) * ?a = ?b * ?a - ?c * ?a
?a * (?b - ?c) = ?a * ?b - ?a * ?c
(?a - ?b) * ?c = ?a * ?c - ?b * ?c
(?a * ?b) ^ ?n = ?a ^ ?n * ?b ^ ?n
?a *\<^sub>R (?x + ?y) = ?a *\<^sub>R ?x + ?a *\<^sub>R ?y
(?a + ?b) *\<^sub>R ?x = ?a *\<^sub>R ?x + ?b *\<^sub>R ?x
(?a - ?b) *\<^sub>R ?x = ?a *\<^sub>R ?x - ?b *\<^sub>R ?x
?a *\<^sub>R (?x - ?y) = ?a *\<^sub>R ?x - ?a *\<^sub>R ?y

goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>i\<^sub>n\<^sub>s\<^sub>e\<^sub>r\<^sub>t t x) \<le> 46 + 23 * log 2 (log 2 u)
[PROOF STEP]
by simp


[STATEMENT]
lemma minus_plus_sub:
  assumes " a \<in> carrier R"
  shows "X_minus a of X_plus a = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cring_Poly.compose R (X_poly_minus R a) (X_poly_plus R a) = X_poly R
[PROOF STEP]
using plus_minus_sub[of "\<ominus>a"]
[PROOF STATE]
proof (prove)
using this:
\<ominus> a \<in> carrier R \<Longrightarrow> Cring_Poly.compose R (X_poly_plus R (\<ominus> a)) (X_poly_minus R (\<ominus> a)) = X_poly R

goal (1 subgoal):
 1. Cring_Poly.compose R (X_poly_minus R a) (X_poly_plus R a) = X_poly R
[PROOF STEP]
unfolding X_poly_minus_def
[PROOF STATE]
proof (prove)
using this:
\<ominus> a \<in> carrier R \<Longrightarrow> Cring_Poly.compose R (X_poly_plus R (\<ominus> a)) (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R (\<ominus> a)) = X_poly R

goal (1 subgoal):
 1. Cring_Poly.compose R (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R a) (X_poly_plus R a) = X_poly R
[PROOF STEP]
unfolding X_poly_plus_def
[PROOF STATE]
proof (prove)
using this:
\<ominus> a \<in> carrier R \<Longrightarrow> Cring_Poly.compose R (X_poly R \<oplus>\<^bsub>UP R\<^esub> to_polynomial R (\<ominus> a)) (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R (\<ominus> a)) = X_poly R

goal (1 subgoal):
 1. Cring_Poly.compose R (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R a) (X_poly R \<oplus>\<^bsub>UP R\<^esub> to_polynomial R a) = X_poly R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<ominus> a \<in> carrier R \<Longrightarrow> Cring_Poly.compose R (X_poly R \<oplus>\<^bsub>UP R\<^esub> to_polynomial R (\<ominus> a)) (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R (\<ominus> a)) = X_poly R
a \<in> carrier R

goal (1 subgoal):
 1. Cring_Poly.compose R (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R a) (X_poly R \<oplus>\<^bsub>UP R\<^esub> to_polynomial R a) = X_poly R
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Cring_Poly.compose R (X_poly R \<oplus>\<^bsub>UP R\<^esub> to_polynomial R (\<ominus> a)) (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R (\<ominus> a)) = X_poly R; a \<in> carrier R\<rbrakk> \<Longrightarrow> Cring_Poly.compose R (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R a) (X_poly R \<oplus>\<^bsub>UP R\<^esub> to_polynomial R a) = X_poly R
[PROOF STEP]
by (metis P_def R.add.inv_closed R.minus_minus a_minus_def to_poly_a_inv)


[STATEMENT]
lemma max_factor_degree: assumes sub: "mset ws \<subseteq># mset vs"
  and len: "length ws + length ws \<le> length vs"
  shows "degree (prod_list ws) \<le> max_factor_degree (map degree vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
define ds where "ds \<equiv> map degree ws"
[PROOF STATE]
proof (state)
this:
ds \<equiv> map degree ws

goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
define es where "es \<equiv> sort (map degree vs)"
[PROOF STATE]
proof (state)
this:
es \<equiv> sort (map degree vs)

goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
from sub len
[PROOF STATE]
proof (chain)
picking this:
mset ws \<subseteq># mset vs
length ws + length ws \<le> length vs
[PROOF STEP]
have sub: "mset ds \<subseteq># mset es" and len: "length ds + length ds \<le> length es"
    and es: "sorted es"
[PROOF STATE]
proof (prove)
using this:
mset ws \<subseteq># mset vs
length ws + length ws \<le> length vs

goal (1 subgoal):
 1. mset ds \<subseteq># mset es &&& length ds + length ds \<le> length es &&& sorted es
[PROOF STEP]
unfolding ds_def es_def
[PROOF STATE]
proof (prove)
using this:
mset ws \<subseteq># mset vs
length ws + length ws \<le> length vs

goal (1 subgoal):
 1. mset (map degree ws) \<subseteq># mset (sort (map degree vs)) &&& length (map degree ws) + length (map degree ws) \<le> length (sort (map degree vs)) &&& sorted (sort (map degree vs))
[PROOF STEP]
by (auto simp: image_mset_subseteq_mono)
[PROOF STATE]
proof (state)
this:
mset ds \<subseteq># mset es
length ds + length ds \<le> length es
sorted es

goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
have "degree (prod_list ws) \<le> sum_list (map degree ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod_list ws) \<le> sum_list (map degree ws)
[PROOF STEP]
by (rule degree_prod_list_le)
[PROOF STATE]
proof (state)
this:
degree (prod_list ws) \<le> sum_list (map degree ws)

goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (prod_list ws) \<le> sum_list (map degree ws)

goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
have "\<dots> \<le> max_factor_degree (map degree vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map degree ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
unfolding max_factor_degree_def Let_def ds_def[symmetric] es_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list ds \<le> sum_list (drop (length es div 2) es)
[PROOF STEP]
using sub len es
[PROOF STATE]
proof (prove)
using this:
mset ds \<subseteq># mset es
length ds + length ds \<le> length es
sorted es

goal (1 subgoal):
 1. sum_list ds \<le> sum_list (drop (length es div 2) es)
[PROOF STEP]
by (rule max_factor_degree_aux)
[PROOF STATE]
proof (state)
this:
sum_list (map degree ws) \<le> max_factor_degree (map degree vs)

goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (prod_list ws) \<le> max_factor_degree (map degree vs)

goal (1 subgoal):
 1. degree (prod_list ws) \<le> max_factor_degree (map degree vs)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
degree (prod_list ws) \<le> max_factor_degree (map degree vs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_eq_empty [iff]: "closure S = {} \<longleftrightarrow> S = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (closure S = {}) = (S = {})
[PROOF STEP]
using closure_empty closure_subset[of S]
[PROOF STATE]
proof (prove)
using this:
closure {} = {}
S \<subseteq> closure S

goal (1 subgoal):
 1. (closure S = {}) = (S = {})
[PROOF STEP]
by blast


[STATEMENT]
lemma insert_sort_by_perm :
  "(insert_sort_by cmp l) <~~> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (insert_sort_by cmp l) = mset l
[PROOF STEP]
by (induction l) (simp_all add: insert_sort_insert_by_perm)


[STATEMENT]
lemma power_half_summable:
 "summable (\<lambda>n. ((1::real) / 2) ^ Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. (1 / 2) ^ Suc n)
[PROOF STEP]
using power_half_series summable_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (1 / 2) ^ Suc n) sums 1
summable ?f = (\<exists>s. ?f sums s)

goal (1 subgoal):
 1. summable (\<lambda>n. (1 / 2) ^ Suc n)
[PROOF STEP]
by blast


[STATEMENT]
lemma bij_swap_iff: "bij (Fun.swap a b f) \<longleftrightarrow> bij f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij (f \<circ> Transposition.transpose a b) = bij f
[PROOF STEP]
by (simp add: bij_betw_swap_iff)


[STATEMENT]
lemma agg_sum_bot:
  "(\<Sum>\<^sub>k bot::'a::aggregation_order) = bot + bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. bot) {k. True} = zero
[PROOF STEP]
proof (induct rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) A = zero
 2. aggregation.sum_0 (\<lambda>k. bot) {} = zero
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; aggregation.sum_0 (\<lambda>k. bot) F = zero\<rbrakk> \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
case (infinite A)
[PROOF STATE]
proof (state)
this:
infinite A

goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) A = zero
 2. aggregation.sum_0 (\<lambda>k. bot) {} = zero
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; aggregation.sum_0 (\<lambda>k. bot) F = zero\<rbrakk> \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. bot) A = zero
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
aggregation.sum_0 (\<lambda>k. bot) A = zero

goal (2 subgoals):
 1. aggregation.sum_0 (\<lambda>k. bot) {} = zero
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; aggregation.sum_0 (\<lambda>k. bot) F = zero\<rbrakk> \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. aggregation.sum_0 (\<lambda>k. bot) {} = zero
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; aggregation.sum_0 (\<lambda>k. bot) F = zero\<rbrakk> \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. aggregation.sum_0 (\<lambda>k. bot) {} = zero
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; aggregation.sum_0 (\<lambda>k. bot) F = zero\<rbrakk> \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. bot) {} = zero
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
aggregation.sum_0 (\<lambda>k. bot) {} = zero

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; aggregation.sum_0 (\<lambda>k. bot) F = zero\<rbrakk> \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; aggregation.sum_0 (\<lambda>k. bot) F = zero\<rbrakk> \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
aggregation.sum_0 (\<lambda>k. bot) F = zero

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; aggregation.sum_0 (\<lambda>k. bot) F = zero\<rbrakk> \<Longrightarrow> aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
aggregation.sum_0 (\<lambda>k. bot) F = zero

goal (1 subgoal):
 1. aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero
[PROOF STEP]
by (metis add.commute add_add_bot aggregation.sum_0.insert)
[PROOF STATE]
proof (state)
this:
aggregation.sum_0 (\<lambda>k. bot) (insert x F) = zero

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma embedding_map_eq:
   "\<lbrakk>embedding_map X Y f; \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> embedding_map X Y g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>embedding_map X Y f; \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> embedding_map X Y g
[PROOF STEP]
unfolding embedding_map_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>homeomorphic_map X (subtopology Y (f ` topspace X)) f; \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> homeomorphic_map X (subtopology Y (g ` topspace X)) g
[PROOF STEP]
by (metis homeomorphic_map_eq image_cong)


[STATEMENT]
lemma ladder_n_minus_1_bound: "is_ladder D L \<Longrightarrow> index \<ge> 1 \<Longrightarrow> index < length L \<Longrightarrow>
  ladder_n L (index - Suc 0) < length D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_ladder D L; 1 \<le> index; index < length L\<rbrakk> \<Longrightarrow> ladder_n L (index - Suc 0) < length D
[PROOF STEP]
by (metis (no_types, lifting) One_nat_def Suc_diff_1 Suc_le_lessD dual_order.strict_implies_order
  is_ladder_def le_neq_implies_less not_less)


[STATEMENT]
lemma sigma_finite_measure_count_space_finite:
  assumes A: "finite A" shows "sigma_finite_measure (count_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure (count_space A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sigma_finite_measure (count_space A)
[PROOF STEP]
interpret finite_measure "count_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_measure (count_space A)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite_measure (count_space A)
[PROOF STEP]
by (rule finite_measure_count_space)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sigma_finite_measure (count_space A)
[PROOF STEP]
show "sigma_finite_measure (count_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure (count_space A)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
sigma_finite_measure (count_space A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma word_induct2 [case_names zero suc, induct type]: "P 0 \<Longrightarrow> (\<And>n. 1 + n \<noteq> 0 \<Longrightarrow> P n \<Longrightarrow> P (1 + n)) \<Longrightarrow> P n"
  for P :: "'b::len word \<Rightarrow> bool"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0; \<And>n. \<lbrakk>1 + n \<noteq> 0; P n\<rbrakk> \<Longrightarrow> P (1 + n)\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
by (induction rule: word_induct_less; force)


[STATEMENT]
lemma "\<lbrakk> rbt l; rbt r \<rbrakk> \<Longrightarrow> bheight(join l x r) \<le> max (bheight l) (bheight r) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rbt l; rbt r\<rbrakk> \<Longrightarrow> bheight (Set2_Join_RBT.join l x r) \<le> max (bheight l) (bheight r) + 1
[PROOF STEP]
using bheight_paint_Black[of "joinL l x r"] bheight_paint_Black[of "joinR l x r"]
  bheight_joinL[of l r x] bheight_joinR[of l r x]
[PROOF STATE]
proof (prove)
using this:
bheight (paint Black (joinL l x r)) \<le> bheight (joinL l x r) + 1
bheight (paint Black (joinR l x r)) \<le> bheight (joinR l x r) + 1
\<lbrakk>invh l; invh r; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> bheight (joinL l x r) = bheight r
\<lbrakk>invh l; invh r; bheight r \<le> bheight l\<rbrakk> \<Longrightarrow> bheight (joinR l x r) = bheight l

goal (1 subgoal):
 1. \<lbrakk>rbt l; rbt r\<rbrakk> \<Longrightarrow> bheight (Set2_Join_RBT.join l x r) \<le> max (bheight l) (bheight r) + 1
[PROOF STEP]
by(auto simp: max_def rbt_def join_def)


[STATEMENT]
lemma \<K>_rw2:
  assumes "0 < k"
shows "(\<Sum>m=0..<Suc (k * max_len). card (set_of_k_words_length_m k m)/ b^m) \<le> (k * max_len)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
have
    "(\<Sum>m=1..<Suc (k * max_len). card (set_of_k_words_length_m k m) / b^m)
    \<le> (\<Sum>m=1..<Suc(k * max_len). b^m / b^m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> (\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m)
[PROOF STEP]
using set_of_k_words_bound b_val
    Groups_Big.sum_mono[of "{1..<Suc(k * max_len)}"
    "(\<lambda>m. (card (set_of_k_words_length_m k m))/b^m)" "\<lambda>m. b^m /b^m"]
[PROOF STATE]
proof (prove)
using this:
real (card (set_of_k_words_length_m ?k ?m)) \<le> b ^ ?m
b = 2
(\<And>i. i \<in> {1..<Suc (k * max_len)} \<Longrightarrow> real (card (set_of_k_words_length_m k i)) / b ^ i \<le> b ^ i / b ^ i) \<Longrightarrow> (\<Sum>i = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k i)) / b ^ i) \<le> (\<Sum>i = 1..<Suc (k * max_len). b ^ i / b ^ i)

goal (1 subgoal):
 1. (\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> (\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> (\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m)

goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> (\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m)

goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
have"(\<Sum>m=1..<Suc(k * max_len). b^m / b^m) = (\<Sum>m=1..<Suc(k *max_len). 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m) = (\<Sum>m = 1..<Suc (k * max_len). 1)
[PROOF STEP]
using b_gt_1
[PROOF STATE]
proof (prove)
using this:
1 < b

goal (1 subgoal):
 1. (\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m) = (\<Sum>m = 1..<Suc (k * max_len). 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m) = (\<Sum>m = 1..<Suc (k * max_len). 1)

goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m) = (\<Sum>m = 1..<Suc (k * max_len). 1)

goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
have "(\<Sum>m=1..<Suc(k * max_len). 1) = (k * max_len)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m = 1..<Suc (k * max_len). 1) = k * max_len
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>m = 1..<Suc (k * max_len). 1) = k * max_len

goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> (\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m)
(\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m) = (\<Sum>m = 1..<Suc (k * max_len). 1)
(\<Sum>m = 1..<Suc (k * max_len). 1) = k * max_len
[PROOF STEP]
have
    "(\<Sum>m = 1..<Suc (k * max_len). card (set_of_k_words_length_m k m) / b ^ m) \<le> k * max_len"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> (\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m)
(\<Sum>m = 1..<Suc (k * max_len). b ^ m / b ^ m) = (\<Sum>m = 1..<Suc (k * max_len). 1)
(\<Sum>m = 1..<Suc (k * max_len). 1) = k * max_len

goal (1 subgoal):
 1. (\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
by (metis One_nat_def card_atLeastLessThan card_eq_sum diff_Suc_Suc real_of_card)
[PROOF STATE]
proof (state)
this:
(\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)

goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)

goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
using empty_set_k_words assms
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m = 1..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
0 < ?k \<Longrightarrow> set_of_k_words_length_m ?k 0 = {}
0 < k

goal (1 subgoal):
 1. (\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)
[PROOF STEP]
by (simp add: sum_shift_lb_Suc0_0_upt split: if_split_asm)
[PROOF STATE]
proof (state)
this:
(\<Sum>m = 0..<Suc (k * max_len). real (card (set_of_k_words_length_m k m)) / b ^ m) \<le> real (k * max_len)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma positive_gauss_norm_valuation_ring_coeffs:
  assumes "g \<in> carrier Q\<^sub>p_x"
  assumes "gauss_norm g \<ge> 0"
  shows "g n \<in> \<O>\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g n \<in> \<O>\<^sub>p
[PROOF STEP]
apply(rule val_ringI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g n \<in> carrier Q\<^sub>p
 2. 0 \<le> val (g n)
[PROOF STEP]
using cfs_closed assms(1)
[PROOF STATE]
proof (prove)
using this:
?f \<in> carrier (UP Q\<^sub>p) \<Longrightarrow> ?f ?n \<in> carrier Q\<^sub>p
g \<in> carrier (UP Q\<^sub>p)

goal (2 subgoals):
 1. g n \<in> carrier Q\<^sub>p
 2. 0 \<le> val (g n)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> val (g n)
[PROOF STEP]
using gauss_normE[of g n] assms
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier (UP Q\<^sub>p) \<Longrightarrow> gauss_norm g \<le> val (g n)
g \<in> carrier (UP Q\<^sub>p)
0 \<le> gauss_norm g

goal (1 subgoal):
 1. 0 \<le> val (g n)
[PROOF STEP]
by auto


[STATEMENT]
lemma drop_bit_int_code [code]:
  fixes i :: int shows
  \<open>drop_bit 0 i = i\<close>
  \<open>drop_bit (Suc n) 0 = (0 :: int)\<close>
  \<open>drop_bit (Suc n) (Int.Pos num.One) = 0\<close>
  \<open>drop_bit (Suc n) (Int.Pos (num.Bit0 m)) = drop_bit n (Int.Pos m)\<close>
  \<open>drop_bit (Suc n) (Int.Pos (num.Bit1 m)) = drop_bit n (Int.Pos m)\<close>
  \<open>drop_bit (Suc n) (Int.Neg num.One) = - 1\<close>
  \<open>drop_bit (Suc n) (Int.Neg (num.Bit0 m)) = drop_bit n (Int.Neg m)\<close>
  \<open>drop_bit (Suc n) (Int.Neg (num.Bit1 m)) = drop_bit n (Int.Neg (Num.inc m))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((drop_bit 0 i = i &&& drop_bit (Suc n) 0 = 0) &&& drop_bit (Suc n) (Int.Pos num.One) = 0 &&& drop_bit (Suc n) (Int.Pos (num.Bit0 m)) = drop_bit n (Int.Pos m)) &&& (drop_bit (Suc n) (Int.Pos (num.Bit1 m)) = drop_bit n (Int.Pos m) &&& drop_bit (Suc n) (Int.Neg num.One) = - 1) &&& drop_bit (Suc n) (Int.Neg (num.Bit0 m)) = drop_bit n (Int.Neg m) &&& drop_bit (Suc n) (Int.Neg (num.Bit1 m)) = drop_bit n (Int.Neg (Num.inc m))
[PROOF STEP]
by (simp_all add: drop_bit_Suc add_One)


[STATEMENT]
lemma less_rat [simp]:
  "b \<noteq> 0 \<Longrightarrow> d \<noteq> 0 \<Longrightarrow> Fract a b < Fract c d \<longleftrightarrow> (a * d) * (b * d) < (c * b) * (b * d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<noteq> 0; d \<noteq> 0\<rbrakk> \<Longrightarrow> (Fract a b < Fract c d) = (a * d * (b * d) < c * b * (b * d))
[PROOF STEP]
by (simp add: less_rat_def positive_rat algebra_simps)


[STATEMENT]
lemma dual_min_set: "min_set = dual_ord.max_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_set = ord.max_set (\<lambda>x y. y \<le> x)
[PROOF STEP]
by (simp add: dual_ord.dual_max_set)


[STATEMENT]
lemma LIMSEQ_indicator_INT:
  "(\<lambda>k. indicator (\<Inter>i<k. A i) x :: 'a::{topological_space,zero_neq_one}) \<longlonglongrightarrow> indicator (\<Inter>i. A i) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x
[PROOF STEP]
have "(\<lambda>k. indicator (\<Inter>i<k. A i) x::'a) \<longlonglongrightarrow> indicator (\<Inter>k. \<Inter>i<k. A i) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter>k. \<Inter> (A ` {..<k})) x
[PROOF STEP]
by (intro LIMSEQ_indicator_decseq) (auto simp: decseq_def intro: less_le_trans)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter>k. \<Inter> (A ` {..<k})) x

goal (1 subgoal):
 1. (\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter>k. \<Inter> (A ` {..<k})) x

goal (1 subgoal):
 1. (\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x
[PROOF STEP]
have "(\<Inter>k. \<Inter>i<k. A i) = (\<Inter>i. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>k. \<Inter> (A ` {..<k})) = \<Inter> (range A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Inter>k. \<Inter> (A ` {..<k})) = \<Inter> (range A)

goal (1 subgoal):
 1. (\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x

goal (1 subgoal):
 1. (\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>k. indicator (\<Inter> (A ` {..<k})) x) \<longlonglongrightarrow> indicator (\<Inter> (range A)) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Module) mQmpTr2:"\<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N ;
        X \<in> carrier (M /\<^sub>m H)\<rbrakk> \<Longrightarrow> (mQmp M H N) X \<in> carrier (M /\<^sub>m N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; X \<in> carrier (M /\<^sub>m H)\<rbrakk> \<Longrightarrow> (Mp\<^bsub>M  H,N\<^esub>) X \<in> carrier (M /\<^sub>m N)
[PROOF STEP]
apply (simp add:qmodule_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; X \<in> set_mr_cos M H\<rbrakk> \<Longrightarrow> (Mp\<^bsub>M  H,N\<^esub>) X \<in> set_mr_cos M N
[PROOF STEP]
apply (simp add:set_mr_cos_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; \<exists>a\<in>carrier M. X = a \<uplus>\<^bsub>M\<^esub> H\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier M. (Mp\<^bsub>M  H,N\<^esub>) X = a \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply (erule bexE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; a \<in> carrier M; X = a \<uplus>\<^bsub>M\<^esub> H\<rbrakk> \<Longrightarrow> \<exists>aa\<in>carrier M. (Mp\<^bsub>M  H,N\<^esub>) (a \<uplus>\<^bsub>M\<^esub> H) = aa \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply (frule_tac m = a in mQmpTr0 [of H N], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>submodule R M H; submodule R M N; H \<subseteq> N; a \<in> carrier M; X = a \<uplus>\<^bsub>M\<^esub> H; (Mp\<^bsub>M  H,N\<^esub>) (a \<uplus>\<^bsub>M\<^esub> H) = a \<uplus>\<^bsub>M\<^esub> N\<rbrakk> \<Longrightarrow> \<exists>aa\<in>carrier M. (Mp\<^bsub>M  H,N\<^esub>) (a \<uplus>\<^bsub>M\<^esub> H) = aa \<uplus>\<^bsub>M\<^esub> N
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma i_f_join_i_shrink_iT_Plus_iT_Div_mod: "
  \<lbrakk> 0 < k; finite I; \<forall>x\<in>I. x mod k = 0 \<rbrakk> \<Longrightarrow>
  (f \<longmapsto>\<^sub>i k) \<Join>\<^bsub>i-f\<^esub> (I \<oplus> (k - 1))= f \<div>\<^sub>i k \<Join>\<^bsub>i-f\<^esub> (I \<oslash> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; finite I; \<forall>x\<in>I. x mod k = 0\<rbrakk> \<Longrightarrow> f \<longmapsto> k \<Join>\<^sub> (I \<oplus> k - 1) = f \<div> k \<Join>\<^sub> (I \<oslash> k)
[PROOF STEP]
apply (case_tac "I = {}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; finite I; \<forall>x\<in>I. x mod k = 0; I = {}\<rbrakk> \<Longrightarrow> f \<longmapsto> k \<Join>\<^sub> (I \<oplus> k - 1) = f \<div> k \<Join>\<^sub> (I \<oslash> k)
 2. \<lbrakk>0 < k; finite I; \<forall>x\<in>I. x mod k = 0; I \<noteq> {}\<rbrakk> \<Longrightarrow> f \<longmapsto> k \<Join>\<^sub> (I \<oplus> k - 1) = f \<div> k \<Join>\<^sub> (I \<oslash> k)
[PROOF STEP]
apply (simp add: iT_Plus_empty iT_Div_empty i_f_join_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; finite I; \<forall>x\<in>I. x mod k = 0; I \<noteq> {}\<rbrakk> \<Longrightarrow> f \<longmapsto> k \<Join>\<^sub> (I \<oplus> k - 1) = f \<div> k \<Join>\<^sub> (I \<oslash> k)
[PROOF STEP]
apply (simp add: i_f_join_def iT_Plus_Max iT_Div_Max)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; finite I; \<forall>x\<in>I. x mod k = 0; I \<noteq> {}\<rbrakk> \<Longrightarrow> f \<longmapsto> k \<Down> (Max I + k) \<Join>\<^sub> (I \<oplus> k - Suc 0) = f \<div> k \<Down> Suc (Max I div k) \<Join>\<^sub> (I \<oslash> k)
[PROOF STEP]
apply (simp add: i_last_message_hold_i_take[symmetric] i_shrink_i_take_mult[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; finite I; \<forall>x\<in>I. x mod k = 0; I \<noteq> {}\<rbrakk> \<Longrightarrow> f \<Down> (Max I + k) \<longmapsto> k \<Join>\<^sub> (I \<oplus> k - Suc 0) = f \<Down> (k + Max I div k * k) \<div> k \<Join>\<^sub> (I \<oslash> k)
[PROOF STEP]
apply (simp add: add.commute[of k])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; finite I; \<forall>x\<in>I. x mod k = 0; I \<noteq> {}\<rbrakk> \<Longrightarrow> f \<Down> (Max I + k) \<longmapsto> k \<Join>\<^sub> (I \<oplus> k - Suc 0) = f \<Down> (Max I div k * k + k) \<div> k \<Join>\<^sub> (I \<oslash> k)
[PROOF STEP]
apply (simp add: mod_0_div_mult_cancel[THEN iffD1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; finite I; \<forall>x\<in>I. x mod k = 0; I \<noteq> {}\<rbrakk> \<Longrightarrow> f \<Down> (Max I + k) \<longmapsto> k \<Join>\<^sub> (I \<oplus> k - Suc 0) = f \<Down> (Max I + k) \<div> k \<Join>\<^sub> (I \<oslash> k)
[PROOF STEP]
apply (simp add: f_join_f_shrink_iT_Plus_iT_Div_mod[unfolded One_nat_def])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma zero_le_mat_iff [simp]: "0 \<le> mat (x :: 'c :: {zero, order}) \<longleftrightarrow> 0 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> mat x) = ((0::'c) \<le> x)
[PROOF STEP]
by (auto simp: Finite_Cartesian_Product.less_eq_vec_def mat_def)


[STATEMENT]
lemma union_less_mono:
  fixes A B C D :: "'a::preorder multiset"
  shows "A < C \<Longrightarrow> B < D \<Longrightarrow> A + B < C + D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A < C; B < D\<rbrakk> \<Longrightarrow> A + B < C + D
[PROOF STEP]
by (blast intro!: union_le_mono1 union_le_mono2 less_trans)


[STATEMENT]
lemma NatMultiples_product_factor: "\<lbrakk> a \<in> F; b \<in> F \<rbrakk> \<Longrightarrow> a * b \<in> NatMultiples F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> F; b \<in> F\<rbrakk> \<Longrightarrow> a * b \<in> NatMultiples F
[PROOF STEP]
by (drule NatMultiples_Factor[of b], rule NatMultiples_Product)


[STATEMENT]
lemma dim_mult_mat_vec[simp]: "dim_vec (A *\<^sub>v v) = dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (A *\<^sub>v v) = dim_row A
[PROOF STEP]
by (auto simp: mult_mat_vec_def)


[STATEMENT]
lemma map2set_finite[relator_props]:
  assumes "finite_map_rel (\<langle>Rk,Id\<rangle>R)"
  shows "finite_set_rel (\<langle>Rk\<rangle>map2set_rel R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_set_rel (\<langle>Rk\<rangle>map2set_rel R)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite_map_rel (\<langle>Rk, unit_rel\<rangle>R)

goal (1 subgoal):
 1. finite_set_rel (\<langle>Rk\<rangle>map2set_rel R)
[PROOF STEP]
unfolding map2set_rel_def finite_set_rel_def finite_map_rel_def
[PROOF STATE]
proof (prove)
using this:
Range (\<langle>Rk, unit_rel\<rangle>R) \<subseteq> Collect (finite \<circ> dom)

goal (1 subgoal):
 1. Range (\<langle>Rk, unit_rel\<rangle>R O {(m, dom m) |m. True}) \<subseteq> Collect finite
[PROOF STEP]
by auto


[STATEMENT]
lemma det_swap_final_cols: assumes A: "A \<in> carrier_mat m m"
  and m: "m = l + k + n"
  shows "det A = (- 1) ^ (k * n) *
    det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
have "det A = det (A\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = det A\<^sup>T
[PROOF STEP]
unfolding det_transpose[OF A]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = det A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det A = det A\<^sup>T

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A = det A\<^sup>T

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
have "\<dots> = (- 1) ^ (k * n) *
    det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))"
    (is "_ = _ * det ?M")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A\<^sup>T = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))
[PROOF STEP]
by (rule det_swap_final_rows[OF _ m], insert A, auto)
[PROOF STATE]
proof (state)
this:
det A\<^sup>T = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A\<^sup>T = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
have "det ?M = det (?M\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j))) = det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))\<^sup>T
[PROOF STEP]
by (subst det_transpose, auto)
[PROOF STATE]
proof (state)
this:
det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j))) = det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))\<^sup>T

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j))) = det (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))\<^sup>T

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
have "?M\<^sup>T = mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))\<^sup>T = mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n))
[PROOF STEP]
unfolding transpose_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_col (mat m m (\<lambda>(i, j). mat (dim_col A) (dim_row A) (\<lambda>(i, j). A $$ (j, i)) $$ (if i < l then i else if i < l + n then i + k else i - n, j)))) (dim_row (mat m m (\<lambda>(i, j). mat (dim_col A) (dim_row A) (\<lambda>(i, j). A $$ (j, i)) $$ (if i < l then i else if i < l + n then i + k else i - n, j)))) (\<lambda>(i, j). mat m m (\<lambda>(i, j). mat (dim_col A) (dim_row A) (\<lambda>(i, j). A $$ (j, i)) $$ (if i < l then i else if i < l + n then i + k else i - n, j)) $$ (j, i)) = mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n))
[PROOF STEP]
using A m
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat m m
m = l + k + n

goal (1 subgoal):
 1. mat (dim_col (mat m m (\<lambda>(i, j). mat (dim_col A) (dim_row A) (\<lambda>(i, j). A $$ (j, i)) $$ (if i < l then i else if i < l + n then i + k else i - n, j)))) (dim_row (mat m m (\<lambda>(i, j). mat (dim_col A) (dim_row A) (\<lambda>(i, j). A $$ (j, i)) $$ (if i < l then i else if i < l + n then i + k else i - n, j)))) (\<lambda>(i, j). mat m m (\<lambda>(i, j). mat (dim_col A) (dim_row A) (\<lambda>(i, j). A $$ (j, i)) $$ (if i < l then i else if i < l + n then i + k else i - n, j)) $$ (j, i)) = mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n))
[PROOF STEP]
by (intro eq_matI, auto)
[PROOF STATE]
proof (state)
this:
(mat m m (\<lambda>(i, j). A\<^sup>T $$ (if i < l then i else if i < l + n then i + k else i - n, j)))\<^sup>T = mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))

goal (1 subgoal):
 1. det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det A = (- (1::'a)) ^ (k * n) * det (mat m m (\<lambda>(i, j). A $$ (i, if j < l then j else if j < l + n then j + k else j - n)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finlsts_mono:
"A\<subseteq>B \<Longrightarrow> A\<^sup>\<star> \<subseteq> B\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> A\<^sup>\<star> \<subseteq> B\<^sup>\<star>
[PROOF STEP]
by (auto, erule finlsts.induct) auto


[STATEMENT]
lemma [simp]:
  shows max_eSuc_eSuc: "max (eSuc n) (eSuc m) = eSuc (max n m)"
  and min_eSuc_eSuc: "min (eSuc n) (eSuc m) = eSuc (min n m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (eSuc n) (eSuc m) = eSuc (max n m) &&& min (eSuc n) (eSuc m) = eSuc (min n m)
[PROOF STEP]
by(simp_all add: eSuc_def split: enat.split)


[STATEMENT]
lemma Max_less_iMin_imp_less: "
  \<lbrakk> finite A; Max A < iMin B; a \<in> A; b \<in> B \<rbrakk> \<Longrightarrow> a < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; Max A < iMin B; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> a < b
[PROOF STEP]
by (blast dest: Max_less_iff intro: order_less_le_trans iMin_le)


[STATEMENT]
lemma sup_corr_eq_chain: "\<And>M::('a::complete_lattice*'a) set. (\<forall>(A,B)\<in>M. f(A)=g(B)) \<Longrightarrow> (Sup {f(A) | A. A\<in>fst_proj M} = Sup {g(B) | B. B\<in>snd_proj M})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M. \<forall>(A, B)\<in>M. f A = g B \<Longrightarrow> Sup {f A |A. A \<in> fst_proj M} = Sup {g B |B. B \<in> snd_proj M}
[PROOF STEP]
by (metis (mono_tags, lifting) case_prod_conv fst_proj_mem snd_proj_mem)


[STATEMENT]
lemma set_empty [simp]: "set {} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set {} = 0
[PROOF STEP]
by (simp add: zero_V_def)


[STATEMENT]
lemma continuous_compose:
  "\<lbrakk> continuous f S T; continuous g T U \<rbrakk> \<Longrightarrow> continuous (g \<circ> f) S U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous f S T; continuous g T U\<rbrakk> \<Longrightarrow> continuous (g \<circ> f) S U
[PROOF STEP]
by (auto intro!: continuousI funcset_comp
       elim!: continuousE simp add: vimage_comp)


[STATEMENT]
lemma in_keys_mapI: "x \<in> keys m \<Longrightarrow> f (lookup m x) \<noteq> 0 \<Longrightarrow> x \<in> keys (Poly_Mapping.map f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> keys m; f (lookup m x) \<noteq> (0::'c)\<rbrakk> \<Longrightarrow> x \<in> keys (Poly_Mapping.map f m)
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma hamming_unfold:
  "hamming = LCons 1 (lmerge (lmap ((*) 2) hamming) (lmerge (lmap ((*) 3) hamming) (lmap ((*) 5) hamming)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hamming = LCons 1 (lmerge (lmap ((*) 2) hamming) (lmerge (lmap ((*) 3) hamming) (lmap ((*) 5) hamming)))
[PROOF STEP]
by(rule llist.expand) simp_all