[STATEMENT]
lemma echelon_foldl_condition3:
  fixes A::"'a::{bezout_domain}^'cols::{mod_type}^'rows::{mod_type}"
  assumes ib: "is_bezout_ext bezout"
  and Am0: "A $ m $ from_nat k \<noteq> 0"
  and all_zero: "\<forall>m. is_zero_row_upt_k m k A"
  and e: "echelon_form_upt_k A k"
  and k: "k < ncols A"
  shows "to_nat (GREATEST n. \<not> is_zero_row_upt_k n (Suc k)
  (bezout_iterate (interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0))
  (nrows A - (Suc 0)) 0 (from_nat k) bezout)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)) = 0
[PROOF STEP]
proof (unfold to_nat_eq_0, rule Greatest_equality)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> is_zero_row_upt_k (0::'rows) (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
 2. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
let ?interchange="(interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> is_zero_row_upt_k (0::'rows) (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
 2. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
let ?b="(bezout_iterate ?interchange (nrows A - (Suc 0)) 0 (from_nat k) bezout)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> is_zero_row_upt_k (0::'rows) (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
 2. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
have b0k: "?b $ 0 $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
proof (rule bezout_iterate_not_zero[OF _ _ _ ib])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 3. mod_type_class.to_nat (0::'rows) \<le> nrows A - Suc 0
[PROOF STEP]
show "interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0) $ 0 $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (mono_tags, lifting) LeastI Am0 interchange_rows_i)
[PROOF STATE]
proof (state)
this:
interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (2 subgoals):
 1. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 2. mod_type_class.to_nat (0::'rows) \<le> nrows A - Suc 0
[PROOF STEP]
show "nrows A - (Suc 0) < nrows (interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('rows) - Suc 0 < CARD('rows)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))

goal (1 subgoal):
 1. mod_type_class.to_nat (0::'rows) \<le> nrows A - Suc 0
[PROOF STEP]
show "to_nat 0 \<le> nrows A - (Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (0::'b) \<le> nrows A - Suc 0
[PROOF STEP]
unfolding to_nat_0 nrows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> CARD('rows) - Suc 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (0::?'b1) \<le> nrows A - Suc 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (2 subgoals):
 1. \<not> is_zero_row_upt_k (0::'rows) (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
 2. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
have least_eq: "(LEAST n. A $ n $ from_nat k \<noteq> 0)
    = (LEAST n. A $ n $ from_nat k \<noteq> 0 \<and> 0 \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> (0::'rows) \<le> n)
[PROOF STEP]
by (metis least_mod_type)
[PROOF STATE]
proof (state)
this:
(LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) = (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a) \<and> (0::'rows) \<le> n)

goal (2 subgoals):
 1. \<not> is_zero_row_upt_k (0::'rows) (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
 2. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
have all_zero_below: "\<forall>a>0. ?b $ a $ from_nat k = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a>0::'rows. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. (0::'rows) < a \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
fix a::'rows
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. (0::'rows) < a \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
assume a: "0 < a"
[PROOF STATE]
proof (state)
this:
(0::'rows) < a

goal (1 subgoal):
 1. \<And>a. (0::'rows) < a \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
show "bezout_iterate (interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0))
      (nrows A - Suc 0) 0 (from_nat k) bezout $ a $ from_nat k = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
proof (rule bezout_iterate_zero_column_k[OF _ ib _ _ a])
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. echelon_form_upt_k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) k
 2. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
 3. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 4. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 5. mod_type_class.to_nat a \<le> nrows A - Suc 0
 6. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "echelon_form_upt_k (interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0)) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. echelon_form_upt_k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) k
[PROOF STEP]
proof(unfold from_nat_0[symmetric] least_eq,
          rule echelon_form_upt_k_interchange[OF e _ Am0 _ k])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_zero_row_upt_k (mod_type_class.from_nat 0) k A
 2. mod_type_class.from_nat 0 \<le> m
[PROOF STEP]
show "is_zero_row_upt_k (from_nat 0) k A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k (mod_type_class.from_nat 0) k A
[PROOF STEP]
by (metis all_zero)
[PROOF STATE]
proof (state)
this:
is_zero_row_upt_k (mod_type_class.from_nat 0) k A

goal (1 subgoal):
 1. mod_type_class.from_nat 0 \<le> m
[PROOF STEP]
show "from_nat 0 \<le> m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat 0 \<le> m
[PROOF STEP]
unfolding from_nat_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'rows) \<le> m
[PROOF STEP]
by (metis least_mod_type)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat 0 \<le> m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
echelon_form_upt_k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) k

goal (5 subgoals):
 1. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 3. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 4. mod_type_class.to_nat a \<le> nrows A - Suc 0
 5. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0) $ 0 $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (mono_tags, lifting) Am0 LeastI interchange_rows_i)
[PROOF STATE]
proof (state)
this:
interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (4 subgoals):
 1. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 2. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 3. mod_type_class.to_nat a \<le> nrows A - Suc 0
 4. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "nrows A - Suc 0 < nrows (interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('rows) - Suc 0 < CARD('rows)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))

goal (3 subgoals):
 1. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 2. mod_type_class.to_nat a \<le> nrows A - Suc 0
 3. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "k < ncols (interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k < ncols A

goal (1 subgoal):
 1. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
k < CARD('cols)

goal (1 subgoal):
 1. k < CARD('cols)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))

goal (2 subgoals):
 1. mod_type_class.to_nat a \<le> nrows A - Suc 0
 2. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "to_nat a \<le> nrows A - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat a \<le> nrows A - Suc 0
[PROOF STEP]
by (metis (erased, opaque_lifting) One_nat_def Suc_leI Suc_le_D diff_Suc_eq_diff_pred
          not_le nrows_def to_nat_less_card zero_less_diff)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat a \<le> nrows A - Suc 0

goal (1 subgoal):
 1. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "is_zero_row_upt_k 0 k (interchange_rows A 0 (LEAST n. A $ n $ from_nat k \<noteq> 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
by (metis all_zero interchange_rows_i is_zero_row_upt_k_def)
[PROOF STATE]
proof (state)
this:
is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>a>0::'rows. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)

goal (2 subgoals):
 1. \<not> is_zero_row_upt_k (0::'rows) (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
 2. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
show "\<not> is_zero_row_upt_k 0 (Suc k) ?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_zero_row_upt_k (0::'rows) (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
by (metis b0k is_zero_row_upt_k_def k lessI ncols_def to_nat_from_nat_id)
[PROOF STATE]
proof (state)
this:
\<not> is_zero_row_upt_k (0::'rows) (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)

goal (1 subgoal):
 1. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
assume  y: "\<not> is_zero_row_upt_k y (Suc k) ?b"
[PROOF STATE]
proof (state)
this:
\<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)

goal (1 subgoal):
 1. \<And>y. \<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout) \<Longrightarrow> y \<le> (0::'rows)
[PROOF STEP]
show "y \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> (0::'rows)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> y \<le> (0::'rows) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> y \<le> 0"
[PROOF STATE]
proof (state)
this:
\<not> y \<le> (0::'rows)

goal (1 subgoal):
 1. \<not> y \<le> (0::'rows) \<Longrightarrow> False
[PROOF STEP]
hence y2: "y>0"
[PROOF STATE]
proof (prove)
using this:
\<not> y \<le> (0::'rows)

goal (1 subgoal):
 1. (0::'rows) < y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'rows) < y

goal (1 subgoal):
 1. \<not> y \<le> (0::'rows) \<Longrightarrow> False
[PROOF STEP]
have "is_zero_row_upt_k y (Suc k) ?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
proof (rule is_zero_row_upt_k_suc)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_zero_row_upt_k y k (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
 2. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
show "is_zero_row_upt_k y k ?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k y k (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
[PROOF STEP]
proof (unfold is_zero_row_upt_k_def, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. mod_type_class.to_nat j < k \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)
[PROOF STEP]
fix j::'cols
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. mod_type_class.to_nat j < k \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)
[PROOF STEP]
assume j: "to_nat j < k"
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat j < k

goal (1 subgoal):
 1. \<And>j. mod_type_class.to_nat j < k \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)
[PROOF STEP]
have "?b $ y $ j = ?interchange $ y $ j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ y $ j
[PROOF STEP]
proof (rule bezout_iterate_preserves[OF _ ib])
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. echelon_form_upt_k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) k
 2. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
 3. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 4. j < mod_type_class.from_nat k
 5. mod_type_class.to_nat (0::'rows) \<le> nrows A - Suc 0
 6. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 7. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "echelon_form_upt_k ?interchange k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. echelon_form_upt_k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) k
[PROOF STEP]
proof (unfold least_eq from_nat_0[symmetric],
              rule echelon_form_upt_k_interchange[OF e _ Am0 _ k])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_zero_row_upt_k (mod_type_class.from_nat 0) k A
 2. mod_type_class.from_nat 0 \<le> m
[PROOF STEP]
show "is_zero_row_upt_k (from_nat 0) k A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k (mod_type_class.from_nat 0) k A
[PROOF STEP]
by (metis all_zero)
[PROOF STATE]
proof (state)
this:
is_zero_row_upt_k (mod_type_class.from_nat 0) k A

goal (1 subgoal):
 1. mod_type_class.from_nat 0 \<le> m
[PROOF STEP]
show "from_nat 0 \<le> m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat 0 \<le> m
[PROOF STEP]
by (metis from_nat_0 least_mod_type)
[PROOF STATE]
proof (state)
this:
mod_type_class.from_nat 0 \<le> m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
echelon_form_upt_k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) k

goal (6 subgoals):
 1. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
 2. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 3. j < mod_type_class.from_nat k
 4. mod_type_class.to_nat (0::'rows) \<le> nrows A - Suc 0
 5. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 6. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "?interchange $ 0 $ from_nat k \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)
[PROOF STEP]
by (metis (mono_tags, lifting) Am0 LeastI interchange_rows_i)
[PROOF STATE]
proof (state)
this:
interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ (0::'rows) $ mod_type_class.from_nat k \<noteq> (0::'a)

goal (5 subgoals):
 1. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 2. j < mod_type_class.from_nat k
 3. mod_type_class.to_nat (0::'rows) \<le> nrows A - Suc 0
 4. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 5. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "nrows A - Suc 0 < nrows ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('rows) - Suc 0 < CARD('rows)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nrows A - Suc 0 < nrows (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))

goal (4 subgoals):
 1. j < mod_type_class.from_nat k
 2. mod_type_class.to_nat (0::'rows) \<le> nrows A - Suc 0
 3. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 4. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "j < from_nat k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < mod_type_class.from_nat k
[PROOF STEP]
by (metis (full_types) j from_nat_mono from_nat_to_nat_id k ncols_def)
[PROOF STATE]
proof (state)
this:
j < mod_type_class.from_nat k

goal (3 subgoals):
 1. mod_type_class.to_nat (0::'rows) \<le> nrows A - Suc 0
 2. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 3. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "to_nat 0 \<le> nrows A - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (0::'b) \<le> nrows A - Suc 0
[PROOF STEP]
by (metis le0 to_nat_0)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (0::?'b1) \<le> nrows A - Suc 0

goal (2 subgoals):
 1. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
 2. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "k < ncols ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k < ncols A

goal (1 subgoal):
 1. k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
k < CARD('cols)

goal (1 subgoal):
 1. k < CARD('cols)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k < ncols (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))

goal (1 subgoal):
 1. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
show "is_zero_row_upt_k 0 k ?interchange"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))
[PROOF STEP]
by (metis all_zero interchange_rows_i is_zero_row_upt_k_def)
[PROOF STATE]
proof (state)
this:
is_zero_row_upt_k (0::'rows) k (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ y $ j

goal (1 subgoal):
 1. \<And>j. mod_type_class.to_nat j < k \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ y $ j

goal (1 subgoal):
 1. \<And>j. mod_type_class.to_nat j < k \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ y $ j = (0::'a)
[PROOF STEP]
by (metis all_zero dual_order.strict_iff_order interchange_rows_j
            interchange_rows_preserves is_zero_row_upt_k_def j y2)
[PROOF STATE]
proof (state)
this:
interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a)) $ y $ j = (0::'a)

goal (1 subgoal):
 1. \<And>j. mod_type_class.to_nat j < k \<Longrightarrow> bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)
[PROOF STEP]
show "?b $ y $ j = 0"
[PROOF STATE]
proof (prove)
using this:
bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)

goal (1 subgoal):
 1. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ j = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_zero_row_upt_k y k (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)

goal (1 subgoal):
 1. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
show "?b $ y $ from_nat k = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
using all_zero_below
[PROOF STATE]
proof (prove)
using this:
\<forall>a>0::'rows. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)

goal (1 subgoal):
 1. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
using y2
[PROOF STATE]
proof (prove)
using this:
\<forall>a>0::'rows. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ a $ mod_type_class.from_nat k = (0::'a)
(0::'rows) < y

goal (1 subgoal):
 1. bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout $ y $ mod_type_class.from_nat k = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)

goal (1 subgoal):
 1. \<not> y \<le> (0::'rows) \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)

goal (1 subgoal):
 1. False
[PROOF STEP]
using y
[PROOF STATE]
proof (prove)
using this:
is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)
\<not> is_zero_row_upt_k y (Suc k) (bezout_iterate (interchange_rows A (0::'rows) (LEAST n. A $ n $ mod_type_class.from_nat k \<noteq> (0::'a))) (nrows A - Suc 0) (0::'rows) (mod_type_class.from_nat k) bezout)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<le> (0::'rows)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma n_add_lub: "n x \<sqsubseteq> n z \<and> n y \<sqsubseteq> n z \<longleftrightarrow> n x \<oplus> n y \<sqsubseteq> n z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n x \<sqsubseteq> n z \<and> n y \<sqsubseteq> n z) = (n x \<oplus> n y \<sqsubseteq> n z)
[PROOF STEP]
by (metis n_add_lubI n_add_op_def n_add_ub1 n_add_ub2 ts_ord_trans)


[STATEMENT]
lemma (in group) get_exp_self:
  assumes "a \<in> carrier G"
  shows "get_exp a a mod ord a = (1::int) mod ord a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. get_exp a a mod int (ord a) = 1 mod int (ord a)
[PROOF STEP]
by (intro pow_eq_int_mod[OF assms], use get_exp_self_fulfills[OF assms] assms in auto)


[STATEMENT]
lemma rconjby_add: "rconjby (x+y) z = rconjby y (rconjby x z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rconjby (x + y) z = rconjby y (rconjby x z)
[PROOF STEP]
by (simp add: minus_add add.assoc[THEN sym])


[STATEMENT]
lemma rtrancl_while_finite_Some:
  assumes "finite ({(x, y). y \<in> set (f x)}\<^sup>* `` {x})" (is "finite ?Cl")
  shows "\<exists>y. rtrancl_while = Some y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. local.rtrancl_while = Some y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>y. local.rtrancl_while = Some y
[PROOF STEP]
let ?R = "(\<lambda>(_, Z). card (?Cl - Z)) <*mlex*> (\<lambda>(ws, _). length ws) <*mlex*> {}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>y. local.rtrancl_while = Some y
[PROOF STEP]
have "wf ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf ((\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {})
[PROOF STEP]
by (blast intro: wf_mlex)
[PROOF STATE]
proof (state)
this:
wf ((\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {})

goal (1 subgoal):
 1. \<exists>y. local.rtrancl_while = Some y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
wf ((\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
wf ((\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {})

goal (1 subgoal):
 1. \<exists>y. local.rtrancl_while = Some y
[PROOF STEP]
unfolding rtrancl_while_def
[PROOF STATE]
proof (prove)
using this:
wf ((\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {})

goal (1 subgoal):
 1. \<exists>y. while_option rtrancl_while_test rtrancl_while_step ([x], {x}) = Some y
[PROOF STEP]
proof (rule wf_rel_while_option_Some[of ?R rtrancl_while_invariant])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> (rtrancl_while_step s, s) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
 2. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> rtrancl_while_invariant (rtrancl_while_step s)
 3. rtrancl_while_invariant ([x], {x})
[PROOF STEP]
fix st
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> (rtrancl_while_step s, s) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
 2. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> rtrancl_while_invariant (rtrancl_while_step s)
 3. rtrancl_while_invariant ([x], {x})
[PROOF STEP]
assume *: "rtrancl_while_invariant st \<and> rtrancl_while_test st"
[PROOF STATE]
proof (state)
this:
rtrancl_while_invariant st \<and> rtrancl_while_test st

goal (3 subgoals):
 1. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> (rtrancl_while_step s, s) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
 2. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> rtrancl_while_invariant (rtrancl_while_step s)
 3. rtrancl_while_invariant ([x], {x})
[PROOF STEP]
hence I: "rtrancl_while_invariant (rtrancl_while_step st)"
[PROOF STATE]
proof (prove)
using this:
rtrancl_while_invariant st \<and> rtrancl_while_test st

goal (1 subgoal):
 1. rtrancl_while_invariant (rtrancl_while_step st)
[PROOF STEP]
by (blast intro: rtrancl_while_invariant)
[PROOF STATE]
proof (state)
this:
rtrancl_while_invariant (rtrancl_while_step st)

goal (3 subgoals):
 1. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> (rtrancl_while_step s, s) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
 2. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> rtrancl_while_invariant (rtrancl_while_step s)
 3. rtrancl_while_invariant ([x], {x})
[PROOF STEP]
show "(rtrancl_while_step st, st) \<in> ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
proof (cases st)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
fix ws Z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
let ?ws = "fst (rtrancl_while_step st)" and ?Z = "snd (rtrancl_while_step st)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
assume st: "st = (ws, Z)"
[PROOF STATE]
proof (state)
this:
st = (ws, Z)

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
rtrancl_while_invariant st \<and> rtrancl_while_test st
st = (ws, Z)
[PROOF STEP]
obtain h t where ws: "ws = h # t" "p h"
[PROOF STATE]
proof (prove)
using this:
rtrancl_while_invariant st \<and> rtrancl_while_test st
st = (ws, Z)

goal (1 subgoal):
 1. (\<And>h t. \<lbrakk>ws = h # t; p h\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases ws) auto
[PROOF STATE]
proof (state)
this:
ws = h # t
p h

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
ws = h # t
p h

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
assume "remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> []"
[PROOF STATE]
proof (state)
this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> []

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> []
[PROOF STEP]
obtain z where "z \<in> set (remdups (filter (\<lambda>y. y \<notin> Z) (f h)))"
[PROOF STATE]
proof (prove)
using this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> []

goal (1 subgoal):
 1. (\<And>z. z \<in> set (remdups (filter (\<lambda>y. y \<notin> Z) (f h))) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
z \<in> set (remdups (filter (\<lambda>y. y \<notin> Z) (f h)))

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
with st ws I
[PROOF STATE]
proof (chain)
picking this:
st = (ws, Z)
ws = h # t
p h
rtrancl_while_invariant (rtrancl_while_step st)
z \<in> set (remdups (filter (\<lambda>y. y \<notin> Z) (f h)))
[PROOF STEP]
have "Z \<subset> ?Z" "Z \<subseteq> ?Cl" "?Z \<subseteq> ?Cl"
[PROOF STATE]
proof (prove)
using this:
st = (ws, Z)
ws = h # t
p h
rtrancl_while_invariant (rtrancl_while_step st)
z \<in> set (remdups (filter (\<lambda>y. y \<notin> Z) (f h)))

goal (1 subgoal):
 1. Z \<subset> snd (rtrancl_while_step st) &&& Z \<subseteq> {(x, y). y \<in> set (f x)}\<^sup>* `` {x} &&& snd (rtrancl_while_step st) \<subseteq> {(x, y). y \<in> set (f x)}\<^sup>* `` {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Z \<subset> snd (rtrancl_while_step st)
Z \<subseteq> {(x, y). y \<in> set (f x)}\<^sup>* `` {x}
snd (rtrancl_while_step st) \<subseteq> {(x, y). y \<in> set (f x)}\<^sup>* `` {x}

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite ({(x, y). y \<in> set (f x)}\<^sup>* `` {x})
Z \<subset> snd (rtrancl_while_step st)
Z \<subseteq> {(x, y). y \<in> set (f x)}\<^sup>* `` {x}
snd (rtrancl_while_step st) \<subseteq> {(x, y). y \<in> set (f x)}\<^sup>* `` {x}
[PROOF STEP]
have "card (?Cl - ?Z) < card (?Cl - Z)"
[PROOF STATE]
proof (prove)
using this:
finite ({(x, y). y \<in> set (f x)}\<^sup>* `` {x})
Z \<subset> snd (rtrancl_while_step st)
Z \<subseteq> {(x, y). y \<in> set (f x)}\<^sup>* `` {x}
snd (rtrancl_while_step st) \<subseteq> {(x, y). y \<in> set (f x)}\<^sup>* `` {x}

goal (1 subgoal):
 1. card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - snd (rtrancl_while_step st)) < card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)
[PROOF STEP]
by (blast intro: psubset_card_mono)
[PROOF STATE]
proof (state)
this:
card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - snd (rtrancl_while_step st)) < card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
with st ws
[PROOF STATE]
proof (chain)
picking this:
st = (ws, Z)
ws = h # t
p h
card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - snd (rtrancl_while_step st)) < card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
using this:
st = (ws, Z)
ws = h # t
p h
card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - snd (rtrancl_while_step st)) < card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)

goal (1 subgoal):
 1. (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
unfolding mlex_prod_def
[PROOF STATE]
proof (prove)
using this:
st = (ws, Z)
ws = h # t
p h
card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - snd (rtrancl_while_step st)) < card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)

goal (1 subgoal):
 1. (rtrancl_while_step st, st) \<in> inv_image (less_than <*lex*> inv_image (less_than <*lex*> {}) (\<lambda>x. (case x of (ws, uu_) \<Rightarrow> length ws, x))) (\<lambda>xa. (case xa of (uu_, Z) \<Rightarrow> card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z), xa))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> [] \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> [] \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> [] \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
assume "remdups (filter (\<lambda>y. y \<notin> Z) (f h)) = []"
[PROOF STATE]
proof (state)
this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) = []

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
with st ws
[PROOF STATE]
proof (chain)
picking this:
st = (ws, Z)
ws = h # t
p h
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) = []
[PROOF STEP]
have "?Z = Z" "?ws = t"
[PROOF STATE]
proof (prove)
using this:
st = (ws, Z)
ws = h # t
p h
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) = []

goal (1 subgoal):
 1. snd (rtrancl_while_step st) = Z &&& fst (rtrancl_while_step st) = t
[PROOF STEP]
by (auto simp: filter_empty_conv)
[PROOF STATE]
proof (state)
this:
snd (rtrancl_while_step st) = Z
fst (rtrancl_while_step st) = t

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
with st ws
[PROOF STATE]
proof (chain)
picking this:
st = (ws, Z)
ws = h # t
p h
snd (rtrancl_while_step st) = Z
fst (rtrancl_while_step st) = t
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
using this:
st = (ws, Z)
ws = h # t
p h
snd (rtrancl_while_step st) = Z
fst (rtrancl_while_step st) = t

goal (1 subgoal):
 1. (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
unfolding mlex_prod_def
[PROOF STATE]
proof (prove)
using this:
st = (ws, Z)
ws = h # t
p h
snd (rtrancl_while_step st) = Z
fst (rtrancl_while_step st) = t

goal (1 subgoal):
 1. (rtrancl_while_step st, st) \<in> inv_image (less_than <*lex*> inv_image (less_than <*lex*> {}) (\<lambda>x. (case x of (ws, uu_) \<Rightarrow> length ws, x))) (\<lambda>xa. (case xa of (uu_, Z) \<Rightarrow> card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z), xa))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) = [] \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal (1 subgoal):
 1. \<And>a b. st = (a, b) \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> [] \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) = [] \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) \<noteq> [] \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
remdups (filter (\<lambda>y. y \<notin> Z) (f h)) = [] \<Longrightarrow> (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal (1 subgoal):
 1. (rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(rtrancl_while_step st, st) \<in> (\<lambda>(uu_, Z). card ({(x, y). y \<in> set (f x)}\<^sup>* `` {x} - Z)) <*mlex*> (\<lambda>(ws, uu_). length ws) <*mlex*> {}

goal (2 subgoals):
 1. \<And>s. rtrancl_while_invariant s \<and> rtrancl_while_test s \<Longrightarrow> rtrancl_while_invariant (rtrancl_while_step s)
 2. rtrancl_while_invariant ([x], {x})
[PROOF STEP]
qed (simp_all add: rtrancl_while_invariant)
[PROOF STATE]
proof (state)
this:
\<exists>y. local.rtrancl_while = Some y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_remove1_subset: "set(remove1 x xs) \<subseteq> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (remove1 x xs) \<subseteq> set xs
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma cnj_scaleR [simp]: "cnj (scaleR r x) = scaleR r (cnj x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Quaternions.cnj (r *\<^sub>R x) = r *\<^sub>R Quaternions.cnj x
[PROOF STEP]
by (simp add: quat_eq_iff)


[STATEMENT]
lemma VEnd_polymap : "VEnd (polymap p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VEnd (polymap p)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. VEnd (polymap p)
[PROOF STEP]
have "set (map endpow [0..<Suc (degree p)]) \<subseteq> {S. VEnd S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map endpow [0..<Suc (degree p)]) \<subseteq> VectorSpaceEndSet
[PROOF STEP]
using VEnd_endpow
[PROOF STATE]
proof (prove)
using this:
VEnd (endpow ?n)

goal (1 subgoal):
 1. set (map endpow [0..<Suc (degree p)]) \<subseteq> VectorSpaceEndSet
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (map endpow [0..<Suc (degree p)]) \<subseteq> VectorSpaceEndSet

goal (1 subgoal):
 1. VEnd (polymap p)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
set (map endpow [0..<Suc (degree p)]) \<subseteq> VectorSpaceEndSet

goal (1 subgoal):
 1. VEnd (polymap p)
[PROOF STEP]
using polymap_def VectorSpace_VectorSpaceEndSet VectorSpace.lincomb_closed
[PROOF STATE]
proof (prove)
using this:
set (map endpow [0..<Suc (degree p)]) \<subseteq> VectorSpaceEndSet
polymap ?p \<equiv> coeffs ?p \<bullet>\<cdot>\<cdot> map endpow [0..<Suc (degree ?p)]
VectorSpace (\<cdot>\<cdot>) VectorSpaceEndSet
\<lbrakk>VectorSpace ?smult ?V; set ?rs \<subseteq> UNIV; set ?ms \<subseteq> ?V\<rbrakk> \<Longrightarrow> scalar_mult.lincomb ?smult ?rs ?ms \<in> ?V

goal (1 subgoal):
 1. VEnd (polymap p)
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
VEnd (polymap p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NSLIMSEQ_imp_rabs: "f \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> (\<lambda>n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S \<bar>l\<bar>"
  for l :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow>\<^sub>N\<^sub>S l \<Longrightarrow> (\<lambda>n. \<bar>f n\<bar>) \<longlonglongrightarrow>\<^sub>N\<^sub>S \<bar>l\<bar>
[PROOF STEP]
by (simp add: NSLIMSEQ_def) (auto intro: approx_hrabs simp add: starfun_abs)


[STATEMENT]
lemma eval_list_disj : "eval (list_disj F) L = (\<exists>f\<in>set(F). eval f L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (list_disj F) L = (\<exists>f\<in>set F. eval f L)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval (list_disj F) L = (\<exists>f\<in>set F. eval f L)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval (list_disj F) L = (\<exists>f\<in>set F. eval f L)
[PROOF STEP]
fix f F
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval (list_disj F) L = (\<exists>f\<in>set F. eval f L)
[PROOF STEP]
have h : "eval (foldr or F f) L = (eval f L \<or> (\<exists>f \<in> set F. eval f L))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (foldr PolyAtoms.or F f) L = (eval f L \<or> (\<exists>f\<in>set F. eval f L))
[PROOF STEP]
apply(induct F)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. eval (foldr PolyAtoms.or [] f) L = (eval f L \<or> (\<exists>f\<in>set []. eval f L))
 2. \<And>a F. eval (foldr PolyAtoms.or F f) L = (eval f L \<or> (\<exists>f\<in>set F. eval f L)) \<Longrightarrow> eval (foldr PolyAtoms.or (a # F) f) L = (eval f L \<or> (\<exists>f\<in>set (a # F). eval f L))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a F. eval (foldr PolyAtoms.or F f) L = (eval f L \<or> (\<exists>f\<in>set F. eval f L)) \<Longrightarrow> eval (foldr PolyAtoms.or (a # F) f) L = (eval f L \<or> (\<exists>f\<in>set (a # F). eval f L))
[PROOF STEP]
using eval_or
[PROOF STATE]
proof (prove)
using this:
eval (PolyAtoms.or ?a ?b) ?L = (eval ?a ?L \<or> eval ?b ?L)

goal (1 subgoal):
 1. \<And>a F. eval (foldr PolyAtoms.or F f) L = (eval f L \<or> (\<exists>f\<in>set F. eval f L)) \<Longrightarrow> eval (foldr PolyAtoms.or (a # F) f) L = (eval f L \<or> (\<exists>f\<in>set (a # F). eval f L))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eval (foldr PolyAtoms.or F f) L = (eval f L \<or> (\<exists>f\<in>set F. eval f L))

goal (1 subgoal):
 1. eval (list_disj F) L = (\<exists>f\<in>set F. eval f L)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
eval (foldr PolyAtoms.or ?Fa2 ?f2) L = (eval ?f2 L \<or> (\<exists>f\<in>set ?Fa2. eval f L))

goal (1 subgoal):
 1. eval (list_disj F) L = (\<exists>f\<in>set F. eval f L)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval (foldr PolyAtoms.or ?Fa2 ?f2) L = (eval ?f2 L \<or> (\<exists>f\<in>set ?Fa2. eval f L))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
eval (foldr PolyAtoms.or ?Fa2 ?f2) L = (eval ?f2 L \<or> (\<exists>f\<in>set ?Fa2. eval f L))

goal (1 subgoal):
 1. eval (list_disj F) L = (\<exists>f\<in>set F. eval f L)
[PROOF STEP]
by(simp add:list_disj_def)
[PROOF STATE]
proof (state)
this:
eval (list_disj F) L = (\<exists>f\<in>set F. eval f L)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vwalk_join_split:
  assumes "u \<in> set p"
  shows "\<exists>q r. p = q \<oplus> r
  \<and> last q = u \<and> hd r = u \<and> q \<noteq> [] \<and> r \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q r. p = q \<oplus> r \<and> last q = u \<and> hd r = u \<and> q \<noteq> [] \<and> r \<noteq> []
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>q r. p = q \<oplus> r \<and> last q = u \<and> hd r = u \<and> q \<noteq> [] \<and> r \<noteq> []
[PROOF STEP]
from \<open>u \<in> set p\<close>
[PROOF STATE]
proof (chain)
picking this:
u \<in> set p
[PROOF STEP]
obtain pre_p post_p where "p = pre_p @ u # post_p"
[PROOF STATE]
proof (prove)
using this:
u \<in> set p

goal (1 subgoal):
 1. (\<And>pre_p post_p. p = pre_p @ u # post_p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by atomize_elim (auto simp add: split_list)
[PROOF STATE]
proof (state)
this:
p = pre_p @ u # post_p

goal (1 subgoal):
 1. \<exists>q r. p = q \<oplus> r \<and> last q = u \<and> hd r = u \<and> q \<noteq> [] \<and> r \<noteq> []
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = pre_p @ u # post_p
[PROOF STEP]
have "p = (pre_p @ [u]) \<oplus> (u # post_p)"
[PROOF STATE]
proof (prove)
using this:
p = pre_p @ u # post_p

goal (1 subgoal):
 1. p = (pre_p @ [u]) \<oplus> u # post_p
[PROOF STEP]
unfolding vwalk_join_def
[PROOF STATE]
proof (prove)
using this:
p = pre_p @ u # post_p

goal (1 subgoal):
 1. p = (pre_p @ [u]) @ tl (u # post_p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p = (pre_p @ [u]) \<oplus> u # post_p

goal (1 subgoal):
 1. \<exists>q r. p = q \<oplus> r \<and> last q = u \<and> hd r = u \<and> q \<noteq> [] \<and> r \<noteq> []
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = (pre_p @ [u]) \<oplus> u # post_p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = (pre_p @ [u]) \<oplus> u # post_p

goal (1 subgoal):
 1. \<exists>q r. p = q \<oplus> r \<and> last q = u \<and> hd r = u \<and> q \<noteq> [] \<and> r \<noteq> []
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>q r. p = q \<oplus> r \<and> last q = u \<and> hd r = u \<and> q \<noteq> [] \<and> r \<noteq> []

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem usubst_game: "Uvariation \<nu> \<omega> U \<Longrightarrow> snd (usubstappp \<sigma> U \<alpha>) \<noteq> undefg \<Longrightarrow>
    (\<nu> \<in> game_sem I (the (snd (usubstappp \<sigma> U \<alpha>))) X) = (\<nu> \<in> game_sem (adjoint \<sigma> I \<omega>) \<alpha> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Uvariation \<nu> \<omega> U; snd (usubstappp \<sigma> U \<alpha>) \<noteq> undefg\<rbrakk> \<Longrightarrow> (\<nu> \<in> game_sem I (the (snd (usubstappp \<sigma> U \<alpha>))) X) = (\<nu> \<in> game_sem (USubst.adjoint \<sigma> I \<omega>) \<alpha> X)
[PROOF STEP]
using usubst_fml_game
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Uvariation ?\<nu> ?\<omega> ?U; usubstappf ?\<sigma> ?U ?\<phi> \<noteq> undeff\<rbrakk> \<Longrightarrow> (?\<nu> \<in> fml_sem ?I (the (usubstappf ?\<sigma> ?U ?\<phi>))) = (?\<nu> \<in> fml_sem (USubst.adjoint ?\<sigma> ?I ?\<omega>) ?\<phi>)
\<lbrakk>Uvariation ?\<nu> ?\<omega> ?U; snd (usubstappp ?\<sigma> ?U ?\<alpha>) \<noteq> undefg\<rbrakk> \<Longrightarrow> (?\<nu> \<in> game_sem ?I (the (snd (usubstappp ?\<sigma> ?U ?\<alpha>))) ?X) = (?\<nu> \<in> game_sem (USubst.adjoint ?\<sigma> ?I ?\<omega>) ?\<alpha> ?X)

goal (1 subgoal):
 1. \<lbrakk>Uvariation \<nu> \<omega> U; snd (usubstappp \<sigma> U \<alpha>) \<noteq> undefg\<rbrakk> \<Longrightarrow> (\<nu> \<in> game_sem I (the (snd (usubstappp \<sigma> U \<alpha>))) X) = (\<nu> \<in> game_sem (USubst.adjoint \<sigma> I \<omega>) \<alpha> X)
[PROOF STEP]
by simp


[STATEMENT]
lemma lhd_lSup_eq:
  assumes chain: "Complete_Partial_Order.chain (\<sqsubseteq>) Y"
  shows "\<lbrakk> xs \<in> Y; \<not> lnull xs \<rbrakk> \<Longrightarrow> lhd (lSup Y) = lhd xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<in> Y; \<not> lnull xs\<rbrakk> \<Longrightarrow> lhd (lSup Y) = lhd xs
[PROOF STEP]
by(subst lhd_lSup)(auto 4 3 dest: chainD[OF chain] lprefix_lhdD intro!: the_equality)


[STATEMENT]
lemma min_shortest_path: assumes "u \<in> V" "v \<in> V" "u \<noteq> v"
  shows "shortest_path u v > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < shortest_path u v
[PROOF STEP]
using shortest_path_lb assms vertices_connected
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<noteq> ?v; vert_connected ?u ?v\<rbrakk> \<Longrightarrow> 0 < shortest_path ?u ?v
u \<in> V
v \<in> V
u \<noteq> v
\<lbrakk>?u \<in> V; ?v \<in> V\<rbrakk> \<Longrightarrow> vert_connected ?u ?v

goal (1 subgoal):
 1. 0 < shortest_path u v
[PROOF STEP]
by auto


[STATEMENT]
lemma in_rel_Collect_case_prod_eq: "in_rel (Collect (case_prod X)) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_rel {(x, y). X x y} = X
[PROOF STEP]
unfolding fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x xa. in_rel {(x, y). X x y} x xa = X x xa
[PROOF STEP]
by auto


[STATEMENT]
lemma expands_to_root_0:
  assumes  "n > 0" "eventually (\<lambda>x. f x = 0) at_top"
           "basis_wf basis" "length basis = expansion_level TYPE('a :: multiseries)"
  shows   "((\<lambda>x. root n (f x)) expands_to (zero_expansion :: 'a)) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. root n (f x)) expands_to zero_expansion) basis
[PROOF STEP]
by (rule expands_to_cong[OF expands_to_zero]) (insert assms, auto elim: eventually_mono)


[STATEMENT]
lemma top_on_sup:
  "top_on_opt o1 X \<Longrightarrow> top_on_opt o2 X \<Longrightarrow> top_on_opt (o1 \<squnion> o2) X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>top_on\<^sub>o o1 X; top_on\<^sub>o o2 X\<rbrakk> \<Longrightarrow> top_on\<^sub>o (o1 \<squnion> o2) X
[PROOF STEP]
apply(induction o1 o2 rule: sup_option.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x y. \<lbrakk>top_on\<^sub>o (Some x) X; top_on\<^sub>o (Some y) X\<rbrakk> \<Longrightarrow> top_on\<^sub>o (Some x \<squnion> Some y) X
 2. \<And>y. \<lbrakk>top_on\<^sub>o None X; top_on\<^sub>o y X\<rbrakk> \<Longrightarrow> top_on\<^sub>o (None \<squnion> y) X
 3. \<And>v. \<lbrakk>top_on\<^sub>o (Some v) X; top_on\<^sub>o None X\<rbrakk> \<Longrightarrow> top_on\<^sub>o (Some v \<squnion> None) X
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sums_confine_minus:
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
  shows "confine f N sums a \<Longrightarrow> confine (uminus \<circ> f) N sums (-a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confine f N sums a \<Longrightarrow> confine (uminus \<circ> f) N sums - a
[PROOF STEP]
using sums_minus [of "confine f N" a]
[PROOF STATE]
proof (prove)
using this:
confine f N sums a \<Longrightarrow> (\<lambda>n. - confine f N n) sums - a

goal (1 subgoal):
 1. confine f N sums a \<Longrightarrow> confine (uminus \<circ> f) N sums - a
[PROOF STEP]
by (simp add: confine_def if_distrib [of uminus] cong: if_cong)


[STATEMENT]
lemma valid_Nil_iff: "valid [] t \<longleftrightarrow> t = Leaf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid [] t = (t = Leaf)
[PROOF STEP]
unfolding valid_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (well_shaped t \<and> well_valued [] t) = (t = Leaf)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. well_shaped t \<and> well_valued [] t \<Longrightarrow> t = Leaf
 2. t = Leaf \<Longrightarrow> well_shaped t \<and> well_valued [] t
[PROOF STEP]
assume "well_shaped t \<and> well_valued [] t"
[PROOF STATE]
proof (state)
this:
well_shaped t \<and> well_valued [] t

goal (2 subgoals):
 1. well_shaped t \<and> well_valued [] t \<Longrightarrow> t = Leaf
 2. t = Leaf \<Longrightarrow> well_shaped t \<and> well_valued [] t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
well_shaped t \<and> well_valued [] t
[PROOF STEP]
show "t = Leaf"
[PROOF STATE]
proof (prove)
using this:
well_shaped t \<and> well_valued [] t

goal (1 subgoal):
 1. t = Leaf
[PROOF STEP]
by (metis le_neq_implies_less list.size(3) not_less_zero tree.collapse well_shaped.simps(2) well_valued0.simps(2))
[PROOF STATE]
proof (state)
this:
t = Leaf

goal (1 subgoal):
 1. t = Leaf \<Longrightarrow> well_shaped t \<and> well_valued [] t
[PROOF STEP]
qed simp


[STATEMENT]
lemma angular_component_closed:
  assumes "a \<in> nonzero Q\<^sub>p"
  shows "angular_component a \<in> carrier Z\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angular_component a \<in> carrier Z\<^sub>p
[PROOF STEP]
using ac_fract assms Q\<^sub>p_def Qp.nonzero_closed Qp.nonzero_memE(2) Zp.Units_inv_closed Zp.m_closed
      Zp.nonzero_closed Zp.nonzero_memE(2) Z\<^sub>p_def ac_Zp_is_Unit angular_component_def local.numer_denom_facts(3)
      padic_fields.numer_denom_facts(1) padic_fields.numer_denom_facts(2) padic_fields_axioms padic_integers.ac_Zp_in_Zp padic_integers_def prime
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?c \<in> carrier Q\<^sub>p; ?a \<in> nonzero Z\<^sub>p; ?b \<in> nonzero Z\<^sub>p; ?c = fraction Z\<^sub>p ?a ?b\<rbrakk> \<Longrightarrow> angular_component ?c = ac_Zp ?a \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp ?b
a \<in> nonzero Q\<^sub>p
Q\<^sub>p \<equiv> Frac Z\<^sub>p
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> ?a \<in> carrier Q\<^sub>p
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> ?a \<noteq> \<zero>
?x \<in> Units Z\<^sub>p \<Longrightarrow> inv\<^bsub>Z\<^sub>p\<^esub> ?x \<in> carrier Z\<^sub>p
\<lbrakk>?x \<in> carrier Z\<^sub>p; ?y \<in> carrier Z\<^sub>p\<rbrakk> \<Longrightarrow> ?x \<otimes>\<^bsub>Z\<^sub>p\<^esub> ?y \<in> carrier Z\<^sub>p
?a \<in> nonzero Z\<^sub>p \<Longrightarrow> ?a \<in> carrier Z\<^sub>p
?a \<in> nonzero Z\<^sub>p \<Longrightarrow> ?a \<noteq> \<zero>\<^bsub>Z\<^sub>p\<^esub>
Z\<^sub>p \<equiv> padic_int p
\<lbrakk>?x \<in> carrier Z\<^sub>p; ?x \<noteq> \<zero>\<^bsub>Z\<^sub>p\<^esub>\<rbrakk> \<Longrightarrow> ac_Zp ?x \<in> Units Z\<^sub>p
angular_component ?a = ac_Zp (numerator Z\<^sub>p ?a) \<otimes>\<^bsub>Z\<^sub>p\<^esub> inv\<^bsub>Z\<^sub>p\<^esub> ac_Zp (denominator Z\<^sub>p ?a)
\<lbrakk>?a \<in> carrier Q\<^sub>p; ?a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> numerator Z\<^sub>p ?a \<noteq> \<zero>\<^bsub>Z\<^sub>p\<^esub>
\<lbrakk>padic_fields ?p; ?a \<in> carrier (Frac (padic_int ?p))\<rbrakk> \<Longrightarrow> numerator (padic_int ?p) ?a \<in> carrier (padic_int ?p)
\<lbrakk>padic_fields ?p; ?a \<in> carrier (Frac (padic_int ?p))\<rbrakk> \<Longrightarrow> denominator (padic_int ?p) ?a \<in> nonzero (padic_int ?p)
padic_fields p
\<lbrakk>padic_integers ?p; ?x \<in> carrier (padic_int ?p); ?x \<noteq> \<zero>\<^bsub>padic_int ?p\<^esub>\<rbrakk> \<Longrightarrow> padic_integers.ac_Zp ?p ?x \<in> carrier (padic_int ?p)
padic_integers ?p \<equiv> prime ?p
prime p

goal (1 subgoal):
 1. angular_component a \<in> carrier Z\<^sub>p
[PROOF STEP]
by auto


[STATEMENT]
lemma Maclaurin2:
  fixes n :: nat
    and h :: real
  assumes INIT1: "0 < h"
    and INIT2: "diff 0 = f"
    and DERIV: "\<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> h \<longrightarrow> DERIV (diff m) t :> diff (Suc m) t"
  shows "\<exists>t. 0 < t \<and> t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / (fact m) * h ^ m) + diff n t / fact n * h ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
with INIT1 INIT2
[PROOF STATE]
proof (chain)
picking this:
0 < h
diff 0 = f
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < h
diff 0 = f
n = 0

goal (1 subgoal):
 1. \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
n = Suc nat_

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = Suc nat_
[PROOF STEP]
have "n > 0"
[PROOF STATE]
proof (prove)
using this:
n = Suc nat_

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

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
from INIT1 this INIT2 DERIV
[PROOF STATE]
proof (chain)
picking this:
0 < h
0 < n
diff 0 = f
\<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> h \<longrightarrow> (diff m has_real_derivative diff (Suc m) t) (at t)
[PROOF STEP]
have "\<exists>t>0. t < h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n"
[PROOF STATE]
proof (prove)
using this:
0 < h
0 < n
diff 0 = f
\<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> h \<longrightarrow> (diff m has_real_derivative diff (Suc m) t) (at t)

goal (1 subgoal):
 1. \<exists>t>0. t < h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
by (rule Maclaurin)
[PROOF STATE]
proof (state)
this:
\<exists>t>0. t < h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>t>0. t < h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>t>0. t < h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n

goal (1 subgoal):
 1. \<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>t>0. t \<le> h \<and> f h = (\<Sum>m<n. diff m 0 / fact m * h ^ m) + diff n t / fact n * h ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma varset_act_diff_un_imp_varset_diff:
  fixes a vs vs' vs''
  assumes "(varset_action a (vs'' -  (vs' \<union> vs)))"
  shows "(varset_action a (vs'' - vs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. varset_action a (vs'' - vs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
varset_action a (vs'' - (vs' \<union> vs))

goal (1 subgoal):
 1. varset_action a (vs'' - vs)
[PROOF STEP]
unfolding varset_action_def
[PROOF STATE]
proof (prove)
using this:
fmdom' (snd a) \<subseteq> vs'' - (vs' \<union> vs)

goal (1 subgoal):
 1. fmdom' (snd a) \<subseteq> vs'' - vs
[PROOF STEP]
by blast


[STATEMENT]
lemma word_plus_mono_right2: "a \<le> a + b \<Longrightarrow> c \<le> b \<Longrightarrow> a \<le> a + c"
  for a b c :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> a + b; c \<le> b\<rbrakk> \<Longrightarrow> a \<le> a + c
[PROOF STEP]
by uint_arith


[STATEMENT]
lemma Vars_indep_foldr:
  assumes "x \<in> set Vars" "set xs \<subseteq> set Vars"
  shows "x \<bowtie>\<^sub>S \<Squnion>\<^sub>S (removeAll x xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bowtie>\<^sub>S \<Squnion>\<^sub>S (removeAll x xs)
[PROOF STEP]
proof (rule foldr_scene_indep)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pairwise (##\<^sub>S) (set (removeAll x xs))
 2. \<forall>b\<in>set (removeAll x xs). x \<bowtie>\<^sub>S b
[PROOF STEP]
show "pairwise (##\<^sub>S) (set (removeAll x xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (##\<^sub>S) (set (removeAll x xs))
[PROOF STEP]
by (simp, metis Diff_subset assms(2) pairwise_mono scene_space_compats)
[PROOF STATE]
proof (state)
this:
pairwise (##\<^sub>S) (set (removeAll x xs))

goal (1 subgoal):
 1. \<forall>b\<in>set (removeAll x xs). x \<bowtie>\<^sub>S b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> set Vars
set xs \<subseteq> set Vars
[PROOF STEP]
show "\<forall>b\<in>set (removeAll x xs). x \<bowtie>\<^sub>S b"
[PROOF STATE]
proof (prove)
using this:
x \<in> set Vars
set xs \<subseteq> set Vars

goal (1 subgoal):
 1. \<forall>b\<in>set (removeAll x xs). x \<bowtie>\<^sub>S b
[PROOF STEP]
by (simp)
       (metis DiffE insertI1 local.indep_Vars pairwiseD scene_indeps_def subset_iff)
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>set (removeAll x xs). x \<bowtie>\<^sub>S b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_order_without_reflexive:
  "linear_order x \<longleftrightarrow> antisymmetric x \<and> transitive x \<and> linear x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_orderable_1 x = (antisymmetric x \<and> transitive x \<and> linear x)
[PROOF STEP]
using linear_reflexive
[PROOF STATE]
proof (prove)
using this:
linear ?x \<Longrightarrow> reflexive ?x

goal (1 subgoal):
 1. linear_orderable_1 x = (antisymmetric x \<and> transitive x \<and> linear x)
[PROOF STEP]
by blast


[STATEMENT]
lemma shift_prefix_cases:
assumes "xl @- xs = yl @- ys"
shows "prefix xl yl \<or> prefix yl xl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix xl yl \<or> prefix yl xl
[PROOF STEP]
using shift_prefix[OF assms]
[PROOF STATE]
proof (prove)
using this:
length xl \<le> length yl \<Longrightarrow> prefix xl yl

goal (1 subgoal):
 1. prefix xl yl \<or> prefix yl xl
[PROOF STEP]
by (cases "length xl \<le> length yl") (metis, metis assms nat_le_linear shift_prefix)


[STATEMENT]
lemma mat_geI[intro]: assumes "A \<in> carrier_mat nr nc"
  "\<And> i j. i < nr \<Longrightarrow> j < nc \<Longrightarrow> A $$ (i,j) \<ge> B $$ (i,j)"
  shows "A \<ge>\<^sub>m B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<ge>\<^sub>m B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
\<lbrakk>?i < nr; ?j < nc\<rbrakk> \<Longrightarrow> B $$ (?i, ?j) \<le> A $$ (?i, ?j)

goal (1 subgoal):
 1. A \<ge>\<^sub>m B
[PROOF STEP]
unfolding mat_ge_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
\<lbrakk>?i < nr; ?j < nc\<rbrakk> \<Longrightarrow> B $$ (?i, ?j) \<le> A $$ (?i, ?j)

goal (1 subgoal):
 1. \<forall>i<dim_row A. \<forall>j<dim_col A. B $$ (i, j) \<le> A $$ (i, j)
[PROOF STEP]
by auto


[STATEMENT]
lemma lincomb_list_carrier:
  assumes "set vs \<subseteq> carrier M" and "c : {0..<length vs} \<rightarrow> carrier R"
  shows "lincomb_list c vs \<in> carrier M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list c vs \<in> carrier M
[PROOF STEP]
by (insert assms, unfold lincomb_list_def, intro sumlist_carrier, auto intro!: smult_closed)


[STATEMENT]
lemma subst\<^sub>0_pretty:
  "subst\<^sub>0 (Eq i j) (Less m n) = Less (subst i j m) (subst i j n)"
  "subst\<^sub>0 (Eq i j) (Eq m n) = Eq (subst i j m) (subst i j n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subst\<^sub>0 (Eq i j) (Less m n) = Less (QEdlo.subst i j m) (QEdlo.subst i j n) &&& subst\<^sub>0 (Eq i j) (Eq m n) = Eq (QEdlo.subst i j m) (QEdlo.subst i j n)
[PROOF STEP]
by auto


[STATEMENT]
lemma Am_ub3: assumes "bst t" shows "Am t \<le> log \<alpha> (size1 t) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> Am t \<le> log \<alpha> (real (size1 t)) + 1
 2. \<not> ?P \<Longrightarrow> Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
assume "t = Leaf"
[PROOF STATE]
proof (state)
this:
t = \<langle>\<rangle>

goal (2 subgoals):
 1. ?P \<Longrightarrow> Am t \<le> log \<alpha> (real (size1 t)) + 1
 2. \<not> ?P \<Longrightarrow> Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
t = \<langle>\<rangle>

goal (1 subgoal):
 1. Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
by(simp add: Am_def)
[PROOF STATE]
proof (state)
this:
Am t \<le> log \<alpha> (real (size1 t)) + 1

goal (1 subgoal):
 1. t \<noteq> \<langle>\<rangle> \<Longrightarrow> Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t \<noteq> \<langle>\<rangle> \<Longrightarrow> Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
assume "t \<noteq> Leaf"
[PROOF STATE]
proof (state)
this:
t \<noteq> \<langle>\<rangle>

goal (1 subgoal):
 1. t \<noteq> \<langle>\<rangle> \<Longrightarrow> Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
have [arith]: "log \<alpha> 2 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < log \<alpha> 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < log \<alpha> 2

goal (1 subgoal):
 1. t \<noteq> \<langle>\<rangle> \<Longrightarrow> Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
using Am_ub[OF assms \<open>t \<noteq> Leaf\<close>]
[PROOF STATE]
proof (prove)
using this:
Am t \<le> log \<alpha> (real (size1 t) / 2) + 1

goal (1 subgoal):
 1. Am t \<le> log \<alpha> (real (size1 t)) + 1
[PROOF STEP]
by(simp add: Am_def log_divide)
[PROOF STATE]
proof (state)
this:
Am t \<le> log \<alpha> (real (size1 t)) + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fo_\<eta>o_initial:
    assumes "\<exists>x u. initial_arrow_to_functor C D G y x u"
    shows "initial_arrow_to_functor C D G y (Fo y) (\<eta>o y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y (Fo y) (\<eta>o y)
[PROOF STEP]
using assms Fo_def \<eta>o_def
            someI_ex [of "\<lambda>x. \<exists>u. initial_arrow_to_functor C D G y x u"]
            someI_ex [of "\<lambda>u. initial_arrow_to_functor C D G y (Fo y) u"]
[PROOF STATE]
proof (prove)
using this:
\<exists>x u. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y x u
Fo ?y = (SOME x. \<exists>u. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G ?y x u)
\<eta>o ?y = (SOME u. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G ?y (Fo ?y) u)
\<exists>x u. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y x u \<Longrightarrow> \<exists>u. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y (SOME x. \<exists>u. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y x u) u
\<exists>x. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y (Fo y) x \<Longrightarrow> initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y (Fo y) (SOME x. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y (Fo y) x)

goal (1 subgoal):
 1. initial_arrow_to_functor (\<cdot>\<^sub>C) (\<cdot>\<^sub>D) G y (Fo y) (\<eta>o y)
[PROOF STEP]
by simp


[STATEMENT]
lemma aezfun_setspan_proj_zero : "aezfun_setspan_proj A 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun_setspan_proj A 0 = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aezfun_setspan_proj A 0 = 0
[PROOF STEP]
have "aezfun (aezfun_setspan_proj A 0) = aezfun 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun (aezfun_setspan_proj A 0) = aezfun 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. aezfun (aezfun_setspan_proj A 0) x = aezfun 0 x
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. aezfun (aezfun_setspan_proj A 0) x = aezfun 0 x
[PROOF STEP]
show "aezfun (aezfun_setspan_proj A 0) a = aezfun 0 a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun (aezfun_setspan_proj A 0) a = aezfun 0 a
[PROOF STEP]
using aezfun_setspan_projD1[of a A 0] aezfun_setspan_projD2[of a A 0]
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<Longrightarrow> aezfun (aezfun_setspan_proj A 0) a = aezfun 0 a
a \<notin> A \<Longrightarrow> aezfun (aezfun_setspan_proj A 0) a = (0::?'e1)

goal (1 subgoal):
 1. aezfun (aezfun_setspan_proj A 0) a = aezfun 0 a
[PROOF STEP]
by    (cases "a\<in>A") auto
[PROOF STATE]
proof (state)
this:
aezfun (aezfun_setspan_proj A 0) a = aezfun 0 a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
aezfun (aezfun_setspan_proj A 0) = aezfun 0

goal (1 subgoal):
 1. aezfun_setspan_proj A 0 = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
aezfun (aezfun_setspan_proj A 0) = aezfun 0

goal (1 subgoal):
 1. aezfun_setspan_proj A 0 = 0
[PROOF STEP]
using aezfun_transfer
[PROOF STATE]
proof (prove)
using this:
aezfun (aezfun_setspan_proj A 0) = aezfun 0
aezfun ?a = aezfun ?b \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. aezfun_setspan_proj A 0 = 0
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
aezfun_setspan_proj A 0 = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Darapti:
  assumes  "A Q C " and "B Q C" and "C \<noteq>{}"   shows "A I B "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A I B
[PROOF STEP]
using Darii assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A Q ?B; ?B I ?C\<rbrakk> \<Longrightarrow> ?A I ?C
A Q C
B Q C
C \<noteq> {}

goal (1 subgoal):
 1. A I B
[PROOF STEP]
unfolding  universal_affirmation_def particular_affirmation_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>b\<in>?B. b \<in> ?A; \<exists>b\<in>?C. b \<in> ?B\<rbrakk> \<Longrightarrow> \<exists>b\<in>?C. b \<in> ?A
\<forall>b\<in>C. b \<in> A
\<forall>b\<in>C. b \<in> B
C \<noteq> {}

goal (1 subgoal):
 1. \<exists>b\<in>B. b \<in> A
[PROOF STEP]
by blast


[STATEMENT]
lemma ofsm_table_refinement_card :
  assumes "equivalence_relation_on_states M f"
  and     "A \<subseteq> states M"
  and     "i \<le> j"
shows "card (ofsm_table M f j ` A) \<ge> card (ofsm_table M f i ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (ofsm_table M f i ` A) \<le> card (ofsm_table M f j ` A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (ofsm_table M f i ` A) \<le> card (ofsm_table M f j ` A)
[PROOF STEP]
have "\<And> k . card (ofsm_table M f (Suc k) ` A) \<ge> card (ofsm_table M f k ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)
[PROOF STEP]
show "card (ofsm_table M f (Suc k) ` A) \<ge> card (ofsm_table M f k ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A) \<Longrightarrow> False
[PROOF STEP]
have "finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
using fsm_states_finite[of M] assms(2)
[PROOF STATE]
proof (prove)
using this:
finite (FSM.states M)
A \<subseteq> FSM.states M

goal (1 subgoal):
 1. finite A
[PROOF STEP]
using finite_subset
[PROOF STATE]
proof (prove)
using this:
finite (FSM.states M)
A \<subseteq> FSM.states M
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite A

goal (1 subgoal):
 1. \<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)"
[PROOF STATE]
proof (state)
this:
\<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)

goal (1 subgoal):
 1. \<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)
[PROOF STEP]
have "card (ofsm_table M f (Suc k) ` A) < card (ofsm_table M f k ` A)"
[PROOF STATE]
proof (prove)
using this:
\<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)

goal (1 subgoal):
 1. card (ofsm_table M f (Suc k) ` A) < card (ofsm_table M f k ` A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (ofsm_table M f (Suc k) ` A) < card (ofsm_table M f k ` A)

goal (1 subgoal):
 1. \<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (ofsm_table M f (Suc k) ` A) < card (ofsm_table M f k ` A)
[PROOF STEP]
obtain q1 q2 where "q1 \<in> A"
                          and "q2 \<in> A"
                          and "ofsm_table M f k q1 \<noteq> ofsm_table M f k q2"
                          and "ofsm_table M f (Suc k) q1 = ofsm_table M f (Suc k) q2"
[PROOF STATE]
proof (prove)
using this:
card (ofsm_table M f (Suc k) ` A) < card (ofsm_table M f k ` A)

goal (1 subgoal):
 1. (\<And>q1 q2. \<lbrakk>q1 \<in> A; q2 \<in> A; ofsm_table M f k q1 \<noteq> ofsm_table M f k q2; ofsm_table M f (Suc k) q1 = ofsm_table M f (Suc k) q2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_card_less_witnesses[OF \<open>finite A\<close>]
[PROOF STATE]
proof (prove)
using this:
card (ofsm_table M f (Suc k) ` A) < card (ofsm_table M f k ` A)
\<lbrakk>card (?g ` A) < card (?f ` A); \<And>a b. \<lbrakk>a \<in> A; b \<in> A; ?f a \<noteq> ?f b; ?g a = ?g b\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>q1 q2. \<lbrakk>q1 \<in> A; q2 \<in> A; ofsm_table M f k q1 \<noteq> ofsm_table M f k q2; ofsm_table M f (Suc k) q1 = ofsm_table M f (Suc k) q2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
q1 \<in> A
q2 \<in> A
ofsm_table M f k q1 \<noteq> ofsm_table M f k q2
ofsm_table M f (Suc k) q1 = ofsm_table M f (Suc k) q2

goal (1 subgoal):
 1. \<not> card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q1 \<in> A
q2 \<in> A
ofsm_table M f k q1 \<noteq> ofsm_table M f k q2
ofsm_table M f (Suc k) q1 = ofsm_table M f (Suc k) q2
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
q1 \<in> A
q2 \<in> A
ofsm_table M f k q1 \<noteq> ofsm_table M f k q2
ofsm_table M f (Suc k) q1 = ofsm_table M f (Suc k) q2

goal (1 subgoal):
 1. False
[PROOF STEP]
using ofsm_table_refinement_disjoint[OF _ _ assms(1), of q1 q2 k]
[PROOF STATE]
proof (prove)
using this:
q1 \<in> A
q2 \<in> A
ofsm_table M f k q1 \<noteq> ofsm_table M f k q2
ofsm_table M f (Suc k) q1 = ofsm_table M f (Suc k) q2
\<lbrakk>q1 \<in> FSM.states M; q2 \<in> FSM.states M; ofsm_table M f k q1 \<noteq> ofsm_table M f k q2\<rbrakk> \<Longrightarrow> ofsm_table M f (Suc k) q1 \<noteq> ofsm_table M f (Suc k) q2

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
q1 \<in> A
q2 \<in> A
ofsm_table M f k q1 \<noteq> ofsm_table M f k q2
ofsm_table M f (Suc k) q1 = ofsm_table M f (Suc k) q2
\<lbrakk>q1 \<in> FSM.states M; q2 \<in> FSM.states M; ofsm_table M f k q1 \<noteq> ofsm_table M f k q2\<rbrakk> \<Longrightarrow> ofsm_table M f (Suc k) q1 \<noteq> ofsm_table M f (Suc k) q2
A \<subseteq> FSM.states M

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (ofsm_table M f k ` A) \<le> card (ofsm_table M f (Suc k) ` A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (ofsm_table M f ?k ` A) \<le> card (ofsm_table M f (Suc ?k) ` A)

goal (1 subgoal):
 1. card (ofsm_table M f i ` A) \<le> card (ofsm_table M f j ` A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (ofsm_table M f ?k ` A) \<le> card (ofsm_table M f (Suc ?k) ` A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (ofsm_table M f ?k ` A) \<le> card (ofsm_table M f (Suc ?k) ` A)

goal (1 subgoal):
 1. card (ofsm_table M f i ` A) \<le> card (ofsm_table M f j ` A)
[PROOF STEP]
using lift_Suc_mono_le[OF _ assms(3), where f="\<lambda> k . card (ofsm_table M f k ` A)"]
[PROOF STATE]
proof (prove)
using this:
card (ofsm_table M f ?k ` A) \<le> card (ofsm_table M f (Suc ?k) ` A)
(\<And>n. card (ofsm_table M f n ` A) \<le> card (ofsm_table M f (Suc n) ` A)) \<Longrightarrow> card (ofsm_table M f i ` A) \<le> card (ofsm_table M f j ` A)

goal (1 subgoal):
 1. card (ofsm_table M f i ` A) \<le> card (ofsm_table M f j ` A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (ofsm_table M f i ` A) \<le> card (ofsm_table M f j ` A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_measurable_log[measurable (raw)]:
  "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. log (g x) (f x)) \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> (\<lambda>x. log (g x) (f x)) \<in> borel_measurable M
[PROOF STEP]
unfolding log_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> (\<lambda>x. ln (f x) / ln (g x)) \<in> borel_measurable M
[PROOF STEP]
by auto


[STATEMENT]
lemma affine_alg_set_singleton:
"affine_alg_set R n {a} = zero_set R n a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine_alg_set R n {a} = V n a
[PROOF STEP]
unfolding affine_alg_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {aa \<in> carrier (R\<^bsup>n\<^esup>). \<forall>b\<in>{a}. aa \<in> V n b} = V n a
[PROOF STEP]
using zero_set_closed
[PROOF STATE]
proof (prove)
using this:
V ?n ?p \<subseteq> carrier (R\<^bsup>?n\<^esup>)

goal (1 subgoal):
 1. {aa \<in> carrier (R\<^bsup>n\<^esup>). \<forall>b\<in>{a}. aa \<in> V n b} = V n a
[PROOF STEP]
by blast


[STATEMENT]
lemma disjointpD:
  "\<lbrakk> disjointp xs; (xs ! n) x; (xs ! m) x; n < length xs; m < length xs \<rbrakk> \<Longrightarrow> n = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>disjointp xs; (xs ! n) x; (xs ! m) x; n < length xs; m < length xs\<rbrakk> \<Longrightarrow> n = m
[PROOF STEP]
by(auto 4 3 simp add: disjointp_def disjoint_family_on_def)


[STATEMENT]
lemma under_empty: "a \<notin> Field r \<Longrightarrow> under r a = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<notin> Field r \<Longrightarrow> under r a = {}
[PROOF STEP]
unfolding Field_def under_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<notin> Domain r \<union> Range r \<Longrightarrow> {b. (b, a) \<in> r} = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma SP_list_set: "set (SP_list \<phi>) = SP \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (SP_list \<phi>) = SP \<phi>
[PROOF STEP]
unfolding SP_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (remdups_adj (sort (SP_list_rec \<phi>))) = SP \<phi>
[PROOF STEP]
by (induction \<phi> rule: SP.induct) (auto simp: fv_fo_terms_set_list)


[STATEMENT]
lemma lower_minus:  "lower (p - (q::_ \<Rightarrow>\<^sub>0 'b::ab_group_add)) v = lower p v - lower q v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower (p - q) v = lower p v - lower q v
[PROOF STEP]
by (auto intro!: poly_mapping_eqI simp: lookup_minus lookup_lower)


[STATEMENT]
lemma (in topological_space) eventually_nhds:
  "eventually P (nhds a) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (nhds a) = (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))
[PROOF STEP]
unfolding nhds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (Inf (principal ` {S. open S \<and> a \<in> S})) = (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))
[PROOF STEP]
by (subst eventually_INF_base) (auto simp: eventually_principal)


[STATEMENT]
lemma cnb_app [simp]: "cnb (l @ l') = cnb l + cnb l'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnb (l @ l') = cnb l + cnb l'
[PROOF STEP]
by (induct l, auto)


[STATEMENT]
lemma poincare_line_poincare_collinear3_general:
  assumes "a \<in> circline_set (poincare_line a1 a2)" "a1 \<noteq> a2"
  shows "poincare_collinear {a, a1, a2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_collinear {a, a1, a2}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> circline_set (poincare_line a1 a2)
a1 \<noteq> a2

goal (1 subgoal):
 1. poincare_collinear {a, a1, a2}
[PROOF STEP]
unfolding poincare_collinear_def
[PROOF STATE]
proof (prove)
using this:
a \<in> circline_set (poincare_line a1 a2)
a1 \<noteq> a2

goal (1 subgoal):
 1. \<exists>p. is_poincare_line p \<and> {a, a1, a2} \<subseteq> circline_set p
[PROOF STEP]
by (rule_tac x="poincare_line a1 a2" in exI, simp)


[STATEMENT]
lemma nats_of_boolss_zeros: "nats_of_boolss n (zeros m n) = replicate n 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nats_of_boolss n (zeros m n) = replicate n 0
[PROOF STEP]
by (induct m) (simp_all add: zeros_def)


[STATEMENT]
lemma dec_interp_not_Inl: "\<lbrakk>dec_interp n FO x ! i = Inl p; i \<notin> FO; i < n\<rbrakk> \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dec_interp n FO x ! i = Inl p; i \<notin> FO; i < n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
unfolding dec_interp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>map (\<lambda>i. if i \<in> FO then Inl (the_elem (positions_in_row x i)) else Inr (positions_in_row x i)) [0..<n] ! i = Inl p; i \<notin> FO; i < n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using nth_map[of n "[0..<n]"]
[PROOF STATE]
proof (prove)
using this:
n < length [0..<n] \<Longrightarrow> map ?f [0..<n] ! n = ?f ([0..<n] ! n)

goal (1 subgoal):
 1. \<lbrakk>map (\<lambda>i. if i \<in> FO then Inl (the_elem (positions_in_row x i)) else Inr (positions_in_row x i)) [0..<n] ! i = Inl p; i \<notin> FO; i < n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by auto