[STATEMENT]
lemma column_Gram_Schmidt_column_k_eq_efficient:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes "Gram_Schmidt_upt_k A k = foldl Gram_Schmidt_column_k_efficient A [0..<Suc k]"
  and suc_k: "Suc k < ncols A"
  shows "column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k))
  = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
proof (cases "b = from_nat (Suc k)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
 2. b \<noteq> mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> mod_type_class.from_nat (Suc k)

goal (2 subgoals):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
 2. b \<noteq> mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<noteq> mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
unfolding Gram_Schmidt_column_k_efficient_def Gram_Schmidt_column_k_def column_def
[PROOF STATE]
proof (prove)
using this:
b \<noteq> mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. (\<chi>i. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - proj_onto (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) {\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i |i. i < b} else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ i $ b) = (\<chi>i. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - (\<Sum>x\<leftarrow>map (\<lambda>n. \<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat n) [0..<mod_type_class.to_nat b]. ((\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) \<bullet> x / (x \<bullet> x)) *\<^sub>R x) else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ i $ b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have tn_fn_suc: "to_nat (from_nat (Suc k)::'n) = Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k
[PROOF STEP]
using suc_k to_nat_from_nat_id
[PROOF STATE]
proof (prove)
using this:
Suc k < ncols A
?x < CARD(?'a) \<Longrightarrow> mod_type_class.to_nat (mod_type_class.from_nat ?x) = ?x

goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
Suc k < CARD('n)
?x < CARD(?'a) \<Longrightarrow> mod_type_class.to_nat (mod_type_class.from_nat ?x) = ?x

goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (mod_type_class.from_nat (Suc k)) = Suc k

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
define G where"G = Gram_Schmidt_upt_k A k"
[PROOF STATE]
proof (state)
this:
G = Gram_Schmidt_upt_k A k

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
let ?f="(\<lambda>x. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
let ?g="(\<lambda>n. column (from_nat n) G) "
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have proj_eq: "proj_onto (column b G) {column i G |i. i < b}
    = sum_list (map ?f (map ?g [0..<to_nat b]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "proj_onto (column b G) {column i G |i. i < b} = sum ?f {column i G |i. i < b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
unfolding proj_onto_def proj_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>u\<in>{column i G |i. i < b}. (column b G \<bullet> u / (u \<bullet> u)) *\<^sub>R u) = (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = sum ?f (set (map ?g [0..<to_nat b]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
by (rule sum.cong, auto simp add: set_map_column[symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>{column i G |i. i < b}. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = sum_list (map ?f (remdups (map ?g [0..<to_nat b])))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
unfolding sum_code
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
have "... = sum_list ((map ?f ((map ?g [0..<to_nat b]))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
proof (rule sum_list_remdups_2, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
assume i: "i < to_nat b"
        and j: "j < to_nat b" and ij: "i \<noteq> j"
        and col_eq: "column (from_nat i) G = column (from_nat j) G"
        and col_0: "column (from_nat j) G \<noteq> 0"
[PROOF STATE]
proof (state)
this:
i < mod_type_class.to_nat b
j < mod_type_class.to_nat b
i \<noteq> j
column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G
column (mod_type_class.from_nat j) G \<noteq> 0

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
have k: "to_nat (from_nat k::'n) = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (mod_type_class.from_nat k) = k
[PROOF STEP]
by (metis Suc_lessD ncols_def suc_k to_nat_from_nat_id)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (mod_type_class.from_nat k) = k

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
have "column (from_nat j) G = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
proof (unfold G_def, rule column_Gram_Schmidt_upt_k_repeated(1)
          [of "(from_nat i)::'n" "from_nat j" "from_nat k" A, unfolded k])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. mod_type_class.from_nat i \<le> mod_type_class.from_nat k
 3. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
 4. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
have "from_nat i < (from_nat (Suc k)::'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
[PROOF STEP]
using from_nat_mono[of i "Suc k"] suc_k i
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < Suc k; Suc k < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
Suc k < ncols A
i < mod_type_class.to_nat b

goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
[PROOF STEP]
unfolding True tn_fn_suc ncols_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i < Suc k; Suc k < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
Suc k < CARD('n)
i < Suc k

goal (1 subgoal):
 1. mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)

goal (4 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. mod_type_class.from_nat i \<le> mod_type_class.from_nat k
 3. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
 4. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
thus "from_nat i \<le> (from_nat k::'n)"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.from_nat i < mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. mod_type_class.from_nat i \<le> mod_type_class.from_nat k
[PROOF STEP]
by (metis Suc_lessD True from_nat_mono' i less_Suc_eq_le ncols_def suc_k tn_fn_suc)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i \<le> mod_type_class.from_nat k

goal (3 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
 3. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
have "from_nat j < (from_nat (Suc k)::'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
[PROOF STEP]
using from_nat_mono[of j "Suc k"] suc_k j
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>j < Suc k; Suc k < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
Suc k < ncols A
j < mod_type_class.to_nat b

goal (1 subgoal):
 1. mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
[PROOF STEP]
unfolding True tn_fn_suc ncols_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>j < Suc k; Suc k < CARD(?'a)\<rbrakk> \<Longrightarrow> mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
Suc k < CARD('n)
j < Suc k

goal (1 subgoal):
 1. mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)

goal (3 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
 3. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
thus "from_nat j \<le> (from_nat k::'n)"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.from_nat j < mod_type_class.from_nat (Suc k)

goal (1 subgoal):
 1. mod_type_class.from_nat j \<le> mod_type_class.from_nat k
[PROOF STEP]
by (metis Suc_lessD True from_nat_mono' j less_Suc_eq_le ncols_def suc_k tn_fn_suc)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat j \<le> mod_type_class.from_nat k

goal (2 subgoals):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
 2. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
show "from_nat i \<noteq> (from_nat j::'n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
[PROOF STEP]
using ij i j True suc_k
[PROOF STATE]
proof (prove)
using this:
i \<noteq> j
i < mod_type_class.to_nat b
j < mod_type_class.to_nat b
b = mod_type_class.from_nat (Suc k)
Suc k < ncols A

goal (1 subgoal):
 1. mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j
[PROOF STEP]
by (metis (no_types, lifting) dual_order.strict_trans from_nat_eq_imp_eq ncols_def tn_fn_suc)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat i \<noteq> mod_type_class.from_nat j

goal (1 subgoal):
 1. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
show "column (from_nat j) (Gram_Schmidt_upt_k A k)
          = column (from_nat i) (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
using G_def col_eq
[PROOF STATE]
proof (prove)
using this:
G = Gram_Schmidt_upt_k A k
column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G

goal (1 subgoal):
 1. column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat j) (Gram_Schmidt_upt_k A k) = column (mod_type_class.from_nat i) (Gram_Schmidt_upt_k A k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
column (mod_type_class.from_nat j) G = 0

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < mod_type_class.to_nat b; j < mod_type_class.to_nat b; i \<noteq> j; column (mod_type_class.from_nat i) G = column (mod_type_class.from_nat j) G; column (mod_type_class.from_nat j) G \<noteq> 0\<rbrakk> \<Longrightarrow> column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
thus "column b G \<bullet> column (from_nat j) G = 0"
[PROOF STATE]
proof (prove)
using this:
column (mod_type_class.from_nat j) G = 0

goal (1 subgoal):
 1. column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
using col_0
[PROOF STATE]
proof (prove)
using this:
column (mod_type_class.from_nat j) G = 0
column (mod_type_class.from_nat j) G \<noteq> 0

goal (1 subgoal):
 1. column b G \<bullet> column (mod_type_class.from_nat j) G = 0
[PROOF STEP]
by contradiction
[PROOF STATE]
proof (state)
this:
column b G \<bullet> column (mod_type_class.from_nat j) G = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>remdups (map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]). (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proj_onto (column b G) {column i G |i. i < b} = (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have "column b (Gram_Schmidt_column_k G (Suc k))
    = column b G - proj_onto (column b G) {column i G |i. i < b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k G (Suc k)) = column b G - proj_onto (column b G) {column i G |i. i < b}
[PROOF STEP]
unfolding True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column (mod_type_class.from_nat (Suc k)) (Gram_Schmidt_column_k G (Suc k)) = column (mod_type_class.from_nat (Suc k)) G - proj_onto (column (mod_type_class.from_nat (Suc k)) G) {column i G |i. i < mod_type_class.from_nat (Suc k)}
[PROOF STEP]
unfolding Gram_Schmidt_column_k_def G_def column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - proj_onto (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) {\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i |i. i < b} else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ i $ mod_type_class.from_nat (Suc k)) = (\<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat (Suc k)) - proj_onto (\<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat (Suc k)) {\<chi>ia. Gram_Schmidt_upt_k A k $ ia $ i |i. i < mod_type_class.from_nat (Suc k)}
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
column b (Gram_Schmidt_column_k G (Suc k)) = column b G - proj_onto (column b G) {column i G |i. i < b}

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column b (Gram_Schmidt_column_k G (Suc k)) = column b G - proj_onto (column b G) {column i G |i. i < b}

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have "... = column b G
    - (\<Sum>x\<leftarrow>map (\<lambda>n. column (from_nat n) G) [0..<to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b G - proj_onto (column b G) {column i G |i. i < b} = column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
unfolding proj_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
column b G - proj_onto (column b G) {column i G |i. i < b} = column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column b G - proj_onto (column b G) {column i G |i. i < b} = column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x)

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
have "... = column b (Gram_Schmidt_column_k_efficient G (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = column b (Gram_Schmidt_column_k_efficient G (Suc k))
[PROOF STEP]
unfolding True Gram_Schmidt_column_k_efficient_def G_def column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat (Suc k)) - (\<Sum>x\<leftarrow>map (\<lambda>n. \<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat n) [0..<mod_type_class.to_nat (mod_type_class.from_nat (Suc k))]. ((\<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat (Suc k)) \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = (\<chi>i. (\<chi>a b. (if b = mod_type_class.from_nat (Suc k) then (\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) - (\<Sum>x\<leftarrow>map (\<lambda>n. \<chi>i. Gram_Schmidt_upt_k A k $ i $ mod_type_class.from_nat n) [0..<mod_type_class.to_nat b]. ((\<chi>i. Gram_Schmidt_upt_k A k $ i $ b) \<bullet> x / (x \<bullet> x)) *\<^sub>R x) else \<chi>i. Gram_Schmidt_upt_k A k $ i $ b) $ a) $ i $ mod_type_class.from_nat (Suc k))
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
column b G - (\<Sum>x\<leftarrow>map (\<lambda>n. column (mod_type_class.from_nat n) G) [0..<mod_type_class.to_nat b]. (column b G \<bullet> x / (x \<bullet> x)) *\<^sub>R x) = column b (Gram_Schmidt_column_k_efficient G (Suc k))

goal (1 subgoal):
 1. b = mod_type_class.from_nat (Suc k) \<Longrightarrow> column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
column b (Gram_Schmidt_column_k G (Suc k)) = column b (Gram_Schmidt_column_k_efficient G (Suc k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
column b (Gram_Schmidt_column_k G (Suc k)) = column b (Gram_Schmidt_column_k_efficient G (Suc k))

goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
using this:
column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))

goal (1 subgoal):
 1. column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
column b (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = column b (Gram_Schmidt_column_k_efficient (Gram_Schmidt_upt_k A k) (Suc k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quantifier_change_order_twice:
  fixes P :: "nat \<Rightarrow> nat \<Rightarrow> nat \<Rightarrow> bool" and m n :: nat
  shows "\<forall>i<m. \<forall>j<n. \<exists> no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
assume fact: "\<forall>i<m. \<forall>j<n. \<exists> no. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
have one: "\<forall>i<m. \<exists>no.\<forall>j<n. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
using fact quantifier_change_order_once
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j
\<forall>j<?m. \<exists>no. \<forall>n\<ge>no. ?P n j \<Longrightarrow> \<exists>no. \<forall>j<?m. \<forall>n\<ge>no. ?P n j

goal (1 subgoal):
 1. \<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
have two: "\<forall>i<m. \<exists>no.\<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<0. \<forall>j<n. \<forall>n\<ge>no. P n i j
 2. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
\<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (2 subgoals):
 1. \<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<0. \<forall>j<n. \<forall>n\<ge>no. P n i j
 2. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i<0. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<0. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<0. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
obtain M where MM: "\<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>M. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. (\<And>M. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j

goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
obtain N where NN: "\<forall>j<n. \<forall>n\<ge>N. P n m j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>N. \<forall>j<n. \<forall>n\<ge>N. P n m j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. (\<And>N. \<forall>j<n. \<forall>n\<ge>N. P n m j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>j<n. \<forall>n\<ge>N. P n m j

goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
let ?N = "max M N"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
from MM NN
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j
\<forall>j<n. \<forall>n\<ge>N. P n m j
[PROOF STEP]
have "\<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>?N. P n i j"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<n. \<forall>n\<ge>M. P n i j
\<forall>j<n. \<forall>n\<ge>N. P n m j

goal (1 subgoal):
 1. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>max M N. P n i j
[PROOF STEP]
by (metis less_antisym max.boundedE)
[PROOF STATE]
proof (state)
this:
\<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>max M N. P n i j

goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>max M N. P n i j
[PROOF STEP]
have "\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>max M N. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<lbrakk>\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j; \<forall>i<Suc m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<Suc m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
with fact
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
using one
[PROOF STATE]
proof (prove)
using this:
\<forall>i<m. \<forall>j<n. \<exists>no. \<forall>n\<ge>no. P n i j
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j \<Longrightarrow> \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
\<forall>i<m. \<exists>no. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal (1 subgoal):
 1. \<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>i<m. \<forall>j<n. \<forall>n\<ge>no. P n i j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zcf_monom_sub':
  assumes "p \<in> carrier P"
  assumes "a \<in> carrier R"
  shows "zcf ((monom P a (Suc n)) of  p) = a \<otimes> zcf p [^] (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zcf (Cring_Poly.compose R (monom P a (Suc n)) p) = a \<otimes> zcf p [^] Suc n
[PROOF STEP]
using zcf_monom_sub assms P_def R.zero_closed UP_cring.ctrm_of_sub UP_cring.to_fun_monom UP_cring_axioms
    zcf_to_fun to_fun_closed monom_closed
[PROOF STATE]
proof (prove)
using this:
?p \<in> carrier P \<Longrightarrow> zcf (Cring_Poly.compose R (monom P \<one> (Suc ?n)) ?p) = zcf ?p [^] Suc ?n
p \<in> carrier P
a \<in> carrier R
P \<equiv> UP R
\<zero> \<in> carrier R
\<lbrakk>UP_cring ?R; ?f \<in> carrier (UP ?R); ?g \<in> carrier (UP ?R)\<rbrakk> \<Longrightarrow> zcf (Cring_Poly.compose ?R ?f ?g) = UP_cring.to_fun ?R ?f (zcf ?g)
\<lbrakk>UP_cring ?R; ?c \<in> carrier ?R; ?x \<in> carrier ?R\<rbrakk> \<Longrightarrow> UP_cring.to_fun ?R (monom (UP ?R) ?c ?n) ?x = ?c \<otimes>\<^bsub>?R\<^esub> ?x [^]\<^bsub>?R\<^esub> ?n
UP_cring R
?p \<in> carrier P \<Longrightarrow> zcf ?p = to_fun ?p \<zero>
\<lbrakk>?f \<in> carrier P; ?x \<in> carrier R\<rbrakk> \<Longrightarrow> to_fun ?f ?x \<in> carrier R
?a \<in> carrier R \<Longrightarrow> monom P ?a ?n \<in> carrier P

goal (1 subgoal):
 1. zcf (Cring_Poly.compose R (monom P a (Suc n)) p) = a \<otimes> zcf p [^] Suc n
[PROOF STEP]
by fastforce


[STATEMENT]
lemma bounded_linear_scaleR_left: "bounded_linear (\<lambda>r. scaleR r x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>r. r *\<^sub>R x)
[PROOF STEP]
using bounded_bilinear_scaleR
[PROOF STATE]
proof (prove)
using this:
bounded_bilinear (*\<^sub>R)

goal (1 subgoal):
 1. bounded_linear (\<lambda>r. r *\<^sub>R x)
[PROOF STEP]
by (rule bounded_bilinear.bounded_linear_left)


[STATEMENT]
lemma open_prod_intro:
  assumes "\<And>x. x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S"
  shows "open S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> ?x \<in> A \<times> B \<and> A \<times> B \<subseteq> S

goal (1 subgoal):
 1. open S
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> ?x \<in> A \<times> B \<and> A \<times> B \<subseteq> S

goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S
[PROOF STEP]
by fast


[STATEMENT]
lemma stream_pred_coinduct[case_names stream_pred, coinduct pred: pred_stream]:
    assumes "R w"
    assumes "\<And> a w. R (a ## w) \<Longrightarrow> P a \<and> R w"
    shows "pred_stream P w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pred_stream P w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
R w
R (?a ## ?w) \<Longrightarrow> P ?a \<and> R ?w

goal (1 subgoal):
 1. pred_stream P w
[PROOF STEP]
unfolding stream.pred_rel eq_onp_def
[PROOF STATE]
proof (prove)
using this:
R w
R (?a ## ?w) \<Longrightarrow> P ?a \<and> R ?w

goal (1 subgoal):
 1. stream_all2 (\<lambda>x y. P x \<and> x = y) w w
[PROOF STEP]
by (coinduction arbitrary: w) (auto)


[STATEMENT]
lemma mod_diff_right_eq: "
  (a::nat) \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
assume a_as:"a \<le> b"
[PROOF STATE]
proof (state)
this:
a \<le> b

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "(b - a) mod m = (b - a + a div m * m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a) mod m = (b - a + a div m * m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b - a + a div m * m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b - a + a div m * m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b + a div m * m - a) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a + a div m * m) mod m = (b + a div m * m - a) mod m
[PROOF STEP]
using a_as
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. (b - a + a div m * m) mod m = (b + a div m * m - a) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b - a + a div m * m) mod m = (b + a div m * m - a) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a + a div m * m) mod m = (b + a div m * m - a) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b + a div m * m - (a div m * m + a mod m)) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + a div m * m - a) mod m = (b + a div m * m - (a div m * m + a mod m)) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b + a div m * m - a) mod m = (b + a div m * m - (a div m * m + a mod m)) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b + a div m * m - a) mod m = (b + a div m * m - (a div m * m + a mod m)) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b + a div m * m - a div m * m - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + a div m * m - (a div m * m + a mod m)) mod m = (b + a div m * m - a div m * m - a mod m) mod m
[PROOF STEP]
by (simp only: diff_diff_left[symmetric])
[PROOF STATE]
proof (state)
this:
(b + a div m * m - (a div m * m + a mod m)) mod m = (b + a div m * m - a div m * m - a mod m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b + a div m * m - (a div m * m + a mod m)) mod m = (b + a div m * m - a div m * m - a mod m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + a div m * m - a div m * m - a mod m) mod m = (b - a mod m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b + a div m * m - a div m * m - a mod m) mod m = (b - a mod m) mod m

goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(b - a) mod m = (b - a mod m) mod m

goal (1 subgoal):
 1. (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b - a mod m) mod m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutations_of_set_aux_list_refine:
  assumes "distinct xs"
  shows   "set (permutations_of_set_aux_list acc xs) = permutations_of_set_aux acc (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (permutations_of_set_aux_list acc xs) = permutations_of_set_aux acc (set xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. set (permutations_of_set_aux_list acc xs) = permutations_of_set_aux acc (set xs)
[PROOF STEP]
by (induction acc xs rule: permutations_of_set_aux_list.induct)
     (subst permutations_of_set_aux_list.simps,
      subst permutations_of_set_aux.simps,
      simp_all add: set_list_bind)


[STATEMENT]
lemma starfun_ln_ge_zero [simp]: "\<And>x. 1 \<le> x \<Longrightarrow> 0 \<le> ( *f* real_ln) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 1 \<le> x \<Longrightarrow> 0 \<le> (*f* real_ln) x
[PROOF STEP]
by transfer (rule ln_ge_zero)


[STATEMENT]
lemma pseudo_rationalizable_on_path_independent_on:
  assumes "pseudo_rationalizable_on A Rs f"
  shows "path_independent_on A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_independent_on A f
[PROOF STEP]
proof %invisible (rule path_independent_onI2)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f_range_on A f
 2. Chernoff_on A f
 3. consistency_on A f
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pseudo_rationalizable_on A Rs f
[PROOF STEP]
show "f_range_on A f"
[PROOF STATE]
proof (prove)
using this:
pseudo_rationalizable_on A Rs f

goal (1 subgoal):
 1. f_range_on A f
[PROOF STEP]
unfolding f_range_on_def pseudo_rationalizable_on_def2
[PROOF STATE]
proof (prove)
using this:
(\<forall>r\<in>Rs. Linear_order r) \<and> (\<forall>B\<subseteq>A. f B = (\<Union>r\<in>Rs. set_option (MaxR.MaxR_opt r B)))

goal (1 subgoal):
 1. \<forall>B\<subseteq>A. f B \<subseteq> B
[PROOF STEP]
using MaxR.range_Some[unfolded MaxR_def]
[PROOF STATE]
proof (prove)
using this:
(\<forall>r\<in>Rs. Linear_order r) \<and> (\<forall>B\<subseteq>A. f B = (\<Union>r\<in>Rs. set_option (MaxR.MaxR_opt r B)))
Linear_order ?r \<Longrightarrow> MaxR.MaxR_opt ?r ?A = Some ?a \<longrightarrow> ?a \<in> ?A \<inter> Field ?r

goal (1 subgoal):
 1. \<forall>B\<subseteq>A. f B \<subseteq> B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f_range_on A f

goal (2 subgoals):
 1. Chernoff_on A f
 2. consistency_on A f
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pseudo_rationalizable_on A Rs f
[PROOF STEP]
show "Chernoff_on A f"
[PROOF STATE]
proof (prove)
using this:
pseudo_rationalizable_on A Rs f

goal (1 subgoal):
 1. Chernoff_on A f
[PROOF STEP]
unfolding pseudo_rationalizable_on_def2
[PROOF STATE]
proof (prove)
using this:
(\<forall>r\<in>Rs. Linear_order r) \<and> (\<forall>B\<subseteq>A. f B = (\<Union>r\<in>Rs. set_option (MaxR.MaxR_opt r B)))

goal (1 subgoal):
 1. Chernoff_on A f
[PROOF STEP]
by - (rule Chernoff_onI; clarsimp; metis MaxR.intro MaxR.subset empty_subsetI insert_subset option.simps(15))
[PROOF STATE]
proof (state)
this:
Chernoff_on A f

goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pseudo_rationalizable_on A Rs f
[PROOF STEP]
show "consistency_on A f"
[PROOF STATE]
proof (prove)
using this:
pseudo_rationalizable_on A Rs f

goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
unfolding pseudo_rationalizable_on_def2
[PROOF STATE]
proof (prove)
using this:
(\<forall>r\<in>Rs. Linear_order r) \<and> (\<forall>B\<subseteq>A. f B = (\<Union>r\<in>Rs. set_option (MaxR.MaxR_opt r B)))

goal (1 subgoal):
 1. consistency_on A f
[PROOF STEP]
by - (rule consistency_onI; simp; metis (no_types, lifting) MaxR.intro MaxR.subset SUP_cong SUP_le_iff)
[PROOF STATE]
proof (state)
this:
consistency_on A f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma true_not_false [simp]: "true \<noteq> false" "false \<noteq> true"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> true = false &&& \<not> false = true
[PROOF STEP]
by (pred_auto)+


[STATEMENT]
lemma measurable_compose_inv:
  assumes inj: "\<And>j. j \<in> J \<Longrightarrow> f' (f j) = j"
  shows "(\<lambda>m. compose (f ` J) m f') \<in> measurable (PiM J (\<lambda>_. M)) (PiM (f ` J) (\<lambda>_. M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. compose (f ` J) m f') \<in> Pi\<^sub>M J (\<lambda>_. M) \<rightarrow>\<^sub>M Pi\<^sub>M (f ` J) (\<lambda>_. M)
[PROOF STEP]
unfolding compose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. \<lambda>x\<in>f ` J. m (f' x)) \<in> Pi\<^sub>M J (\<lambda>_. M) \<rightarrow>\<^sub>M Pi\<^sub>M (f ` J) (\<lambda>_. M)
[PROOF STEP]
by (rule measurable_restrict) (auto simp: inj)


[STATEMENT]
lemma fds_deriv_const [simp]: "fds_deriv (fds_const c) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_deriv (fds_const c) = 0
[PROOF STEP]
by (rule fds_eqI) (simp add: fds_nth_deriv fds_nth_const)


[STATEMENT]
lemma (in Ring) whole_ideal:"ideal R (carrier R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal R (carrier R)
[PROOF STEP]
apply (rule ideal_condition1)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. carrier R \<subseteq> carrier R
 2. carrier R \<noteq> {}
 3. \<forall>x\<in>carrier R. \<forall>y\<in>carrier R. x \<plusminus> y \<in> carrier R
 4. \<forall>r\<in>carrier R. \<forall>x\<in>carrier R. r \<cdot>\<^sub>r x \<in> carrier R
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. carrier R \<noteq> {}
 2. \<forall>x\<in>carrier R. \<forall>y\<in>carrier R. x \<plusminus> y \<in> carrier R
 3. \<forall>r\<in>carrier R. \<forall>x\<in>carrier R. r \<cdot>\<^sub>r x \<in> carrier R
[PROOF STEP]
apply (cut_tac ring_zero, blast)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x\<in>carrier R. \<forall>y\<in>carrier R. x \<plusminus> y \<in> carrier R
 2. \<forall>r\<in>carrier R. \<forall>x\<in>carrier R. r \<cdot>\<^sub>r x \<in> carrier R
[PROOF STEP]
apply (cut_tac ring_is_ag,
        simp add:aGroup.ag_pOp_closed,
        simp add:ring_tOp_closed)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Ln_inverse_if:
  assumes "z \<noteq> 0"
    shows "Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then -(Ln z) + \<i> * 2 * complex_of_real pi else -(Ln z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
proof (cases "z \<in> \<real>\<^sub>\<le>\<^sub>0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
 2. z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (2 subgoals):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
 2. z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<notin> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
by (simp add: Ln_inverse)
[PROOF STATE]
proof (state)
this:
Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z \<in> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have z: "Im z = 0" "Re z < 0" "- z \<notin> \<real>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
using this:
z \<in> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. Im z = 0 &&& Re z < 0 &&& - z \<notin> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
using assms complex_eq_iff complex_nonpos_Reals_iff
[PROOF STATE]
proof (prove)
using this:
z \<in> \<real>\<^sub>\<le>\<^sub>0
z \<noteq> 0
(?x = ?y) = (Re ?x = Re ?y \<and> Im ?x = Im ?y)
(?z \<in> \<real>\<^sub>\<le>\<^sub>0) = (Re ?z \<le> 0 \<and> Im ?z = 0)

goal (1 subgoal):
 1. Im z = 0 &&& Re z < 0 &&& - z \<notin> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im z = 0
Re z < 0
- z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
have "Ln(inverse z) = Ln(- (inverse (-z)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (inverse z) = Ln (- inverse (- z))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Ln (inverse z) = Ln (- inverse (- z))

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln (inverse z) = Ln (- inverse (- z))

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
have "\<dots> = Ln (inverse (-z)) + \<i> * complex_of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (- inverse (- z)) = Ln (inverse (- z)) + \<i> * complex_of_real pi
[PROOF STEP]
using assms z
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
Im z = 0
Re z < 0
- z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. Ln (- inverse (- z)) = Ln (inverse (- z)) + \<i> * complex_of_real pi
[PROOF STEP]
by (simp add: Ln_minus divide_less_0_iff)
[PROOF STATE]
proof (state)
this:
Ln (- inverse (- z)) = Ln (inverse (- z)) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln (- inverse (- z)) = Ln (inverse (- z)) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
have "\<dots> = - Ln (- z) + \<i> * complex_of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (inverse (- z)) + \<i> * complex_of_real pi = - Ln (- z) + \<i> * complex_of_real pi
[PROOF STEP]
using z Ln_inverse
[PROOF STATE]
proof (prove)
using this:
Im z = 0
Re z < 0
- z \<notin> \<real>\<^sub>\<le>\<^sub>0
?z \<notin> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse ?z) = - Ln ?z

goal (1 subgoal):
 1. Ln (inverse (- z)) + \<i> * complex_of_real pi = - Ln (- z) + \<i> * complex_of_real pi
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
Ln (inverse (- z)) + \<i> * complex_of_real pi = - Ln (- z) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln (inverse (- z)) + \<i> * complex_of_real pi = - Ln (- z) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
have "\<dots> = - (Ln z) + \<i> * 2 * complex_of_real pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - Ln (- z) + \<i> * complex_of_real pi = - Ln z + \<i> * 2 * complex_of_real pi
[PROOF STEP]
using Ln_minus assms z
[PROOF STATE]
proof (prove)
using this:
?z \<noteq> 0 \<Longrightarrow> Ln (- ?z) = (if Im ?z \<le> 0 \<and> \<not> (Re ?z < 0 \<and> Im ?z = 0) then Ln ?z + \<i> * complex_of_real pi else Ln ?z - \<i> * complex_of_real pi)
z \<noteq> 0
Im z = 0
Re z < 0
- z \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. - Ln (- z) + \<i> * complex_of_real pi = - Ln z + \<i> * 2 * complex_of_real pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- Ln (- z) + \<i> * complex_of_real pi = - Ln z + \<i> * 2 * complex_of_real pi

goal (1 subgoal):
 1. z \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Ln (inverse z) = - Ln z + \<i> * 2 * complex_of_real pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ln (inverse z) = - Ln z + \<i> * 2 * complex_of_real pi

goal (1 subgoal):
 1. Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)
[PROOF STEP]
by (simp add: True)
[PROOF STATE]
proof (state)
this:
Ln (inverse z) = (if z \<in> \<real>\<^sub>\<le>\<^sub>0 then - Ln z + \<i> * 2 * complex_of_real pi else - Ln z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_set_rel_transfer: "\<lbrakk>(s,s')\<in>\<langle>R\<rangle>set_rel; single_valued R; finite s\<rbrakk> \<Longrightarrow> finite s'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(s, s') \<in> \<langle>R\<rangle>set_rel; single_valued R; finite s\<rbrakk> \<Longrightarrow> finite s'
[PROOF STEP]
unfolding set_rel_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(s, s') \<in> {(A, B). A \<subseteq> R\<inverse> `` B \<and> B \<subseteq> R `` A}; single_valued R; finite s\<rbrakk> \<Longrightarrow> finite s'
[PROOF STEP]
by (blast intro: finite_subset[OF _ finite_Image_sv])


[STATEMENT]
lemma init_segment_antisym: "\<lbrakk>init_segment S T; init_segment T S\<rbrakk> \<Longrightarrow> S=T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>init_segment S T; init_segment T S\<rbrakk> \<Longrightarrow> S = T
[PROOF STEP]
by (auto simp: init_segment_def)


[STATEMENT]
lemma unwinding_in_Ints: "(z - Ln(exp z)) / (of_real(2*pi) * \<i>) \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>) \<in> \<int>
[PROOF STEP]
using Arg_exp_diff_2pi [of z]
[PROOF STATE]
proof (prove)
using this:
\<exists>k. Im z - real_of_int k * (2 * pi) = Arg (exp z)

goal (1 subgoal):
 1. (z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>) \<in> \<int>
[PROOF STEP]
by (force simp: Ints_def image_def field_simps Arg_def intro!: complex_eqI)


[STATEMENT]
lemma ring_hom_trans: \<^marker>\<open>contributor \<open>Paulo Em?lio de Vilhena\<close>\<close>
  "\<lbrakk> f \<in> ring_hom R S; g \<in> ring_hom S T \<rbrakk> \<Longrightarrow> g \<circ> f \<in> ring_hom R T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> ring_hom R S; g \<in> ring_hom S T\<rbrakk> \<Longrightarrow> g \<circ> f \<in> ring_hom R T
[PROOF STEP]
by (rule ring_hom_memI) (auto simp add: ring_hom_closed ring_hom_mult ring_hom_add ring_hom_one)


[STATEMENT]
lemma twice_field_differentiable_at_add [intro]:
  assumes "f twice_field_differentiable_at x"
      and "g twice_field_differentiable_at x"
    shows "(\<lambda>x. f x + g x) twice_field_differentiable_at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
obtain S S'
   where Df_on_S:  "f field_differentiable_on S" and x_int_S: "x \<in> interior S"
     and Dg_on_S': "g field_differentiable_on S'" and x_int_S': " x \<in> interior S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S S'. \<lbrakk>f field_differentiable_on S; x \<in> interior S; g field_differentiable_on S'; x \<in> interior S'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms twice_field_differentiable_at_def
[PROOF STATE]
proof (prove)
using this:
f twice_field_differentiable_at x
g twice_field_differentiable_at x
?f twice_field_differentiable_at ?x \<equiv> \<exists>S. ?f field_differentiable_on S \<and> ?x \<in> interior S \<and> deriv ?f field_differentiable at ?x

goal (1 subgoal):
 1. (\<And>S S'. \<lbrakk>f field_differentiable_on S; x \<in> interior S; g field_differentiable_on S'; x \<in> interior S'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f field_differentiable_on S
x \<in> interior S
g field_differentiable_on S'
x \<in> interior S'

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
let ?T = "interior (S \<inter> S')"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
have x_int_T: "x \<in> interior ?T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> interior (interior (S \<inter> S'))
[PROOF STEP]
by (simp add: x_int_S x_int_S')
[PROOF STATE]
proof (state)
this:
x \<in> interior (interior (S \<inter> S'))

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
have Df_on_T: "f field_differentiable_on ?T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f field_differentiable_on interior (S \<inter> S')
[PROOF STEP]
by (meson Df_on_S field_differentiable_on_subset inf_sup_ord(1) interior_subset)
[PROOF STATE]
proof (state)
this:
f field_differentiable_on interior (S \<inter> S')

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
have  Dg_on_fT: "g field_differentiable_on ?T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g field_differentiable_on interior (S \<inter> S')
[PROOF STEP]
by (meson Dg_on_S' field_differentiable_on_subset interior_subset le_infE)
[PROOF STATE]
proof (state)
this:
g field_differentiable_on interior (S \<inter> S')

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
have "(\<lambda>x. f x + g x) field_differentiable_on ?T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) field_differentiable_on interior (S \<inter> S')
[PROOF STEP]
unfolding field_differentiable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>interior (S \<inter> S'). (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> interior (S \<inter> S') \<Longrightarrow> (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> interior (S \<inter> S') \<Longrightarrow> (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
assume x_in_T: "x \<in> ?T"
[PROOF STATE]
proof (state)
this:
x \<in> interior (S \<inter> S')

goal (1 subgoal):
 1. \<And>x. x \<in> interior (S \<inter> S') \<Longrightarrow> (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
have "f field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f field_differentiable at x
[PROOF STEP]
by (metis x_in_T Df_on_T at_within_open field_differentiable_on_def open_interior)
[PROOF STATE]
proof (state)
this:
f field_differentiable at x

goal (1 subgoal):
 1. \<And>x. x \<in> interior (S \<inter> S') \<Longrightarrow> (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f field_differentiable at x

goal (1 subgoal):
 1. \<And>x. x \<in> interior (S \<inter> S') \<Longrightarrow> (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
have "g field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g field_differentiable at x
[PROOF STEP]
by (metis x_in_T Dg_on_fT at_within_open field_differentiable_on_def open_interior)
[PROOF STATE]
proof (state)
this:
g field_differentiable at x

goal (1 subgoal):
 1. \<And>x. x \<in> interior (S \<inter> S') \<Longrightarrow> (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f field_differentiable at x
g field_differentiable at x
[PROOF STEP]
have "(\<lambda>x. f x + g x) field_differentiable at x"
[PROOF STATE]
proof (prove)
using this:
f field_differentiable at x
g field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
by (simp add: field_differentiable_add)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) field_differentiable at x

goal (1 subgoal):
 1. \<And>x. x \<in> interior (S \<inter> S') \<Longrightarrow> (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
show "(\<lambda>x. f x + g x) field_differentiable at x within ?T"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f x + g x) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
using field_differentiable_at_within
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f x + g x) field_differentiable at x
?f field_differentiable at ?x \<Longrightarrow> ?f field_differentiable at ?x within ?S

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) field_differentiable at x within interior (S \<inter> S')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) field_differentiable_on interior (S \<inter> S')

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) field_differentiable_on interior (S \<inter> S')

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
have "deriv (\<lambda>x. f x + g x) field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
have "deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
[PROOF STEP]
by (simp add: assms once_field_differentiable_at)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x

goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x

goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
have "(\<lambda>x. deriv f x + deriv g x) field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. deriv f x + deriv g x) field_differentiable at x
[PROOF STEP]
by (simp add: field_differentiable_add assms deriv_field_differentiable_at)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. deriv f x + deriv g x) field_differentiable at x

goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
(\<lambda>x. deriv f x + deriv g x) field_differentiable at x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
(\<lambda>x. deriv f x + deriv g x) field_differentiable at x

goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
using assms DERIV_deriv_iff_field_differentiable
            DERIV_cong_ev[of x x "deriv (\<lambda>x. f x + g x)" "\<lambda>x. deriv f x + deriv g x"]
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x
(\<lambda>x. deriv f x + deriv g x) field_differentiable at x
f twice_field_differentiable_at x
g twice_field_differentiable_at x
(?f has_field_derivative deriv ?f ?x) (at ?x) = (?f field_differentiable at ?x)
\<lbrakk>x = x; \<forall>\<^sub>F x in nhds x. deriv (\<lambda>x. f x + g x) x = deriv f x + deriv g x; ?u = ?v\<rbrakk> \<Longrightarrow> (deriv (\<lambda>x. f x + g x) has_field_derivative ?u) (at x) = ((\<lambda>x. deriv f x + deriv g x) has_field_derivative ?v) (at x)

goal (1 subgoal):
 1. deriv (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
by (simp add: eventually_deriv_add field_differentiable_def)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. f x + g x) field_differentiable at x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. f x + g x) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. f x + g x) field_differentiable_on interior (S \<inter> S')
deriv (\<lambda>x. f x + g x) field_differentiable at x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f x + g x) field_differentiable_on interior (S \<inter> S')
deriv (\<lambda>x. f x + g x) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
using twice_field_differentiable_at_def x_int_T
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f x + g x) field_differentiable_on interior (S \<inter> S')
deriv (\<lambda>x. f x + g x) field_differentiable at x
?f twice_field_differentiable_at ?x \<equiv> \<exists>S. ?f field_differentiable_on S \<and> ?x \<in> interior S \<and> deriv ?f field_differentiable at ?x
x \<in> interior (interior (S \<inter> S'))

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) twice_field_differentiable_at x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) twice_field_differentiable_at x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma valid_path_reversepath [simp]: "valid_path(reversepath g) \<longleftrightarrow> valid_path g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path (reversepath g) = valid_path g
[PROOF STEP]
using valid_path_imp_reverse
[PROOF STATE]
proof (prove)
using this:
valid_path ?g \<Longrightarrow> valid_path (reversepath ?g)

goal (1 subgoal):
 1. valid_path (reversepath g) = valid_path g
[PROOF STEP]
by force


[STATEMENT]
lemma sigma_sets_into_sp: "A \<subseteq> Pow sp \<Longrightarrow> x \<in> sigma_sets sp A \<Longrightarrow> x \<subseteq> sp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> Pow sp; x \<in> sigma_sets sp A\<rbrakk> \<Longrightarrow> x \<subseteq> sp
[PROOF STEP]
by (erule sigma_sets.induct, auto)


[STATEMENT]
lemma terms_cases: \<open>t \<in> terms S \<Longrightarrow> t = Fun 0 [] \<or> (\<exists>p \<in> S. t \<in> set (subtermFm p))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> terms S \<Longrightarrow> t = Fun 0 [] \<or> (\<exists>p\<in>S. t \<in> set (subtermFm p))
[PROOF STEP]
unfolding terms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> (if (\<Union>p\<in>S. set (subtermFm p)) = {} then {Fun 0 []} else \<Union>p\<in>S. set (subtermFm p)) \<Longrightarrow> t = Fun 0 [] \<or> (\<exists>p\<in>S. t \<in> set (subtermFm p))
[PROOF STEP]
by (simp split: if_splits)


[STATEMENT]
lemma open_prod_intro:
  assumes "\<And>x. x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S"
  shows "open S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> ?x \<in> A \<times> B \<and> A \<times> B \<subseteq> S

goal (1 subgoal):
 1. open S
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> ?x \<in> A \<times> B \<and> A \<times> B \<subseteq> S

goal (1 subgoal):
 1. \<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S
[PROOF STEP]
by fast


[STATEMENT]
lemma Suffixes_empty_iff [simp]: "Suffixes A = {} \<longleftrightarrow> A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suffixes A = {}) = (A = {})
[PROOF STEP]
by (auto simp: Suffixes_altdef)


[STATEMENT]
lemma extend_measure_cong:
  assumes "\<Omega> = \<Omega>'" "I = I'" "G = G'" "\<And>i. i \<in> I' \<Longrightarrow> \<mu> i = \<mu>' i"
  shows "extend_measure \<Omega> I G \<mu> = extend_measure \<Omega>' I' G' \<mu>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extend_measure \<Omega> I G \<mu> = extend_measure \<Omega>' I' G' \<mu>'
[PROOF STEP]
unfolding extend_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if (\<exists>\<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G ` I)) \<mu>') \<and> \<not> (\<forall>i\<in>I. \<mu> i = 0) then measure_of \<Omega> (G ` I) (SOME \<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G ` I)) \<mu>') else sigma \<Omega> (G ` I)) = (if (\<exists>\<mu>''. (\<forall>i\<in>I'. \<mu>'' (G' i) = \<mu>' i) \<and> measure_space \<Omega>' (sigma_sets \<Omega>' (G' ` I')) \<mu>'') \<and> \<not> (\<forall>i\<in>I'. \<mu>' i = 0) then measure_of \<Omega>' (G' ` I') (SOME \<mu>''. (\<forall>i\<in>I'. \<mu>'' (G' i) = \<mu>' i) \<and> measure_space \<Omega>' (sigma_sets \<Omega>' (G' ` I')) \<mu>'') else sigma \<Omega>' (G' ` I'))
[PROOF STEP]
by (auto simp add: assms)


[STATEMENT]
lemma xor_left_comm: "x \<oplus> (y \<oplus> z) = y \<oplus> (x \<oplus> z)" if "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<oplus> y \<oplus> z = y \<oplus> x \<oplus> z
[PROOF STEP]
using that xor_assoc xor_comm
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L
\<lbrakk>?x \<in> carrier L; ?y \<in> carrier L; ?z \<in> carrier L\<rbrakk> \<Longrightarrow> (?x \<oplus> ?y) \<oplus> ?z = ?x \<oplus> ?y \<oplus> ?z
\<lbrakk>?x \<in> carrier L; ?y \<in> carrier L\<rbrakk> \<Longrightarrow> ?x \<oplus> ?y = ?y \<oplus> ?x

goal (1 subgoal):
 1. x \<oplus> y \<oplus> z = y \<oplus> x \<oplus> z
[PROOF STEP]
by auto


[STATEMENT]
lemma Qp_pow_ConsI:
  assumes "t \<in> carrier Q\<^sub>p"
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>)"
  shows "t#x \<in> carrier (Q\<^sub>p\<^bsup>Suc m\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t # x \<in> carrier (Q\<^sub>p\<^bsup>Suc m\<^esup>)
[PROOF STEP]
using assms cartesian_power_cons[of x Q\<^sub>p m t] Suc_eq_plus1
[PROOF STATE]
proof (prove)
using this:
t \<in> carrier Q\<^sub>p
x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>)
\<lbrakk>x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>); t \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> t # x \<in> carrier (Q\<^sub>p\<^bsup>m + 1\<^esup>)
Suc ?n = ?n + 1

goal (1 subgoal):
 1. t # x \<in> carrier (Q\<^sub>p\<^bsup>Suc m\<^esup>)
[PROOF STEP]
by presburger


[STATEMENT]
lemma irreducible\<^sub>d_square_free:
  fixes p :: "'a :: {comm_semiring_1, semiring_no_zero_divisors} poly"
  shows "irreducible\<^sub>d p \<Longrightarrow> square_free p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible\<^sub>d p \<Longrightarrow> square_free p
[PROOF STEP]
by (metis degree_0 degree_mult_eq degree_mult_eq_0 irreducible\<^sub>dD(1) irreducible\<^sub>dD(2) irreducible\<^sub>d_dvd_smult irreducible\<^sub>d_smultI less_add_same_cancel2 not_gr_zero square_free_def)


[STATEMENT]
lemma integral_eq_nn_integral:
  assumes [measurable]: "f \<in> borel_measurable M"
  assumes nonneg: "AE x in M. 0 \<le> f x"
  shows "integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
 2. \<not> ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
assume *: "(\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) = \<infinity>"
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = \<infinity>

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
 2. \<not> ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = \<infinity>

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
 2. \<not> ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M
[PROOF STEP]
using nonneg
[PROOF STATE]
proof (prove)
using this:
AE x in M. 0 \<le> f x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M
[PROOF STEP]
by (intro nn_integral_cong_AE) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M = \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
 2. \<not> ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = \<infinity>
[PROOF STEP]
have "\<not> integrable M f"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = \<infinity>

goal (1 subgoal):
 1. \<not> integrable M f
[PROOF STEP]
by (auto simp: integrable_iff_bounded)
[PROOF STATE]
proof (state)
this:
\<not> integrable M f

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
 2. \<not> ?P \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> integrable M f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> integrable M f

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
by (simp add: * not_integrable_integral_eq)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity> \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity> \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
assume "(\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) \<noteq> \<infinity>"
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity> \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>
[PROOF STEP]
have "integrable M f"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity>

goal (1 subgoal):
 1. integrable M f
[PROOF STEP]
by (cases "\<integral>\<^sup>+ x. ennreal (f x) \<partial>M" rule: ennreal_cases)
       (auto intro!: integrableI_nn_integral_finite assms)
[PROOF STATE]
proof (state)
this:
integrable M f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>M \<noteq> \<infinity> \<Longrightarrow> integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
from nn_integral_eq_integral[OF this] nonneg
[PROOF STATE]
proof (chain)
picking this:
AE x in M. 0 \<le> f x \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal (integral\<^sup>L M f)
AE x in M. 0 \<le> f x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in M. 0 \<le> f x \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (f x) \<partial>M = ennreal (integral\<^sup>L M f)
AE x in M. 0 \<le> f x

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
by (simp add: integral_nonneg_AE)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subspace_Span_is_findim :
  "\<lbrakk> set vs \<subseteq> V; Subspace W; W \<subseteq> Span vs \<rbrakk> \<Longrightarrow> findim W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set vs \<subseteq> V; Subspace W; W \<subseteq> RSpan vs\<rbrakk> \<Longrightarrow> \<exists>ms. set ms \<subseteq> W \<and> RSpan ms = W
[PROOF STEP]
using finrank_Span subspace_finrank[of "Span vs" W] SubspaceD1[of W]
        VectorSpace.finrank_imp_findim
[PROOF STATE]
proof (prove)
using this:
set ?vs \<subseteq> V \<Longrightarrow> R_finrank (RSpan ?vs)
\<lbrakk>R_finrank (RSpan vs); W \<subseteq> RSpan vs\<rbrakk> \<Longrightarrow> R_finrank W
Subspace W \<Longrightarrow> VectorSpace (\<cdot>) W
\<lbrakk>VectorSpace ?smult ?V; R_scalar_mult.R_finrank UNIV ?smult ?V\<rbrakk> \<Longrightarrow> \<exists>ms. set ms \<subseteq> ?V \<and> R_scalar_mult.RSpan UNIV ?smult ms = ?V

goal (1 subgoal):
 1. \<lbrakk>set vs \<subseteq> V; Subspace W; W \<subseteq> RSpan vs\<rbrakk> \<Longrightarrow> \<exists>ms. set ms \<subseteq> W \<and> RSpan ms = W
[PROOF STEP]
by    auto


[STATEMENT]
theorem inv_backward: "A \<longleftrightarrow> B \<Longrightarrow> \<not>A \<Longrightarrow> \<not>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A = B; \<not> A\<rbrakk> \<Longrightarrow> \<not> B
[PROOF STEP]
by auto


[STATEMENT]
lemma lem: "m - Suc 0 < n ==> m < Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m - Suc 0 < n \<Longrightarrow> m < Suc n
[PROOF STEP]
by arith


[STATEMENT]
lemma divmod_one:
  "divmod (Num.One) (Num.One) = (Numeral1, 0)"
  "divmod (Num.One) (Num.Bit0 x) = (0, Numeral1)"
  "divmod (Num.One) (Num.Bit1 x) = (0, Numeral1)"
  "divmod x (Num.One) = (numeral x, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (divmod num.One num.One = (Numeral1, 0::'a) &&& divmod num.One (num.Bit0 x) = (0::'b, Numeral1)) &&& divmod num.One (num.Bit1 x) = (0::'c, Numeral1) &&& divmod x num.One = (numeral x, 0::'d)
[PROOF STEP]
unfolding divmod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((Numeral1 div Numeral1, Numeral1 mod Numeral1) = (Numeral1, 0::'a) &&& (Numeral1 div numeral (num.Bit0 x), Numeral1 mod numeral (num.Bit0 x)) = (0::'b, Numeral1)) &&& (Numeral1 div numeral (num.Bit1 x), Numeral1 mod numeral (num.Bit1 x)) = (0::'c, Numeral1) &&& (numeral x div Numeral1, numeral x mod Numeral1) = (numeral x, 0::'d)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma (in product_prob_space) emeasure_PiM_Collect_single:
  assumes X: "i \<in> I" "A \<in> sets (M i)"
  shows "emeasure (Pi\<^sub>M I M) {x\<in>space (Pi\<^sub>M I M). x i \<in> A} = emeasure (M i) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (Pi\<^sub>M I M) {x \<in> space (Pi\<^sub>M I M). x i \<in> A} = emeasure (M i) A
[PROOF STEP]
using emeasure_PiM_Collect[of "{i}" "\<lambda>i. A"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{i} \<subseteq> I; finite {i}; \<And>ia. ia \<in> {i} \<Longrightarrow> A \<in> M.events ia\<rbrakk> \<Longrightarrow> emeasure (Pi\<^sub>M I M) {x \<in> space (Pi\<^sub>M I M). \<forall>i\<in>{i}. x i \<in> A} = (\<Prod>i\<in>{i}. emeasure (M i) A)
i \<in> I
A \<in> M.events i

goal (1 subgoal):
 1. emeasure (Pi\<^sub>M I M) {x \<in> space (Pi\<^sub>M I M). x i \<in> A} = emeasure (M i) A
[PROOF STEP]
by simp


[STATEMENT]
lemma "(\<exists>x. P \<longrightarrow> Q x) \<and> (\<exists>x. Q x \<longrightarrow> P) \<longrightarrow> (\<exists>x. P=Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P \<longrightarrow> Q x) \<and> (\<exists>x. Q x \<longrightarrow> P) \<longrightarrow> (\<exists>x. P = Q x)
[PROOF STEP]
by blast


[STATEMENT]
lemma replicate_numeral: "replicate (numeral n) x = x # replicate (pred_numeral n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replicate (numeral n) x = x # replicate (pred_numeral n) x
[PROOF STEP]
by (simp add: numeral_eq_Suc)


[STATEMENT]
lemma combining_sys_satisfies_properties_R:
  fixes p:: "real poly"
  fixes qs1 :: "real poly list"
  fixes qs2 :: "real poly list"
  assumes nonzero: "p \<noteq> 0"
  assumes nontriv1: "length qs1 > 0"
  assumes nontriv2: "length qs2 > 0"
  assumes satisfies_properties_sys1: "satisfies_properties_R p qs1 (get_subsets_R (calculate_data_R p qs1)) (get_signs_R (calculate_data_R p qs1)) (get_matrix_R (calculate_data_R p qs1))"
  assumes satisfies_properties_sys2: "satisfies_properties_R p qs2 (get_subsets_R (calculate_data_R p qs2)) (get_signs_R (calculate_data_R p qs2)) (get_matrix_R (calculate_data_R p qs2))"
  shows  "satisfies_properties_R p (qs1@qs2) (get_subsets_R (snd ((combine_systems_R p (qs1,calculate_data_R p qs1) (qs2,calculate_data_R p qs2)))))
  (get_signs_R (snd ((combine_systems_R p (qs1,calculate_data_R p qs1) (qs2,calculate_data_R p qs2)))))
  (get_matrix_R (snd ((combine_systems_R p (qs1,calculate_data_R p qs1) (qs2,calculate_data_R p qs2)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfies_properties_R p (qs1 @ qs2) (get_subsets_R (snd (combine_systems_R p (qs1, calculate_data_R p qs1) (qs2, calculate_data_R p qs2)))) (get_signs_R (snd (combine_systems_R p (qs1, calculate_data_R p qs1) (qs2, calculate_data_R p qs2)))) (get_matrix_R (snd (combine_systems_R p (qs1, calculate_data_R p qs1) (qs2, calculate_data_R p qs2))))
[PROOF STEP]
using combining_sys_satisfies_properties_helper_R[of p qs1 qs2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p \<noteq> 0; 0 < length qs1; 0 < length qs2; satisfies_properties_R p qs1 ?subsets1.0 ?signs1.0 ?matrix1.0; satisfies_properties_R p qs2 ?subsets2.0 ?signs2.0 ?matrix2.0\<rbrakk> \<Longrightarrow> satisfies_properties_R p (qs1 @ qs2) (get_subsets_R (snd (combine_systems_R p (qs1, ?matrix1.0, ?subsets1.0, ?signs1.0) (qs2, ?matrix2.0, ?subsets2.0, ?signs2.0)))) (get_signs_R (snd (combine_systems_R p (qs1, ?matrix1.0, ?subsets1.0, ?signs1.0) (qs2, ?matrix2.0, ?subsets2.0, ?signs2.0)))) (get_matrix_R (snd (combine_systems_R p (qs1, ?matrix1.0, ?subsets1.0, ?signs1.0) (qs2, ?matrix2.0, ?subsets2.0, ?signs2.0))))

goal (1 subgoal):
 1. satisfies_properties_R p (qs1 @ qs2) (get_subsets_R (snd (combine_systems_R p (qs1, calculate_data_R p qs1) (qs2, calculate_data_R p qs2)))) (get_signs_R (snd (combine_systems_R p (qs1, calculate_data_R p qs1) (qs2, calculate_data_R p qs2)))) (get_matrix_R (snd (combine_systems_R p (qs1, calculate_data_R p qs1) (qs2, calculate_data_R p qs2))))
[PROOF STEP]
by (metis getter_functions_R nontriv1 nontriv2 nonzero satisfies_properties_sys1 satisfies_properties_sys2)


[STATEMENT]
lemma lemma_st_part_Ex: "x \<in> HFinite \<Longrightarrow> \<exists>t\<in>Reals. \<forall>r \<in> Reals. 0 < r \<longrightarrow> \<bar>x - t\<bar> < r"
  for x :: hypreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> HFinite \<Longrightarrow> \<exists>t\<in>\<real>. \<forall>r\<in>\<real>. 0 < r \<longrightarrow> \<bar>x - t\<bar> < r
[PROOF STEP]
by (meson isLubD1a lemma_st_part_lub lemma_st_part_major2)


[STATEMENT]
lemma Qp_function_tuple_comp_closed:
  assumes "f \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p"
  assumes "length fs = n"
  assumes "is_function_tuple Q\<^sub>p m fs"
  shows "function_tuple_comp Q\<^sub>p fs f \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<rightarrow> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. function_tuple_comp Q\<^sub>p fs f \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
using assms function_tuple_comp_closed
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p
length fs = n
is_function_tuple Q\<^sub>p m fs
\<lbrakk>?f \<in> carrier (?R\<^bsup>?n\<^esup>) \<rightarrow> carrier ?R; length ?fs = ?n; is_function_tuple ?R ?m ?fs\<rbrakk> \<Longrightarrow> function_tuple_comp ?R ?fs ?f \<in> carrier (?R\<^bsup>?m\<^esup>) \<rightarrow> carrier ?R

goal (1 subgoal):
 1. function_tuple_comp Q\<^sub>p fs f \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
by blast


[STATEMENT]
lemma is_poincare_line_x_axis [simp]:
  shows "is_poincare_line x_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_poincare_line x_axis
[PROOF STEP]
by (transfer, transfer) (auto simp add: hermitean_def mat_adj_def mat_cnj_def)


[STATEMENT]
lemma "~~((P --> Q) = (~P | Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (P \<longrightarrow> Q) \<noteq> (\<not> P \<or> Q)
[PROOF STEP]
by iprover


[STATEMENT]
lemma (in flowgraph) ntrp_mon_s:
  assumes A: "((s,c),e,(s',c'))\<in>ntrp fg"
  shows "mon_c fg (add_mset s' c') = mon_c fg (add_mset s c) \<union> fst (\<alpha>nl fg e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mon_c fg (add_mset s' c') = mon_c fg (add_mset s c) \<union> fst (\<alpha>nl fg e)
[PROOF STEP]
using ntr_mon_s[OF gtrp2gtr_s[OF A]]
[PROOF STATE]
proof (prove)
using this:
mon_c fg (add_mset s' c') = mon_c fg (add_mset s c) \<union> fst (\<alpha>n fg (le_rem_s e))

goal (1 subgoal):
 1. mon_c fg (add_mset s' c') = mon_c fg (add_mset s c) \<union> fst (\<alpha>nl fg e)
[PROOF STEP]
by (unfold \<alpha>nl_def)


[STATEMENT]
lemma celcius_to_kelvin: "T\<degree>C = (T *\<^sub>Q kelvin) + (273.15 *\<^sub>Q kelvin)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T\<degree>C = (T *\<^sub>Q kelvin) + ((27315::'a) / (10::'a)\<^sup>2 *\<^sub>Q kelvin)
[PROOF STEP]
by (si_simp)


[STATEMENT]
lemma pos2: "0 < (2::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 2
[PROOF STEP]
by simp


[STATEMENT]
lemma "let x = y in [x, x] = [y, y]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. let x = y in [x, x] = [y, y]
[PROOF STEP]
by normalization