[STATEMENT]
lemma finite_enumerate_initial_segment:
  fixes S :: "'a::wellorder set"
  assumes "finite S" and n: "n < card (S \<inter> {..<s})"
  shows "enumerate (S \<inter> {..<s}) n = enumerate S n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
n < card (S \<inter> {..<s})

goal (1 subgoal):
 1. wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) 0 = wellorder_class.enumerate S 0
 2. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < card (S \<inter> {..<s})

goal (2 subgoals):
 1. 0 < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) 0 = wellorder_class.enumerate S 0
 2. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
have "(LEAST n. n \<in> S \<and> n < s) = (LEAST n. n \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. n \<in> S \<and> n < s) = (LEAST n. n \<in> S)
[PROOF STEP]
proof (rule Least_equality)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (LEAST n. n \<in> S) \<in> S \<and> (LEAST n. n \<in> S) < s
 2. \<And>y. y \<in> S \<and> y < s \<Longrightarrow> (LEAST n. n \<in> S) \<le> y
[PROOF STEP]
have "\<exists>t. t \<in> S \<and> t < s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t. t \<in> S \<and> t < s
[PROOF STEP]
by (metis "0" card_gt_0_iff disjoint_iff_not_equal lessThan_iff)
[PROOF STATE]
proof (state)
this:
\<exists>t. t \<in> S \<and> t < s

goal (2 subgoals):
 1. (LEAST n. n \<in> S) \<in> S \<and> (LEAST n. n \<in> S) < s
 2. \<And>y. y \<in> S \<and> y < s \<Longrightarrow> (LEAST n. n \<in> S) \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>t. t \<in> S \<and> t < s
[PROOF STEP]
show "(LEAST n. n \<in> S) \<in> S \<and> (LEAST n. n \<in> S) < s"
[PROOF STATE]
proof (prove)
using this:
\<exists>t. t \<in> S \<and> t < s

goal (1 subgoal):
 1. (LEAST n. n \<in> S) \<in> S \<and> (LEAST n. n \<in> S) < s
[PROOF STEP]
by (meson LeastI Least_le le_less_trans)
[PROOF STATE]
proof (state)
this:
(LEAST n. n \<in> S) \<in> S \<and> (LEAST n. n \<in> S) < s

goal (1 subgoal):
 1. \<And>y. y \<in> S \<and> y < s \<Longrightarrow> (LEAST n. n \<in> S) \<le> y
[PROOF STEP]
qed (simp add: Least_le)
[PROOF STATE]
proof (state)
this:
(LEAST n. n \<in> S \<and> n < s) = (LEAST n. n \<in> S)

goal (2 subgoals):
 1. 0 < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) 0 = wellorder_class.enumerate S 0
 2. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(LEAST n. n \<in> S \<and> n < s) = (LEAST n. n \<in> S)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(LEAST n. n \<in> S \<and> n < s) = (LEAST n. n \<in> S)

goal (1 subgoal):
 1. wellorder_class.enumerate (S \<inter> {..<s}) 0 = wellorder_class.enumerate S 0
[PROOF STEP]
by (auto simp: enumerate_0)
[PROOF STATE]
proof (state)
this:
wellorder_class.enumerate (S \<inter> {..<s}) 0 = wellorder_class.enumerate S 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n
Suc n < card (S \<inter> {..<s})

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n
Suc n < card (S \<inter> {..<s})
[PROOF STEP]
have less_card: "Suc n < card S"
[PROOF STATE]
proof (prove)
using this:
n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n
Suc n < card (S \<inter> {..<s})

goal (1 subgoal):
 1. Suc n < card S
[PROOF STEP]
by (meson assms(1) card_mono inf_sup_ord(1) leD le_less_linear order.trans)
[PROOF STATE]
proof (state)
this:
Suc n < card S

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
obtain T where T: "T \<in> {s \<in> S. enumerate S n < s}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>T. T \<in> {s \<in> S. wellorder_class.enumerate S n < s} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis Infinite_Set.enumerate_step enumerate_in_set finite_enumerate_in_set finite_enumerate_step less_card mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
T \<in> {s \<in> S. wellorder_class.enumerate S n < s}

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
have "(LEAST x. x \<in> S \<and> x < s \<and> enumerate S n < x) = (LEAST x. x \<in> S \<and> enumerate S n < x)"
       (is "_ = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST x. x \<in> S \<and> x < s \<and> wellorder_class.enumerate S n < x) = (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
[PROOF STEP]
proof (intro Least_equality conjI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<in> S
 2. (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) < s
 3. wellorder_class.enumerate S n < (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
 4. \<And>y. y \<in> S \<and> y < s \<and> wellorder_class.enumerate S n < y \<Longrightarrow> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<le> y
[PROOF STEP]
show "?r \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<in> S
[PROOF STEP]
by (metis (mono_tags, lifting) LeastI mem_Collect_eq T)
[PROOF STATE]
proof (state)
this:
(LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<in> S

goal (3 subgoals):
 1. (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) < s
 2. wellorder_class.enumerate S n < (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
 3. \<And>y. y \<in> S \<and> y < s \<and> wellorder_class.enumerate S n < y \<Longrightarrow> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<le> y
[PROOF STEP]
have "\<not> s \<le> ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> s \<le> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
[PROOF STEP]
using not_less_Least [of _ "\<lambda>x. x \<in> S \<and> enumerate S n < x"] Suc assms
[PROOF STATE]
proof (prove)
using this:
?k < (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<Longrightarrow> \<not> (?k \<in> S \<and> wellorder_class.enumerate S n < ?k)
n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n
Suc n < card (S \<inter> {..<s})
finite S
n < card (S \<inter> {..<s})

goal (1 subgoal):
 1. \<not> s \<le> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
[PROOF STEP]
by (metis (mono_tags, lifting) Int_Collect Suc_lessD finite_Int finite_enumerate_in_set finite_enumerate_step lessThan_def less_le_trans)
[PROOF STATE]
proof (state)
this:
\<not> s \<le> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)

goal (3 subgoals):
 1. (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) < s
 2. wellorder_class.enumerate S n < (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
 3. \<And>y. y \<in> S \<and> y < s \<and> wellorder_class.enumerate S n < y \<Longrightarrow> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> s \<le> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
[PROOF STEP]
show "?r < s"
[PROOF STATE]
proof (prove)
using this:
\<not> s \<le> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)

goal (1 subgoal):
 1. (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) < s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) < s

goal (2 subgoals):
 1. wellorder_class.enumerate S n < (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
 2. \<And>y. y \<in> S \<and> y < s \<and> wellorder_class.enumerate S n < y \<Longrightarrow> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<le> y
[PROOF STEP]
show "enumerate S n < ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wellorder_class.enumerate S n < (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
[PROOF STEP]
by (metis (no_types, lifting) LeastI mem_Collect_eq T)
[PROOF STATE]
proof (state)
this:
wellorder_class.enumerate S n < (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)

goal (1 subgoal):
 1. \<And>y. y \<in> S \<and> y < s \<and> wellorder_class.enumerate S n < y \<Longrightarrow> (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x) \<le> y
[PROOF STEP]
qed (auto simp: Least_le)
[PROOF STATE]
proof (state)
this:
(LEAST x. x \<in> S \<and> x < s \<and> wellorder_class.enumerate S n < x) = (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n; Suc n < card (S \<inter> {..<s})\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(LEAST x. x \<in> S \<and> x < s \<and> wellorder_class.enumerate S n < x) = (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(LEAST x. x \<in> S \<and> x < s \<and> wellorder_class.enumerate S n < x) = (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)

goal (1 subgoal):
 1. wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
using Suc assms
[PROOF STATE]
proof (prove)
using this:
(LEAST x. x \<in> S \<and> x < s \<and> wellorder_class.enumerate S n < x) = (LEAST x. x \<in> S \<and> wellorder_class.enumerate S n < x)
n < card (S \<inter> {..<s}) \<Longrightarrow> wellorder_class.enumerate (S \<inter> {..<s}) n = wellorder_class.enumerate S n
Suc n < card (S \<inter> {..<s})
finite S
n < card (S \<inter> {..<s})

goal (1 subgoal):
 1. wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)
[PROOF STEP]
by (simp add: finite_enumerate_Suc'' less_card)
[PROOF STATE]
proof (state)
this:
wellorder_class.enumerate (S \<inter> {..<s}) (Suc n) = wellorder_class.enumerate S (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma change_row_carrier[simp]:
  "(change_row k f A \<in> carrier_mat nr nc) = (A \<in> carrier_mat nr nc)"
  "dim_row (change_row k f A) = dim_row A"
  "dim_col (change_row k f A) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (change_row k f A \<in> carrier_mat nr nc) = (A \<in> carrier_mat nr nc) &&& dim_row (change_row k f A) = dim_row A &&& dim_col (change_row k f A) = dim_col A
[PROOF STEP]
unfolding change_row_def carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat (dim_row A) (dim_col A) (\<lambda>(i, j). if i = k then f j (A $$ (k, j)) else A $$ (i, j)) \<in> {m. dim_row m = nr \<and> dim_col m = nc}) = (A \<in> {m. dim_row m = nr \<and> dim_col m = nc}) &&& dim_row (mat (dim_row A) (dim_col A) (\<lambda>(i, j). if i = k then f j (A $$ (k, j)) else A $$ (i, j))) = dim_row A &&& dim_col (mat (dim_row A) (dim_col A) (\<lambda>(i, j). if i = k then f j (A $$ (k, j)) else A $$ (i, j))) = dim_col A
[PROOF STEP]
by auto


[STATEMENT]
lemma onorm_inner_right:
  assumes "bounded_linear r"
  shows "onorm (\<lambda>x. f \<bullet> r x) \<le> norm f * onorm r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. f \<bullet> r x) \<le> norm f * onorm r
[PROOF STEP]
apply (subst inner_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x \<bullet> f) \<le> norm f * onorm r
[PROOF STEP]
apply (rule onorm_inner_left[OF assms, THEN order_trans])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm r * norm f \<le> norm f * onorm r
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iWeakUntil_conj_iUntil_conv: "
  (P t1. t1 \<W> t2 I. (P t2 \<and> Q t2)) = (\<not> (\<not> Q t1. t1 \<U> t2 I. \<not> P t2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P t1. t1 \<W> t2 I. P t2 \<and> Q t2) = (\<not> (\<not> Q t1. t1 \<U> t2 I. \<not> P t2))
[PROOF STEP]
by (simp add: iRelease_not_iUntil_conv[symmetric] iRelease_iWeakUntil_conv)


[STATEMENT]
lemma ord_strict_p_monom_mult:
  assumes "p \<prec>\<^sub>p q" and "c \<noteq> (0::'b::semiring_no_zero_divisors)"
  shows "monom_mult c t p \<prec>\<^sub>p monom_mult c t q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_mult c t p \<prec>\<^sub>p monom_mult c t q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. monom_mult c t p \<prec>\<^sub>p monom_mult c t q
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
p \<prec>\<^sub>p q
[PROOF STEP]
obtain v where 1: "lookup p v = 0" and 2: "lookup q v \<noteq> 0"
    and 3: "\<And>u. v \<prec>\<^sub>t u \<Longrightarrow> lookup p u = lookup q u"
[PROOF STATE]
proof (prove)
using this:
p \<prec>\<^sub>p q

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>lookup p v = (0::'b); lookup q v \<noteq> (0::'b); \<And>u. v \<prec>\<^sub>t u \<Longrightarrow> lookup p u = lookup q u\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding ord_strict_p_def
[PROOF STATE]
proof (prove)
using this:
\<exists>v. lookup p v = (0::'b) \<and> lookup q v \<noteq> (0::'b) \<and> (\<forall>u. v \<prec>\<^sub>t u \<longrightarrow> lookup p u = lookup q u)

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>lookup p v = (0::'b); lookup q v \<noteq> (0::'b); \<And>u. v \<prec>\<^sub>t u \<Longrightarrow> lookup p u = lookup q u\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lookup p v = (0::'b)
lookup q v \<noteq> (0::'b)
v \<prec>\<^sub>t ?u22 \<Longrightarrow> lookup p ?u22 = lookup q ?u22

goal (1 subgoal):
 1. monom_mult c t p \<prec>\<^sub>p monom_mult c t q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_mult c t p \<prec>\<^sub>p monom_mult c t q
[PROOF STEP]
unfolding ord_strict_p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v. lookup (monom_mult c t p) v = (0::'b) \<and> lookup (monom_mult c t q) v \<noteq> (0::'b) \<and> (\<forall>u. v \<prec>\<^sub>t u \<longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u)
[PROOF STEP]
proof (intro exI conjI allI impI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. lookup (monom_mult c t p) ?v = (0::'b)
 2. lookup (monom_mult c t q) ?v \<noteq> (0::'b)
 3. \<And>u. ?v \<prec>\<^sub>t u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
lookup p v = (0::'b)
[PROOF STEP]
show "lookup (monom_mult c t p) (t \<oplus> v) = 0"
[PROOF STATE]
proof (prove)
using this:
lookup p v = (0::'b)

goal (1 subgoal):
 1. lookup (monom_mult c t p) (t \<oplus> v) = (0::'b)
[PROOF STEP]
by (simp add: lookup_monom_mult_plus)
[PROOF STATE]
proof (state)
this:
lookup (monom_mult c t p) (t \<oplus> v) = (0::'b)

goal (2 subgoals):
 1. lookup (monom_mult c t q) (t \<oplus> v) \<noteq> (0::'b)
 2. \<And>u. t \<oplus> v \<prec>\<^sub>t u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lookup (monom_mult c t q) (t \<oplus> v) \<noteq> (0::'b)
 2. \<And>u. t \<oplus> v \<prec>\<^sub>t u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
from 2 assms(2)
[PROOF STATE]
proof (chain)
picking this:
lookup q v \<noteq> (0::'b)
c \<noteq> (0::'b)
[PROOF STEP]
show "lookup (monom_mult c t q) (t \<oplus> v) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
lookup q v \<noteq> (0::'b)
c \<noteq> (0::'b)

goal (1 subgoal):
 1. lookup (monom_mult c t q) (t \<oplus> v) \<noteq> (0::'b)
[PROOF STEP]
by (simp add: lookup_monom_mult_plus)
[PROOF STATE]
proof (state)
this:
lookup (monom_mult c t q) (t \<oplus> v) \<noteq> (0::'b)

goal (1 subgoal):
 1. \<And>u. t \<oplus> v \<prec>\<^sub>t u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. t \<oplus> v \<prec>\<^sub>t u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
fix u
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. t \<oplus> v \<prec>\<^sub>t u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
assume "t \<oplus> v \<prec>\<^sub>t u"
[PROOF STATE]
proof (state)
this:
t \<oplus> v \<prec>\<^sub>t u

goal (1 subgoal):
 1. \<And>u. t \<oplus> v \<prec>\<^sub>t u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
show "lookup (monom_mult c t p) u = lookup (monom_mult c t q) u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
proof (cases "t adds\<^sub>p u")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
 2. \<not> t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
t adds\<^sub>p u

goal (2 subgoals):
 1. t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
 2. \<not> t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t adds\<^sub>p u
[PROOF STEP]
obtain w where u: "u = t \<oplus> w"
[PROOF STATE]
proof (prove)
using this:
t adds\<^sub>p u

goal (1 subgoal):
 1. (\<And>w. u = t \<oplus> w \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
u = t \<oplus> w

goal (2 subgoals):
 1. t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
 2. \<not> t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
from \<open>t \<oplus> v \<prec>\<^sub>t u\<close>
[PROOF STATE]
proof (chain)
picking this:
t \<oplus> v \<prec>\<^sub>t u
[PROOF STEP]
have "v \<prec>\<^sub>t w"
[PROOF STATE]
proof (prove)
using this:
t \<oplus> v \<prec>\<^sub>t u

goal (1 subgoal):
 1. v \<prec>\<^sub>t w
[PROOF STEP]
unfolding u
[PROOF STATE]
proof (prove)
using this:
t \<oplus> v \<prec>\<^sub>t t \<oplus> w

goal (1 subgoal):
 1. v \<prec>\<^sub>t w
[PROOF STEP]
by (rule ord_term_strict_canc)
[PROOF STATE]
proof (state)
this:
v \<prec>\<^sub>t w

goal (2 subgoals):
 1. t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
 2. \<not> t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
hence "lookup p w = lookup q w"
[PROOF STATE]
proof (prove)
using this:
v \<prec>\<^sub>t w

goal (1 subgoal):
 1. lookup p w = lookup q w
[PROOF STEP]
by (rule 3)
[PROOF STATE]
proof (state)
this:
lookup p w = lookup q w

goal (2 subgoals):
 1. t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
 2. \<not> t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
lookup p w = lookup q w

goal (1 subgoal):
 1. lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
by (simp add: u lookup_monom_mult_plus)
[PROOF STATE]
proof (state)
this:
lookup (monom_mult c t p) u = lookup (monom_mult c t q) u

goal (1 subgoal):
 1. \<not> t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> t adds\<^sub>p u

goal (1 subgoal):
 1. \<not> t adds\<^sub>p u \<Longrightarrow> lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> t adds\<^sub>p u

goal (1 subgoal):
 1. lookup (monom_mult c t p) u = lookup (monom_mult c t q) u
[PROOF STEP]
by (simp add: lookup_monom_mult)
[PROOF STATE]
proof (state)
this:
lookup (monom_mult c t p) u = lookup (monom_mult c t q) u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lookup (monom_mult c t p) u = lookup (monom_mult c t q) u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
monom_mult c t p \<prec>\<^sub>p monom_mult c t q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma glb_singleton [simp]: "glb {x} = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>{x} = x
[PROOF STEP]
by (rule is_glb_singleton [THEN glb_eqI])


[STATEMENT]
lemma wf_interp_for_formula_FAnd:
  "wf_interp_for_formula (w, I) (FAnd \<phi>1 \<phi>2) =
     (wf_interp_for_formula (w, I) \<phi>1 \<and> wf_interp_for_formula (w, I) \<phi>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_interp_for_formula (w, I) (FAnd \<phi>1 \<phi>2) = (wf_interp_for_formula (w, I) \<phi>1 \<and> wf_interp_for_formula (w, I) \<phi>2)
[PROOF STEP]
by auto


[STATEMENT]
lemma proots_within_times:
  fixes s::"'a::{semiring_no_zero_divisors,comm_semiring_0} set"
  shows "proots_within (p*q) s = proots_within p s \<union> proots_within q s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within (p * q) s = proots_within p s \<union> proots_within q s
[PROOF STEP]
unfolding proots_within_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> s. poly (p * q) x = (0::'a)} = {x \<in> s. poly p x = (0::'a)} \<union> {x \<in> s. poly q x = (0::'a)}
[PROOF STEP]
by auto


[STATEMENT]
lemma vsubset_vdiff_vinsert: "A \<subseteq>\<^sub>\<circ> B -\<^sub>\<circ> vinsert x C \<longleftrightarrow> A \<subseteq>\<^sub>\<circ> B -\<^sub>\<circ> C \<and> x \<notin>\<^sub>\<circ> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<subseteq>\<^sub>\<circ> B -\<^sub>\<circ> vinsert x C) = (A \<subseteq>\<^sub>\<circ> B -\<^sub>\<circ> C \<and> x \<notin>\<^sub>\<circ> A)
[PROOF STEP]
by auto


[STATEMENT]
lemma from_univ_poly_mult:
  assumes "i \<le> n"
  assumes "p \<in> carrier (UP (R[\<X>\<^bsub>n\<^esub>])) "
  assumes "Q \<in> carrier (UP (R[\<X>\<^bsub>n\<^esub>])) "
  shows "from_univ_poly (Suc n) i (p \<otimes>\<^bsub>UP (R[\<X>\<^bsub>n\<^esub>])\<^esub>Q) =
        from_univ_poly (Suc n) i p \<otimes>\<^bsub>R[\<X>\<^bsub>Suc n\<^esub>]\<^esub> from_univ_poly (Suc n) i Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_univ_poly (Suc n) i (p \<otimes>\<^bsub>UP (R [\<X>\<^bsub>n\<^esub>])\<^esub> Q) = from_univ_poly (Suc n) i p \<otimes>\<^bsub>R [\<X>\<^bsub>Suc n\<^esub>]\<^esub> from_univ_poly (Suc n) i Q
[PROOF STEP]
using from_univ_poly_is_hom ring_hom_mult
[PROOF STATE]
proof (prove)
using this:
?i \<le> ?n \<Longrightarrow> from_univ_poly (Suc ?n) ?i \<in> ring_hom (UP (R [\<X>\<^bsub>?n\<^esub>])) (R [\<X>\<^bsub>Suc ?n\<^esub>])
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<otimes>\<^bsub>?R\<^esub> ?y) = ?h ?x \<otimes>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. from_univ_poly (Suc n) i (p \<otimes>\<^bsub>UP (R [\<X>\<^bsub>n\<^esub>])\<^esub> Q) = from_univ_poly (Suc n) i p \<otimes>\<^bsub>R [\<X>\<^bsub>Suc n\<^esub>]\<^esub> from_univ_poly (Suc n) i Q
[PROOF STEP]
by (metis assms(1) assms(2) assms(3))


[STATEMENT]
lemma Gromov_converging_at_boundary_converges':
  assumes "Gromov_converging_at_boundary u"
  shows "convergent (\<lambda>n. to_Gromov_completion (u n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. to_Gromov_completion (u n))
[PROOF STEP]
unfolding convergent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>L. (\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> L
[PROOF STEP]
using Gromov_converging_at_boundary_converges[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>Gromov_boundary. (\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> x

goal (1 subgoal):
 1. \<exists>L. (\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> L
[PROOF STEP]
by auto


[STATEMENT]
lemma sq_pow_div2 [simp]:
    "m mod 2 = 0 \<Longrightarrow> ((n::nat)*n)^(m div 2) = n^m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m mod 2 = 0 \<Longrightarrow> (n * n) ^ (m div 2) = n ^ m
[PROOF STEP]
apply (simp add: power2_eq_square [symmetric] power_mult [symmetric] minus_mod_eq_mult_div [symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma jordan_matrix_upper_triangular: "i < sum_list (map fst n_as)
  \<Longrightarrow> j < i \<Longrightarrow> jordan_matrix n_as $$ (i,j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < sum_list (map fst n_as); j < i\<rbrakk> \<Longrightarrow> jordan_matrix n_as $$ (i, j) = (0::'a)
[PROOF STEP]
unfolding jordan_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < sum_list (map fst n_as); j < i\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>(x, y). jordan_block x y) n_as) $$ (i, j) = (0::'a)
[PROOF STEP]
by (rule diag_block_upper_triangular, auto simp: jordan_matrix_def[symmetric])


[STATEMENT]
lemma cfs_X_minus:
  assumes "a \<in> carrier R"
  shows "X_minus a n = (if n = 0 then \<ominus> a else (if n = 1 then \<one> else \<zero>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X_poly_minus R a n = (if n = 0 then \<ominus> a else if n = 1 then \<one> else \<zero>)
[PROOF STEP]
using cfs_X_plus[of "\<ominus> a"] assms
[PROOF STATE]
proof (prove)
using this:
\<ominus> a \<in> carrier R \<Longrightarrow> X_poly_plus R (\<ominus> a) ?n = (if ?n = 0 then \<ominus> a else if ?n = 1 then \<one> else \<zero>)
a \<in> carrier R

goal (1 subgoal):
 1. X_poly_minus R a n = (if n = 0 then \<ominus> a else if n = 1 then \<one> else \<zero>)
[PROOF STEP]
unfolding X_poly_plus_def X_poly_minus_def
[PROOF STATE]
proof (prove)
using this:
\<ominus> a \<in> carrier R \<Longrightarrow> (X_poly R \<oplus>\<^bsub>UP R\<^esub> to_polynomial R (\<ominus> a)) ?n = (if ?n = 0 then \<ominus> a else if ?n = 1 then \<one> else \<zero>)
a \<in> carrier R

goal (1 subgoal):
 1. (X_poly R \<ominus>\<^bsub>UP R\<^esub> to_polynomial R a) n = (if n = 0 then \<ominus> a else if n = 1 then \<one> else \<zero>)
[PROOF STEP]
by (simp add: P_def a_minus_def to_poly_a_inv)


[STATEMENT]
lemma count_roots_interval: assumes cr: "count_roots_interval p = (cr,nr)"
  and sf: "square_free p"
  shows "a \<le> b \<Longrightarrow> cr a b = (card {x. a \<le> x \<and> x \<le> b \<and> poly p x = 0})"
    "nr a = card {x. x \<le> a \<and> poly p x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<le> b \<Longrightarrow> cr a b = card {x. a \<le> x \<and> x \<le> b \<and> poly p x = 0}) &&& nr a = card {x. x \<le> a \<and> poly p x = 0}
[PROOF STEP]
using count_roots_interval_sf[OF _ cr[unfolded count_roots_interval_iff[OF sf]]]
    sf[unfolded square_free_def]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p \<noteq> 0; ?a \<le> ?b\<rbrakk> \<Longrightarrow> cr ?a ?b = card {x. ?a \<le> x \<and> x \<le> ?b \<and> poly p x = 0}
p \<noteq> 0 \<Longrightarrow> nr ?a = card {x. x \<le> ?a \<and> poly p x = 0}
p \<noteq> 0 \<and> (\<forall>q. 0 < degree q \<longrightarrow> \<not> q * q dvd p)

goal (1 subgoal):
 1. (a \<le> b \<Longrightarrow> cr a b = card {x. a \<le> x \<and> x \<le> b \<and> poly p x = 0}) &&& nr a = card {x. x \<le> a \<and> poly p x = 0}
[PROOF STEP]
by blast+


[STATEMENT]
lemma (in PolynRg) polyn_deg_add3:"\<lbrakk>p \<in> carrier R; p \<noteq> \<zero>; q \<in> carrier R;
       q \<noteq> \<zero>; p \<plusminus> q \<noteq> \<zero>; (deg_n R S X p) \<le> n; (deg_n R S X q) \<le> n\<rbrakk>  \<Longrightarrow>
          deg_n R S X (p \<plusminus> q) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; p \<noteq> \<zero>; q \<in> carrier R; q \<noteq> \<zero>; p \<plusminus> q \<noteq> \<zero>; deg_n R S X p \<le> n; deg_n R S X q \<le> n\<rbrakk> \<Longrightarrow> deg_n R S X (p \<plusminus> q) \<le> n
[PROOF STEP]
apply (case_tac "(deg_n R S X p) = (deg_n R S X q)",
       frule polyn_deg_add2[of "p" "q"], assumption+,
       simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; p \<noteq> \<zero>; q \<in> carrier R; q \<noteq> \<zero>; p \<plusminus> q \<noteq> \<zero>; deg_n R S X p \<le> n; deg_n R S X q \<le> n; deg_n R S X p \<noteq> deg_n R S X q\<rbrakk> \<Longrightarrow> deg_n R S X (p \<plusminus> q) \<le> n
[PROOF STEP]
apply (cut_tac less_linear[of "deg_n R S X p" "deg_n R S X q"],
       simp, thin_tac "deg_n R S X p \<noteq> deg_n R S X q",
       erule disjE, simp add:polyn_deg_add1,
       cut_tac ring_is_ag, simp add:aGroup.ag_pOp_commute[of "R" "p" "q"],
       simp add:polyn_deg_add1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma inf_prefix_length_Suc[simp]: "
  inf_prefix_length (a # xs) (a # ys) = Suc (inf_prefix_length xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf_prefix_length (a # xs) (a # ys) = Suc (inf_prefix_length xs ys)
[PROOF STEP]
by (simp add: inf_prefix_length_def)


[STATEMENT]
lemma config_rand_distinct:
  shows "\<forall>x \<in> (config_rand  A init qs). distinct (fst x) = distinct init"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set_pmf (config'_rand A (fst A init \<bind> (\<lambda>is. return_pmf (init, is))) qs). distinct (fst x) = distinct init
[PROOF STEP]
apply (induct rule: config_rand_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. distinct init = distinct init
 2. \<And>s q a. distinct s = distinct init \<Longrightarrow> distinct (step s q a) = distinct init
[PROOF STEP]
by (simp_all add: distinct_step)


[STATEMENT]
lemma fv_cp_foldr_Disj: "\<forall>Q\<in>set Qs \<union> {Q}. cpropagated Q \<and> fv Q = A \<Longrightarrow> fv (cp (foldr Disj Qs Q)) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>Q\<in>set Qs \<union> {Q}. cpropagated Q \<and> fv Q = A \<Longrightarrow> fv (cp (foldr Disj Qs Q)) = A
[PROOF STEP]
by (induct Qs) (auto simp: cpropagated_cp_triv Let_def is_Bool_def)


[STATEMENT]
lemma stack_rel_def: "\<langle>vrel\<rangle>stack_rel lrel srel \<equiv> {
  ((li,si),l). (li,l)\<in>\<langle>vrel\<rangle>lrel \<and> (si,set l)\<in>\<langle>vrel\<rangle>srel \<and> distinct l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>vrel\<rangle>stack_rel lrel srel \<equiv> {((li, si), l). (li, l) \<in> \<langle>vrel\<rangle>lrel \<and> (si, set l) \<in> \<langle>vrel\<rangle>srel \<and> distinct l}
[PROOF STEP]
unfolding stack_rel_internal_def relAPP_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {((li, si), l). (li, l) \<in> lrel vrel \<and> (si, set l) \<in> srel vrel \<and> distinct l} \<equiv> {((li, si), l). (li, l) \<in> lrel vrel \<and> (si, set l) \<in> srel vrel \<and> distinct l}
[PROOF STEP]
by auto


[STATEMENT]
lemma filter_eq_nths: "filter P xs = nths xs {i. i<length xs \<and> P(xs!i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P xs = nths xs {i. i < length xs \<and> P (xs ! i)}
[PROOF STEP]
by(induction xs) (auto simp: nths_Cons)


[STATEMENT]
lemma U_finite: "finite U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite U
[PROOF STEP]
unfolding U_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union> (S ` {1..m}))
[PROOF STEP]
using S_finite
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{1..m}. finite (S i)

goal (1 subgoal):
 1. finite (\<Union> (S ` {1..m}))
[PROOF STEP]
by blast


[STATEMENT]
lemma mix_pmf_pref_iff_more_likely [iff]:
  assumes "b \<succ>[\<R>] w"
  assumes "\<alpha> \<in> {0..1}"
    and "\<beta> \<in> {0..1}"
  shows "\<alpha> > \<beta> \<longleftrightarrow> mix_pmf \<alpha> b w \<succ>[\<R>] mix_pmf \<beta> b w" (is "?L \<longleftrightarrow> ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<beta> < \<alpha>) = (mix_pmf \<alpha> b w \<succeq>[\<R>] mix_pmf \<beta> b w \<and> (mix_pmf \<beta> b w, mix_pmf \<alpha> b w) \<notin> \<R>)
[PROOF STEP]
using assms step_1_most_general[of b w \<alpha> \<beta>]
[PROOF STATE]
proof (prove)
using this:
b \<succeq>[\<R>] w \<and> (w, b) \<notin> \<R>
\<alpha> \<in> {0..1}
\<beta> \<in> {0..1}
\<lbrakk>b \<succeq>[\<R>] w \<and> (w, b) \<notin> \<R>; \<alpha> \<in> {0..1}; \<beta> \<in> {0..1}; \<beta> < \<alpha>\<rbrakk> \<Longrightarrow> mix_pmf \<alpha> b w \<succeq>[\<R>] mix_pmf \<beta> b w \<and> (mix_pmf \<beta> b w, mix_pmf \<alpha> b w) \<notin> \<R>

goal (1 subgoal):
 1. (\<beta> < \<alpha>) = (mix_pmf \<alpha> b w \<succeq>[\<R>] mix_pmf \<beta> b w \<and> (mix_pmf \<beta> b w, mix_pmf \<alpha> b w) \<notin> \<R>)
[PROOF STEP]
by (metis linorder_neqE_linordered_idom step_1_most_general)


[STATEMENT]
lemma transpose_mat [simp]: "transpose (mat n) = mat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (mat n) = mat n
[PROOF STEP]
by (vector transpose_def mat_def)


[STATEMENT]
lemma vec_mod_index[simp]: "i < dim_vec v \<Longrightarrow> (vec_mod v) $ i = (v $ i) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec v \<Longrightarrow> vec_mod v $ i = v $ i mod m
[PROOF STEP]
using vec_mod_def
[PROOF STATE]
proof (prove)
using this:
vec_mod ?v \<equiv> map_vec (\<lambda>x. x mod m) ?v

goal (1 subgoal):
 1. i < dim_vec v \<Longrightarrow> vec_mod v $ i = v $ i mod m
[PROOF STEP]
by simp


[STATEMENT]
lemma map_indets_inverseE_Polys:
  assumes "inj_on f X" and "p \<in> P[X]"
  shows "map_indets (the_inv_into X f) (map_indets f p) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_indets (the_inv_into X f) (map_indets f p) = p
[PROOF STEP]
unfolding map_indets_map_indets
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_indets (the_inv_into X f \<circ> f) p = p
[PROOF STEP]
proof (rule map_indets_id)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> indets p \<Longrightarrow> (the_inv_into X f \<circ> f) x = x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> indets p \<Longrightarrow> (the_inv_into X f \<circ> f) x = x
[PROOF STEP]
assume "x \<in> indets p"
[PROOF STATE]
proof (state)
this:
x \<in> indets p

goal (1 subgoal):
 1. \<And>x. x \<in> indets p \<Longrightarrow> (the_inv_into X f \<circ> f) x = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<in> indets p

goal (1 subgoal):
 1. \<And>x. x \<in> indets p \<Longrightarrow> (the_inv_into X f \<circ> f) x = x
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
p \<in> P[X]
[PROOF STEP]
have "\<dots> \<subseteq> X"
[PROOF STATE]
proof (prove)
using this:
p \<in> P[X]

goal (1 subgoal):
 1. indets p \<subseteq> X
[PROOF STEP]
by (rule PolysD)
[PROOF STATE]
proof (state)
this:
indets p \<subseteq> X

goal (1 subgoal):
 1. \<And>x. x \<in> indets p \<Longrightarrow> (the_inv_into X f \<circ> f) x = x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<in> X
[PROOF STEP]
show "(the_inv_into X f \<circ> f) x = x"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. (the_inv_into X f \<circ> f) x = x
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> X
inj_on f X

goal (1 subgoal):
 1. (the_inv_into X f \<circ> f) x = x
[PROOF STEP]
by (auto intro: the_inv_into_f_f)
[PROOF STATE]
proof (state)
this:
(the_inv_into X f \<circ> f) x = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma boolfun_cases[case_names False Id True Neg]: "\<lbrakk>g=(\<lambda>x. False) \<Longrightarrow> P g; g=(\<lambda>x. x) \<Longrightarrow> P g; g=(\<lambda>x. True) \<Longrightarrow> P g; g=(\<lambda>x. \<not>x) \<Longrightarrow> P g\<rbrakk> \<Longrightarrow> P g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g = (\<lambda>x. False) \<Longrightarrow> P g; g = (\<lambda>x. x) \<Longrightarrow> P g; g = (\<lambda>x. True) \<Longrightarrow> P g; g = Not \<Longrightarrow> P g\<rbrakk> \<Longrightarrow> P g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>g = (\<lambda>x. False) \<Longrightarrow> P g; g = (\<lambda>x. x) \<Longrightarrow> P g; g = (\<lambda>x. True) \<Longrightarrow> P g; g = Not \<Longrightarrow> P g\<rbrakk> \<Longrightarrow> P g
[PROOF STEP]
note boolfun_cases_helper[of g]
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. False) \<or> g = (\<lambda>x. x) \<or> g = (\<lambda>x. True) \<or> g = Not

goal (1 subgoal):
 1. \<lbrakk>g = (\<lambda>x. False) \<Longrightarrow> P g; g = (\<lambda>x. x) \<Longrightarrow> P g; g = (\<lambda>x. True) \<Longrightarrow> P g; g = Not \<Longrightarrow> P g\<rbrakk> \<Longrightarrow> P g
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. False) \<or> g = (\<lambda>x. x) \<or> g = (\<lambda>x. True) \<or> g = Not

goal (1 subgoal):
 1. \<lbrakk>g = (\<lambda>x. False) \<Longrightarrow> P g; g = (\<lambda>x. x) \<Longrightarrow> P g; g = (\<lambda>x. True) \<Longrightarrow> P g; g = Not \<Longrightarrow> P g\<rbrakk> \<Longrightarrow> P g
[PROOF STEP]
assume "g=(\<lambda>x. False) \<Longrightarrow> P g" "g=(\<lambda>x. x) \<Longrightarrow> P g" "g=(\<lambda>x. True) \<Longrightarrow> P g" "g=(\<lambda>x. \<not>x) \<Longrightarrow> P g"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. False) \<Longrightarrow> P g
g = (\<lambda>x. x) \<Longrightarrow> P g
g = (\<lambda>x. True) \<Longrightarrow> P g
g = Not \<Longrightarrow> P g

goal (1 subgoal):
 1. \<lbrakk>g = (\<lambda>x. False) \<Longrightarrow> P g; g = (\<lambda>x. x) \<Longrightarrow> P g; g = (\<lambda>x. True) \<Longrightarrow> P g; g = Not \<Longrightarrow> P g\<rbrakk> \<Longrightarrow> P g
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g = (\<lambda>x. False) \<or> g = (\<lambda>x. x) \<or> g = (\<lambda>x. True) \<or> g = Not
g = (\<lambda>x. False) \<Longrightarrow> P g
g = (\<lambda>x. x) \<Longrightarrow> P g
g = (\<lambda>x. True) \<Longrightarrow> P g
g = Not \<Longrightarrow> P g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g = (\<lambda>x. False) \<or> g = (\<lambda>x. x) \<or> g = (\<lambda>x. True) \<or> g = Not
g = (\<lambda>x. False) \<Longrightarrow> P g
g = (\<lambda>x. x) \<Longrightarrow> P g
g = (\<lambda>x. True) \<Longrightarrow> P g
g = Not \<Longrightarrow> P g

goal (1 subgoal):
 1. P g
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
P g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_le_list_ex: "length xs \<le> n \<Longrightarrow> \<exists>ys. length (xs @ ys) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> n \<Longrightarrow> \<exists>ys. length (xs @ ys) = n
[PROOF STEP]
apply (rule exI[where x="replicate (n - length xs) z" for z])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> n \<Longrightarrow> length (xs @ replicate (n - length xs) ?z4) = n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma exp_times_self_eqD:
  assumes "w * exp w = x"
  shows   "x \<ge> -exp (-1)" and "w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - exp (- 1) \<le> x &&& w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - exp (- 1) \<le> x
 2. w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
w * exp w = x
[PROOF STEP]
show "x \<ge> -exp (-1)"
[PROOF STATE]
proof (prove)
using this:
w * exp w = x

goal (1 subgoal):
 1. - exp (- 1) \<le> x
[PROOF STEP]
using exp_times_self_ge[of w]
[PROOF STATE]
proof (prove)
using this:
w * exp w = x
- exp (- 1) \<le> w * exp w

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

goal (1 subgoal):
 1. w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
show "w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
proof (cases "w \<ge> -1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
 2. \<not> - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
- 1 \<le> w

goal (2 subgoals):
 1. - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
 2. \<not> - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
hence "Lambert_W x = w"
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> w

goal (1 subgoal):
 1. Lambert_W x = w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> w
w * exp w = x

goal (1 subgoal):
 1. Lambert_W x = w
[PROOF STEP]
by (intro Lambert_W_eqI) auto
[PROOF STATE]
proof (state)
this:
Lambert_W x = w

goal (2 subgoals):
 1. - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
 2. \<not> - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Lambert_W x = w

goal (1 subgoal):
 1. w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x

goal (1 subgoal):
 1. \<not> - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> - 1 \<le> w

goal (1 subgoal):
 1. \<not> - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> - 1 \<le> w
[PROOF STEP]
have "w * exp w < 0"
[PROOF STATE]
proof (prove)
using this:
\<not> - 1 \<le> w

goal (1 subgoal):
 1. w * exp w < 0
[PROOF STEP]
by (intro mult_neg_pos) auto
[PROOF STATE]
proof (state)
this:
w * exp w < 0

goal (1 subgoal):
 1. \<not> - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> - 1 \<le> w
[PROOF STEP]
have "Lambert_W' x = w"
[PROOF STATE]
proof (prove)
using this:
\<not> - 1 \<le> w

goal (1 subgoal):
 1. Lambert_W' x = w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> - 1 \<le> w
w * exp w = x

goal (1 subgoal):
 1. Lambert_W' x = w
[PROOF STEP]
by (intro Lambert_W'_eqI) auto
[PROOF STATE]
proof (state)
this:
Lambert_W' x = w

goal (1 subgoal):
 1. \<not> - 1 \<le> w \<Longrightarrow> w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Lambert_W' x = w

goal (1 subgoal):
 1. w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
using assms \<open>w * exp w < 0\<close>
[PROOF STATE]
proof (prove)
using this:
Lambert_W' x = w
w * exp w = x
w * exp w < 0

goal (1 subgoal):
 1. w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
w = Lambert_W x \<or> x < 0 \<and> w = Lambert_W' x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_contains_Sup:
  fixes S :: "real set"
  assumes neS: "S \<noteq> {}" and bS: "\<forall>x\<in>S. x \<le> B"
  shows "Sup S \<in> closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
let ?T = "uminus ` S"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
from neS
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
have neT: "?T \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. uminus ` S \<noteq> {}
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
uminus ` S \<noteq> {}

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
from bS
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>S. x \<le> B
[PROOF STEP]
have bT: "\<forall>x\<in>?T. -B \<le> x"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. x \<le> B

goal (1 subgoal):
 1. \<forall>x\<in>uminus ` S. - B \<le> x
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>uminus ` S. - B \<le> x

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
hence bbT: "bdd_below ?T"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>uminus ` S. - B \<le> x

goal (1 subgoal):
 1. bdd_below (uminus ` S)
[PROOF STEP]
by(intro bdd_belowI, blast)
[PROOF STATE]
proof (state)
this:
bdd_below (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
have "Sup S = - Inf ?T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup S = - Inf (uminus ` S)
[PROOF STEP]
proof(rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Sup S \<le> - Inf (uminus ` S)
 2. - Inf (uminus ` S) \<le> Sup S
[PROOF STEP]
from neT bbT
[PROOF STATE]
proof (chain)
picking this:
uminus ` S \<noteq> {}
bdd_below (uminus ` S)
[PROOF STEP]
have "\<And>x. x\<in>S \<Longrightarrow> Inf (uminus ` S) \<le> -x"
[PROOF STATE]
proof (prove)
using this:
uminus ` S \<noteq> {}
bdd_below (uminus ` S)

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> Inf (uminus ` S) \<le> - x
[PROOF STEP]
by(blast intro:cInf_lower)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> Inf (uminus ` S) \<le> - ?x

goal (2 subgoals):
 1. Sup S \<le> - Inf (uminus ` S)
 2. - Inf (uminus ` S) \<le> Sup S
[PROOF STEP]
hence "\<And>x. x\<in>S \<Longrightarrow> -1 * -x \<le> -1 * Inf (uminus ` S)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> Inf (uminus ` S) \<le> - ?x

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> - 1 * - x \<le> - 1 * Inf (uminus ` S)
[PROOF STEP]
by(rule mult_left_mono_neg, auto)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> - 1 * - ?x \<le> - 1 * Inf (uminus ` S)

goal (2 subgoals):
 1. Sup S \<le> - Inf (uminus ` S)
 2. - Inf (uminus ` S) \<le> Sup S
[PROOF STEP]
hence lenInf: "\<And>x. x\<in>S \<Longrightarrow> x \<le> - Inf (uminus ` S)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> - 1 * - ?x \<le> - 1 * Inf (uminus ` S)

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> - Inf (uminus ` S)
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> ?x \<le> - Inf (uminus ` S)

goal (2 subgoals):
 1. Sup S \<le> - Inf (uminus ` S)
 2. - Inf (uminus ` S) \<le> Sup S
[PROOF STEP]
with neS bS
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
\<forall>x\<in>S. x \<le> B
?x \<in> S \<Longrightarrow> ?x \<le> - Inf (uminus ` S)
[PROOF STEP]
show "Sup S \<le> - Inf ?T"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
\<forall>x\<in>S. x \<le> B
?x \<in> S \<Longrightarrow> ?x \<le> - Inf (uminus ` S)

goal (1 subgoal):
 1. Sup S \<le> - Inf (uminus ` S)
[PROOF STEP]
by(blast intro:cSup_least)
[PROOF STATE]
proof (state)
this:
Sup S \<le> - Inf (uminus ` S)

goal (1 subgoal):
 1. - Inf (uminus ` S) \<le> Sup S
[PROOF STEP]
have "- Sup S \<le> Inf ?T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - Sup S \<le> Inf (uminus ` S)
[PROOF STEP]
proof(rule cInf_greatest[OF neT])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> uminus ` S \<Longrightarrow> - Sup S \<le> x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> uminus ` S \<Longrightarrow> - Sup S \<le> x
[PROOF STEP]
assume "x \<in> uminus ` S"
[PROOF STATE]
proof (state)
this:
x \<in> uminus ` S

goal (1 subgoal):
 1. \<And>x. x \<in> uminus ` S \<Longrightarrow> - Sup S \<le> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> uminus ` S
[PROOF STEP]
obtain y where yin: "y \<in> S" and rwx: "x = -y"
[PROOF STATE]
proof (prove)
using this:
x \<in> uminus ` S

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

goal (1 subgoal):
 1. \<And>x. x \<in> uminus ` S \<Longrightarrow> - Sup S \<le> x
[PROOF STEP]
from yin bS
[PROOF STATE]
proof (chain)
picking this:
y \<in> S
\<forall>x\<in>S. x \<le> B
[PROOF STEP]
have "y \<le> Sup S"
[PROOF STATE]
proof (prove)
using this:
y \<in> S
\<forall>x\<in>S. x \<le> B

goal (1 subgoal):
 1. y \<le> Sup S
[PROOF STEP]
by(intro cSup_upper bdd_belowI, auto)
[PROOF STATE]
proof (state)
this:
y \<le> Sup S

goal (1 subgoal):
 1. \<And>x. x \<in> uminus ` S \<Longrightarrow> - Sup S \<le> x
[PROOF STEP]
hence "-1 * Sup S \<le> -1 * y"
[PROOF STATE]
proof (prove)
using this:
y \<le> Sup S

goal (1 subgoal):
 1. - 1 * Sup S \<le> - 1 * y
[PROOF STEP]
by(simp add:mult_left_mono_neg)
[PROOF STATE]
proof (state)
this:
- 1 * Sup S \<le> - 1 * y

goal (1 subgoal):
 1. \<And>x. x \<in> uminus ` S \<Longrightarrow> - Sup S \<le> x
[PROOF STEP]
with rwx
[PROOF STATE]
proof (chain)
picking this:
x = - y
- 1 * Sup S \<le> - 1 * y
[PROOF STEP]
show "- Sup S \<le> x"
[PROOF STATE]
proof (prove)
using this:
x = - y
- 1 * Sup S \<le> - 1 * y

goal (1 subgoal):
 1. - Sup S \<le> x
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
- Sup S \<le> x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
- Sup S \<le> Inf (uminus ` S)

goal (1 subgoal):
 1. - Inf (uminus ` S) \<le> Sup S
[PROOF STEP]
hence "-1 * Inf ?T \<le> -1 * (- Sup S)"
[PROOF STATE]
proof (prove)
using this:
- Sup S \<le> Inf (uminus ` S)

goal (1 subgoal):
 1. - 1 * Inf (uminus ` S) \<le> - 1 * - Sup S
[PROOF STEP]
by(simp add:mult_left_mono_neg)
[PROOF STATE]
proof (state)
this:
- 1 * Inf (uminus ` S) \<le> - 1 * - Sup S

goal (1 subgoal):
 1. - Inf (uminus ` S) \<le> Sup S
[PROOF STEP]
thus "- Inf ?T \<le> Sup S"
[PROOF STATE]
proof (prove)
using this:
- 1 * Inf (uminus ` S) \<le> - 1 * - Sup S

goal (1 subgoal):
 1. - Inf (uminus ` S) \<le> Sup S
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
- Inf (uminus ` S) \<le> Sup S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sup S = - Inf (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sup S = - Inf (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
Sup S = - Inf (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
from neT bbT
[PROOF STATE]
proof (chain)
picking this:
uminus ` S \<noteq> {}
bdd_below (uminus ` S)
[PROOF STEP]
have "Inf ?T \<in> closure ?T"
[PROOF STATE]
proof (prove)
using this:
uminus ` S \<noteq> {}
bdd_below (uminus ` S)

goal (1 subgoal):
 1. Inf (uminus ` S) \<in> closure (uminus ` S)
[PROOF STEP]
by(rule closure_contains_Inf)
[PROOF STATE]
proof (state)
this:
Inf (uminus ` S) \<in> closure (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
hence "- Inf ?T \<in> uminus ` closure ?T"
[PROOF STATE]
proof (prove)
using this:
Inf (uminus ` S) \<in> closure (uminus ` S)

goal (1 subgoal):
 1. - Inf (uminus ` S) \<in> uminus ` closure (uminus ` S)
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
- Inf (uminus ` S) \<in> uminus ` closure (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
- Inf (uminus ` S) \<in> uminus ` closure (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- Inf (uminus ` S) \<in> uminus ` closure (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
- Inf (uminus ` S) \<in> uminus ` closure (uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
have "linear uminus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear uminus
[PROOF STEP]
by(auto intro:linearI)
[PROOF STATE]
proof (state)
this:
linear uminus

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
hence "uminus ` closure ?T \<subseteq> closure (uminus ` ?T)"
[PROOF STATE]
proof (prove)
using this:
linear uminus

goal (1 subgoal):
 1. uminus ` closure (uminus ` S) \<subseteq> closure (uminus ` uminus ` S)
[PROOF STEP]
by(rule closure_linear_image_subset)
[PROOF STATE]
proof (state)
this:
uminus ` closure (uminus ` S) \<subseteq> closure (uminus ` uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
uminus ` closure (uminus ` S) \<subseteq> closure (uminus ` uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
uminus ` closure (uminus ` S) \<subseteq> closure (uminus ` uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
uminus ` closure (uminus ` S) \<subseteq> closure (uminus ` uminus ` S)

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
have "uminus ` ?T \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uminus ` uminus ` S \<subseteq> S
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
uminus ` uminus ` S \<subseteq> S

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
hence "closure (uminus ` ?T) \<subseteq> closure S"
[PROOF STATE]
proof (prove)
using this:
uminus ` uminus ` S \<subseteq> S

goal (1 subgoal):
 1. closure (uminus ` uminus ` S) \<subseteq> closure S
[PROOF STEP]
by(rule closure_mono)
[PROOF STATE]
proof (state)
this:
closure (uminus ` uminus ` S) \<subseteq> closure S

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
closure (uminus ` uminus ` S) \<subseteq> closure S

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sup S \<in> closure S
[PROOF STEP]
show "Sup S \<in> closure S"
[PROOF STATE]
proof (prove)
using this:
Sup S \<in> closure S

goal (1 subgoal):
 1. Sup S \<in> closure S
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Sup S \<in> closure S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Joints_set_zip_subset:
  assumes "xs \<in> Joints XS"
  assumes "length xs = length XS"
  assumes "length ys = length YS"
  assumes "set (zip ys YS) \<subseteq> set (zip xs XS)"
  shows "ys \<in> Joints YS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ys \<in> Joints YS
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ys \<in> Joints YS
[PROOF STEP]
from Joints_mapE assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?ys \<in> Joints ?YS; \<And>e. \<lbrakk>?ys = map (aform_val e) ?YS; \<And>i. e i \<in> {- 1..1}\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
xs \<in> Joints XS
length xs = length XS
length ys = length YS
set (zip ys YS) \<subseteq> set (zip xs XS)
[PROOF STEP]
obtain e where
    ys: "xs = map (\<lambda>x. aform_val e x) XS"
    and e: "\<And>i. e i \<in> {-1 .. 1}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?ys \<in> Joints ?YS; \<And>e. \<lbrakk>?ys = map (aform_val e) ?YS; \<And>i. e i \<in> {- 1..1}\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
xs \<in> Joints XS
length xs = length XS
length ys = length YS
set (zip ys YS) \<subseteq> set (zip xs XS)

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>xs = map (aform_val e) XS; \<And>i. e i \<in> {- 1..1}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
xs = map (aform_val e) XS
e ?i \<in> {- 1..1}

goal (1 subgoal):
 1. ys \<in> Joints YS
[PROOF STEP]
show "ys \<in> Joints YS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ys \<in> Joints YS
[PROOF STEP]
using e zipped_subset_mapped_Elem[OF ys e assms(2-4)]
[PROOF STATE]
proof (prove)
using this:
e ?i \<in> {- 1..1}
ys = map (aform_val e) YS

goal (1 subgoal):
 1. ys \<in> Joints YS
[PROOF STEP]
by (auto simp: Joints_def valuate_def intro!: exI[where x=e])
[PROOF STATE]
proof (state)
this:
ys \<in> Joints YS

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fmsubset_eq:
  assumes "s1 \<subseteq>\<^sub>f s2"
  shows "(\<forall>a. a |\<in>| fmdom s1 \<longrightarrow> fmlookup s1 a = fmlookup s2 a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. a |\<in>| fmdom s1 \<longrightarrow> fmlookup s1 a = fmlookup s2 a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s1 \<subseteq>\<^sub>f s2

goal (1 subgoal):
 1. \<forall>a. a |\<in>| fmdom s1 \<longrightarrow> fmlookup s1 a = fmlookup s2 a
[PROOF STEP]
by (metis (mono_tags, lifting) domIff fmdom_notI fmsubset.rep_eq map_le_def)

\<comment> \<open>NOTE added lemma.\<close>
\<comment> \<open>TODO refactor/move into 'FmapUtils.thy'.\<close>


[STATEMENT]
lemma content_cbox_pair_eq0_D:
   "content (cbox (a,c) (b,d)) = 0 \<Longrightarrow> content (cbox a b) = 0 \<or> content (cbox c d) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (cbox (a, c) (b, d)) = 0 \<Longrightarrow> content (cbox a b) = 0 \<or> content (cbox c d) = 0
[PROOF STEP]
by (simp add: content_Pair)


[STATEMENT]
lemma nat_of_string_bij: "bij nat_of_string"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij nat_of_string
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij nat_of_string
[PROOF STEP]
have "countable (UNIV::string set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
countable UNIV

goal (1 subgoal):
 1. bij nat_of_string
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
countable UNIV

goal (1 subgoal):
 1. bij nat_of_string
[PROOF STEP]
have "infinite (UNIV::string set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
using infinite_UNIV_listI
[PROOF STATE]
proof (prove)
using this:
infinite UNIV

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

goal (1 subgoal):
 1. bij nat_of_string
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
countable UNIV
infinite UNIV
[PROOF STEP]
obtain x where "bij (x:: string \<Rightarrow> nat)"
[PROOF STATE]
proof (prove)
using this:
countable UNIV
infinite UNIV

goal (1 subgoal):
 1. (\<And>x. bij x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using countableE_infinite[of UNIV]
[PROOF STATE]
proof (prove)
using this:
countable UNIV
infinite UNIV
\<lbrakk>countable UNIV; infinite UNIV; \<And>e. bij e \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>x. bij x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij x

goal (1 subgoal):
 1. bij nat_of_string
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij x
[PROOF STEP]
show "?thesis"
[PROOF STATE]
proof (prove)
using this:
bij x

goal (1 subgoal):
 1. bij nat_of_string
[PROOF STEP]
unfolding nat_of_string_def
[PROOF STATE]
proof (prove)
using this:
bij x

goal (1 subgoal):
 1. bij (SOME f. bij f)
[PROOF STEP]
using someI
[PROOF STATE]
proof (prove)
using this:
bij x
?P ?x \<Longrightarrow> ?P (Eps ?P)

goal (1 subgoal):
 1. bij (SOME f. bij f)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
bij nat_of_string

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Im_Ln_pos_le:
  assumes "z \<noteq> 0"
    shows "0 \<le> Im(Ln z) \<and> Im(Ln z) \<le> pi \<longleftrightarrow> 0 \<le> Im(z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
assume "w = Ln z"
[PROOF STATE]
proof (state)
this:
w = Ln z

goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w = Ln z
[PROOF STEP]
have w: "Im w \<le> pi" "- pi < Im w"
[PROOF STATE]
proof (prove)
using this:
w = Ln z

goal (1 subgoal):
 1. Im w \<le> pi &&& - pi < Im w
[PROOF STEP]
using Im_Ln_le_pi [of z]  mpi_less_Im_Ln [of z]  assms
[PROOF STATE]
proof (prove)
using this:
w = Ln z
z \<noteq> 0 \<Longrightarrow> Im (Ln z) \<le> pi
z \<noteq> 0 \<Longrightarrow> - pi < Im (Ln z)
z \<noteq> 0

goal (1 subgoal):
 1. Im w \<le> pi &&& - pi < Im w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im w \<le> pi
- pi < Im w

goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Im w \<le> pi
- pi < Im w
[PROOF STEP]
have "0 \<le> Im w \<and> Im w \<le> pi \<longleftrightarrow> 0 \<le> Im(exp w)"
[PROOF STATE]
proof (prove)
using this:
Im w \<le> pi
- pi < Im w

goal (1 subgoal):
 1. (0 \<le> Im w \<and> Im w \<le> pi) = (0 \<le> Im (exp w))
[PROOF STEP]
using sin_ge_zero [of "- (Im w)"] sin_ge_zero [of "abs(Im w)"] sin_zero_pi_iff [of "Im w"]
[PROOF STATE]
proof (prove)
using this:
Im w \<le> pi
- pi < Im w
\<lbrakk>0 \<le> - Im w; - Im w \<le> pi\<rbrakk> \<Longrightarrow> 0 \<le> sin (- Im w)
\<lbrakk>0 \<le> \<bar>Im w\<bar>; \<bar>Im w\<bar> \<le> pi\<rbrakk> \<Longrightarrow> 0 \<le> sin \<bar>Im w\<bar>
\<bar>Im w\<bar> < pi \<Longrightarrow> (sin (Im w) = 0) = (Im w = 0)

goal (1 subgoal):
 1. (0 \<le> Im w \<and> Im w \<le> pi) = (0 \<le> Im (exp w))
[PROOF STEP]
by (force simp: Im_exp zero_le_mult_iff sin_ge_zero)
[PROOF STATE]
proof (state)
this:
(0 \<le> Im w \<and> Im w \<le> pi) = (0 \<le> Im (exp w))

goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?w2 = Ln z \<Longrightarrow> (0 \<le> Im ?w2 \<and> Im ?w2 \<le> pi) = (0 \<le> Im (exp ?w2))

goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?w2 = Ln z \<Longrightarrow> (0 \<le> Im ?w2 \<and> Im ?w2 \<le> pi) = (0 \<le> Im (exp ?w2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?w2 = Ln z \<Longrightarrow> (0 \<le> Im ?w2 \<and> Im ?w2 \<le> pi) = (0 \<le> Im (exp ?w2))

goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?w2 = Ln z \<Longrightarrow> (0 \<le> Im ?w2 \<and> Im ?w2 \<le> pi) = (0 \<le> Im (exp ?w2))
z \<noteq> 0

goal (1 subgoal):
 1. (0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0 \<le> Im (Ln z) \<and> Im (Ln z) \<le> pi) = (0 \<le> Im z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma min_absorb2:
  assumes "y \<le>\<^sub>a x"
  shows "min x y = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.min x y = y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y \<le>\<^sub>a x

goal (1 subgoal):
 1. local.min x y = y
[PROOF STEP]
unfolding min_def
[PROOF STATE]
proof (prove)
using this:
y \<le>\<^sub>a x

goal (1 subgoal):
 1. (if x \<le>\<^sub>a y then x else y) = y
[PROOF STEP]
by (simp add: eq_iff)


[STATEMENT]
lemma TailIsPrefixList :
fixes
  l1 :: "'a list" and
  tail :: "'a list"
assumes "tail \<noteq> []"
shows "prefixList l1 (l1 @ tail)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefixList l1 (l1 @ tail)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
tail \<noteq> []

goal (1 subgoal):
 1. prefixList l1 (l1 @ tail)
[PROOF STEP]
proof (induct l1, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. tail \<noteq> [] \<Longrightarrow> prefixList [] tail
 2. \<And>a l1. \<lbrakk>prefixList l1 (l1 @ tail); tail \<noteq> []\<rbrakk> \<Longrightarrow> prefixList (a # l1) (a # l1 @ tail)
[PROOF STEP]
have "\<exists> x xs . tail = x # xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x xs. tail = x # xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
tail \<noteq> []

goal (1 subgoal):
 1. \<exists>x xs. tail = x # xs
[PROOF STEP]
by (metis neq_Nil_conv)
[PROOF STATE]
proof (state)
this:
\<exists>x xs. tail = x # xs

goal (2 subgoals):
 1. tail \<noteq> [] \<Longrightarrow> prefixList [] tail
 2. \<And>a l1. \<lbrakk>prefixList l1 (l1 @ tail); tail \<noteq> []\<rbrakk> \<Longrightarrow> prefixList (a # l1) (a # l1 @ tail)
[PROOF STEP]
thus "prefixList [] tail"
[PROOF STATE]
proof (prove)
using this:
\<exists>x xs. tail = x # xs

goal (1 subgoal):
 1. prefixList [] tail
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>x xs. tail = x # xs
tail \<noteq> []

goal (1 subgoal):
 1. prefixList [] tail
[PROOF STEP]
by (metis prefixList.intros(1))
[PROOF STATE]
proof (state)
this:
prefixList [] tail

goal (1 subgoal):
 1. \<And>a l1. \<lbrakk>prefixList l1 (l1 @ tail); tail \<noteq> []\<rbrakk> \<Longrightarrow> prefixList (a # l1) (a # l1 @ tail)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l1. \<lbrakk>prefixList l1 (l1 @ tail); tail \<noteq> []\<rbrakk> \<Longrightarrow> prefixList (a # l1) (a # l1 @ tail)
[PROOF STEP]
fix a l1
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l1. \<lbrakk>prefixList l1 (l1 @ tail); tail \<noteq> []\<rbrakk> \<Longrightarrow> prefixList (a # l1) (a # l1 @ tail)
[PROOF STEP]
assume "prefixList l1 (l1 @ tail)"
[PROOF STATE]
proof (state)
this:
prefixList l1 (l1 @ tail)

goal (1 subgoal):
 1. \<And>a l1. \<lbrakk>prefixList l1 (l1 @ tail); tail \<noteq> []\<rbrakk> \<Longrightarrow> prefixList (a # l1) (a # l1 @ tail)
[PROOF STEP]
thus "prefixList (a # l1) (a # l1 @ tail)"
[PROOF STATE]
proof (prove)
using this:
prefixList l1 (l1 @ tail)

goal (1 subgoal):
 1. prefixList (a # l1) (a # l1 @ tail)
[PROOF STEP]
by (metis prefixList.intros(2))
[PROOF STATE]
proof (state)
this:
prefixList (a # l1) (a # l1 @ tail)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma weak_integer_composition_enum_length:
  "xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l
[PROOF STEP]
proof(induct l arbitrary: xs i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs i. xs \<in> set (weak_integer_composition_enum i 0) \<Longrightarrow> length xs = 0
 2. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
xs \<in> set (weak_integer_composition_enum i 0)

goal (2 subgoals):
 1. \<And>xs i. xs \<in> set (weak_integer_composition_enum i 0) \<Longrightarrow> length xs = 0
 2. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<in> set (weak_integer_composition_enum i 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
xs \<in> set (weak_integer_composition_enum i 0)

goal (1 subgoal):
 1. length xs = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length xs = 0

goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
case (Suc l)
[PROOF STATE]
proof (state)
this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> length ?xs = l
xs \<in> set (weak_integer_composition_enum i (Suc l))

goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> length xs = l; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> length xs = Suc l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> length ?xs = l
xs \<in> set (weak_integer_composition_enum i (Suc l))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> length ?xs = l
xs \<in> set (weak_integer_composition_enum i (Suc l))

goal (1 subgoal):
 1. length xs = Suc l
[PROOF STEP]
by(cases l) auto
[PROOF STATE]
proof (state)
this:
length xs = Suc l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma twice_field_differentiable_at_power [simp, intro]:
  "(\<lambda>x. x ^ n) twice_field_differentiable_at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
have "\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
have "deriv ((\<lambda>x. x ^ n)) field_differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
have "deriv ((\<lambda>x. x ^ n)) = (\<lambda>x. of_nat n * x ^ (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))
[PROOF STEP]
by (simp add: ext)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))

goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))

goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
using field_differentiable_mult[of "\<lambda>x. of_nat n" x UNIV "\<lambda>x. x ^ (n - 1)"]
[PROOF STATE]
proof (prove)
using this:
deriv (\<lambda>x. x ^ n) = (\<lambda>x. of_nat n * x ^ (n - 1))
\<lbrakk>(\<lambda>x. of_nat n) field_differentiable at x; (\<lambda>x. x ^ (n - 1)) field_differentiable at x\<rbrakk> \<Longrightarrow> (\<lambda>z. of_nat n * z ^ (n - 1)) field_differentiable at x

goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
by (simp add: field_differentiable_caratheodory_at)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. x ^ n) field_differentiable at x

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

goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x
deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x
deriv (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. x ^ n) twice_field_differentiable_at x
[PROOF STEP]
unfolding twice_field_differentiable_at_def field_differentiable_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. (\<lambda>x. x ^ n) field_differentiable at x
deriv (\<lambda>x. x ^ n) field_differentiable at x

goal (1 subgoal):
 1. \<exists>S. (\<forall>x\<in>S. (\<lambda>x. x ^ n) field_differentiable at x within S) \<and> x \<in> interior S \<and> deriv (\<lambda>x. x ^ n) field_differentiable at x
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x ^ n) twice_field_differentiable_at x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma listset_card[simp]: "card (listset XS) = prod_list (map card XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (listset XS) = prod_list (map card XS)
[PROOF STEP]
proof (induct XS)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card (listset []) = prod_list (map card [])
 2. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card (listset []) = prod_list (map card [])
 2. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (listset []) = prod_list (map card [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (listset []) = prod_list (map card [])

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
case (Cons A XS)
[PROOF STATE]
proof (state)
this:
card (listset XS) = prod_list (map card XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have 1: "inj (case_prod Cons)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>(x, y). x # y)
[PROOF STEP]
unfolding inj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (case x of (x, xa) \<Rightarrow> x # xa) = (case y of (x, xa) \<Rightarrow> x # xa) \<longrightarrow> x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj (\<lambda>(x, y). x # y)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "listset (A # XS) = case_prod Cons ` (A \<times> listset XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. listset (A # XS) = (\<lambda>(x, y). x # y) ` (A \<times> listset XS)
[PROOF STEP]
by (auto simp: set_Cons_def)
[PROOF STATE]
proof (state)
this:
listset (A # XS) = (\<lambda>(x, y). x # y) ` (A \<times> listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
listset (A # XS) = (\<lambda>(x, y). x # y) ` (A \<times> listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "card \<dots> = card (A \<times> listset XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>(x, y). x # y) ` (A \<times> listset XS)) = card (A \<times> listset XS)
[PROOF STEP]
using card_image 1
[PROOF STATE]
proof (prove)
using this:
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A
inj (\<lambda>(x, y). x # y)

goal (1 subgoal):
 1. card ((\<lambda>(x, y). x # y) ` (A \<times> listset XS)) = card (A \<times> listset XS)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card ((\<lambda>(x, y). x # y) ` (A \<times> listset XS)) = card (A \<times> listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((\<lambda>(x, y). x # y) ` (A \<times> listset XS)) = card (A \<times> listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "\<dots> = card A * card (listset XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<times> listset XS) = card A * card (listset XS)
[PROOF STEP]
using card_cartesian_product
[PROOF STATE]
proof (prove)
using this:
card (?A \<times> ?B) = card ?A * card ?B

goal (1 subgoal):
 1. card (A \<times> listset XS) = card A * card (listset XS)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (A \<times> listset XS) = card A * card (listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (A \<times> listset XS) = card A * card (listset XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "card (listset XS) = prod_list (map card XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (listset XS) = prod_list (map card XS)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
card (listset XS) = prod_list (map card XS)

goal (1 subgoal):
 1. card (listset XS) = prod_list (map card XS)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (listset XS) = prod_list (map card XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (listset XS) = prod_list (map card XS)

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
have "card A * \<dots> = prod_list (map card (A # XS))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A * prod_list (map card XS) = prod_list (map card (A # XS))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card A * prod_list (map card XS) = prod_list (map card (A # XS))

goal (1 subgoal):
 1. \<And>a XS. card (listset XS) = prod_list (map card XS) \<Longrightarrow> card (listset (a # XS)) = prod_list (map card (a # XS))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (listset (A # XS)) = prod_list (map card (A # XS))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (listset (A # XS)) = prod_list (map card (A # XS))

goal (1 subgoal):
 1. card (listset (A # XS)) = prod_list (map card (A # XS))
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (listset (A # XS)) = prod_list (map card (A # XS))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_on_linord_of_list:
  assumes "Linear_order r"
  assumes "set xs = Field r"
  assumes "sorted_on r xs"
  assumes "distinct xs"
  shows "linord_of_list (rev xs) = r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linord_of_list (rev xs) = r
[PROOF STEP]
proof(rule equalityI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. linord_of_list (rev xs) \<subseteq> r
 2. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs
[PROOF STEP]
show "linord_of_list (rev xs) \<subseteq> r"
[PROOF STATE]
proof (prove)
using this:
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs

goal (1 subgoal):
 1. linord_of_list (rev xs) \<subseteq> r
[PROOF STEP]
using sorted_on_linord_of_list_subseteq_r
[PROOF STATE]
proof (prove)
using this:
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs
\<lbrakk>Linear_order ?r; sorted_on ?r ?xs; distinct ?xs\<rbrakk> \<Longrightarrow> linord_of_list (rev ?xs) \<subseteq> ?r

goal (1 subgoal):
 1. linord_of_list (rev xs) \<subseteq> r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linord_of_list (rev xs) \<subseteq> r

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
assume xy: "(x, y) \<in> r"
[PROOF STATE]
proof (state)
this:
(x, y) \<in> r

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
with \<open>Linear_order r\<close>
[PROOF STATE]
proof (chain)
picking this:
Linear_order r
(x, y) \<in> r
[PROOF STEP]
have "(y, x) \<notin> r - Id"
[PROOF STATE]
proof (prove)
using this:
Linear_order r
(x, y) \<in> r

goal (1 subgoal):
 1. (y, x) \<notin> r - Id
[PROOF STEP]
using Linear_order_in_diff_Id
[PROOF STATE]
proof (prove)
using this:
Linear_order r
(x, y) \<in> r
\<lbrakk>Linear_order ?r; ?a \<in> Field ?r; ?b \<in> Field ?r\<rbrakk> \<Longrightarrow> ((?a, ?b) \<in> ?r) = ((?b, ?a) \<notin> ?r - Id)

goal (1 subgoal):
 1. (y, x) \<notin> r - Id
[PROOF STEP]
by (fastforce intro: FieldI1)
[PROOF STATE]
proof (state)
this:
(y, x) \<notin> r - Id

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
with linord_of_list_Linear_order[of "rev xs" "Field r"] assms xy
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>distinct (rev xs); Field r = set (rev xs)\<rbrakk> \<Longrightarrow> linear_order_on (Field r) (linord_of_list (rev xs))
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs
(x, y) \<in> r
(y, x) \<notin> r - Id
[PROOF STEP]
have "(x, y) \<in> linord_of_list (rev xs)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>distinct (rev xs); Field r = set (rev xs)\<rbrakk> \<Longrightarrow> linear_order_on (Field r) (linord_of_list (rev xs))
Linear_order r
set xs = Field r
sorted_on r xs
distinct xs
(x, y) \<in> r
(y, x) \<notin> r - Id

goal (1 subgoal):
 1. (x, y) \<in> linord_of_list (rev xs)
[PROOF STEP]
by simp (metis Diff_subset FieldI1 FieldI2 Linear_order_in_diff_Id linord_of_list_Field set_rev sorted_on_linord_of_list_subseteq_r subset_eq)
[PROOF STATE]
proof (state)
this:
(x, y) \<in> linord_of_list (rev xs)

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(?x2, ?y2) \<in> r \<Longrightarrow> (?x2, ?y2) \<in> linord_of_list (rev xs)

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?x2, ?y2) \<in> r \<Longrightarrow> (?x2, ?y2) \<in> linord_of_list (rev xs)
[PROOF STEP]
show "r \<subseteq> linord_of_list (rev xs)"
[PROOF STATE]
proof (prove)
using this:
(?x2, ?y2) \<in> r \<Longrightarrow> (?x2, ?y2) \<in> linord_of_list (rev xs)

goal (1 subgoal):
 1. r \<subseteq> linord_of_list (rev xs)
[PROOF STEP]
by clarsimp
[PROOF STATE]
proof (state)
this:
r \<subseteq> linord_of_list (rev xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in monoid_cancel) divides_mult_l [simp]:
  assumes carr: "a \<in> carrier G"  "b \<in> carrier G"  "c \<in> carrier G"
  shows "(c \<otimes> a) divides (c \<otimes> b) = a divides b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<otimes> a divides c \<otimes> b = a divides b
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b
 2. a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b
[PROOF STEP]
show "c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b
[PROOF STEP]
using carr monoid.m_assoc monoid_axioms monoid_cancel.l_cancel monoid_cancel_axioms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
b \<in> carrier G
c \<in> carrier G
\<lbrakk>Group.monoid ?G; ?x \<in> carrier ?G; ?y \<in> carrier ?G; ?z \<in> carrier ?G\<rbrakk> \<Longrightarrow> ?x \<otimes>\<^bsub>?G\<^esub> ?y \<otimes>\<^bsub>?G\<^esub> ?z = ?x \<otimes>\<^bsub>?G\<^esub> (?y \<otimes>\<^bsub>?G\<^esub> ?z)
Group.monoid G
\<lbrakk>monoid_cancel ?G; ?c \<otimes>\<^bsub>?G\<^esub> ?a = ?c \<otimes>\<^bsub>?G\<^esub> ?b; ?a \<in> carrier ?G; ?b \<in> carrier ?G; ?c \<in> carrier ?G\<rbrakk> \<Longrightarrow> ?a = ?b
monoid_cancel G

goal (1 subgoal):
 1. c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
c \<otimes> a divides c \<otimes> b \<Longrightarrow> a divides b

goal (1 subgoal):
 1. a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b
[PROOF STEP]
show "a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b
[PROOF STEP]
using carr(1) carr(3)
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
c \<in> carrier G

goal (1 subgoal):
 1. a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a divides b \<Longrightarrow> c \<otimes> a divides c \<otimes> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_distinct: "finite s \<Longrightarrow> finite {xs . set xs \<subseteq> s \<and> distinct xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
assume "finite s"
[PROOF STATE]
proof (state)
this:
finite s

goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
hence "{xs . set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}"
[PROOF STATE]
proof (prove)
using this:
finite s

goal (1 subgoal):
 1. {xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
using distinct_length_le
[PROOF STATE]
proof (prove)
using this:
finite s
\<lbrakk>finite ?s; set ?xs \<subseteq> ?s; distinct ?xs\<rbrakk> \<Longrightarrow> length ?xs \<le> card ?s

goal (1 subgoal):
 1. {xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}

goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}

goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
have "finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
using finite_lists_length_le[OF \<open>finite s\<close>]
[PROOF STATE]
proof (prove)
using this:
finite {xs. set xs \<subseteq> s \<and> length xs \<le> ?n}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}

goal (1 subgoal):
 1. finite s \<Longrightarrow> finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{xs. set xs \<subseteq> s \<and> distinct xs} \<subseteq> {xs. set xs \<subseteq> s \<and> length xs \<le> card s}
finite {xs. set xs \<subseteq> s \<and> length xs \<le> card s}

goal (1 subgoal):
 1. finite {xs. set xs \<subseteq> s \<and> distinct xs}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {xs. set xs \<subseteq> s \<and> distinct xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_det_bound_of_int: fixes A :: "'a :: linordered_idom mat"
  assumes db: "is_det_bound db"
  and A: "A \<in> carrier_mat n n"
  and "A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)"
shows "abs (det A) \<le> of_int (db n bnd)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_det_bound db
A \<in> carrier_mat n n
A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)
[PROOF STEP]
have "A \<in> \<int>\<^sub>m"
[PROOF STATE]
proof (prove)
using this:
is_det_bound db
A \<in> carrier_mat n n
A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)

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

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
from Ints_matE[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>B. A = of_int_hom.mat_hom B
[PROOF STEP]
obtain B where
    AB: "A = map_mat of_int B"
[PROOF STATE]
proof (prove)
using this:
\<exists>B. A = of_int_hom.mat_hom B

goal (1 subgoal):
 1. (\<And>B. A = of_int_hom.mat_hom B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = of_int_hom.mat_hom B

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_det_bound db
A \<in> carrier_mat n n
A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)
[PROOF STEP]
have "A \<in> Bounded_mat (of_int bnd)"
[PROOF STATE]
proof (prove)
using this:
is_det_bound db
A \<in> carrier_mat n n
A \<in> \<int>\<^sub>m \<inter> Bounded_mat (of_int bnd)

goal (1 subgoal):
 1. A \<in> Bounded_mat (of_int bnd)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> Bounded_mat (of_int bnd)

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
hence "B \<in> Bounded_mat bnd"
[PROOF STATE]
proof (prove)
using this:
A \<in> Bounded_mat (of_int bnd)

goal (1 subgoal):
 1. B \<in> Bounded_mat bnd
[PROOF STEP]
unfolding AB Bounded_mat_elements_mat
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>elements_mat (of_int_hom.mat_hom B). \<bar>x\<bar> \<le> of_int bnd

goal (1 subgoal):
 1. \<forall>x\<in>elements_mat B. \<bar>x\<bar> \<le> bnd
[PROOF STEP]
by (auto simp flip: of_int_abs)
[PROOF STATE]
proof (state)
this:
B \<in> Bounded_mat bnd

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
from db[unfolded is_det_bound_def, rule_format, OF _ this, of n] AB A
[PROOF STATE]
proof (chain)
picking this:
B \<in> carrier_mat n n \<Longrightarrow> \<bar>det B\<bar> \<le> db n bnd
A = of_int_hom.mat_hom B
A \<in> carrier_mat n n
[PROOF STEP]
have "\<bar>det B\<bar> \<le> db n bnd"
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat n n \<Longrightarrow> \<bar>det B\<bar> \<le> db n bnd
A = of_int_hom.mat_hom B
A \<in> carrier_mat n n

goal (1 subgoal):
 1. \<bar>det B\<bar> \<le> db n bnd
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>det B\<bar> \<le> db n bnd

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>det B\<bar> \<le> db n bnd

goal (1 subgoal):
 1. \<bar>det A\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
unfolding AB of_int_hom.hom_det
[PROOF STATE]
proof (prove)
using this:
\<bar>det B\<bar> \<le> db n bnd

goal (1 subgoal):
 1. \<bar>of_int (det B)\<bar> \<le> of_int (db n bnd)
[PROOF STEP]
by (simp flip: of_int_abs)
[PROOF STATE]
proof (state)
this:
\<bar>det A\<bar> \<le> of_int (db n bnd)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_If_set:
  assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'"
  assumes P: "A \<inter> space M \<in> sets M"
  shows "(\<lambda>x. if x \<in> A then f x else g x) \<in> measurable M M'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> A then f x else g x) \<in> M \<rightarrow>\<^sub>M M'
[PROOF STEP]
proof (rule measurable_If[OF measure])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} \<in> sets M
[PROOF STEP]
have "{x \<in> space M. x \<in> A} = A \<inter> space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} = A \<inter> space M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> space M. x \<in> A} = A \<inter> space M

goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} \<in> sets M
[PROOF STEP]
thus "{x \<in> space M. x \<in> A} \<in> sets M"
[PROOF STATE]
proof (prove)
using this:
{x \<in> space M. x \<in> A} = A \<inter> space M

goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} \<in> sets M
[PROOF STEP]
using \<open>A \<inter> space M \<in> sets M\<close>
[PROOF STATE]
proof (prove)
using this:
{x \<in> space M. x \<in> A} = A \<inter> space M
A \<inter> space M \<in> sets M

goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} \<in> sets M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> space M. x \<in> A} \<in> sets M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_orbit_list:
  assumes "x \<in> orbit f x"
  shows "set (orbit_list f x) = orbit f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (orbit_list f x) = orbit f x
[PROOF STEP]
by (simp add: orbit_list_def orbit_conv_funpow_dist1[OF assms] set_iterate)