[STATEMENT]
lemma linear_surjective_rank_eq_ncols:
  assumes lf: "linear ((*s)) ((*s)) f"
  shows "surj f \<longleftrightarrow> rank (matrix f::'a::{field}^'cols::{mod_type}^'rows::{mod_type}) = nrows (matrix f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj f = (rank (matrix f) = nrows (matrix f))
[PROOF STEP]
proof (rule)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. surj f \<Longrightarrow> rank (matrix f) = nrows (matrix f)
 2. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
assume surj: "surj f"
[PROOF STATE]
proof (state)
this:
surj f

goal (2 subgoals):
 1. surj f \<Longrightarrow> rank (matrix f) = nrows (matrix f)
 2. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
have "nrows (matrix f) = CARD ('rows)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows (matrix f) = CARD('rows)
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('rows) = CARD('rows)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
nrows (matrix f) = CARD('rows)

goal (2 subgoals):
 1. surj f \<Longrightarrow> rank (matrix f) = nrows (matrix f)
 2. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nrows (matrix f) = CARD('rows)

goal (2 subgoals):
 1. surj f \<Longrightarrow> rank (matrix f) = nrows (matrix f)
 2. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
have "... = vec.dim (range f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('rows) = vec.dim (range f)
[PROOF STEP]
by (metis surj vec_dim_card)
[PROOF STATE]
proof (state)
this:
CARD('rows) = vec.dim (range f)

goal (2 subgoals):
 1. surj f \<Longrightarrow> rank (matrix f) = nrows (matrix f)
 2. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
CARD('rows) = vec.dim (range f)

goal (2 subgoals):
 1. surj f \<Longrightarrow> rank (matrix f) = nrows (matrix f)
 2. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
have "... = rank (matrix f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (range f) = rank (matrix f)
[PROOF STEP]
unfolding rank_matrix_dim_range[OF lf]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (range f) = vec.dim (range f)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
vec.dim (range f) = rank (matrix f)

goal (2 subgoals):
 1. surj f \<Longrightarrow> rank (matrix f) = nrows (matrix f)
 2. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
nrows (matrix f) = rank (matrix f)
[PROOF STEP]
show "rank (matrix f) = nrows (matrix f)"
[PROOF STATE]
proof (prove)
using this:
nrows (matrix f) = rank (matrix f)

goal (1 subgoal):
 1. rank (matrix f) = nrows (matrix f)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
rank (matrix f) = nrows (matrix f)

goal (1 subgoal):
 1. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
assume "rank (matrix f) = nrows (matrix f)"
[PROOF STATE]
proof (state)
this:
rank (matrix f) = nrows (matrix f)

goal (1 subgoal):
 1. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
hence "vec.dim (range f) = CARD ('rows)"
[PROOF STATE]
proof (prove)
using this:
rank (matrix f) = nrows (matrix f)

goal (1 subgoal):
 1. vec.dim (range f) = CARD('rows)
[PROOF STEP]
unfolding rank_matrix_dim_range[OF lf] nrows_def
[PROOF STATE]
proof (prove)
using this:
vec.dim (range f) = CARD('rows)

goal (1 subgoal):
 1. vec.dim (range f) = CARD('rows)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec.dim (range f) = CARD('rows)

goal (1 subgoal):
 1. rank (matrix f) = nrows (matrix f) \<Longrightarrow> surj f
[PROOF STEP]
thus "surj f"
[PROOF STATE]
proof (prove)
using this:
vec.dim (range f) = CARD('rows)

goal (1 subgoal):
 1. surj f
[PROOF STEP]
using vec.basis_exists independent_is_basis is_basis_def lf
      vec.subspace_UNIV vec.subspace_image
[PROOF STATE]
proof (prove)
using this:
vec.dim (range f) = CARD('rows)
(\<And>B. \<lbrakk>B \<subseteq> ?V; vec.independent B; ?V \<subseteq> vec.span B; card B = vec.dim ?V\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
(vec.independent ?B \<and> card ?B = CARD(?'n)) = is_basis ?B
is_basis ?S \<equiv> vec.independent ?S \<and> vec.span ?S = UNIV
linear (*s) (*s) f
vec.subspace UNIV
vec.subspace ?S \<Longrightarrow> vec.subspace ((*v) ?A ` ?S)

goal (1 subgoal):
 1. surj f
[PROOF STEP]
by (metis col_space_eq' col_space_eq_range vec.span_subspace)
[PROOF STATE]
proof (state)
this:
surj f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LFP_greatest:
  assumes "x \<in> carrier L"
          "(\<And>u. \<lbrakk> u \<in> carrier L; f u \<sqsubseteq> u \<rbrakk> \<Longrightarrow> x \<sqsubseteq> u)"
  shows "x \<sqsubseteq> LFP f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> LFP f
[PROOF STEP]
by (auto simp add:LEAST_FP_def intro:inf_greatest assms)


[STATEMENT]
lemma sylvester_mat_sub_dim[simp]:
  fixes m n p q
  defines "S \<equiv> sylvester_mat_sub m n p q"
  shows "dim_row S = m+n" and "dim_col S = m+n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row S = m + n &&& dim_col S = m + n
[PROOF STEP]
unfolding S_def sylvester_mat_sub_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat (m + n) (m + n) (\<lambda>(i, j). if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a))) = m + n &&& dim_col (mat (m + n) (m + n) (\<lambda>(i, j). if i < n then if i \<le> j \<and> j - i \<le> m then coeff p (m + i - j) else (0::'a) else if i - n \<le> j \<and> j \<le> i then coeff q (i - j) else (0::'a))) = m + n
[PROOF STEP]
by auto


[STATEMENT]
lemma eq_dfa_accepts:
  assumes bss: "list_all (is_alph n) bss"
  shows "dfa_accepts (eq_dfa n ks l) bss = (eval_dioph ks (nats_of_boolss n bss) = l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dfa_accepts (eq_dfa n ks l) bss = (eval_dioph ks (nats_of_boolss n bss) = l)
[PROOF STEP]
by (simp add: accepts_def)
    (rule eq_dfa_accepting [of l l n ks, OF _ bss, simplified dioph_dfs_start, simplified])


[STATEMENT]
lemma permutationss_Cons:
  "permutationss (xs # xss) = concat (map (\<lambda>ys. map (Cons ys) (permutationss xss)) (permutations xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutationss (xs # xss) = concat (map (\<lambda>ys. map ((#) ys) (permutationss xss)) (permutations xs))
[PROOF STEP]
by (auto simp: permutationss_def)


[STATEMENT]
lemma ex1_the_shift:
  assumes ex1: "\<exists>!y :: 'a :: group_add. P y"
  shows "(THE x. P (x + d)) = (THE y. P y) - d"
    and "(THE x. P (x - d)) = (THE y. P y) + d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE x. P (x + d)) = (THE y. P y) - d &&& (THE x. P (x - d)) = (THE y. P y) + d
[PROOF STEP]
unfolding bij_ex1_imp_the_shift[OF bij_add ex1] bij_ex1_imp_the_shift[OF bij_minus ex1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv (\<lambda>x. x + d) (The P) = (THE y. P y) - d &&& inv (\<lambda>x. x - d) (The P) = (THE y. P y) + d
[PROOF STEP]
by auto


[STATEMENT]
lemma SELECT_refine_iff: "(SELECT P \<le>\<Down>(\<langle>R\<rangle>option_rel) (SELECT P'))
  \<longleftrightarrow> (
    (Ex P' \<longrightarrow> Ex P) \<and>
    (\<forall>x. P x \<longrightarrow> (\<exists>x'. (x,x')\<in>R \<and> P' x'))
  )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SELECT P \<le> \<Down> (\<langle>R\<rangle>option_rel) (SELECT P')) = ((Ex P' \<longrightarrow> Ex P) \<and> (\<forall>x. P x \<longrightarrow> (\<exists>x'. (x, x') \<in> R \<and> P' x')))
[PROOF STEP]
by (force simp: SELECT_def pw_le_iff refine_pw_simps)


[STATEMENT]
lemma "back"[simp]:
assumes "II \<subseteq> {brnL cl n ..<+ brn (cl!n)}"
shows "back cl n II \<subseteq> {..< brn (cl!n)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. back cl n II \<subseteq> {..<brn (cl ! n)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
II \<subseteq> {brnL cl n..<brnL cl n + brn (cl ! n)}

goal (1 subgoal):
 1. back cl n II \<subseteq> {..<brn (cl ! n)}
[PROOF STEP]
unfolding back_def
[PROOF STATE]
proof (prove)
using this:
II \<subseteq> {brnL cl n..<brnL cl n + brn (cl ! n)}

goal (1 subgoal):
 1. (\<lambda>ii. ii - brnL cl n) ` II \<subseteq> {..<brn (cl ! n)}
[PROOF STEP]
by force


[STATEMENT]
lemma pi_approx_75: "abs (pi - 3.1415926535897932384626 :: real) \<le> inverse (10^22)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
define a :: real
    where "a = 8295936325956147794769600190539918304 / 2626685325478320010006427764892578125"
[PROOF STATE]
proof (state)
this:
a = 8295936325956147794769600190539918304 / 2626685325478320010006427764892578125

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
define b :: real
    where "b = 8428294561696506782041394632 / 503593538783547230635598424135"
  \<comment> \<open>The introduction of this constant prevents the simplifier from applying solvers that
      we don't want. We want it to simply evaluate the terms to rational constants.}\<close>
[PROOF STATE]
proof (state)
this:
b = 8428294561696506782041394632 / 503593538783547230635598424135

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
define eq :: "real \<Rightarrow> real \<Rightarrow> bool" where "eq = (=)"

  \<comment> \<open>Splitting the computation into several steps has the advantage that simplification can
      be done in parallel\<close>
[PROOF STATE]
proof (state)
this:
eq = (=)

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
have "abs (pi - pi_approx 6) \<le> inverse (2^76)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - pi_approx 6\<bar> \<le> inverse (2 ^ 76)
[PROOF STEP]
by (rule pi_approx') simp_all
[PROOF STATE]
proof (state)
this:
\<bar>pi - pi_approx 6\<bar> \<le> inverse (2 ^ 76)

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>pi - pi_approx 6\<bar> \<le> inverse (2 ^ 76)

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
have "pi_approx 6 = 16 * arctan_approx (3 * 6) (1 / 5) - 4 * arctan_approx 6 (1 / 239)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi_approx 6 = 16 * arctan_approx (3 * 6) (1 / 5) - 4 * arctan_approx 6 (1 / 239)
[PROOF STEP]
unfolding pi_approx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 16 * arctan_approx (3 * 6) (1 / 5) - 4 * arctan_approx 6 (1 / 239) = 16 * arctan_approx (3 * 6) (1 / 5) - 4 * arctan_approx 6 (1 / 239)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pi_approx 6 = 16 * arctan_approx (3 * 6) (1 / 5) - 4 * arctan_approx 6 (1 / 239)

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pi_approx 6 = 16 * arctan_approx (3 * 6) (1 / 5) - 4 * arctan_approx 6 (1 / 239)

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
have [unfolded eq_def]: "eq (16 * arctan_approx (3 * 6) (1 / 5)) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (16 * arctan_approx (3 * 6) (1 / 5)) a
[PROOF STEP]
by (simp add: arctan_approx_def' power2_eq_square,
        simp add: expand_arctan_approx, unfold a_def eq_def, rule refl)
[PROOF STATE]
proof (state)
this:
16 * arctan_approx (3 * 6) (1 / 5) = a

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
16 * arctan_approx (3 * 6) (1 / 5) = a

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
have [unfolded eq_def]: "eq (4 * arctan_approx 6 (1 / 239::real)) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (4 * arctan_approx 6 (1 / 239)) b
[PROOF STEP]
by (simp add: arctan_approx_def' power2_eq_square,
        simp add: expand_arctan_approx, unfold b_def eq_def, rule refl)
[PROOF STATE]
proof (state)
this:
4 * arctan_approx 6 (1 / 239) = b

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
4 * arctan_approx 6 (1 / 239) = b

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
have [unfolded eq_def]:
    "eq (a - b) (171331331860120333586637094112743033554946184594977368554649608 /
                 54536456744112171868276045488779391002026386559009552001953125)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (a - b) (171331331860120333586637094112743033554946184594977368554649608 / 54536456744112171868276045488779391002026386559009552001953125)
[PROOF STEP]
by (unfold a_def b_def, simp, unfold eq_def, rule refl)
[PROOF STATE]
proof (state)
this:
a - b = 171331331860120333586637094112743033554946184594977368554649608 / 54536456744112171868276045488779391002026386559009552001953125

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>pi - 171331331860120333586637094112743033554946184594977368554649608 / 54536456744112171868276045488779391002026386559009552001953125\<bar> \<le> inverse (2 ^ 76)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>pi - 171331331860120333586637094112743033554946184594977368554649608 / 54536456744112171868276045488779391002026386559009552001953125\<bar> \<le> inverse (2 ^ 76)

goal (1 subgoal):
 1. \<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)
[PROOF STEP]
by (rule approx_coarsen) simp
[PROOF STATE]
proof (state)
this:
\<bar>pi - 31415926535897932384626 / 10 ^ 22\<bar> \<le> inverse (10 ^ 22)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_weak_ranking_permute:
  assumes "f permutes (\<Union>(set xs))"
  shows   "of_weak_ranking (map ((`) f) xs) = map_relation (inv f) (of_weak_ranking xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_weak_ranking (map ((`) f) xs) = map_relation (inv f) (of_weak_ranking xs)
[PROOF STEP]
using of_weak_ranking_permute'[OF permutes_inv[OF assms]] assms
[PROOF STATE]
proof (prove)
using this:
map_relation (inv f) (of_weak_ranking xs) = of_weak_ranking (map ((`) (inv (inv f))) xs)
f permutes \<Union> (set xs)

goal (1 subgoal):
 1. of_weak_ranking (map ((`) f) xs) = map_relation (inv f) (of_weak_ranking xs)
[PROOF STEP]
by (simp add: inv_inv_eq permutes_bij)


[STATEMENT]
theorem Right_Coset_bij:
  assumes G [simp]: "x \<in> G" "y \<in> G"
  shows "bij_betw (inverse x \<cdot> y)\<^sub>R (H |\<cdot> x) (H |\<cdot> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (inverse x \<cdot> y)\<^sub>R (H |\<cdot> x) (H |\<cdot> y)
[PROOF STEP]
proof (rule bij_betw_imageI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (inverse x \<cdot> y)\<^sub>R (H |\<cdot> x)
 2. (inverse x \<cdot> y)\<^sub>R ` (H |\<cdot> x) = H |\<cdot> y
[PROOF STEP]
show "inj_on (inverse x \<cdot> y)\<^sub>R (H |\<cdot> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (inverse x \<cdot> y)\<^sub>R (H |\<cdot> x)
[PROOF STEP]
by (fastforce intro: inj_onI simp add: Right_Coset_is_orbit right.translation_apply orbit.block_closed)
[PROOF STATE]
proof (state)
this:
inj_on (inverse x \<cdot> y)\<^sub>R (H |\<cdot> x)

goal (1 subgoal):
 1. (inverse x \<cdot> y)\<^sub>R ` (H |\<cdot> x) = H |\<cdot> y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (inverse x \<cdot> y)\<^sub>R ` (H |\<cdot> x) = H |\<cdot> y
[PROOF STEP]
show "(inverse x \<cdot> y)\<^sub>R ` (H |\<cdot> x) = H |\<cdot> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inverse x \<cdot> y)\<^sub>R ` (H |\<cdot> x) = H |\<cdot> y
[PROOF STEP]
by (force simp add: right.translation_apply associative invertible_right_inverse2)
[PROOF STATE]
proof (state)
this:
(inverse x \<cdot> y)\<^sub>R ` (H |\<cdot> x) = H |\<cdot> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lift_prod_list: "lift (prod_list xs) = prod_list (map lift xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lift (prod_list xs) = prod_list (map lift xs)
[PROOF STEP]
by (induction xs) (simp_all add: lift_mult)


[STATEMENT]
lemma det_zero_imp_zero_row: assumes A: "(A :: 'a :: field mat) \<in> carrier_mat n n"
  and det: "det A = 0"
  shows "\<exists> P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n
    \<and> row_echelon_form (P * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
let ?R = "ring_mat TYPE('a) n b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
let ?U = "Units ?R"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
interpret m: ring ?R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring (ring_mat TYPE('a) n b)
[PROOF STEP]
by (rule ring_mat)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
let ?g = "gauss_jordan A A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
obtain A' B' where g: "?g = (A', B')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A' B'. gauss_jordan A A = (A', B') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases ?g)
[PROOF STATE]
proof (state)
this:
gauss_jordan A A = (A', B')

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
from det unit_imp_det_non_zero[of A n b]
[PROOF STATE]
proof (chain)
picking this:
det A = (0::'a)
A \<in> Units (ring_mat TYPE('a) n b) \<Longrightarrow> det A \<noteq> (0::'a)
[PROOF STEP]
have AU: "A \<notin> ?U"
[PROOF STATE]
proof (prove)
using this:
det A = (0::'a)
A \<in> Units (ring_mat TYPE('a) n b) \<Longrightarrow> det A \<noteq> (0::'a)

goal (1 subgoal):
 1. A \<notin> Units (ring_mat TYPE('a) n b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<notin> Units (ring_mat TYPE('a) n b)

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
with gauss_jordan_inverse_one_direction(1)[OF A A, of _ b]
[PROOF STATE]
proof (chain)
picking this:
gauss_jordan A A = (1\<^sub>m n, ?B') \<Longrightarrow> A \<in> Units (ring_mat TYPE('a) n b)
A \<notin> Units (ring_mat TYPE('a) n b)
[PROOF STEP]
have A'1: "A' \<noteq> 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
gauss_jordan A A = (1\<^sub>m n, ?B') \<Longrightarrow> A \<in> Units (ring_mat TYPE('a) n b)
A \<notin> Units (ring_mat TYPE('a) n b)

goal (1 subgoal):
 1. A' \<noteq> 1\<^sub>m n
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
gauss_jordan A A = (1\<^sub>m n, ?B') \<Longrightarrow> A \<in> Units (ring_mat TYPE('a) n b)
A \<notin> Units (ring_mat TYPE('a) n b)
gauss_jordan A A = (A', B')

goal (1 subgoal):
 1. A' \<noteq> 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' \<noteq> 1\<^sub>m n

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
from gauss_jordan_carrier(1)[OF A A g]
[PROOF STATE]
proof (chain)
picking this:
A' \<in> carrier_mat n n
[PROOF STEP]
have A': "A' \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
A' \<in> carrier_mat n n

goal (1 subgoal):
 1. A' \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
from gauss_jordan_row_echelon[OF A g]
[PROOF STATE]
proof (chain)
picking this:
row_echelon_form A'
[PROOF STEP]
have re: "row_echelon_form A'"
[PROOF STATE]
proof (prove)
using this:
row_echelon_form A'

goal (1 subgoal):
 1. row_echelon_form A'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
row_echelon_form A'

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
from row_echelon_form_imp_1_or_0_row[OF A' this] A'1
[PROOF STATE]
proof (chain)
picking this:
A' = 1\<^sub>m n \<or> 0 < n \<and> row A' (n - 1) = 0\<^sub>v n
A' \<noteq> 1\<^sub>m n
[PROOF STEP]
have n: "0 < n" and row: "row A' (n - 1) = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
using this:
A' = 1\<^sub>m n \<or> 0 < n \<and> row A' (n - 1) = 0\<^sub>v n
A' \<noteq> 1\<^sub>m n

goal (1 subgoal):
 1. 0 < n &&& row A' (n - 1) = 0\<^sub>v n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < n
row A' (n - 1) = 0\<^sub>v n

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
from gauss_jordan_transform[OF A A g, of b]
[PROOF STATE]
proof (chain)
picking this:
\<exists>P\<in>Units (ring_mat TYPE('a) n b). A' = P * A \<and> B' = P * A
[PROOF STEP]
obtain P
    where P: "P \<in> ?U" and A': "A' = P * A"
[PROOF STATE]
proof (prove)
using this:
\<exists>P\<in>Units (ring_mat TYPE('a) n b). A' = P * A \<and> B' = P * A

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>P \<in> Units (ring_mat TYPE('a) n b); A' = P * A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P \<in> Units (ring_mat TYPE('a) n b)
A' = P * A

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
P \<in> Units (ring_mat TYPE('a) n b)
A' = P * A

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
using n row re
[PROOF STATE]
proof (prove)
using this:
P \<in> Units (ring_mat TYPE('a) n b)
A' = P * A
0 < n
row A' (n - 1) = 0\<^sub>v n
row_echelon_form A'

goal (1 subgoal):
 1. \<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>P. P \<in> Units (ring_mat TYPE('a) n b) \<and> row (P * A) (n - 1) = 0\<^sub>v n \<and> 0 < n \<and> row_echelon_form (P * A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  cross_minus_left [simp]: "(-x) \<times> y = - (x \<times> y)" for x::"real^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- x) \<times> y = - (x \<times> y)
[PROOF STEP]
by (simp add: cross3_simps)


[STATEMENT]
lemma geometric_series_id:
  assumes "a \<in> carrier R"
  assumes "b \<in> carrier R"
  shows "a[^](Suc n) \<ominus>b[^] (Suc n) = (a \<ominus> b) \<otimes> (geometric_series n a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] Suc n \<ominus> b [^] Suc n = (a \<ominus> b) \<otimes> geometric_series n a b
[PROOF STEP]
using assms geom_quot
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
b \<in> carrier R
\<lbrakk>?a \<in> carrier R; ?b \<in> carrier R; ?p = monom P \<one> (Suc ?n) \<ominus>\<^bsub>P\<^esub> monom P (?b [^] Suc ?n) 0; ?g = UP_root_div ?p ?b\<rbrakk> \<Longrightarrow> ?a [^] Suc ?n \<ominus> ?b [^] Suc ?n = (?a \<ominus> ?b) \<otimes> to_fun ?g ?a

goal (1 subgoal):
 1. a [^] Suc n \<ominus> b [^] Suc n = (a \<ominus> b) \<otimes> geometric_series n a b
[PROOF STEP]
by (simp add: P_def geometric_series_def)


[STATEMENT]
lemma E_sup_add:
  assumes [measurable]: "f \<in> borel_measurable St" "g \<in> borel_measurable St"
  shows "E_sup s (\<lambda>x. f x + g x) \<le> E_sup s f + E_sup s g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E_sup s (\<lambda>x. f x + g x) \<le> E_sup s f + E_sup s g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. E_sup s (\<lambda>x. f x + g x) \<le> E_sup s f + E_sup s g
[PROOF STEP]
have "E_sup s (\<lambda>x. f x + g x) = (\<Squnion>cfg\<in>cfg_on s. (\<integral>\<^sup>+x. f x \<partial>T cfg) + (\<integral>\<^sup>+x. g x \<partial>T cfg))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E_sup s (\<lambda>x. f x + g x) = (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f + integral\<^sup>N (T cfg) g)
[PROOF STEP]
by (simp add: E_sup_def nn_integral_add)
[PROOF STATE]
proof (state)
this:
E_sup s (\<lambda>x. f x + g x) = (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f + integral\<^sup>N (T cfg) g)

goal (1 subgoal):
 1. E_sup s (\<lambda>x. f x + g x) \<le> E_sup s f + E_sup s g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
E_sup s (\<lambda>x. f x + g x) = (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f + integral\<^sup>N (T cfg) g)

goal (1 subgoal):
 1. E_sup s (\<lambda>x. f x + g x) \<le> E_sup s f + E_sup s g
[PROOF STEP]
have "\<dots> \<le> (\<Squnion>cfg\<in>cfg_on s. \<integral>\<^sup>+x. f x \<partial>T cfg) + (\<Squnion>cfg\<in>cfg_on s. (\<integral>\<^sup>+x. g x \<partial>T cfg))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f + integral\<^sup>N (T cfg) g) \<le> (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f) + (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) g)
[PROOF STEP]
by (auto simp: SUP_le_iff intro!: add_mono SUP_upper)
[PROOF STATE]
proof (state)
this:
(\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f + integral\<^sup>N (T cfg) g) \<le> (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f) + (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) g)

goal (1 subgoal):
 1. E_sup s (\<lambda>x. f x + g x) \<le> E_sup s f + E_sup s g
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
E_sup s (\<lambda>x. f x + g x) \<le> (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f) + (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
E_sup s (\<lambda>x. f x + g x) \<le> (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f) + (\<Squnion>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) g)

goal (1 subgoal):
 1. E_sup s (\<lambda>x. f x + g x) \<le> E_sup s f + E_sup s g
[PROOF STEP]
by (simp add: E_sup_def)
[PROOF STATE]
proof (state)
this:
E_sup s (\<lambda>x. f x + g x) \<le> E_sup s f + E_sup s g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma demand_Suc_Least:
  assumes [simp]: "f\<cdot>\<bottom> = \<bottom>"
  assumes "demand f \<noteq> C\<^sup>\<infinity>"
  shows "demand f = C\<^bsup>(Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>))\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f\<cdot>\<bottom> = \<bottom>
demand f \<noteq> C\<^sup>\<infinity>
[PROOF STEP]
have "demand f = C\<^bsup>(LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>)\<^esup>"
[PROOF STATE]
proof (prove)
using this:
f\<cdot>\<bottom> = \<bottom>
demand f \<noteq> C\<^sup>\<infinity>

goal (1 subgoal):
 1. demand f = C\<^bsup>LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>\<^esup>
[PROOF STEP]
by (auto simp add: demand_def)
[PROOF STATE]
proof (state)
this:
demand f = C\<^bsup>LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>\<^esup>

goal (1 subgoal):
 1. demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
demand f = C\<^bsup>LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>\<^esup>

goal (1 subgoal):
 1. demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
demand f = C\<^bsup>LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>\<^esup>
[PROOF STEP]
obtain n where "f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>"
[PROOF STATE]
proof (prove)
using this:
demand f = C\<^bsup>LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>\<^esup>

goal (1 subgoal):
 1. (\<And>n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis  demand_suffices')
[PROOF STATE]
proof (state)
this:
f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>

goal (1 subgoal):
 1. demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>
[PROOF STEP]
hence "(LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>) = Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)"
[PROOF STATE]
proof (prove)
using this:
f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>

goal (1 subgoal):
 1. (LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>) = Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)
[PROOF STEP]
apply (rule Least_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> f\<cdot>C\<^bsup>0\<^esup> \<noteq> \<bottom>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(LEAST n. f\<cdot>C\<^bsup>n\<^esup> \<noteq> \<bottom>) = Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)

goal (1 subgoal):
 1. demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>

goal (1 subgoal):
 1. demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
demand f = C\<^bsup>Suc (LEAST n. f\<cdot>C\<^bsup>Suc n\<^esup> \<noteq> \<bottom>)\<^esup>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_vector_is_zero_poly: "coeff (vec_to_lpoly (0\<^sub>v n)) i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abstract_Linear_Poly.coeff (vec_to_lpoly (0\<^sub>v n)) i = 0
[PROOF STEP]
by (metis index_zero_vec(1) index_zero_vec(2) not_less
      outside_list_coeff0 vec_to_lin_poly_coeff_access)


[STATEMENT]
lemma sum_ssub_nzero_commutative: "(\<Sum>t=0..(q::nat). \<Sum>S- p l (\<lambda>k. f k t)) = (\<Sum>S- p l (\<lambda>k. \<Sum>t=0..q. f k t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t = 0..q. \<Sum>S- p l (\<lambda>k. f k t) ) = \<Sum>S- p l (\<lambda>k. sum (f k) {0..q})
[PROOF STEP]
by (rule sum_commutative sum_ssub_nzero.simps) +


[STATEMENT]
lemma Lcm_nat_empty: "Lcm {} = (1::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm {} = 1
[PROOF STEP]
by (simp add: Lcm_nat_def del: One_nat_def)


[STATEMENT]
lemma radical_Int_subset: "\<surd>(A \<inter> B) \<subseteq> \<surd>A \<inter> \<surd>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<surd>(A \<inter> B) \<subseteq> \<surd>A \<inter> \<surd>B
[PROOF STEP]
by (auto intro: radicalI elim: radicalE)


[STATEMENT]
lemma rel_fun_assoc: "((f :: 'a \<Rightarrow> 'b::quantale) \<star> g) \<star> h = f \<star> (g \<star> h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<star> g) \<star> h = f \<star> (g \<star> h)
[PROOF STEP]
by (simp add: times_rel_fun_def fun_eq_iff bmod_assoc[symmetric])


[STATEMENT]
lemma ex3_6: "\<bar>integral {0 .. pi} (\<lambda>x::real. (x * sin x) / (1 + (cos x)\<^sup>2)) - pi\<^sup>2/4\<bar> \<le> 1 / 10^6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>integral {0..pi} (\<lambda>x. x * sin x / (1 + (cos x)\<^sup>2)) - pi\<^sup>2 / 4\<bar> \<le> 1 / 10 ^ 6
[PROOF STEP]
by (rule abs_minus_leI) (tactic \<open>integral_bnds_tac 1 40 10 6 30 "" [] @{context} 1\<close>)


[STATEMENT]
lemma n_distrib1_opp: "(n x \<oplus> n y) \<cdot> n z  = (n x \<cdot> n z) \<oplus> (n y \<cdot> n z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n x \<oplus> n y) \<cdot> n z = n x \<cdot> n z \<oplus> n y \<cdot> n z
[PROOF STEP]
using n_add_op_def n_comm n_distrib1
[PROOF STATE]
proof (prove)
using this:
?x \<oplus> ?y \<equiv> n (n ?x \<cdot> n ?y)
n ?x \<cdot> n ?y = n ?y \<cdot> n ?x
n ?x \<cdot> (n ?y \<oplus> n ?z) = n ?x \<cdot> n ?y \<oplus> n ?x \<cdot> n ?z

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


[STATEMENT]
lemma hypext_power_Hyperdual_parts:
  "(*h* (\<lambda>x. x ^ n)) (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) =
        a ^ n *\<^sub>H ba + (of_nat n * b * a ^ (n - 1)) *\<^sub>H e1 + (of_nat n * c * a ^ (n - 1)) *\<^sub>H e2 +
        (d * (of_nat n * a ^ (n - 1)) + b * c * (of_nat n * of_nat (n - 1) * a ^ (n - 2))) *\<^sub>H e12"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*h* (\<lambda>x. x ^ n)) (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = a ^ n *\<^sub>H ba + (of_nat n * b * a ^ (n - 1)) *\<^sub>H e1 + (of_nat n * c * a ^ (n - 1)) *\<^sub>H e2 + (d * (of_nat n * a ^ (n - 1)) + b * c * (of_nat n * of_nat (n - 1) * a ^ (n - 2))) *\<^sub>H e12
[PROOF STEP]
by (simp add: Hyperdual_eq [symmetric] hypext_power_Hyperdual)


[STATEMENT]
lemma map_indets_cong: "p = q \<Longrightarrow> (\<And>x. x \<in> indets q \<Longrightarrow> f x = g x) \<Longrightarrow> map_indets f p = map_indets g q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p = q; \<And>x. x \<in> indets q \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> map_indets f p = map_indets g q
[PROOF STEP]
unfolding map_indets_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p = q; \<And>x. x \<in> indets q \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> poly_subst (\<lambda>x. monomial (1::'b) (monomial 1 (f x))) p = poly_subst (\<lambda>x. monomial (1::'b) (monomial 1 (g x))) q
[PROOF STEP]
by (simp cong: poly_subst_cong)


[STATEMENT]
lemma less_eq_imp_Interp_subseteq_Interp: "C \<le> D \<Longrightarrow> Interp C \<subseteq> Interp D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<le> D \<Longrightarrow> Interp C \<subseteq> Interp D
[PROOF STEP]
using Interp_def less_eq_imp_interp_subseteq_Interp less_eq_imp_production_subseteq_Interp
[PROOF STATE]
proof (prove)
using this:
Interp ?C = interp ?C \<union> production ?C
?C \<le> ?D \<Longrightarrow> interp ?C \<subseteq> Interp ?D
?C \<le> ?D \<Longrightarrow> production ?C \<subseteq> Interp ?D

goal (1 subgoal):
 1. C \<le> D \<Longrightarrow> Interp C \<subseteq> Interp D
[PROOF STEP]
by auto


[STATEMENT]
lemma atms_of_add_mset[simp]: "atms_of (add_mset a A) = insert (atm_of a) (atms_of A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atms_of (add_mset a A) = insert (atm_of a) (atms_of A)
[PROOF STEP]
unfolding atms_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atm_of ` set_mset (add_mset a A) = insert (atm_of a) (atm_of ` set_mset A)
[PROOF STEP]
by auto


[STATEMENT]
lemma uniqHeadTailSet:
  assumes "uniq l"
  shows "set (tl l) = (set l) - {hd l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (tl l) = set l - {hd l}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
uniq l

goal (1 subgoal):
 1. set (tl l) = set l - {hd l}
[PROOF STEP]
by (induct l) auto


[STATEMENT]
lemma drop_bit_Suc_bit1 [simp]:
  \<open>drop_bit (Suc n) (numeral (Num.Bit1 k)) = drop_bit n (numeral k)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop_bit (Suc n) (numeral (num.Bit1 k)) = drop_bit n (numeral k)
[PROOF STEP]
by (simp add: drop_bit_Suc numeral_Bit1_div_2)


[STATEMENT]
lemma at_least_two_cars_exists:"\<exists>c d ::cars . c\<noteq>d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>c d. c \<noteq> d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>c d. c \<noteq> d
[PROOF STEP]
have "(0::nat) \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<noteq> 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<noteq> 1

goal (1 subgoal):
 1. \<exists>c d. c \<noteq> d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> 1
[PROOF STEP]
have "Abs_cars (0::nat) \<noteq> Abs_cars(1) "
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> 1

goal (1 subgoal):
 1. Abs_cars 0 \<noteq> Abs_cars 1
[PROOF STEP]
by (simp add:Abs_cars_inject)
[PROOF STATE]
proof (state)
this:
Abs_cars 0 \<noteq> Abs_cars 1

goal (1 subgoal):
 1. \<exists>c d. c \<noteq> d
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Abs_cars 0 \<noteq> Abs_cars 1

goal (1 subgoal):
 1. \<exists>c d. c \<noteq> d
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>c d. c \<noteq> d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_funI2: "(\<And>i j. f i j \<le> g i j) \<Longrightarrow> f \<le> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. f i j \<le> g i j) \<Longrightarrow> f \<le> g
[PROOF STEP]
by (metis le_funI)


[STATEMENT]
lemma coeff_sum_unique:
  fixes p :: "'a \<Rightarrow> 'b::semiring_0 poly"
  assumes I: "finite I" "i \<in> I" "\<And>j. j \<in> I \<Longrightarrow> j \<noteq> i \<Longrightarrow> degree (p j) < degree (p i)"
  shows "coeff (\<Sum>i\<in>I. p i) (degree (p i)) = coeff (p i) (degree (p i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (sum p I) (degree (p i)) = lead_coeff (p i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff (sum p I) (degree (p i)) = lead_coeff (p i)
[PROOF STEP]
have "(\<Sum>j\<in>I. coeff (p j) (degree (p i))) = (\<Sum>i\<in>{i}. coeff (p i) (degree (p i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>I. coeff (p j) (degree (p i))) = (\<Sum>i\<in>{i}. lead_coeff (p i))
[PROOF STEP]
using I
[PROOF STATE]
proof (prove)
using this:
finite I
i \<in> I
\<lbrakk>?j \<in> I; ?j \<noteq> i\<rbrakk> \<Longrightarrow> degree (p ?j) < degree (p i)

goal (1 subgoal):
 1. (\<Sum>j\<in>I. coeff (p j) (degree (p i))) = (\<Sum>i\<in>{i}. lead_coeff (p i))
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) (auto intro!: coeff_eq_0)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>I. coeff (p j) (degree (p i))) = (\<Sum>i\<in>{i}. lead_coeff (p i))

goal (1 subgoal):
 1. coeff (sum p I) (degree (p i)) = lead_coeff (p i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j\<in>I. coeff (p j) (degree (p i))) = (\<Sum>i\<in>{i}. lead_coeff (p i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j\<in>I. coeff (p j) (degree (p i))) = (\<Sum>i\<in>{i}. lead_coeff (p i))

goal (1 subgoal):
 1. coeff (sum p I) (degree (p i)) = lead_coeff (p i)
[PROOF STEP]
by (simp add: coeff_sum)
[PROOF STATE]
proof (state)
this:
coeff (sum p I) (degree (p i)) = lead_coeff (p i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SA_zero_set_memE:
  assumes "f \<in> carrier (SA n)"
  assumes "x \<in> SA_zero_set n f"
  shows "f x = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = \<zero>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
x \<in> SA_zero_set n f

goal (1 subgoal):
 1. f x = \<zero>
[PROOF STEP]
unfolding SA_zero_set_def
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x = \<zero>}

goal (1 subgoal):
 1. f x = \<zero>
[PROOF STEP]
by blast


[STATEMENT]
theorem sorted_merge_sort [simp, intro]: "sorted (merge_sort xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (merge_sort xs)
[PROOF STEP]
by (induction xs rule: merge_sort.induct)
     (subst merge_sort.simps, use sorted01 in auto)


[STATEMENT]
lemma metric_LIMSEQ_D: "X \<longlonglongrightarrow> L \<Longrightarrow> 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (X n) L < r"
  for L :: "'a::metric_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow> L; 0 < r\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (X n) L < r
[PROOF STEP]
by (simp add: lim_sequentially)


[STATEMENT]
lemma isCont_tan: "cos x \<noteq> 0 \<Longrightarrow> isCont tan x"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<noteq> (0::'a) \<Longrightarrow> isCont tan x
[PROOF STEP]
by (rule DERIV_tan [THEN DERIV_isCont])


[STATEMENT]
lemma Gcd_group_closure_in_group_closure:
  "Gcd (group_closure S) \<in> group_closure S" for S :: "int set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
proof (cases "S \<subseteq> {0}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
 2. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S \<subseteq> {0}

goal (2 subgoals):
 1. S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
 2. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> {0}
[PROOF STEP]
have "S = {} \<or> S = {0}"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {0}

goal (1 subgoal):
 1. S = {} \<or> S = {0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S = {} \<or> S = {0}

goal (2 subgoals):
 1. S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
 2. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {} \<or> S = {0}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {} \<or> S = {0}

goal (1 subgoal):
 1. Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Gcd (group_closure S) \<in> group_closure S

goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> S \<subseteq> {0}

goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> S \<subseteq> {0}
[PROOF STEP]
obtain s where s: "s \<noteq> 0" "s \<in> S"
[PROOF STATE]
proof (prove)
using this:
\<not> S \<subseteq> {0}

goal (1 subgoal):
 1. (\<And>s. \<lbrakk>s \<noteq> 0; s \<in> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s \<noteq> 0
s \<in> S

goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s \<noteq> 0
s \<in> S
[PROOF STEP]
have s': "\<bar>s\<bar> \<noteq> 0" "\<bar>s\<bar> \<in> group_closure S"
[PROOF STATE]
proof (prove)
using this:
s \<noteq> 0
s \<in> S

goal (1 subgoal):
 1. \<bar>s\<bar> \<noteq> 0 &&& \<bar>s\<bar> \<in> group_closure S
[PROOF STEP]
by (auto intro: group_closure.base)
[PROOF STATE]
proof (state)
this:
\<bar>s\<bar> \<noteq> 0
\<bar>s\<bar> \<in> group_closure S

goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
define m where "m = (LEAST n. n > 0 \<and> int n \<in> group_closure S)"
[PROOF STATE]
proof (state)
this:
m = (LEAST n. 0 < n \<and> int n \<in> group_closure S)

goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
have "m > 0 \<and> int m \<in> group_closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<and> int m \<in> group_closure S
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (LEAST n. 0 < n \<and> int n \<in> group_closure S) \<and> int (LEAST n. 0 < n \<and> int n \<in> group_closure S) \<in> group_closure S
[PROOF STEP]
apply (rule LeastI [of _ "nat \<bar>s\<bar>"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < nat \<bar>s\<bar> \<and> int (nat \<bar>s\<bar>) \<in> group_closure S
[PROOF STEP]
using s'
[PROOF STATE]
proof (prove)
using this:
\<bar>s\<bar> \<noteq> 0
\<bar>s\<bar> \<in> group_closure S

goal (1 subgoal):
 1. 0 < nat \<bar>s\<bar> \<and> int (nat \<bar>s\<bar>) \<in> group_closure S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < m \<and> int m \<in> group_closure S

goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < m \<and> int m \<in> group_closure S
[PROOF STEP]
have m: "int m \<in> group_closure S" and "0 < m"
[PROOF STATE]
proof (prove)
using this:
0 < m \<and> int m \<in> group_closure S

goal (1 subgoal):
 1. int m \<in> group_closure S &&& 0 < m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int m \<in> group_closure S
0 < m

goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
have "Gcd (group_closure S) = int m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd (group_closure S) = int m
[PROOF STEP]
proof (rule associated_eqI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. Gcd (group_closure S) dvd int m
 2. int m dvd Gcd (group_closure S)
 3. normalize (Gcd (group_closure S)) = Gcd (group_closure S)
 4. normalize (int m) = int m
[PROOF STEP]
from m
[PROOF STATE]
proof (chain)
picking this:
int m \<in> group_closure S
[PROOF STEP]
show "Gcd (group_closure S) dvd int m"
[PROOF STATE]
proof (prove)
using this:
int m \<in> group_closure S

goal (1 subgoal):
 1. Gcd (group_closure S) dvd int m
[PROOF STEP]
by (rule Gcd_dvd)
[PROOF STATE]
proof (state)
this:
Gcd (group_closure S) dvd int m

goal (3 subgoals):
 1. int m dvd Gcd (group_closure S)
 2. normalize (Gcd (group_closure S)) = Gcd (group_closure S)
 3. normalize (int m) = int m
[PROOF STEP]
show "int m dvd Gcd (group_closure S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int m dvd Gcd (group_closure S)
[PROOF STEP]
proof (rule Gcd_greatest)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> group_closure S \<Longrightarrow> int m dvd b
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> group_closure S \<Longrightarrow> int m dvd b
[PROOF STEP]
assume s: "s \<in> group_closure S"
[PROOF STATE]
proof (state)
this:
s \<in> group_closure S

goal (1 subgoal):
 1. \<And>b. b \<in> group_closure S \<Longrightarrow> int m dvd b
[PROOF STEP]
show "int m dvd s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int m dvd s
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> int m dvd s \<Longrightarrow> False
[PROOF STEP]
assume "\<not> int m dvd s"
[PROOF STATE]
proof (state)
this:
\<not> int m dvd s

goal (1 subgoal):
 1. \<not> int m dvd s \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> int m dvd s
[PROOF STEP]
have *: "0 < s mod int m"
[PROOF STATE]
proof (prove)
using this:
\<not> int m dvd s

goal (1 subgoal):
 1. 0 < s mod int m
[PROOF STEP]
using \<open>0 < m\<close> le_less
[PROOF STATE]
proof (prove)
using this:
\<not> int m dvd s
0 < m
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

goal (1 subgoal):
 1. 0 < s mod int m
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < s mod int m

goal (1 subgoal):
 1. \<not> int m dvd s \<Longrightarrow> False
[PROOF STEP]
have "m \<le> nat (s mod int m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> nat (s mod int m)
[PROOF STEP]
proof (subst m_def, rule Least_le, rule)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < nat (s mod int m)
 2. int (nat (s mod int m)) \<in> group_closure S
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
0 < s mod int m
[PROOF STEP]
show "0 < nat (s mod int m)"
[PROOF STATE]
proof (prove)
using this:
0 < s mod int m

goal (1 subgoal):
 1. 0 < nat (s mod int m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < nat (s mod int m)

goal (1 subgoal):
 1. int (nat (s mod int m)) \<in> group_closure S
[PROOF STEP]
from minus_div_mult_eq_mod [symmetric, of s "int m"]
[PROOF STATE]
proof (chain)
picking this:
s mod int m = s - s div int m * int m
[PROOF STEP]
have "s mod int m = s - s div int m * int m"
[PROOF STATE]
proof (prove)
using this:
s mod int m = s - s div int m * int m

goal (1 subgoal):
 1. s mod int m = s - s div int m * int m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s mod int m = s - s div int m * int m

goal (1 subgoal):
 1. int (nat (s mod int m)) \<in> group_closure S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
s mod int m = s - s div int m * int m

goal (1 subgoal):
 1. int (nat (s mod int m)) \<in> group_closure S
[PROOF STEP]
have "s - s div int m * int m \<in> group_closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s - s div int m * int m \<in> group_closure S
[PROOF STEP]
by (auto intro: group_closure.diff s group_closure_mult_right m)
[PROOF STATE]
proof (state)
this:
s - s div int m * int m \<in> group_closure S

goal (1 subgoal):
 1. int (nat (s mod int m)) \<in> group_closure S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
s mod int m \<in> group_closure S
[PROOF STEP]
show "int (nat (s mod int m)) \<in> group_closure S"
[PROOF STATE]
proof (prove)
using this:
s mod int m \<in> group_closure S

goal (1 subgoal):
 1. int (nat (s mod int m)) \<in> group_closure S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (nat (s mod int m)) \<in> group_closure S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
m \<le> nat (s mod int m)

goal (1 subgoal):
 1. \<not> int m dvd s \<Longrightarrow> False
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
0 < s mod int m
m \<le> nat (s mod int m)
[PROOF STEP]
have "int m \<le> s mod int m"
[PROOF STATE]
proof (prove)
using this:
0 < s mod int m
m \<le> nat (s mod int m)

goal (1 subgoal):
 1. int m \<le> s mod int m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int m \<le> s mod int m

goal (1 subgoal):
 1. \<not> int m dvd s \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
int m \<le> s mod int m

goal (1 subgoal):
 1. \<not> int m dvd s \<Longrightarrow> False
[PROOF STEP]
have "s mod int m < int m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s mod int m < int m
[PROOF STEP]
using \<open>0 < m\<close>
[PROOF STATE]
proof (prove)
using this:
0 < m

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

goal (1 subgoal):
 1. \<not> int m dvd s \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
int m \<le> s mod int m
s mod int m < int m
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
int m \<le> s mod int m
s mod int m < int m

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
int m dvd s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
int m dvd Gcd (group_closure S)

goal (2 subgoals):
 1. normalize (Gcd (group_closure S)) = Gcd (group_closure S)
 2. normalize (int m) = int m
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
Gcd (group_closure S) = int m

goal (1 subgoal):
 1. \<not> S \<subseteq> {0} \<Longrightarrow> Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
with m
[PROOF STATE]
proof (chain)
picking this:
int m \<in> group_closure S
Gcd (group_closure S) = int m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
int m \<in> group_closure S
Gcd (group_closure S) = int m

goal (1 subgoal):
 1. Gcd (group_closure S) \<in> group_closure S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Gcd (group_closure S) \<in> group_closure S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem lconfluent_confluent:
  "\<lbrakk> wfP (R^--1); \<And>a b c. R a b \<Longrightarrow> R a c \<Longrightarrow> \<exists>d. R^** b d \<and> R^** c d  \<rbrakk> \<Longrightarrow> confluent R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wfP R\<inverse>\<inverse>; \<And>a b c. \<lbrakk>R a b; R a c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d\<rbrakk> \<Longrightarrow> confluent R
[PROOF STEP]
by(auto simp add: diamond_def commute_def square_def intro: newman)


[STATEMENT]
lemma merge_fcard_le1_sub: "is_subtree t1 (merge t2) \<Longrightarrow> fcard (sucs t1) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_subtree t1 (merge t2) \<Longrightarrow> fcard (sucs t1) \<le> 1
[PROOF STEP]
using merge_mdeg_le1_sub mdeg_ge_fcard[of "sucs t1" "root t1"]
[PROOF STATE]
proof (prove)
using this:
is_subtree ?t1.0 (merge ?t2.0) \<Longrightarrow> max_deg ?t1.0 \<le> 1
fcard (sucs t1) \<le> max_deg (Node (dtree.root t1) (sucs t1))

goal (1 subgoal):
 1. is_subtree t1 (merge t2) \<Longrightarrow> fcard (sucs t1) \<le> 1
[PROOF STEP]
by force


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


[STATEMENT]
lemma set_inter_mem:
assumes "x mem l1"
       and "x mem l2"
shows "set l1 \<inter> set l2 \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set l1 \<inter> set l2 \<noteq> {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x mem l1
x mem l2

goal (1 subgoal):
 1. set l1 \<inter> set l2 \<noteq> {}
[PROOF STEP]
by (metis IntI empty_iff mem_set_1)


[STATEMENT]
lemma homotopic_loops_imp_homotopic_circlemaps:
  assumes "homotopic_loops S p q"
    shows "homotopic_with_canon (\<lambda>h. True) (sphere 0 1) S
                          (p \<circ> (\<lambda>z. (Arg2pi z / (2 * pi))))
                          (q \<circ> (\<lambda>z. (Arg2pi z / (2 * pi))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) (sphere 0 1) S (p \<circ> (\<lambda>z. Arg2pi z / (2 * pi))) (q \<circ> (\<lambda>z. Arg2pi z / (2 * pi)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) (sphere 0 1) S (p \<circ> (\<lambda>z. Arg2pi z / (2 * pi))) (q \<circ> (\<lambda>z. Arg2pi z / (2 * pi)))
[PROOF STEP]
obtain h where conth: "continuous_on ({0..1::real} \<times> {0..1}) h"
             and him: "h ` ({0..1} \<times> {0..1}) \<subseteq> S"
             and h0: "(\<forall>x. h (0, x) = p x)"
             and h1: "(\<forall>x. h (1, x) = q x)"
             and h01: "(\<forall>t\<in>{0..1}. h (t, 1) = h (t, 0)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. \<lbrakk>continuous_on ({0..1} \<times> {0..1}) h; h ` ({0..1} \<times> {0..1}) \<subseteq> S; \<forall>x. h (0, x) = p x; \<forall>x. h (1, x) = q x; \<forall>t\<in>{0..1}. h (t, 1) = h (t, 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
homotopic_loops S p q

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>continuous_on ({0..1} \<times> {0..1}) h; h ` ({0..1} \<times> {0..1}) \<subseteq> S; \<forall>x. h (0, x) = p x; \<forall>x. h (1, x) = q x; \<forall>t\<in>{0..1}. h (t, 1) = h (t, 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: homotopic_loops_def sphere_def homotopic_with_def pathstart_def pathfinish_def)
[PROOF STATE]
proof (state)
this:
continuous_on ({0..1} \<times> {0..1}) h
h ` ({0..1} \<times> {0..1}) \<subseteq> S
\<forall>x. h (0, x) = p x
\<forall>x. h (1, x) = q x
\<forall>t\<in>{0..1}. h (t, 1) = h (t, 0)

goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) (sphere 0 1) S (p \<circ> (\<lambda>z. Arg2pi z / (2 * pi))) (q \<circ> (\<lambda>z. Arg2pi z / (2 * pi)))
[PROOF STEP]
define j where "j \<equiv> \<lambda>z. if 0 \<le> Im (snd z)
                          then h (fst z, Arg2pi (snd z) / (2 * pi))
                          else h (fst z, 1 - Arg2pi (cnj (snd z)) / (2 * pi))"
[PROOF STATE]
proof (state)
this:
j \<equiv> \<lambda>z. if 0 \<le> Im (snd z) then h (fst z, Arg2pi (snd z) / (2 * pi)) else h (fst z, 1 - Arg2pi (cnj (snd z)) / (2 * pi))

goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) (sphere 0 1) S (p \<circ> (\<lambda>z. Arg2pi z / (2 * pi))) (q \<circ> (\<lambda>z. Arg2pi z / (2 * pi)))
[PROOF STEP]
have Arg2pi_eq: "1 - Arg2pi (cnj y) / (2 * pi) = Arg2pi y / (2 * pi) \<or> Arg2pi y = 0 \<and> Arg2pi (cnj y) = 0" if "cmod y = 1" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - Arg2pi (cnj y) / (2 * pi) = Arg2pi y / (2 * pi) \<or> Arg2pi y = 0 \<and> Arg2pi (cnj y) = 0
[PROOF STEP]
using that Arg2pi_eq_0_pi Arg2pi_eq_pi
[PROOF STATE]
proof (prove)
using this:
cmod y = 1
(Arg2pi ?z = 0 \<or> Arg2pi ?z = pi) = (?z \<in> \<real>)
(Arg2pi ?z = pi) = (?z \<in> \<real> \<and> Re ?z < 0)

goal (1 subgoal):
 1. 1 - Arg2pi (cnj y) / (2 * pi) = Arg2pi y / (2 * pi) \<or> Arg2pi y = 0 \<and> Arg2pi (cnj y) = 0
[PROOF STEP]
by (force simp: Arg2pi_cnj field_split_simps)
[PROOF STATE]
proof (state)
this:
cmod ?y = 1 \<Longrightarrow> 1 - Arg2pi (cnj ?y) / (2 * pi) = Arg2pi ?y / (2 * pi) \<or> Arg2pi ?y = 0 \<and> Arg2pi (cnj ?y) = 0

goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) (sphere 0 1) S (p \<circ> (\<lambda>z. Arg2pi z / (2 * pi))) (q \<circ> (\<lambda>z. Arg2pi z / (2 * pi)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>h. True) (sphere 0 1) S (p \<circ> (\<lambda>z. Arg2pi z / (2 * pi))) (q \<circ> (\<lambda>z. Arg2pi z / (2 * pi)))
[PROOF STEP]
proof (simp add: homotopic_with; intro conjI ballI exI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. continuous_on ({0..1} \<times> sphere 0 1) ?h10
 2. ?h10 ` ({0..1} \<times> sphere 0 1) \<subseteq> S
 3. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> ?h10 (0, x) = p (Arg2pi x / (2 * pi))
 4. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> ?h10 (1, x) = q (Arg2pi x / (2 * pi))
[PROOF STEP]
show "continuous_on ({0..1} \<times> sphere 0 1) (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1) (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi)))
[PROOF STEP]
proof (rule continuous_on_eq)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. continuous_on ({0..1} \<times> sphere 0 1) ?f
 2. \<And>x. x \<in> {0..1} \<times> sphere 0 1 \<Longrightarrow> ?f x = h (fst x, Arg2pi (snd x) / (2 * pi))
[PROOF STEP]
show j: "j x = h (fst x, Arg2pi (snd x) / (2 * pi))" if "x \<in> {0..1} \<times> sphere 0 1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j x = h (fst x, Arg2pi (snd x) / (2 * pi))
[PROOF STEP]
using Arg2pi_eq that h01
[PROOF STATE]
proof (prove)
using this:
cmod ?y = 1 \<Longrightarrow> 1 - Arg2pi (cnj ?y) / (2 * pi) = Arg2pi ?y / (2 * pi) \<or> Arg2pi ?y = 0 \<and> Arg2pi (cnj ?y) = 0
x \<in> {0..1} \<times> sphere 0 1
\<forall>t\<in>{0..1}. h (t, 1) = h (t, 0)

goal (1 subgoal):
 1. j x = h (fst x, Arg2pi (snd x) / (2 * pi))
[PROOF STEP]
by (force simp: j_def)
[PROOF STATE]
proof (state)
this:
?x \<in> {0..1} \<times> sphere 0 1 \<Longrightarrow> j ?x = h (fst ?x, Arg2pi (snd ?x) / (2 * pi))

goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1) j
[PROOF STEP]
have eq:  "S = S \<inter> (UNIV \<times> {z. 0 \<le> Im z}) \<union> S \<inter> (UNIV \<times> {z. Im z \<le> 0})" for S :: "(real*complex)set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = S \<inter> UNIV \<times> {z. 0 \<le> Im z} \<union> S \<inter> UNIV \<times> {z. Im z \<le> 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?S = ?S \<inter> UNIV \<times> {z. 0 \<le> Im z} \<union> ?S \<inter> UNIV \<times> {z. Im z \<le> 0}

goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1) j
[PROOF STEP]
have c1: "continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z}) (\<lambda>x. h (fst x, Arg2pi (snd x) / (2 * pi)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z}) (\<lambda>x. h (fst x, Arg2pi (snd x) / (2 * pi)))
[PROOF STEP]
apply (intro continuous_intros continuous_on_compose2 [OF conth]  continuous_on_compose2 [OF continuous_on_upperhalf_Arg2pi])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. snd ` ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z}) \<subseteq> {z. 0 \<le> Im z} - {0}
 2. \<forall>x\<in>{0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z}. 2 * pi \<noteq> 0
 3. (\<lambda>x. (fst x, Arg2pi (snd x) / (2 * pi))) ` ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z}) \<subseteq> {0..1} \<times> {0..1}
[PROOF STEP]
apply (auto simp: Arg2pi)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa ba. \<lbrakk>cmod ba = 1; 0 \<le> Im ba; 0 \<le> aa; aa \<le> 1\<rbrakk> \<Longrightarrow> Arg2pi ba \<le> 2 * pi
[PROOF STEP]
apply (meson Arg2pi_lt_2pi linear not_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z}) (\<lambda>x. h (fst x, Arg2pi (snd x) / (2 * pi)))

goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1) j
[PROOF STEP]
have c2: "continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}) (\<lambda>x. h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}) (\<lambda>x. h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi)))
[PROOF STEP]
apply (intro continuous_intros continuous_on_compose2 [OF conth]  continuous_on_compose2 [OF continuous_on_upperhalf_Arg2pi])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>x. cnj (snd x)) ` ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}) \<subseteq> {z. 0 \<le> Im z} - {0}
 2. \<forall>x\<in>{0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}. 2 * pi \<noteq> 0
 3. (\<lambda>x. (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi))) ` ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}) \<subseteq> {0..1} \<times> {0..1}
[PROOF STEP]
apply (auto simp: Arg2pi)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa ba. \<lbrakk>cmod ba = 1; Im ba \<le> 0; 0 \<le> aa; aa \<le> 1\<rbrakk> \<Longrightarrow> Arg2pi (cnj ba) \<le> 2 * pi
[PROOF STEP]
apply (meson Arg2pi_lt_2pi linear not_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}) (\<lambda>x. h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi)))

goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1) j
[PROOF STEP]
show "continuous_on ({0..1} \<times> sphere 0 1) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1) j
[PROOF STEP]
apply (simp add: j_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1) (\<lambda>x. if 0 \<le> Im (snd x) then h (fst x, Arg2pi (snd x) / (2 * pi)) else h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi)))
[PROOF STEP]
apply (subst eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z} \<union> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}) (\<lambda>x. if 0 \<le> Im (snd x) then h (fst x, Arg2pi (snd x) / (2 * pi)) else h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi)))
[PROOF STEP]
apply (rule continuous_on_cases_local)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. closedin (top_of_set ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z} \<union> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0})) ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z})
 2. closedin (top_of_set ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z} \<union> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0})) ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0})
 3. continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z}) (\<lambda>x. h (fst x, Arg2pi (snd x) / (2 * pi)))
 4. continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}) (\<lambda>x. h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi)))
 5. \<And>x. x \<in> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z} \<and> \<not> 0 \<le> Im (snd x) \<or> x \<in> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0} \<and> 0 \<le> Im (snd x) \<Longrightarrow> h (fst x, Arg2pi (snd x) / (2 * pi)) = h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi))
[PROOF STEP]
using Arg2pi_eq h01
[PROOF STATE]
proof (prove)
using this:
cmod ?y = 1 \<Longrightarrow> 1 - Arg2pi (cnj ?y) / (2 * pi) = Arg2pi ?y / (2 * pi) \<or> Arg2pi ?y = 0 \<and> Arg2pi (cnj ?y) = 0
\<forall>t\<in>{0..1}. h (t, 1) = h (t, 0)

goal (5 subgoals):
 1. closedin (top_of_set ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z} \<union> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0})) ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z})
 2. closedin (top_of_set ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z} \<union> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0})) ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0})
 3. continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z}) (\<lambda>x. h (fst x, Arg2pi (snd x) / (2 * pi)))
 4. continuous_on ({0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0}) (\<lambda>x. h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi)))
 5. \<And>x. x \<in> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. 0 \<le> Im z} \<and> \<not> 0 \<le> Im (snd x) \<or> x \<in> {0..1} \<times> sphere 0 1 \<inter> UNIV \<times> {z. Im z \<le> 0} \<and> 0 \<le> Im (snd x) \<Longrightarrow> h (fst x, Arg2pi (snd x) / (2 * pi)) = h (fst x, 1 - Arg2pi (cnj (snd x)) / (2 * pi))
[PROOF STEP]
by (force simp add: eq [symmetric] closedin_closed_Int closed_Times closed_halfspace_Im_le closed_halfspace_Im_ge c1 c2)+
[PROOF STATE]
proof (state)
this:
continuous_on ({0..1} \<times> sphere 0 1) j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous_on ({0..1} \<times> sphere 0 1) (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi)))

goal (3 subgoals):
 1. (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S
 2. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (0, x), Arg2pi (snd (0, x)) / (2 * pi)) = p (Arg2pi x / (2 * pi))
 3. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (1, x), Arg2pi (snd (1, x)) / (2 * pi)) = q (Arg2pi x / (2 * pi))
[PROOF STEP]
have "(\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> h ` ({0..1} \<times> {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> h ` ({0..1} \<times> {0..1})
[PROOF STEP]
by (auto simp: Arg2pi_ge_0 Arg2pi_lt_2pi less_imp_le)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> h ` ({0..1} \<times> {0..1})

goal (3 subgoals):
 1. (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S
 2. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (0, x), Arg2pi (snd (0, x)) / (2 * pi)) = p (Arg2pi x / (2 * pi))
 3. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (1, x), Arg2pi (snd (1, x)) / (2 * pi)) = q (Arg2pi x / (2 * pi))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> h ` ({0..1} \<times> {0..1})

goal (3 subgoals):
 1. (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S
 2. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (0, x), Arg2pi (snd (0, x)) / (2 * pi)) = p (Arg2pi x / (2 * pi))
 3. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (1, x), Arg2pi (snd (1, x)) / (2 * pi)) = q (Arg2pi x / (2 * pi))
[PROOF STEP]
have "... \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h ` ({0..1} \<times> {0..1}) \<subseteq> S
[PROOF STEP]
using him
[PROOF STATE]
proof (prove)
using this:
h ` ({0..1} \<times> {0..1}) \<subseteq> S

goal (1 subgoal):
 1. h ` ({0..1} \<times> {0..1}) \<subseteq> S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
h ` ({0..1} \<times> {0..1}) \<subseteq> S

goal (3 subgoals):
 1. (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S
 2. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (0, x), Arg2pi (snd (0, x)) / (2 * pi)) = p (Arg2pi x / (2 * pi))
 3. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (1, x), Arg2pi (snd (1, x)) / (2 * pi)) = q (Arg2pi x / (2 * pi))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S
[PROOF STEP]
show "(\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S

goal (1 subgoal):
 1. (\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>w. h (fst w, Arg2pi (snd w) / (2 * pi))) ` ({0..1} \<times> sphere 0 1) \<subseteq> S

goal (2 subgoals):
 1. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (0, x), Arg2pi (snd (0, x)) / (2 * pi)) = p (Arg2pi x / (2 * pi))
 2. \<And>x. x \<in> sphere 0 1 \<Longrightarrow> h (fst (1, x), Arg2pi (snd (1, x)) / (2 * pi)) = q (Arg2pi x / (2 * pi))
[PROOF STEP]
qed (auto simp: h0 h1)
[PROOF STATE]
proof (state)
this:
homotopic_with_canon (\<lambda>h. True) (sphere 0 1) S (p \<circ> (\<lambda>z. Arg2pi z / (2 * pi))) (q \<circ> (\<lambda>z. Arg2pi z / (2 * pi)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma top_eq:  "\<lbrakk> t \<in> carrier L; \<And> x. x \<in> carrier L \<Longrightarrow> x \<sqsubseteq> t \<rbrakk> \<Longrightarrow> t = \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t \<in> carrier L; \<And>x. x \<in> carrier L \<Longrightarrow> x \<sqsubseteq> t\<rbrakk> \<Longrightarrow> t = \<top>
[PROOF STEP]
by (metis le_antisym top_closed top_higher)


[STATEMENT]
lemma lm101:
  assumes "x \<notin> set xs"
          "set (injections_alg xs Y) = injections (set xs) Y"
          "finite Y"
  shows    "set (injections_alg (x#xs) Y) = injections ({x} \<union> set xs) Y"
  (is "?l=?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (injections_alg (x # xs) Y) = injections ({x} \<union> set xs) Y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (injections_alg (x # xs) Y) = injections ({x} \<union> set xs) Y
[PROOF STEP]
have "?l = (\<Union> f\<in>injections (set xs) Y. {f +* {(x,y)} | y . y \<in> Y-Range f})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (injections_alg (x # xs) Y) = (\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f})
[PROOF STEP]
using assms(2,3) lm095
[PROOF STATE]
proof (prove)
using this:
set (injections_alg xs Y) = injections (set xs) Y
finite Y
finite ?Y \<Longrightarrow> set (concat (map (\<lambda>f. map (\<lambda>y. f +< {(?x, y)}) (sorted_list_of_set (?Y - Range f))) ?F)) = (\<Union>f\<in>set ?F. {f +< {(?x, y)} |y. y \<in> ?Y - Range f})

goal (1 subgoal):
 1. set (injections_alg (x # xs) Y) = (\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (injections_alg (x # xs) Y) = (\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f})

goal (1 subgoal):
 1. set (injections_alg (x # xs) Y) = injections ({x} \<union> set xs) Y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (injections_alg (x # xs) Y) = (\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f})

goal (1 subgoal):
 1. set (injections_alg (x # xs) Y) = injections ({x} \<union> set xs) Y
[PROOF STEP]
have "... = ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f}) = injections ({x} \<union> set xs) Y
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<notin> set xs

goal (1 subgoal):
 1. (\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f}) = injections ({x} \<union> set xs) Y
[PROOF STEP]
by (rule lm090)
[PROOF STATE]
proof (state)
this:
(\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f}) = injections ({x} \<union> set xs) Y

goal (1 subgoal):
 1. set (injections_alg (x # xs) Y) = injections ({x} \<union> set xs) Y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (injections_alg (x # xs) Y) = (\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f})
(\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f}) = injections ({x} \<union> set xs) Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (injections_alg (x # xs) Y) = (\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f})
(\<Union>f\<in>injections (set xs) Y. {f +< {(x, y)} |y. y \<in> Y - Range f}) = injections ({x} \<union> set xs) Y

goal (1 subgoal):
 1. set (injections_alg (x # xs) Y) = injections ({x} \<union> set xs) Y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (injections_alg (x # xs) Y) = injections ({x} \<union> set xs) Y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prefix_Suc: "prefix f (Suc n) = prefix f n @ [the (f (Suc n))]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix f (Suc n) = prefix f n @ [the (f (Suc n))]
[PROOF STEP]
unfolding prefix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>x. the (f x)) [0..<Suc (Suc n)] = map (\<lambda>x. the (f x)) [0..<Suc n] @ [the (f (Suc n))]
[PROOF STEP]
by simp


[STATEMENT]
lemma truncate_down_eq_truncate_up: "truncate_down p x = - truncate_up p (-x)"
  and truncate_up_eq_truncate_down: "truncate_up p x = - truncate_down p (-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. truncate_down p x = - truncate_up p (- x) &&& truncate_up p x = - truncate_down p (- x)
[PROOF STEP]
by (auto simp: truncate_up_uminus_eq truncate_down_uminus_eq)


[STATEMENT]
lemma gcd_fib_mod: "0 < m \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
proof (induct n rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < m\<rbrakk> \<Longrightarrow> gcd (fib m) (fib (y mod m)) = gcd (fib m) (fib y); 0 < m\<rbrakk> \<Longrightarrow> gcd (fib m) (fib (x mod m)) = gcd (fib m) (fib x)
[PROOF STEP]
case (less n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y < n; 0 < m\<rbrakk> \<Longrightarrow> gcd (fib m) (fib (?y mod m)) = gcd (fib m) (fib ?y)
0 < m

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < m\<rbrakk> \<Longrightarrow> gcd (fib m) (fib (y mod m)) = gcd (fib m) (fib y); 0 < m\<rbrakk> \<Longrightarrow> gcd (fib m) (fib (x mod m)) = gcd (fib m) (fib x)
[PROOF STEP]
show "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
proof (cases "m < n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
m < n

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m < n
[PROOF STEP]
have "m \<le> n"
[PROOF STATE]
proof (prove)
using this:
m < n

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

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
with \<open>0 < m\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < m
m \<le> n
[PROOF STEP]
have "0 < n"
[PROOF STATE]
proof (prove)
using this:
0 < m
m \<le> n

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

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
with \<open>0 < m\<close> \<open>m < n\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < m
m < n
0 < n
[PROOF STEP]
have *: "n - m < n"
[PROOF STATE]
proof (prove)
using this:
0 < m
m < n
0 < n

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

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
have "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib ((n - m) mod m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib ((n - m) mod m))
[PROOF STEP]
by (simp add: mod_if [of n]) (use \<open>m < n\<close> in auto)
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib ((n - m) mod m))

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib ((n - m) mod m))

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
have "\<dots> = gcd (fib m)  (fib (n - m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib (n - m))
[PROOF STEP]
by (simp add: less.hyps * \<open>0 < m\<close>)
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib (n - m))

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib (n - m))

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
have "\<dots> = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib m) (fib (n - m)) = gcd (fib m) (fib n)
[PROOF STEP]
by (simp add: gcd_fib_diff \<open>m \<le> n\<close>)
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n - m)) = gcd (fib m) (fib n)

goal (2 subgoals):
 1. m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
 2. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
show "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
using this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> m < n

goal (1 subgoal):
 1. \<not> m < n \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> m < n
[PROOF STEP]
show "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
using this:
\<not> m < n

goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
by (cases "m = n") auto
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_pair_iff: "(a, b) \<in>\<^sub>p A \<longleftrightarrow> ((a, b) \<in> A \<or> (b, a) \<in> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((a, b) \<in>\<^sub>p A) = ((a, b) \<in> A \<or> (b, a) \<in> A)
[PROOF STEP]
by (simp add: in_pair_alt)


[STATEMENT]
lemma "Rep_check (Abs_check n) = n \<Longrightarrow> n < 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_check (Abs_check n) = n \<Longrightarrow> n < 2
[PROOF STEP]
nitpick [card = 1-3, expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_check (Abs_check n) = n \<Longrightarrow> n < 2
[PROOF STEP]
using Rep_check[of "Abs_check n"]
[PROOF STATE]
proof (prove)
using this:
Rep_check (Abs_check n) \<in> {x. x < 2}

goal (1 subgoal):
 1. Rep_check (Abs_check n) = n \<Longrightarrow> n < 2
[PROOF STEP]
by auto


[STATEMENT]
lemma size_abort_isSng: "op_map_isSng s \<longleftrightarrow> op_map_size_abort 2 s = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_map_isSng s = (op_map_size_abort 2 s = 1)
[PROOF STEP]
by (auto simp: dom_eq_singleton_conv min_def dest!: card_eq_SucD)


[STATEMENT]
lemma curve_elt_opp:
  assumes "p\<^sub>1 = Point x\<^sub>1 y\<^sub>1"
  and "p\<^sub>2 = Point x\<^sub>2 y\<^sub>2"
  and "on_curve a b p\<^sub>1"
  and "on_curve a b p\<^sub>2"
  and "x\<^sub>1 = x\<^sub>2"
  shows "p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2
[PROOF STEP]
from \<open>p\<^sub>1 = Point x\<^sub>1 y\<^sub>1\<close> \<open>on_curve a b p\<^sub>1\<close>
[PROOF STATE]
proof (chain)
picking this:
p\<^sub>1 = Point x\<^sub>1 y\<^sub>1
on_curve a b p\<^sub>1
[PROOF STEP]
have "y\<^sub>1 \<in> carrier R" "y\<^sub>1 [^] (2::nat) = x\<^sub>1 [^] (3::nat) \<oplus> a \<otimes> x\<^sub>1 \<oplus> b"
[PROOF STATE]
proof (prove)
using this:
p\<^sub>1 = Point x\<^sub>1 y\<^sub>1
on_curve a b p\<^sub>1

goal (1 subgoal):
 1. y\<^sub>1 \<in> carrier R &&& y\<^sub>1 [^] 2 = x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b
[PROOF STEP]
by (simp_all add: on_curve_def)
[PROOF STATE]
proof (state)
this:
y\<^sub>1 \<in> carrier R
y\<^sub>1 [^] 2 = x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b

goal (1 subgoal):
 1. p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
y\<^sub>1 \<in> carrier R
y\<^sub>1 [^] 2 = x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b

goal (1 subgoal):
 1. p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2
[PROOF STEP]
from \<open>p\<^sub>2 = Point x\<^sub>2 y\<^sub>2\<close> \<open>on_curve a b p\<^sub>2\<close> \<open>x\<^sub>1 = x\<^sub>2\<close>
[PROOF STATE]
proof (chain)
picking this:
p\<^sub>2 = Point x\<^sub>2 y\<^sub>2
on_curve a b p\<^sub>2
x\<^sub>1 = x\<^sub>2
[PROOF STEP]
have "y\<^sub>2 \<in> carrier R" "x\<^sub>1 [^] (3::nat) \<oplus> a \<otimes> x\<^sub>1 \<oplus> b = y\<^sub>2 [^] (2::nat)"
[PROOF STATE]
proof (prove)
using this:
p\<^sub>2 = Point x\<^sub>2 y\<^sub>2
on_curve a b p\<^sub>2
x\<^sub>1 = x\<^sub>2

goal (1 subgoal):
 1. y\<^sub>2 \<in> carrier R &&& x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b = y\<^sub>2 [^] 2
[PROOF STEP]
by (simp_all add: on_curve_def)
[PROOF STATE]
proof (state)
this:
y\<^sub>2 \<in> carrier R
x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b = y\<^sub>2 [^] 2

goal (1 subgoal):
 1. p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
y\<^sub>1 \<in> carrier R
y\<^sub>1 [^] 2 = x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b
y\<^sub>2 \<in> carrier R
x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b = y\<^sub>2 [^] 2
[PROOF STEP]
have "y\<^sub>1 = y\<^sub>2 \<or> y\<^sub>1 = \<ominus> y\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
y\<^sub>1 \<in> carrier R
y\<^sub>1 [^] 2 = x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b
y\<^sub>2 \<in> carrier R
x\<^sub>1 [^] 3 \<oplus> a \<otimes> x\<^sub>1 \<oplus> b = y\<^sub>2 [^] 2

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

goal (1 subgoal):
 1. p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2
[PROOF STEP]
with \<open>p\<^sub>1 = Point x\<^sub>1 y\<^sub>1\<close> \<open>p\<^sub>2 = Point x\<^sub>2 y\<^sub>2\<close> \<open>x\<^sub>1 = x\<^sub>2\<close>
[PROOF STATE]
proof (chain)
picking this:
p\<^sub>1 = Point x\<^sub>1 y\<^sub>1
p\<^sub>2 = Point x\<^sub>2 y\<^sub>2
x\<^sub>1 = x\<^sub>2
y\<^sub>1 = y\<^sub>2 \<or> y\<^sub>1 = \<ominus> y\<^sub>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p\<^sub>1 = Point x\<^sub>1 y\<^sub>1
p\<^sub>2 = Point x\<^sub>2 y\<^sub>2
x\<^sub>1 = x\<^sub>2
y\<^sub>1 = y\<^sub>2 \<or> y\<^sub>1 = \<ominus> y\<^sub>2

goal (1 subgoal):
 1. p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2
[PROOF STEP]
by (auto simp add: opp_def)
[PROOF STATE]
proof (state)
this:
p\<^sub>1 = p\<^sub>2 \<or> p\<^sub>1 = opp p\<^sub>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compact_eq_bounded_closed:
  fixes S :: "'a::heine_borel set"
  shows "compact S \<longleftrightarrow> bounded S \<and> closed S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact S = (bounded S \<and> closed S)
[PROOF STEP]
using bounded_closed_imp_seq_compact compact_eq_seq_compact_metric compact_imp_bounded compact_imp_closed
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bounded ?S; closed ?S\<rbrakk> \<Longrightarrow> seq_compact ?S
compact ?S = seq_compact ?S
compact ?U \<Longrightarrow> bounded ?U
compact ?s \<Longrightarrow> closed ?s

goal (1 subgoal):
 1. compact S = (bounded S \<and> closed S)
[PROOF STEP]
by auto


[STATEMENT]
lemma prodinf_split_head:
  assumes "convergent_prod f" "f 0 \<noteq> 0"
  shows "(\<Prod>n. f (Suc n)) = prodinf f / f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>n. f (Suc n)) = prodinf f / f 0
[PROOF STEP]
using prodinf_split_initial_segment[of 1] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>convergent_prod f; \<And>i. i < 1 \<Longrightarrow> f i \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> prodinf f = (\<Prod>i. f (i + 1)) * prod f {..<1}
convergent_prod f
f 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<Prod>n. f (Suc n)) = prodinf f / f 0
[PROOF STEP]
by simp


[STATEMENT]
lemma tl_list_minus_butlast_eq_empty:
  assumes "strict_prefix (butlast s) t" and "length s = length t"
  shows "tl (t - (butlast s)) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tl (t - butlast s) = []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_prefix (butlast s) t
length s = length t

goal (1 subgoal):
 1. tl (t - butlast s) = []
[PROOF STEP]
by (metis list.sel(3) list_minus_butlast_eq_butlast_list)


[STATEMENT]
lemma relto_relto_fun_conv: "((a,b) \<in> (relto A B)^^n) = (\<exists> as sel m. relto_fun A B n as sel m (a,b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((a, b) \<in> (B\<^sup>* O A O B\<^sup>*) ^^ n) = (\<exists>as sel m. relto_fun A B n as sel m (a, b))
[PROOF STEP]
using relto_fun_into_reltos[of A B n _ _ _ a b] reltos_into_relto_fun[of a b n B A]
[PROOF STATE]
proof (prove)
using this:
relto_fun A B n ?as ?sel ?m (a, b) \<Longrightarrow> (a, b) \<in> (B\<^sup>* O A O B\<^sup>*) ^^ n
(a, b) \<in> (B\<^sup>* O A O B\<^sup>*) ^^ n \<Longrightarrow> \<exists>as sel m. relto_fun A B n as sel m (a, b)

goal (1 subgoal):
 1. ((a, b) \<in> (B\<^sup>* O A O B\<^sup>*) ^^ n) = (\<exists>as sel m. relto_fun A B n as sel m (a, b))
[PROOF STEP]
by blast


[STATEMENT]
lemma independent_explicit_module:
  "independent s \<longleftrightarrow> (\<forall>t u v. finite t \<longrightarrow> t \<subseteq> s \<longrightarrow> (\<Sum>v\<in>t. u v *s v) = 0 \<longrightarrow> v \<in> t \<longrightarrow> u v = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent s = (\<forall>t u v. finite t \<longrightarrow> t \<subseteq> s \<longrightarrow> (\<Sum>v\<in>t. u v *s v) = (0::'b) \<longrightarrow> v \<in> t \<longrightarrow> u v = (0::'a))
[PROOF STEP]
unfolding dependent_explicit
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>t u. finite t \<and> t \<subseteq> s \<and> (\<Sum>v\<in>t. u v *s v) = (0::'b) \<and> (\<exists>v\<in>t. u v \<noteq> (0::'a))) = (\<forall>t u v. finite t \<longrightarrow> t \<subseteq> s \<longrightarrow> (\<Sum>v\<in>t. u v *s v) = (0::'b) \<longrightarrow> v \<in> t \<longrightarrow> u v = (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma gt_0_times_gt_0_imp:
  fixes a b :: zhmultiset
  assumes a_gt0: "a > 0" and b_gt0: "b > 0"
  shows "a * b > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a * b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < a * b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a * b
[PROOF STEP]
using a_gt0 b_gt0
[PROOF STATE]
proof (prove)
using this:
0 < a
0 < b

goal (1 subgoal):
 1. 0 < a * b
[PROOF STEP]
by (subst (asm) (2 4) zhmset_pos_neg_partition, simp, transfer,
        simp del: HMSet_less add: algebra_simps zmset_of_plus[symmetric] hmsetmset_plus[symmetric]
        zmset_of_less HMSet_less[symmetric])
      (rule mono_cross_mult_less_hmset)
[PROOF STATE]
proof (state)
this:
0 < a * b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [code]:
  \<open>bit m n \<longleftrightarrow> odd (drop_bit n m)\<close>
  \<open>mask n = 2 ^ n - (1 :: integer)\<close>
  \<open>set_bit n m = m OR push_bit n 1\<close>
  \<open>flip_bit n m = m XOR push_bit n 1\<close>
  \<open>push_bit n m = m * 2 ^ n\<close>
  \<open>drop_bit n m = m div 2 ^ n\<close>
  \<open>take_bit n m = m mod 2 ^ n\<close> for m :: natural
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bit m n = odd (drop_bit n m) &&& mask n = 2 ^ n - 1 &&& set_bit n m = m OR push_bit n 1) &&& (flip_bit n m = m XOR push_bit n 1 &&& push_bit n m = m * 2 ^ n) &&& drop_bit n m = m div 2 ^ n &&& take_bit n m = m mod 2 ^ n
[PROOF STEP]
by (fact bit_iff_odd_drop_bit mask_eq_exp_minus_1
    set_bit_eq_or flip_bit_eq_xor push_bit_eq_mult drop_bit_eq_div take_bit_eq_mod)+


[STATEMENT]
lemma vec_of_ell2_zero[code]:
  \<comment> \<open>Code equation for computing the zero vector\<close>
  "vec_of_ell2 (0::'a::enum ell2) = zero_vec (CARD('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_ell2 0 = 0\<^sub>v CARD('a)
[PROOF STEP]
by (simp add: vec_of_ell2_def vec_of_basis_enum_zero)


[STATEMENT]
lemma charpoly_of_real: "charpoly (map_matrix complex_of_real A) = map_poly of_real (charpoly A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. charpoly (HMA_Connect.map_matrix complex_of_real A) = map_poly complex_of_real (charpoly A)
[PROOF STEP]
by (transfer_hma rule: of_real_hom.char_poly_hom)


[STATEMENT]
lemma content_real_eq_0: "content {a..b::real} = 0 \<longleftrightarrow> a \<ge> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (content {a..b} = 0) = (b \<le> a)
[PROOF STEP]
by (metis atLeastatMost_empty_iff2 content_empty content_real diff_self eq_iff le_cases le_iff_diff_le_0)


[STATEMENT]
lemma powreal_gt_zero: "a > 0 \<Longrightarrow> a pow\<^sub>\<real> x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> 0 < a pow\<^sub>\<real> x
[PROOF STEP]
by (auto dest: powa_gt_zero real_inverse_ge_one_lemma
        simp add: powreal_def not_less)


[STATEMENT]
lemma t_fusion_assoc [simp]:
  "\<lbrakk> last x = first y; last y = first z \<rbrakk> \<Longrightarrow> t_fusion x (t_fusion y z) = t_fusion (t_fusion x y) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Dioid_Models.last x = first y; Dioid_Models.last y = first z\<rbrakk> \<Longrightarrow> t_fusion x (t_fusion y z) = t_fusion (t_fusion x y) z
[PROOF STEP]
by (cases x, cases y, cases z, simp add: t_fusion_def)


[STATEMENT]
lemma power_neg:
  assumes a0: "a < 0" shows "odd n \<Longrightarrow> a ^ n < 0" and "even n \<Longrightarrow> a ^ n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (odd n \<Longrightarrow> a ^ n < (0::'a)) &&& (even n \<Longrightarrow> (0::'a) < a ^ n)
[PROOF STEP]
by (atomize(full), induct n, insert a0, auto simp add: mult_pos_neg2 mult_neg_neg)


[STATEMENT]
lemma subresultant_mat_dim[simp]:
  fixes j p q
  defines "S \<equiv> subresultant_mat j p q"
  shows "dim_row S = (degree p - j) + (degree q - j)" and "dim_col S = (degree p - j) + (degree q - j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row S = degree p - j + (degree q - j) &&& dim_col S = degree p - j + (degree q - j)
[PROOF STEP]
unfolding S_def subresultant_mat_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat (degree p - j + (degree q - j)) (degree p - j + (degree q - j)) (\<lambda>(i, ja). if ja < degree q - j then if i = degree p - j + (degree q - j) - 1 then monom (1::'a) (degree q - j - 1 - ja) * p else [:coeff_int p (int (degree p) - int i + int ja):] else if i = degree p - j + (degree q - j) - 1 then monom (1::'a) (degree p - j - 1 - (ja - (degree q - j))) * q else [:coeff_int q (int (degree q) - int i + int (ja - (degree q - j))):])) = degree p - j + (degree q - j) &&& dim_col (mat (degree p - j + (degree q - j)) (degree p - j + (degree q - j)) (\<lambda>(i, ja). if ja < degree q - j then if i = degree p - j + (degree q - j) - 1 then monom (1::'a) (degree q - j - 1 - ja) * p else [:coeff_int p (int (degree p) - int i + int ja):] else if i = degree p - j + (degree q - j) - 1 then monom (1::'a) (degree p - j - 1 - (ja - (degree q - j))) * q else [:coeff_int q (int (degree q) - int i + int (ja - (degree q - j))):])) = degree p - j + (degree q - j)
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_imp_finite_dfs_reachable:
  "\<lbrakk>finite E; finite S\<rbrakk> \<Longrightarrow> finite (E\<^sup>*``S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite E; finite S\<rbrakk> \<Longrightarrow> finite (E\<^sup>* `` S)
[PROOF STEP]
apply (rule finite_subset[where B="S \<union> (Relation.Domain E \<union> Relation.Range E)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite E; finite S\<rbrakk> \<Longrightarrow> E\<^sup>* `` S \<subseteq> S \<union> (Relation.Domain E \<union> Range E)
 2. \<lbrakk>finite E; finite S\<rbrakk> \<Longrightarrow> finite (S \<union> (Relation.Domain E \<union> Range E))
[PROOF STEP]
apply (auto simp: intro: finite_Domain finite_Range elim: rtranclE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma in_zmset_conv_pos_neg_disj: "x \<in>#\<^sub>z M \<longleftrightarrow> x \<in># mset_pos M \<or> x \<in># mset_neg M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in>#\<^sub>z M) = (x \<in># mset_pos M \<or> x \<in># mset_neg M)
[PROOF STEP]
by (metis count_mset_pos in_diff_zcount mem_zmset_of mset_pos_neg_partition nat_code(2) not_in_iff zcount_ne_zero_iff)