[STATEMENT]
lemma exp_approx:
  assumes "n > 0" "0 \<le> x" "x < 2"
  shows   "exp (x::real) - (\<Sum>k<n. x^k / fact k) \<in> {0..(2 * x^n / (2 - x)) / fact n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<in> {0..2 * x ^ n / (2 - x) / fact n}
[PROOF STEP]
proof (unfold atLeastAtMost_iff, safe)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> exp x - (\<Sum>k<n. x ^ k / fact k)
 2. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
define approx where "approx = (\<Sum>k<n. x^k / fact k)"
[PROOF STATE]
proof (state)
this:
approx = (\<Sum>k<n. x ^ k / fact k)

goal (2 subgoals):
 1. 0 \<le> exp x - (\<Sum>k<n. x ^ k / fact k)
 2. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
have "(\<lambda>k. x^k / fact k) sums exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. x ^ k / fact k) sums exp x
[PROOF STEP]
using exp_converges[of x]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. x ^ n /\<^sub>R fact n) sums exp x

goal (1 subgoal):
 1. (\<lambda>k. x ^ k / fact k) sums exp x
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ k / fact k) sums exp x

goal (2 subgoals):
 1. 0 \<le> exp x - (\<Sum>k<n. x ^ k / fact k)
 2. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
from sums_split_initial_segment[OF this, of n]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. x ^ (i + n) / fact (i + n)) sums (exp x - (\<Sum>i<n. x ^ i / fact i))
[PROOF STEP]
have sums: "(\<lambda>k. x^n * (x^k / fact (n+k))) sums (exp x - approx)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. x ^ (i + n) / fact (i + n)) sums (exp x - (\<Sum>i<n. x ^ i / fact i))

goal (1 subgoal):
 1. (\<lambda>k. x ^ n * (x ^ k / fact (n + k))) sums (exp x - approx)
[PROOF STEP]
by (simp add: approx_def algebra_simps power_add)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ n * (x ^ k / fact (n + k))) sums (exp x - approx)

goal (2 subgoals):
 1. 0 \<le> exp x - (\<Sum>k<n. x ^ k / fact k)
 2. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
0 \<le> x
x < 2
[PROOF STEP]
show "(exp x - approx) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 < n
0 \<le> x
x < 2

goal (1 subgoal):
 1. 0 \<le> exp x - approx
[PROOF STEP]
by (intro sums_le[OF _ sums_zero sums]) auto
[PROOF STATE]
proof (state)
this:
0 \<le> exp x - approx

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
have "x^n * (x^k / fact (n+k)) \<le> (x^n / fact n) * (x / 2)^k" for k::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
have "x^n * (x^k / fact (n + k)) = x^(n+k) / fact (n + k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) = x ^ (n + k) / fact (n + k)
[PROOF STEP]
by (simp add: power_add)
[PROOF STATE]
proof (state)
this:
x ^ n * (x ^ k / fact (n + k)) = x ^ (n + k) / fact (n + k)

goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x ^ n * (x ^ k / fact (n + k)) = x ^ (n + k) / fact (n + k)

goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
0 \<le> x
x < 2
[PROOF STEP]
have "\<dots> \<le> x^(n+k) / (2^k * fact n)"
[PROOF STATE]
proof (prove)
using this:
0 < n
0 \<le> x
x < 2

goal (1 subgoal):
 1. x ^ (n + k) / fact (n + k) \<le> x ^ (n + k) / (2 ^ k * fact n)
[PROOF STEP]
by (intro divide_left_mono two_power_fact_le_fact zero_le_power) simp_all
[PROOF STATE]
proof (state)
this:
x ^ (n + k) / fact (n + k) \<le> x ^ (n + k) / (2 ^ k * fact n)

goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x ^ (n + k) / fact (n + k) \<le> x ^ (n + k) / (2 ^ k * fact n)

goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
have "\<dots> = (x^n / fact n) * (x / 2) ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ (n + k) / (2 ^ k * fact n) = x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
by (simp add: field_simps power_add)
[PROOF STATE]
proof (state)
this:
x ^ (n + k) / (2 ^ k * fact n) = x ^ n / fact n * (x / 2) ^ k

goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
show "x^n * (x^k / fact (n+k)) \<le> (x^n / fact n) * (x / 2)^k"
[PROOF STATE]
proof (prove)
using this:
x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k

goal (1 subgoal):
 1. x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x ^ n * (x ^ k / fact (n + k)) \<le> x ^ n / fact n * (x / 2) ^ k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x ^ n * (x ^ ?k / fact (n + ?k)) \<le> x ^ n / fact n * (x / 2) ^ ?k

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x ^ n * (x ^ ?k / fact (n + ?k)) \<le> x ^ n / fact n * (x / 2) ^ ?k

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
note sums
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ n * (x ^ k / fact (n + k))) sums (exp x - approx)

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ n * (x ^ k / fact (n + k))) sums (exp x - approx)

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ n * (x ^ k / fact (n + k))) sums (exp x - approx)

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
0 \<le> x
x < 2
[PROOF STEP]
have "(\<lambda>k. (x^n / fact n) * (x / 2)^k) sums ((x^n / fact n) * (1 / (1 - x / 2)))"
[PROOF STATE]
proof (prove)
using this:
0 < n
0 \<le> x
x < 2

goal (1 subgoal):
 1. (\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (x ^ n / fact n * (1 / (1 - x / 2)))
[PROOF STEP]
by (intro sums_mult geometric_sums) simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (x ^ n / fact n * (1 / (1 - x / 2)))

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (x ^ n / fact n * (1 / (1 - x / 2)))

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
0 \<le> x
x < 2
[PROOF STEP]
have "((x^n / fact n) * (1 / (1 - x / 2))) = (2 * x^n / (2 - x)) / fact n"
[PROOF STATE]
proof (prove)
using this:
0 < n
0 \<le> x
x < 2

goal (1 subgoal):
 1. x ^ n / fact n * (1 / (1 - x / 2)) = 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
by (auto simp: field_split_simps)
[PROOF STATE]
proof (state)
this:
x ^ n / fact n * (1 / (1 - x / 2)) = 2 * x ^ n / (2 - x) / fact n

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (2 * x ^ n / (2 - x) / fact n)
[PROOF STEP]
have "(\<lambda>k. (x^n / fact n) * (x / 2)^k) sums \<dots>"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (2 * x ^ n / (2 - x) / fact n)

goal (1 subgoal):
 1. (\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (2 * x ^ n / (2 - x) / fact n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (2 * x ^ n / (2 - x) / fact n)

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (2 * x ^ n / (2 - x) / fact n)

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x ^ n * (x ^ ?k / fact (n + ?k)) \<le> x ^ n / fact n * (x / 2) ^ ?k
(\<lambda>k. x ^ n * (x ^ k / fact (n + k))) sums (exp x - approx)
(\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (2 * x ^ n / (2 - x) / fact n)
[PROOF STEP]
show "(exp x - approx) \<le> (2 * x^n / (2 - x)) / fact n"
[PROOF STATE]
proof (prove)
using this:
x ^ n * (x ^ ?k / fact (n + ?k)) \<le> x ^ n / fact n * (x / 2) ^ ?k
(\<lambda>k. x ^ n * (x ^ k / fact (n + k))) sums (exp x - approx)
(\<lambda>k. x ^ n / fact n * (x / 2) ^ k) sums (2 * x ^ n / (2 - x) / fact n)

goal (1 subgoal):
 1. exp x - approx \<le> 2 * x ^ n / (2 - x) / fact n
[PROOF STEP]
by (rule sums_le)
[PROOF STATE]
proof (state)
this:
exp x - approx \<le> 2 * x ^ n / (2 - x) / fact n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cols_length[simp]: "length (cols A) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (cols A) = dim_col A
[PROOF STEP]
unfolding cols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map (col A) [0..<dim_col A]) = dim_col A
[PROOF STEP]
by auto


[STATEMENT]
lemma conjugate_zero_iff_vec[simp]:
  fixes v :: "'a :: conjugatable_ring vec"
  shows "conjugate v = 0\<^sub>v n \<longleftrightarrow> v = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (conjugate v = 0\<^sub>v n) = (v = 0\<^sub>v n)
[PROOF STEP]
using conjugate_cancel_iff[of _ "0\<^sub>v n :: 'a vec"]
[PROOF STATE]
proof (prove)
using this:
(conjugate ?a = conjugate (0\<^sub>v n)) = (?a = 0\<^sub>v n)

goal (1 subgoal):
 1. (conjugate v = 0\<^sub>v n) = (v = 0\<^sub>v n)
[PROOF STEP]
by auto


[STATEMENT]
lemma nlcons_invlevel: "\<lbrakk>is_leveln_ftree n t; is_leveln_node n nd\<rbrakk>
  \<Longrightarrow> is_leveln_ftree n (nlcons nd t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_leveln_ftree n t; is_leveln_node n nd\<rbrakk> \<Longrightarrow> is_leveln_ftree n (nlcons nd t)
[PROOF STEP]
by (induct t arbitrary: n nd rule: nlcons.induct)
(auto simp add: deep_def node3_def)


[STATEMENT]
lemma l2product_lzero [simp]: "l2product S (\<lambda>x. 0) f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2product S (\<lambda>x. 0) f = 0
[PROOF STEP]
by (simp add: l2product_def)


[STATEMENT]
lemma prod_F_zcong: "[prod id F = ((-1) ^ (card E)) * prod id E] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [prod id F = (- 1) ^ card E * prod id E] (mod int p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [prod id F = (- 1) ^ card E * prod id E] (mod int p)
[PROOF STEP]
have FE: "prod id F = prod ((-) p) E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id F = prod ((-) (int p)) E
[PROOF STEP]
apply (auto simp add: F_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>((-) (int p) ` E) = prod ((-) (int p)) E
[PROOF STEP]
apply (insert finite_E inj_on_pminusx_E)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite E; inj_on ((-) (int p)) E\<rbrakk> \<Longrightarrow> \<Prod>((-) (int p) ` E) = prod ((-) (int p)) E
[PROOF STEP]
apply (drule prod.reindex)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite E; prod ?g8 ((-) (int p) ` E) = prod (?g8 \<circ> (-) (int p)) E\<rbrakk> \<Longrightarrow> \<Prod>((-) (int p) ` E) = prod ((-) (int p)) E
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
prod id F = prod ((-) (int p)) E

goal (1 subgoal):
 1. [prod id F = (- 1) ^ card E * prod id E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prod id F = prod ((-) (int p)) E
[PROOF STEP]
have "\<forall>x \<in> E. [(p-x) mod p = - x](mod p)"
[PROOF STATE]
proof (prove)
using this:
prod id F = prod ((-) (int p)) E

goal (1 subgoal):
 1. \<forall>x\<in>E. [(int p - x) mod int p = - x] (mod int p)
[PROOF STEP]
by (metis cong_def minus_mod_self1 mod_mod_trivial)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>E. [(int p - x) mod int p = - x] (mod int p)

goal (1 subgoal):
 1. [prod id F = (- 1) ^ card E * prod id E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>E. [(int p - x) mod int p = - x] (mod int p)
[PROOF STEP]
have "[prod ((\<lambda>x. x mod p) \<circ> ((-) p)) E = prod (uminus) E](mod p)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>E. [(int p - x) mod int p = - x] (mod int p)

goal (1 subgoal):
 1. [prod ((\<lambda>x. x mod int p) \<circ> (-) (int p)) E = prod uminus E] (mod int p)
[PROOF STEP]
using finite_E p_ge_2 cong_prod [of E "(\<lambda>x. x mod p) \<circ> ((-) p)" uminus p]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>E. [(int p - x) mod int p = - x] (mod int p)
finite E
2 < p
(\<And>x. x \<in> E \<Longrightarrow> [((\<lambda>x. x mod int p) \<circ> (-) (int p)) x = - x] (mod int p)) \<Longrightarrow> [prod ((\<lambda>x. x mod int p) \<circ> (-) (int p)) E = prod uminus E] (mod int p)

goal (1 subgoal):
 1. [prod ((\<lambda>x. x mod int p) \<circ> (-) (int p)) E = prod uminus E] (mod int p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[prod ((\<lambda>x. x mod int p) \<circ> (-) (int p)) E = prod uminus E] (mod int p)

goal (1 subgoal):
 1. [prod id F = (- 1) ^ card E * prod id E] (mod int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[prod ((\<lambda>x. x mod int p) \<circ> (-) (int p)) E = prod uminus E] (mod int p)
[PROOF STEP]
have two: "[prod id F = prod (uminus) E](mod p)"
[PROOF STATE]
proof (prove)
using this:
[prod ((\<lambda>x. x mod int p) \<circ> (-) (int p)) E = prod uminus E] (mod int p)

goal (1 subgoal):
 1. [prod id F = prod uminus E] (mod int p)
[PROOF STEP]
by (metis FE cong_cong_mod_int cong_refl cong_prod minus_mod_self1)
[PROOF STATE]
proof (state)
this:
[prod id F = prod uminus E] (mod int p)

goal (1 subgoal):
 1. [prod id F = (- 1) ^ card E * prod id E] (mod int p)
[PROOF STEP]
have "prod uminus E = (-1) ^ card E * prod id E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod uminus E = (- 1) ^ card E * prod id E
[PROOF STEP]
using finite_E
[PROOF STATE]
proof (prove)
using this:
finite E

goal (1 subgoal):
 1. prod uminus E = (- 1) ^ card E * prod id E
[PROOF STEP]
by (induct set: finite) auto
[PROOF STATE]
proof (state)
this:
prod uminus E = (- 1) ^ card E * prod id E

goal (1 subgoal):
 1. [prod id F = (- 1) ^ card E * prod id E] (mod int p)
[PROOF STEP]
with two
[PROOF STATE]
proof (chain)
picking this:
[prod id F = prod uminus E] (mod int p)
prod uminus E = (- 1) ^ card E * prod id E
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[prod id F = prod uminus E] (mod int p)
prod uminus E = (- 1) ^ card E * prod id E

goal (1 subgoal):
 1. [prod id F = (- 1) ^ card E * prod id E] (mod int p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[prod id F = (- 1) ^ card E * prod id E] (mod int p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coplanar_perm_23:
  assumes "Coplanar A B C D"
  shows "Coplanar D C B A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar D C B A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar D C B A
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar D C B A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar D C B A
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar D C B A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar D C B A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma id_is_gate [simp]:
  "gate n (Id n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate n (Quantum.Id n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. dim_row (Quantum.Id n) = 2 ^ n
 2. square_mat (Quantum.Id n)
 3. unitary (Quantum.Id n)
[PROOF STEP]
show "dim_row (Id n) = 2^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Quantum.Id n) = 2 ^ n
[PROOF STEP]
using Id_def
[PROOF STATE]
proof (prove)
using this:
Quantum.Id ?n \<equiv> 1\<^sub>m (2 ^ ?n)

goal (1 subgoal):
 1. dim_row (Quantum.Id n) = 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (Quantum.Id n) = 2 ^ n

goal (2 subgoals):
 1. square_mat (Quantum.Id n)
 2. unitary (Quantum.Id n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. square_mat (Quantum.Id n)
 2. unitary (Quantum.Id n)
[PROOF STEP]
show "square_mat (Id n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_mat (Quantum.Id n)
[PROOF STEP]
using Id_def
[PROOF STATE]
proof (prove)
using this:
Quantum.Id ?n \<equiv> 1\<^sub>m (2 ^ ?n)

goal (1 subgoal):
 1. square_mat (Quantum.Id n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
square_mat (Quantum.Id n)

goal (1 subgoal):
 1. unitary (Quantum.Id n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. unitary (Quantum.Id n)
[PROOF STEP]
show "unitary (Id n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary (Quantum.Id n)
[PROOF STEP]
by (simp add: Id_def)
[PROOF STATE]
proof (state)
this:
unitary (Quantum.Id n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bit_list_induct:
  assumes empty: "P []"
  and     zero:  "!!bs. P bs ==> P (\<zero>#bs)"
  and     one:   "!!bs. P bs ==> P (\<one>#bs)"
  shows   "P w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P w
[PROOF STEP]
proof (induct w, simp_all add: empty)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a w. P w \<Longrightarrow> P (a # w)
[PROOF STEP]
fix b bs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a w. P w \<Longrightarrow> P (a # w)
[PROOF STEP]
assume "P bs"
[PROOF STATE]
proof (state)
this:
P bs

goal (1 subgoal):
 1. \<And>a w. P w \<Longrightarrow> P (a # w)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P bs
[PROOF STEP]
show "P (b#bs)"
[PROOF STATE]
proof (prove)
using this:
P bs

goal (1 subgoal):
 1. P (b # bs)
[PROOF STEP]
by (cases b) (auto intro!: zero one)
[PROOF STATE]
proof (state)
this:
P (b # bs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prim_pyth_tripleI1:
  assumes "0 < v" "v < u" "coprime u v" "\<not>(odd u \<and> odd v)"
  shows   "prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
have "v ^ 2 < u ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v\<^sup>2 < u\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)

goal (1 subgoal):
 1. v\<^sup>2 < u\<^sup>2
[PROOF STEP]
by (intro power_strict_mono) auto
[PROOF STATE]
proof (state)
this:
v\<^sup>2 < u\<^sup>2

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
hence "\<not>u ^ 2 < v ^ 2"
[PROOF STATE]
proof (prove)
using this:
v\<^sup>2 < u\<^sup>2

goal (1 subgoal):
 1. \<not> u\<^sup>2 < v\<^sup>2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<not> u\<^sup>2 < v\<^sup>2

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)
[PROOF STEP]
have "coprime (int u) (int v ^ 2)"
[PROOF STATE]
proof (prove)
using this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)

goal (1 subgoal):
 1. coprime (int u) ((int v)\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime (int u) ((int v)\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
hence "coprime (int u) (int u * int u + (-(int v ^ 2)))"
[PROOF STATE]
proof (prove)
using this:
coprime (int u) ((int v)\<^sup>2)

goal (1 subgoal):
 1. coprime (int u) (int u * int u + - (int v)\<^sup>2)
[PROOF STEP]
unfolding coprime_iff_gcd_eq_1
[PROOF STATE]
proof (prove)
using this:
gcd (int u) ((int v)\<^sup>2) = 1

goal (1 subgoal):
 1. gcd (int u) (int u * int u + - (int v)\<^sup>2) = 1
[PROOF STEP]
by (subst gcd_add_mult) auto
[PROOF STATE]
proof (state)
this:
coprime (int u) (int u * int u + - (int v)\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coprime (int u) (int u * int u + - (int v)\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
have "int u * int u + (-(int v ^ 2)) = int (u ^ 2 - v ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int u * int u + - (int v)\<^sup>2 = int (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
using \<open>v < u\<close>
[PROOF STATE]
proof (prove)
using this:
v < u

goal (1 subgoal):
 1. int u * int u + - (int v)\<^sup>2 = int (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
by (simp add: of_nat_diff flip: power2_eq_square)
[PROOF STATE]
proof (state)
this:
int u * int u + - (int v)\<^sup>2 = int (u\<^sup>2 - v\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coprime (int u) (int (u\<^sup>2 - v\<^sup>2))
[PROOF STEP]
have coprime1: "coprime u (u ^ 2 - v ^ 2)"
[PROOF STATE]
proof (prove)
using this:
coprime (int u) (int (u\<^sup>2 - v\<^sup>2))

goal (1 subgoal):
 1. coprime u (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime u (u\<^sup>2 - v\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)
[PROOF STEP]
have "coprime (int v) (int u ^ 2)"
[PROOF STATE]
proof (prove)
using this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)

goal (1 subgoal):
 1. coprime (int v) ((int u)\<^sup>2)
[PROOF STEP]
by (auto simp: coprime_commute)
[PROOF STATE]
proof (state)
this:
coprime (int v) ((int u)\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
hence "coprime (int v) ((-int v) * int v + int u ^ 2)"
[PROOF STATE]
proof (prove)
using this:
coprime (int v) ((int u)\<^sup>2)

goal (1 subgoal):
 1. coprime (int v) (- int v * int v + (int u)\<^sup>2)
[PROOF STEP]
unfolding coprime_iff_gcd_eq_1
[PROOF STATE]
proof (prove)
using this:
gcd (int v) ((int u)\<^sup>2) = 1

goal (1 subgoal):
 1. gcd (int v) (- int v * int v + (int u)\<^sup>2) = 1
[PROOF STEP]
by (subst gcd_add_mult) auto
[PROOF STATE]
proof (state)
this:
coprime (int v) (- int v * int v + (int u)\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coprime (int v) (- int v * int v + (int u)\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
have "(-int v) * int v + int u ^ 2 = int (u ^ 2 - v ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - int v * int v + (int u)\<^sup>2 = int (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
using \<open>v < u\<close>
[PROOF STATE]
proof (prove)
using this:
v < u

goal (1 subgoal):
 1. - int v * int v + (int u)\<^sup>2 = int (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
by (simp add: of_nat_diff flip: power2_eq_square)
[PROOF STATE]
proof (state)
this:
- int v * int v + (int u)\<^sup>2 = int (u\<^sup>2 - v\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coprime (int v) (int (u\<^sup>2 - v\<^sup>2))
[PROOF STEP]
have coprime2: "coprime v (u ^ 2 - v ^ 2)"
[PROOF STATE]
proof (prove)
using this:
coprime (int v) (int (u\<^sup>2 - v\<^sup>2))

goal (1 subgoal):
 1. coprime v (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime v (u\<^sup>2 - v\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
have "(2 * u * v) ^ 2 + (u ^ 2 - v ^ 2) ^ 2 = (u ^ 2 + v ^ 2) ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 * u * v)\<^sup>2 + (u\<^sup>2 - v\<^sup>2)\<^sup>2 = (u\<^sup>2 + v\<^sup>2)\<^sup>2
[PROOF STEP]
using \<open>v < u\<close>
[PROOF STATE]
proof (prove)
using this:
v < u

goal (1 subgoal):
 1. (2 * u * v)\<^sup>2 + (u\<^sup>2 - v\<^sup>2)\<^sup>2 = (u\<^sup>2 + v\<^sup>2)\<^sup>2
[PROOF STEP]
by (intro prim_pyth_triple_aux) auto
[PROOF STATE]
proof (state)
this:
(2 * u * v)\<^sup>2 + (u\<^sup>2 - v\<^sup>2)\<^sup>2 = (u\<^sup>2 + v\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(2 * u * v)\<^sup>2 + (u\<^sup>2 - v\<^sup>2)\<^sup>2 = (u\<^sup>2 + v\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
have "coprime (2 * u * v) (u ^ 2 - v ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (2 * u * v) (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
using assms \<open>\<not>u ^ 2 < v ^ 2\<close> coprime1 coprime2
[PROOF STATE]
proof (prove)
using this:
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)
\<not> u\<^sup>2 < v\<^sup>2
coprime u (u\<^sup>2 - v\<^sup>2)
coprime v (u\<^sup>2 - v\<^sup>2)

goal (1 subgoal):
 1. coprime (2 * u * v) (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime (2 * u * v) (u\<^sup>2 - v\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(2 * u * v)\<^sup>2 + (u\<^sup>2 - v\<^sup>2)\<^sup>2 = (u\<^sup>2 + v\<^sup>2)\<^sup>2
coprime (2 * u * v) (u\<^sup>2 - v\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(2 * u * v)\<^sup>2 + (u\<^sup>2 - v\<^sup>2)\<^sup>2 = (u\<^sup>2 + v\<^sup>2)\<^sup>2
coprime (2 * u * v) (u\<^sup>2 - v\<^sup>2)

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
using assms \<open>v ^ 2 < u ^ 2\<close>
[PROOF STATE]
proof (prove)
using this:
(2 * u * v)\<^sup>2 + (u\<^sup>2 - v\<^sup>2)\<^sup>2 = (u\<^sup>2 + v\<^sup>2)\<^sup>2
coprime (2 * u * v) (u\<^sup>2 - v\<^sup>2)
0 < v
v < u
coprime u v
\<not> (odd u \<and> odd v)
v\<^sup>2 < u\<^sup>2

goal (1 subgoal):
 1. prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)
[PROOF STEP]
by (simp add: prim_pyth_triple_def)
[PROOF STATE]
proof (state)
this:
prim_pyth_triple (2 * u * v) (u\<^sup>2 - v\<^sup>2) (u\<^sup>2 + v\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma upower_inductr:
  assumes "Q \<sqsubseteq> R \<sqinter> (Q ;; P)"
  shows "Q \<sqsubseteq> R ;; (P \<^bold>^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<sqsubseteq> R ;; power.power II (;;) P n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Q \<sqsubseteq> R \<sqinter> (Q ;; P)

goal (1 subgoal):
 1. Q \<sqsubseteq> R ;; power.power II (;;) P n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P 0
 2. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> R \<sqinter> (Q ;; P)

goal (2 subgoals):
 1. Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P 0
 2. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q \<sqsubseteq> R \<sqinter> (Q ;; P)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Q \<sqsubseteq> R \<sqinter> (Q ;; P)

goal (1 subgoal):
 1. Q \<sqsubseteq> R ;; power.power II (;;) P 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> R ;; power.power II (;;) P 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n
Q \<sqsubseteq> R \<sqinter> (Q ;; P)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
have "R ;; P \<^bold>^ Suc n = (R ;; P \<^bold>^ n) ;; P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R ;; power.power II (;;) P (Suc n) = (R ;; power.power II (;;) P n) ;; P
[PROOF STEP]
by (metis seqr_assoc upred_semiring.power_Suc2)
[PROOF STATE]
proof (state)
this:
R ;; power.power II (;;) P (Suc n) = (R ;; power.power II (;;) P n) ;; P

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
R ;; power.power II (;;) P (Suc n) = (R ;; power.power II (;;) P n) ;; P

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
have "Q ;; P \<sqsubseteq> ..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q ;; P \<sqsubseteq> (R ;; power.power II (;;) P n) ;; P
[PROOF STEP]
by (meson Suc.hyps assms eq_iff seqr_mono)
[PROOF STATE]
proof (state)
this:
Q ;; P \<sqsubseteq> (R ;; power.power II (;;) P n) ;; P

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Q ;; P \<sqsubseteq> (R ;; power.power II (;;) P n) ;; P

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
have "Q \<sqsubseteq> ..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<sqsubseteq> Q ;; P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Q \<sqsubseteq> R \<sqinter> (Q ;; P)

goal (1 subgoal):
 1. Q \<sqsubseteq> Q ;; P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> Q ;; P

goal (1 subgoal):
 1. \<And>n. \<lbrakk>Q \<sqsubseteq> R \<sqinter> (Q ;; P) \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P n; Q \<sqsubseteq> R \<sqinter> (Q ;; P)\<rbrakk> \<Longrightarrow> Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)

goal (1 subgoal):
 1. Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Q \<sqsubseteq> R ;; power.power II (;;) P (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma braun_indices_if_braun: "braun t \<Longrightarrow> braun_indices t = {1..size t}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. braun t \<Longrightarrow> braun_indices t = {1..size t}
[PROOF STEP]
proof(induction t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. braun \<langle>\<rangle> \<Longrightarrow> braun_indices \<langle>\<rangle> = {1..size \<langle>\<rangle>}
 2. \<And>t1 x2 t2. \<lbrakk>braun t1 \<Longrightarrow> braun_indices t1 = {1..size t1}; braun t2 \<Longrightarrow> braun_indices t2 = {1..size t2}; braun \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> braun_indices \<langle>t1, x2, t2\<rangle> = {1..size \<langle>t1, x2, t2\<rangle>}
[PROOF STEP]
case Leaf
[PROOF STATE]
proof (state)
this:
braun \<langle>\<rangle>

goal (2 subgoals):
 1. braun \<langle>\<rangle> \<Longrightarrow> braun_indices \<langle>\<rangle> = {1..size \<langle>\<rangle>}
 2. \<And>t1 x2 t2. \<lbrakk>braun t1 \<Longrightarrow> braun_indices t1 = {1..size t1}; braun t2 \<Longrightarrow> braun_indices t2 = {1..size t2}; braun \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> braun_indices \<langle>t1, x2, t2\<rangle> = {1..size \<langle>t1, x2, t2\<rangle>}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
braun \<langle>\<rangle>

goal (1 subgoal):
 1. braun_indices \<langle>\<rangle> = {1..size \<langle>\<rangle>}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
braun_indices \<langle>\<rangle> = {1..size \<langle>\<rangle>}

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>braun t1 \<Longrightarrow> braun_indices t1 = {1..size t1}; braun t2 \<Longrightarrow> braun_indices t2 = {1..size t2}; braun \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> braun_indices \<langle>t1, x2, t2\<rangle> = {1..size \<langle>t1, x2, t2\<rangle>}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>braun t1 \<Longrightarrow> braun_indices t1 = {1..size t1}; braun t2 \<Longrightarrow> braun_indices t2 = {1..size t2}; braun \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> braun_indices \<langle>t1, x2, t2\<rangle> = {1..size \<langle>t1, x2, t2\<rangle>}
[PROOF STEP]
have *: "(*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b} = {2*a..2*b+1}" (is "?l = ?r") for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b} = {2 * a..2 * b + 1}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b} \<subseteq> {2 * a..2 * b + 1}
 2. {2 * a..2 * b + 1} \<subseteq> (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b}
[PROOF STEP]
show "?l \<subseteq> ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b} \<subseteq> {2 * a..2 * b + 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b} \<subseteq> {2 * a..2 * b + 1}

goal (1 subgoal):
 1. {2 * a..2 * b + 1} \<subseteq> (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {2 * a..2 * b + 1} \<subseteq> (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b}
[PROOF STEP]
have "\<exists>x2\<in>{a..b}. x \<in> {Suc (2*x2), 2*x2}" if *: "x \<in> {2*a .. 2*b+1}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x2\<in>{a..b}. x \<in> {Suc (2 * x2), 2 * x2}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x2\<in>{a..b}. x \<in> {Suc (2 * x2), 2 * x2}
[PROOF STEP]
have "x div 2 \<in> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x div 2 \<in> {a..b}
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
x \<in> {2 * a..2 * b + 1}

goal (1 subgoal):
 1. x div 2 \<in> {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x div 2 \<in> {a..b}

goal (1 subgoal):
 1. \<exists>x2\<in>{a..b}. x \<in> {Suc (2 * x2), 2 * x2}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x div 2 \<in> {a..b}

goal (1 subgoal):
 1. \<exists>x2\<in>{a..b}. x \<in> {Suc (2 * x2), 2 * x2}
[PROOF STEP]
have "x \<in> {2 * (x div 2), Suc(2 * (x div 2))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {2 * (x div 2), Suc (2 * (x div 2))}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {2 * (x div 2), Suc (2 * (x div 2))}

goal (1 subgoal):
 1. \<exists>x2\<in>{a..b}. x \<in> {Suc (2 * x2), 2 * x2}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x div 2 \<in> {a..b}
x \<in> {2 * (x div 2), Suc (2 * (x div 2))}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x div 2 \<in> {a..b}
x \<in> {2 * (x div 2), Suc (2 * (x div 2))}

goal (1 subgoal):
 1. \<exists>x2\<in>{a..b}. x \<in> {Suc (2 * x2), 2 * x2}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>x2\<in>{a..b}. x \<in> {Suc (2 * x2), 2 * x2}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> {2 * a..2 * b + 1} \<Longrightarrow> \<exists>x2\<in>{a..b}. ?x \<in> {Suc (2 * x2), 2 * x2}

goal (1 subgoal):
 1. {2 * a..2 * b + 1} \<subseteq> (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b}
[PROOF STEP]
thus "?r \<subseteq> ?l"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {2 * a..2 * b + 1} \<Longrightarrow> \<exists>x2\<in>{a..b}. ?x \<in> {Suc (2 * x2), 2 * x2}

goal (1 subgoal):
 1. {2 * a..2 * b + 1} \<subseteq> (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{2 * a..2 * b + 1} \<subseteq> (*) 2 ` {a..b} \<union> Suc ` (*) 2 ` {a..b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(*) 2 ` {?a..?b} \<union> Suc ` (*) 2 ` {?a..?b} = {2 * ?a..2 * ?b + 1}

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>braun t1 \<Longrightarrow> braun_indices t1 = {1..size t1}; braun t2 \<Longrightarrow> braun_indices t2 = {1..size t2}; braun \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> braun_indices \<langle>t1, x2, t2\<rangle> = {1..size \<langle>t1, x2, t2\<rangle>}
[PROOF STEP]
case (Node l x r)
[PROOF STATE]
proof (state)
this:
braun l \<Longrightarrow> braun_indices l = {1..size l}
braun r \<Longrightarrow> braun_indices r = {1..size r}
braun \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>braun t1 \<Longrightarrow> braun_indices t1 = {1..size t1}; braun t2 \<Longrightarrow> braun_indices t2 = {1..size t2}; braun \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> braun_indices \<langle>t1, x2, t2\<rangle> = {1..size \<langle>t1, x2, t2\<rangle>}
[PROOF STEP]
hence "size l = size r \<or> size l = size r + 1" (is "?A \<or> ?B")
[PROOF STATE]
proof (prove)
using this:
braun l \<Longrightarrow> braun_indices l = {1..size l}
braun r \<Longrightarrow> braun_indices r = {1..size r}
braun \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. size l = size r \<or> size l = size r + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size l = size r \<or> size l = size r + 1

goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>braun t1 \<Longrightarrow> braun_indices t1 = {1..size t1}; braun t2 \<Longrightarrow> braun_indices t2 = {1..size t2}; braun \<langle>t1, x2, t2\<rangle>\<rbrakk> \<Longrightarrow> braun_indices \<langle>t1, x2, t2\<rangle> = {1..size \<langle>t1, x2, t2\<rangle>}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
size l = size r \<or> size l = size r + 1

goal (1 subgoal):
 1. braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. size l = size r \<Longrightarrow> braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
 2. size l = size r + 1 \<Longrightarrow> braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
[PROOF STEP]
assume ?A
[PROOF STATE]
proof (state)
this:
size l = size r

goal (2 subgoals):
 1. size l = size r \<Longrightarrow> braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
 2. size l = size r + 1 \<Longrightarrow> braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
[PROOF STEP]
with Node
[PROOF STATE]
proof (chain)
picking this:
braun l \<Longrightarrow> braun_indices l = {1..size l}
braun r \<Longrightarrow> braun_indices r = {1..size r}
braun \<langle>l, x, r\<rangle>
size l = size r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
braun l \<Longrightarrow> braun_indices l = {1..size l}
braun r \<Longrightarrow> braun_indices r = {1..size r}
braun \<langle>l, x, r\<rangle>
size l = size r

goal (1 subgoal):
 1. braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
[PROOF STEP]
by (auto simp: *)
[PROOF STATE]
proof (state)
this:
braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}

goal (1 subgoal):
 1. size l = size r + 1 \<Longrightarrow> braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size l = size r + 1 \<Longrightarrow> braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
[PROOF STEP]
assume ?B
[PROOF STATE]
proof (state)
this:
size l = size r + 1

goal (1 subgoal):
 1. size l = size r + 1 \<Longrightarrow> braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
[PROOF STEP]
with Node
[PROOF STATE]
proof (chain)
picking this:
braun l \<Longrightarrow> braun_indices l = {1..size l}
braun r \<Longrightarrow> braun_indices r = {1..size r}
braun \<langle>l, x, r\<rangle>
size l = size r + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
braun l \<Longrightarrow> braun_indices l = {1..size l}
braun r \<Longrightarrow> braun_indices r = {1..size r}
braun \<langle>l, x, r\<rangle>
size l = size r + 1

goal (1 subgoal):
 1. braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}
[PROOF STEP]
by (auto simp: * atLeastAtMostSuc_conv)
[PROOF STATE]
proof (state)
this:
braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
braun_indices \<langle>l, x, r\<rangle> = {1..size \<langle>l, x, r\<rangle>}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_eq_sum_mset:
  "size M = (\<Sum>a\<in>#M. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size M = (\<Sum>a\<in>#M. 1)
[PROOF STEP]
using image_mset_const_eq [of "1::nat" M]
[PROOF STATE]
proof (prove)
using this:
{#1. a \<in># M#} = replicate_mset (size M) 1

goal (1 subgoal):
 1. size M = (\<Sum>a\<in>#M. 1)
[PROOF STEP]
by simp


[STATEMENT]
lemma W_rec:
  "W i j = (if j \<ge> i then W i (j - 1) + p j else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W i j = (if i \<le> j then W i (j - 1) + p j else 0)
[PROOF STEP]
unfolding W_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum p {i..j} = (if i \<le> j then sum p {i..j - 1} + p j else 0)
[PROOF STEP]
by (simp add: atLeastAtMost_split_insert)

\<comment> \<open>The weight function correctly implements costs.\<close>


[STATEMENT]
lemma uniform_limit_tendsto_bcontfun:
  fixes f::"'i \<Rightarrow> 'a::topological_space \<Rightarrow>\<^sub>C 'b::metric_space"
    and l::"'a::topological_space \<Rightarrow>\<^sub>C 'b::metric_space"
  assumes "uniform_limit UNIV f l F"
  shows "(f \<longlongrightarrow> l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> l) F
[PROOF STEP]
proof (rule tendstoI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
have "e / 2 > 0"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 < e / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
from uniform_limitD[OF assms this]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in F. \<forall>x\<in>UNIV. dist (apply_bcontfun (f n) x) (apply_bcontfun l x) < e / 2
[PROOF STEP]
have "\<forall>\<^sub>F i in F. \<forall>x. dist (f i x) (l x) < e / 2"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. \<forall>x\<in>UNIV. dist (apply_bcontfun (f n) x) (apply_bcontfun l x) < e / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F i in F. \<forall>x. dist (apply_bcontfun (f i) x) (apply_bcontfun l x) < e / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F i in F. \<forall>x. dist (apply_bcontfun (f i) x) (apply_bcontfun l x) < e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F i in F. \<forall>x. dist (apply_bcontfun (f i) x) (apply_bcontfun l x) < e / 2
[PROOF STEP]
have "\<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F i in F. \<forall>x. dist (apply_bcontfun (f i) x) (apply_bcontfun l x) < e / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2
[PROOF STEP]
by eventually_elim (blast intro: dist_bound less_imp_le)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2
[PROOF STEP]
show "\<forall>\<^sub>F x in F. dist (f x) l < e"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. dist (f x) l \<le> e / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. dist (f x) l < e
[PROOF STEP]
by eventually_elim (use \<open>0 < e\<close> in auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. dist (f x) l < e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in comm_monoid) extend_prod:
  fixes a A S
  assumes fin: "finite S" and subset: "A\<subseteq>S" and a: "a\<in>A\<rightarrow>carrier G"
  shows "(\<Otimes>\<^bsub>G\<^esub> x\<in>S. (if x\<in>A then a x else \<one>\<^bsub>G\<^esub>)) = (\<Otimes>\<^bsub>G\<^esub> x\<in>A. a x)"
  (is "(\<Otimes>\<^bsub>G\<^esub> x\<in>S. ?b x) = (\<Otimes>\<^bsub>G\<^esub> x\<in>A. a x)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Otimes>x\<in>S. if x \<in> A then a x else \<one>) = finprod G a A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Otimes>x\<in>S. if x \<in> A then a x else \<one>) = finprod G a A
[PROOF STEP]
from subset
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> S
[PROOF STEP]
have uni:"S = A \<union> (S-A)"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> S

goal (1 subgoal):
 1. S = A \<union> (S - A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S = A \<union> (S - A)

goal (1 subgoal):
 1. (\<Otimes>x\<in>S. if x \<in> A then a x else \<one>) = finprod G a A
[PROOF STEP]
from assms subset
[PROOF STATE]
proof (chain)
picking this:
finite S
A \<subseteq> S
a \<in> A \<rightarrow> carrier G
A \<subseteq> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite S
A \<subseteq> S
a \<in> A \<rightarrow> carrier G
A \<subseteq> S

goal (1 subgoal):
 1. (\<Otimes>x\<in>S. if x \<in> A then a x else \<one>) = finprod G a A
[PROOF STEP]
apply (subst uni)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; A \<subseteq> S; a \<in> A \<rightarrow> carrier G; A \<subseteq> S\<rbrakk> \<Longrightarrow> (\<Otimes>x\<in>A \<union> (S - A). if x \<in> A then a x else \<one>) = finprod G a A
[PROOF STEP]
apply (subst finprod_Un_disjoint, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite S; a \<in> A \<rightarrow> carrier G; A \<subseteq> S\<rbrakk> \<Longrightarrow> finite A
 2. \<lbrakk>finite S; a \<in> A \<rightarrow> carrier G; A \<subseteq> S\<rbrakk> \<Longrightarrow> (\<Otimes>x\<in>A. if x \<in> A then a x else \<one>) \<otimes> (\<Otimes>x\<in>S - A. if x \<in> A then a x else \<one>) = finprod G a A
[PROOF STEP]
by (auto cong: finprod_cong if_cong elim: finite_subset simp add:Pi_def finite_subset)
[PROOF STATE]
proof (state)
this:
(\<Otimes>x\<in>S. if x \<in> A then a x else \<one>) = finprod G a A

goal:
No subgoals!
[PROOF STEP]
(*Pi_def is key for automation here*)
[PROOF STATE]
proof (state)
this:
(\<Otimes>x\<in>S. if x \<in> A then a x else \<one>) = finprod G a A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lesseq_vecD: assumes "w \<in> carrier_vec n"
  and "v \<le> w"
  and "i < n"
shows "v $ i \<le> w $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v $ i \<le> w $ i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
w \<in> carrier_vec n
v \<le> w
i < n

goal (1 subgoal):
 1. v $ i \<le> w $ i
[PROOF STEP]
unfolding less_eq_vec_def
[PROOF STATE]
proof (prove)
using this:
w \<in> carrier_vec n
dim_vec v = dim_vec w \<and> (\<forall>i<dim_vec w. v $ i \<le> w $ i)
i < n

goal (1 subgoal):
 1. v $ i \<le> w $ i
[PROOF STEP]
by auto


[STATEMENT]
lemma (in group) set_mult_subset_generate:
  assumes "A \<subseteq> carrier G" "B \<subseteq> carrier G"
  shows "A <#> B \<subseteq> generate G (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A <#> B \<subseteq> generate G (A \<union> B)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A <#> B \<Longrightarrow> x \<in> generate G (A \<union> B)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A <#> B \<Longrightarrow> x \<in> generate G (A \<union> B)
[PROOF STEP]
assume "x \<in> A <#> B"
[PROOF STATE]
proof (state)
this:
x \<in> A <#> B

goal (1 subgoal):
 1. \<And>x. x \<in> A <#> B \<Longrightarrow> x \<in> generate G (A \<union> B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> A <#> B
[PROOF STEP]
obtain a b where ab: "a \<in> A" "b \<in> B" "x = a \<otimes> b"
[PROOF STATE]
proof (prove)
using this:
x \<in> A <#> B

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> A; b \<in> B; x = a \<otimes> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding set_mult_def
[PROOF STATE]
proof (prove)
using this:
x \<in> (\<Union>h\<in>A. \<Union>k\<in>B. {h \<otimes> k})

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> A; b \<in> B; x = a \<otimes> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> A
b \<in> B
x = a \<otimes> b

goal (1 subgoal):
 1. \<And>x. x \<in> A <#> B \<Longrightarrow> x \<in> generate G (A \<union> B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
b \<in> B
x = a \<otimes> b
[PROOF STEP]
have "a \<in> generate G (A \<union> B)" "b \<in> generate G (A \<union> B)"
[PROOF STATE]
proof (prove)
using this:
a \<in> A
b \<in> B
x = a \<otimes> b

goal (1 subgoal):
 1. a \<in> generate G (A \<union> B) &&& b \<in> generate G (A \<union> B)
[PROOF STEP]
using generate.incl[of _ "A \<union> B" G]
[PROOF STATE]
proof (prove)
using this:
a \<in> A
b \<in> B
x = a \<otimes> b
?h \<in> A \<union> B \<Longrightarrow> ?h \<in> generate G (A \<union> B)

goal (1 subgoal):
 1. a \<in> generate G (A \<union> B) &&& b \<in> generate G (A \<union> B)
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
a \<in> generate G (A \<union> B)
b \<in> generate G (A \<union> B)

goal (1 subgoal):
 1. \<And>x. x \<in> A <#> B \<Longrightarrow> x \<in> generate G (A \<union> B)
[PROOF STEP]
thus "x \<in> generate G (A \<union> B)"
[PROOF STATE]
proof (prove)
using this:
a \<in> generate G (A \<union> B)
b \<in> generate G (A \<union> B)

goal (1 subgoal):
 1. x \<in> generate G (A \<union> B)
[PROOF STEP]
using ab generate.eng
[PROOF STATE]
proof (prove)
using this:
a \<in> generate G (A \<union> B)
b \<in> generate G (A \<union> B)
a \<in> A
b \<in> B
x = a \<otimes> b
\<lbrakk>?h1.0 \<in> generate ?G ?H; ?h2.0 \<in> generate ?G ?H\<rbrakk> \<Longrightarrow> ?h1.0 \<otimes>\<^bsub>?G\<^esub> ?h2.0 \<in> generate ?G ?H

goal (1 subgoal):
 1. x \<in> generate G (A \<union> B)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
x \<in> generate G (A \<union> B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_append_swap:
  assumes "x @ y <\<^sub>v u @ v"
    and "length x = length u"
  shows "y @ x <\<^sub>v v @ u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y @ x <\<^sub>v v @ u
[PROOF STEP]
using assms(2, 1)
[PROOF STATE]
proof (prove)
using this:
length x = length u
x @ y <\<^sub>v u @ v

goal (1 subgoal):
 1. y @ x <\<^sub>v v @ u
[PROOF STEP]
by (induct x u rule: list_induct2)
    (auto simp: order_vec.order.strict_iff_order le_Cons le_append le_length)


[STATEMENT]
lemma VectorSpaceHomSet_is_fmaps_in_GroupHomSet :
  fixes smult' :: "'f \<Rightarrow> 'w::ab_group_add \<Rightarrow> 'w" (infixr "\<star>" 70)
  shows "VectorSpaceHomSet smult V smult' W
              = (GroupHomSet V W) \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> (T v)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VectorSpaceHomSet (\<cdot>) V (\<star>) W = GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. VectorSpaceHomSet (\<cdot>) V (\<star>) W \<subseteq> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
 2. GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v} \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
show "VectorSpaceHomSet smult V smult' W
              \<subseteq> (GroupHomSet V W) \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> (T v)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VectorSpaceHomSet (\<cdot>) V (\<star>) W \<subseteq> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
[PROOF STEP]
using VectorSpaceHomSetD_VectorSpaceHom[of _ smult]
          VectorSpaceHomSetD_Im[of _ smult]
          VectorSpaceHom.GroupHom[of smult] GroupHomSetI[of V _ W]
          VectorSpaceHom.f_map[of smult]
[PROOF STATE]
proof (prove)
using this:
?T \<in> VectorSpaceHomSet (\<cdot>) ?V ?fsmult' ?N \<Longrightarrow> VectorSpaceHom (\<cdot>) ?V ?fsmult' ?T
?T \<in> VectorSpaceHomSet (\<cdot>) ?V ?fsmult' ?W \<Longrightarrow> ?T ` ?V \<subseteq> ?W
VectorSpaceHom (\<cdot>) ?V ?smult' ?T \<Longrightarrow> GroupHom ?V ?T
\<lbrakk>GroupHom V ?T; ?T ` V \<subseteq> W\<rbrakk> \<Longrightarrow> ?T \<in> GroupHomSet V W
\<lbrakk>VectorSpaceHom (\<cdot>) ?V ?smult' ?T; ?r \<in> UNIV; ?m \<in> ?V\<rbrakk> \<Longrightarrow> ?T (?r \<cdot> ?m) = ?smult' ?r (?T ?m)

goal (1 subgoal):
 1. VectorSpaceHomSet (\<cdot>) V (\<star>) W \<subseteq> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
VectorSpaceHomSet (\<cdot>) V (\<star>) W \<subseteq> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}

goal (1 subgoal):
 1. GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v} \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
show "VectorSpaceHomSet smult V smult' W
              \<supseteq> (GroupHomSet V W) \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> (T v)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v} \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v} \<Longrightarrow> x \<in> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
fix T
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v} \<Longrightarrow> x \<in> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
assume T: "T \<in> (GroupHomSet V W)
                          \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> (T v)}"
[PROOF STATE]
proof (state)
this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}

goal (1 subgoal):
 1. \<And>x. x \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v} \<Longrightarrow> x \<in> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
have "VectorSpaceHom smult V smult' T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VectorSpaceHom (\<cdot>) V (\<star>) T
[PROOF STEP]
proof (rule VectorSpaceHom.intro, rule ModuleHom.intro, rule RModuleHom.intro)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. RModule UNIV (\<cdot>) V
 2. GroupHom V T
 3. RModuleHom_axioms UNIV (\<cdot>) V (\<star>) T
[PROOF STEP]
show "RModule UNIV (\<cdot>) V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RModule UNIV (\<cdot>) V
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
RModule UNIV (\<cdot>) V

goal (2 subgoals):
 1. GroupHom V T
 2. RModuleHom_axioms UNIV (\<cdot>) V (\<star>) T
[PROOF STEP]
from T
[PROOF STATE]
proof (chain)
picking this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
[PROOF STEP]
show "GroupHom V T"
[PROOF STATE]
proof (prove)
using this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}

goal (1 subgoal):
 1. GroupHom V T
[PROOF STEP]
using GroupHomSetD_GroupHom
[PROOF STATE]
proof (prove)
using this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
?T \<in> GroupHomSet ?G ?H \<Longrightarrow> GroupHom ?G ?T

goal (1 subgoal):
 1. GroupHom V T
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
GroupHom V T

goal (1 subgoal):
 1. RModuleHom_axioms UNIV (\<cdot>) V (\<star>) T
[PROOF STEP]
from T
[PROOF STATE]
proof (chain)
picking this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
[PROOF STEP]
show "RModuleHom_axioms UNIV smult V smult' T"
[PROOF STATE]
proof (prove)
using this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}

goal (1 subgoal):
 1. RModuleHom_axioms UNIV (\<cdot>) V (\<star>) T
[PROOF STEP]
by unfold_locales fast
[PROOF STATE]
proof (state)
this:
RModuleHom_axioms UNIV (\<cdot>) V (\<star>) T

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
VectorSpaceHom (\<cdot>) V (\<star>) T

goal (1 subgoal):
 1. \<And>x. x \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v} \<Longrightarrow> x \<in> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
with T
[PROOF STATE]
proof (chain)
picking this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
VectorSpaceHom (\<cdot>) V (\<star>) T
[PROOF STEP]
show "T \<in> VectorSpaceHomSet smult V smult' W"
[PROOF STATE]
proof (prove)
using this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
VectorSpaceHom (\<cdot>) V (\<star>) T

goal (1 subgoal):
 1. T \<in> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
using GroupHomSetD_Im[of T] VectorSpaceHomSetI
[PROOF STATE]
proof (prove)
using this:
T \<in> GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v}
VectorSpaceHom (\<cdot>) V (\<star>) T
T \<in> GroupHomSet ?G ?H \<Longrightarrow> T ` ?G \<subseteq> ?H
\<lbrakk>VectorSpaceHom ?fsmult ?V ?fsmult' ?T; ?T ` ?V \<subseteq> ?W\<rbrakk> \<Longrightarrow> ?T \<in> VectorSpaceHomSet ?fsmult ?V ?fsmult' ?W

goal (1 subgoal):
 1. T \<in> VectorSpaceHomSet (\<cdot>) V (\<star>) W
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
T \<in> VectorSpaceHomSet (\<cdot>) V (\<star>) W

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
GroupHomSet V W \<inter> {T. \<forall>a. \<forall>v\<in>V. T (a \<cdot> v) = a \<star> T v} \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<star>) W

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in topology) open_diff_closed:
assumes aclosed: "A closed"
  and   bopen: "B open"
  shows "B - A open"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B - A open
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B - A open
[PROOF STEP]
from aclosed
[PROOF STATE]
proof (chain)
picking this:
A closed
[PROOF STEP]
have "carrier - A open"
[PROOF STATE]
proof (prove)
using this:
A closed

goal (1 subgoal):
 1. carrier - A open
[PROOF STEP]
by (rule closedE)
[PROOF STATE]
proof (state)
this:
carrier - A open

goal (1 subgoal):
 1. B - A open
[PROOF STEP]
hence "(carrier - A) \<inter> B open"
[PROOF STATE]
proof (prove)
using this:
carrier - A open

goal (1 subgoal):
 1. (carrier - A) \<inter> B open
[PROOF STEP]
using bopen
[PROOF STATE]
proof (prove)
using this:
carrier - A open
B open

goal (1 subgoal):
 1. (carrier - A) \<inter> B open
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(carrier - A) \<inter> B open

goal (1 subgoal):
 1. B - A open
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(carrier - A) \<inter> B open

goal (1 subgoal):
 1. B - A open
[PROOF STEP]
from bopen
[PROOF STATE]
proof (chain)
picking this:
B open
[PROOF STEP]
have "B \<subseteq> carrier"
[PROOF STATE]
proof (prove)
using this:
B open

goal (1 subgoal):
 1. B \<subseteq> carrier
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<subseteq> carrier

goal (1 subgoal):
 1. B - A open
[PROOF STEP]
hence "(carrier - A) \<inter> B = B - A"
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> carrier

goal (1 subgoal):
 1. (carrier - A) \<inter> B = B - A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(carrier - A) \<inter> B = B - A

goal (1 subgoal):
 1. B - A open
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(carrier - A) \<inter> B open
(carrier - A) \<inter> B = B - A
[PROOF STEP]
show "B - A open"
[PROOF STATE]
proof (prove)
using this:
(carrier - A) \<inter> B open
(carrier - A) \<inter> B = B - A

goal (1 subgoal):
 1. B - A open
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B - A open

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fact_approx_add: "fact (l + n) \<le> fact l * (real l + real n) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (l + n) \<le> fact l * (real l + real n) ^ n
[PROOF STEP]
proof (induct n arbitrary: l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
case (Suc n l)
[PROOF STATE]
proof (state)
this:
fact (?l + n) \<le> fact ?l * (real ?l + real n) ^ n

goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
have "fact (l + Suc n) = (real l + Suc n) * fact (l + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (l + Suc n) = (real l + real (Suc n)) * fact (l + n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fact (l + Suc n) = (real l + real (Suc n)) * fact (l + n)

goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (l + Suc n) = (real l + real (Suc n)) * fact (l + n)

goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
have "\<dots> \<le> (real l + Suc n) * (fact l * (real l + real n) ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real l + real (Suc n)) * fact (l + n) \<le> (real l + real (Suc n)) * (fact l * (real l + real n) ^ n)
[PROOF STEP]
by (intro mult_left_mono[OF Suc], auto)
[PROOF STATE]
proof (state)
this:
(real l + real (Suc n)) * fact (l + n) \<le> (real l + real (Suc n)) * (fact l * (real l + real n) ^ n)

goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real l + real (Suc n)) * fact (l + n) \<le> (real l + real (Suc n)) * (fact l * (real l + real n) ^ n)

goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
have "\<dots> = fact l * ((real l + Suc n) * (real l + real n) ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real l + real (Suc n)) * (fact l * (real l + real n) ^ n) = fact l * ((real l + real (Suc n)) * (real l + real n) ^ n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(real l + real (Suc n)) * (fact l * (real l + real n) ^ n) = fact l * ((real l + real (Suc n)) * (real l + real n) ^ n)

goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real l + real (Suc n)) * (fact l * (real l + real n) ^ n) = fact l * ((real l + real (Suc n)) * (real l + real n) ^ n)

goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
have "\<dots> \<le> fact l * ((real l + Suc n) * (real l + real (Suc n)) ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact l * ((real l + real (Suc n)) * (real l + real n) ^ n) \<le> fact l * ((real l + real (Suc n)) * (real l + real (Suc n)) ^ n)
[PROOF STEP]
by (rule mult_left_mono, rule mult_left_mono, rule power_mono, auto)
[PROOF STATE]
proof (state)
this:
fact l * ((real l + real (Suc n)) * (real l + real n) ^ n) \<le> fact l * ((real l + real (Suc n)) * (real l + real (Suc n)) ^ n)

goal (2 subgoals):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
 2. \<And>n l. (\<And>l. fact (l + n) \<le> fact l * (real l + real n) ^ n) \<Longrightarrow> fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fact (l + Suc n) \<le> fact l * ((real l + real (Suc n)) * (real l + real (Suc n)) ^ n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
fact (l + Suc n) \<le> fact l * ((real l + real (Suc n)) * (real l + real (Suc n)) ^ n)

goal (1 subgoal):
 1. fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fact (l + Suc n) \<le> fact l * (real l + real (Suc n)) ^ Suc n

goal (1 subgoal):
 1. \<And>l. fact (l + 0) \<le> fact l * (real l + real 0) ^ 0
[PROOF STEP]
qed simp


[STATEMENT]
lemma continuous_on_compose_fracI:
  fixes f :: "real \<Rightarrow> real"
  assumes cont1: "continuous_on {0..1} f"
  assumes cont2: "f 0 = f 1"
  shows   "continuous_on UNIV (\<lambda>x. f (frac x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on UNIV (\<lambda>x. f (frac x))
[PROOF STEP]
proof (rule periodic_continuous_onI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. f (frac (x + ?p)) = f (frac x)
 2. 0 < ?p
 3. continuous_on {?a..?a + ?p} (\<lambda>x. f (frac x))
[PROOF STEP]
have cont: "continuous_on {0..1} (\<lambda>x. f (frac x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. f (frac x))
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
assume x: "x \<in> {0..1}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..1}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
show "((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
proof (cases "x = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
 2. x \<noteq> 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> 1

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
 2. x \<noteq> 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0..1}
x \<noteq> 1
[PROOF STEP]
have [simp]: "frac x = x"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..1}
x \<noteq> 1

goal (1 subgoal):
 1. frac x = x
[PROOF STEP]
by (simp add: frac_eq)
[PROOF STATE]
proof (state)
this:
frac x = x

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
 2. x \<noteq> 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
from x False
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0..1}
x \<noteq> 1
[PROOF STEP]
have "eventually (\<lambda>x. x \<in> {..<1}) (nhds x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..1}
x \<noteq> 1

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. x \<in> {..<1}
[PROOF STEP]
by (intro eventually_nhds_in_open) auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds x. x \<in> {..<1}

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
 2. x \<noteq> 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
hence "eventually (\<lambda>x. frac x = x) (at x within {0..1})"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. x \<in> {..<1}

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x within {0..1}. frac x = x
[PROOF STEP]
by (auto simp: eventually_at_filter frac_eq elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x within {0..1}. frac x = x

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
 2. x \<noteq> 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
hence "eventually (\<lambda>x. f x = f (frac x)) (at x within {0..1})"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at x within {0..1}. frac x = x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x within {0..1}. f x = f (frac x)
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x within {0..1}. f x = f (frac x)

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
 2. x \<noteq> 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x within {0..1}. f x = f (frac x)

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
 2. x \<noteq> 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
from cont1 x
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} f
x \<in> {0..1}
[PROOF STEP]
have "(f \<longlongrightarrow> f (frac x)) (at x within {0..1})"
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} f
x \<in> {0..1}

goal (1 subgoal):
 1. (f \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
by (simp add: continuous_on_def)
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> f (frac x)) (at x within {0..1})

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
 2. x \<noteq> 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at x within {0..1}. f x = f (frac x)
(f \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
show "((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at x within {0..1}. f x = f (frac x)
(f \<longlongrightarrow> f (frac x)) (at x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
by (blast intro: Lim_transform_eventually)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})

goal (1 subgoal):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = 1

goal (1 subgoal):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
from cont1
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} f
[PROOF STEP]
have **: "(f \<longlongrightarrow> f 1) (at 1 within {0..1})"
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} f

goal (1 subgoal):
 1. (f \<longlongrightarrow> f 1) (at 1 within {0..1})
[PROOF STEP]
by (simp add: continuous_on_def)
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> f 1) (at 1 within {0..1})

goal (1 subgoal):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> f 1) (at 1 within {0..1})

goal (1 subgoal):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
have *: "filterlim frac (at 1 within {0..1}) (at 1 within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim frac (at (1::'a) within {0::'a..1::'a}) (at (1::'a) within {0::'a..1::'a})
[PROOF STEP]
proof (subst filterlim_cong[OF refl refl])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in at (1::'a) within {0::'a..1::'a}. frac x = ?g x
 2. filterlim ?g (at (1::'a) within {0::'a..1::'a}) (at (1::'a) within {0::'a..1::'a})
[PROOF STEP]
show "eventually (\<lambda>x. frac x = x) (at 1 within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at (1::'b) within {0::'b..1::'b}. frac x = x
[PROOF STEP]
by (auto simp: eventually_at_filter frac_eq)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at (1::?'b1) within {0::?'b1..1::?'b1}. frac x = x

goal (1 subgoal):
 1. LIM x at (1::'a) within {0::'a..1::'a}. x :> at (1::'a) within {0::'a..1::'a}
[PROOF STEP]
qed (simp add: filterlim_ident)
[PROOF STATE]
proof (state)
this:
filterlim frac (at (1::?'a1) within {0::?'a1..1::?'a1}) (at (1::?'a1) within {0::?'a1..1::?'a1})

goal (1 subgoal):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> f 1) (at 1 within {0..1})
filterlim frac (at (1::?'a1) within {0::?'a1..1::?'a1}) (at (1::?'a1) within {0::?'a1..1::?'a1})
[PROOF STEP]
have "((\<lambda>x. f (frac x)) \<longlongrightarrow> f 1) (at 1 within {0..1})"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f 1) (at 1 within {0..1})
filterlim frac (at (1::?'a1) within {0::?'a1..1::?'a1}) (at (1::?'a1) within {0::?'a1..1::?'a1})

goal (1 subgoal):
 1. ((\<lambda>x. f (frac x)) \<longlongrightarrow> f 1) (at 1 within {0..1})
[PROOF STEP]
by (rule filterlim_compose)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (frac x)) \<longlongrightarrow> f 1) (at 1 within {0..1})

goal (1 subgoal):
 1. x = 1 \<Longrightarrow> ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f (frac x)) \<longlongrightarrow> f 1) (at 1 within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})
[PROOF STEP]
by (simp add: True cont2 frac_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (frac x)) \<longlongrightarrow> f (frac x)) (at x within {0..1})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. f (frac x))

goal (3 subgoals):
 1. \<And>x. f (frac (x + ?p)) = f (frac x)
 2. 0 < ?p
 3. continuous_on {?a..?a + ?p} (\<lambda>x. f (frac x))
[PROOF STEP]
thus "continuous_on {0..0+1} (\<lambda>x. f (frac x))"
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>x. f (frac x))

goal (1 subgoal):
 1. continuous_on {0..0 + 1} (\<lambda>x. f (frac x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
continuous_on {0..0 + 1} (\<lambda>x. f (frac x))

goal (2 subgoals):
 1. \<And>x. f (frac (x + 1)) = f (frac x)
 2. 0 < 1
[PROOF STEP]
qed (simp_all add: frac.periodic_simps)


[STATEMENT]
lemma coneD:
  assumes "p \<in> cone (h, U)" and "p \<noteq> 0"
  shows "lpp h adds lpp (p::_ \<Rightarrow>\<^sub>0 _::{comm_semiring_0,semiring_no_zero_divisors})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lpp h adds lpp p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lpp h adds lpp p
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
p \<in> cone (h, U)
[PROOF STEP]
obtain a where p: "p = a * h"
[PROOF STATE]
proof (prove)
using this:
p \<in> cone (h, U)

goal (1 subgoal):
 1. (\<And>a. p = a * h \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule coneE)
[PROOF STATE]
proof (state)
this:
p = a * h

goal (1 subgoal):
 1. lpp h adds lpp p
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
p = a * h
[PROOF STEP]
have "a \<noteq> 0" and "h \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
p = a * h

goal (1 subgoal):
 1. a \<noteq> 0 &&& h \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<noteq> 0
h \<noteq> 0

goal (1 subgoal):
 1. lpp h adds lpp p
[PROOF STEP]
hence "lpp p = lpp a + lpp h"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
h \<noteq> 0

goal (1 subgoal):
 1. lpp p = lpp a + lpp h
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
h \<noteq> 0

goal (1 subgoal):
 1. lpp (a * h) = lpp a + lpp h
[PROOF STEP]
by (rule lp_times)
[PROOF STATE]
proof (state)
this:
lpp p = lpp a + lpp h

goal (1 subgoal):
 1. lpp h adds lpp p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lpp p = lpp a + lpp h

goal (1 subgoal):
 1. lpp h adds lpp p
[PROOF STEP]
have "\<dots> = lpp h + lpp a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lpp a + lpp h = lpp h + lpp a
[PROOF STEP]
by (rule add.commute)
[PROOF STATE]
proof (state)
this:
lpp a + lpp h = lpp h + lpp a

goal (1 subgoal):
 1. lpp h adds lpp p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lpp p = lpp h + lpp a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lpp p = lpp h + lpp a

goal (1 subgoal):
 1. lpp h adds lpp p
[PROOF STEP]
by (rule addsI)
[PROOF STATE]
proof (state)
this:
lpp h adds lpp p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorders_finite_nonempty:
  assumes "finite A"
  shows   "linorders_on A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorders_on A \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linorders_on A \<noteq> {}
[PROOF STEP]
from finite_distinct_list[OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>xs. set xs = A \<and> distinct xs
[PROOF STEP]
obtain xs where "set xs = A" "distinct xs"
[PROOF STATE]
proof (prove)
using this:
\<exists>xs. set xs = A \<and> distinct xs

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

goal (1 subgoal):
 1. linorders_on A \<noteq> {}
[PROOF STEP]
hence "linorder_on A (linorder_of_list xs)"
[PROOF STATE]
proof (prove)
using this:
set xs = A
distinct xs

goal (1 subgoal):
 1. linorder_on A (linorder_of_list xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
linorder_on A (linorder_of_list xs)

goal (1 subgoal):
 1. linorders_on A \<noteq> {}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
linorder_on A (linorder_of_list xs)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coplanar_perm_20:
  assumes "Coplanar A B C D"
  shows "Coplanar D B A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar D B A C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar D B A C
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar D B A C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar D B A C
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar D B A C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar D B A C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_dvd_poly: "[:coeff a (degree a):] dvd (a::'a::{field} poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:lead_coeff a:] dvd a
[PROOF STEP]
proof (cases "a=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<Longrightarrow> [:lead_coeff a:] dvd a
 2. a \<noteq> 0 \<Longrightarrow> [:lead_coeff a:] dvd a
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = 0

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> [:lead_coeff a:] dvd a
 2. a \<noteq> 0 \<Longrightarrow> [:lead_coeff a:] dvd a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a = 0

goal (1 subgoal):
 1. [:lead_coeff a:] dvd a
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
a = 0

goal (1 subgoal):
 1. \<exists>k. a = [:lead_coeff a:] * k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[:lead_coeff a:] dvd a

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> [:lead_coeff a:] dvd a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> [:lead_coeff a:] dvd a
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> [:lead_coeff a:] dvd a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. [:lead_coeff a:] dvd a
[PROOF STEP]
by (intro dvd_trans[OF is_unit_triv one_dvd]) simp
[PROOF STATE]
proof (state)
this:
[:lead_coeff a:] dvd a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma succ_finite[simp, intro]: "finite (edges G) \<Longrightarrow> finite (succ G v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (edges G) \<Longrightarrow> finite (succ G v)
[PROOF STEP]
unfolding succ_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (edges G) \<Longrightarrow> finite {v'. (v, v') \<in> edges G}
[PROOF STEP]
by (rule finite_subset[where B="snd`edges G"]) force+