[STATEMENT]
lemma
  assumes "finite V" "i \<notin> V"
  shows ssubst_insert:  "ssubst t (insert i V) F = subst i (F i) (ssubst t V F)"  (is ?thesis1)
    and ssubst_insert2: "ssubst t (insert i V) F = ssubst (subst i (F i) t) V F"  (is ?thesis2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ssubst t (insert i V) F = subst i (F i) (ssubst t V F) &&& ssubst t (insert i V) F = ssubst (subst i (F i) t) V F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ssubst t (insert i V) F = subst i (F i) (ssubst t V F)
 2. ssubst t (insert i V) F = ssubst (subst i (F i) t) V F
[PROOF STEP]
interpret comp_fun_commute "(\<lambda>i. subst i (F i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>i. subst i (F i))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y x. subst y (F y) \<circ> subst x (F x) = subst x (F x) \<circ> subst y (F y)
[PROOF STEP]
qed (simp add: subst_F_left_commute fun_eq_iff)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ssubst t (insert i V) F = subst i (F i) (ssubst t V F)
 2. ssubst t (insert i V) F = ssubst (subst i (F i) t) V F
[PROOF STEP]
show ?thesis1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ssubst t (insert i V) F = subst i (F i) (ssubst t V F)
[PROOF STEP]
using assms Vs
[PROOF STATE]
proof (prove)
using this:
finite V
i \<notin> V
finite Vs

goal (1 subgoal):
 1. ssubst t (insert i V) F = subst i (F i) (ssubst t V F)
[PROOF STEP]
by (simp add: ssubst_def)
[PROOF STATE]
proof (state)
this:
ssubst t (insert i V) F = subst i (F i) (ssubst t V F)

goal (1 subgoal):
 1. ssubst t (insert i V) F = ssubst (subst i (F i) t) V F
[PROOF STEP]
show ?thesis2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ssubst t (insert i V) F = ssubst (subst i (F i) t) V F
[PROOF STEP]
using assms Vs
[PROOF STATE]
proof (prove)
using this:
finite V
i \<notin> V
finite Vs

goal (1 subgoal):
 1. ssubst t (insert i V) F = ssubst (subst i (F i) t) V F
[PROOF STEP]
by (simp add: ssubst_def fold_insert2 del: fold_insert)
[PROOF STATE]
proof (state)
this:
ssubst t (insert i V) F = ssubst (subst i (F i) t) V F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_row_1_id:
  fixes A:: "'a::semiring_1^'n^'m"
  shows "mult_row A b 1 = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult_row A b (1::'a) = A
[PROOF STEP]
unfolding mult_row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. if i = b then (1::'a) * A $h b $h j else A $h i $h j) = A
[PROOF STEP]
by vector


[STATEMENT]
lemma exp_times_self_inj: "inj_on (\<lambda>x::real. x * exp x) {-1..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>x. x * exp x) {- 1..}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {- 1..}; y \<in> {- 1..}; x * exp x = y * exp y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {- 1..}; y \<in> {- 1..}; x * exp x = y * exp y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "x \<in> {-1..}" "y \<in> {-1..}" "x * exp x = y * exp y"
[PROOF STATE]
proof (state)
this:
x \<in> {- 1..}
y \<in> {- 1..}
x * exp x = y * exp y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {- 1..}; y \<in> {- 1..}; x * exp x = y * exp y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus "x = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> {- 1..}
y \<in> {- 1..}
x * exp x = y * exp y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using exp_times_self_strict_mono[of x y] exp_times_self_strict_mono[of y x]
[PROOF STATE]
proof (prove)
using this:
x \<in> {- 1..}
y \<in> {- 1..}
x * exp x = y * exp y
\<lbrakk>- 1 \<le> x; x < y\<rbrakk> \<Longrightarrow> x * exp x < y * exp y
\<lbrakk>- 1 \<le> y; y < x\<rbrakk> \<Longrightarrow> y * exp y < x * exp x

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (cases x y rule: linorder_cases) auto
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_ls_rehash:
  assumes "1 < length l"
  shows "1 < length (ls_rehash l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < length (ls_rehash l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < length (ls_rehash l)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 < length l
[PROOF STEP]
have "1 < length (replicate (2 * length l) [])"
[PROOF STATE]
proof (prove)
using this:
1 < length l

goal (1 subgoal):
 1. 1 < length (replicate (2 * length l) [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < length (replicate (2 * length l) [])

goal (1 subgoal):
 1. 1 < length (ls_rehash l)
[PROOF STEP]
from length_ls_copy[OF this, of "length l" l]
[PROOF STATE]
proof (chain)
picking this:
1 < length (ls_copy (length l) l (replicate (2 * length l) []))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 < length (ls_copy (length l) l (replicate (2 * length l) []))

goal (1 subgoal):
 1. 1 < length (ls_rehash l)
[PROOF STEP]
by (simp add: ls_rehash_def)
[PROOF STATE]
proof (state)
this:
1 < length (ls_rehash l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma content_ball_pos:
  assumes "r > 0"
  shows   "content (ball c r) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
from rational_boxes[OF assms, of c]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a b. (\<forall>i\<in>Basis. a \<bullet> i \<in> \<rat> \<and> b \<bullet> i \<in> \<rat>) \<and> c \<in> box a b \<and> box a b \<subseteq> ball c r
[PROOF STEP]
obtain a b where ab: "c \<in> box a b" "box a b \<subseteq> ball c r"
[PROOF STATE]
proof (prove)
using this:
\<exists>a b. (\<forall>i\<in>Basis. a \<bullet> i \<in> \<rat> \<and> b \<bullet> i \<in> \<rat>) \<and> c \<in> box a b \<and> box a b \<subseteq> ball c r

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>c \<in> box a b; box a b \<subseteq> ball c r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<in> box a b
box a b \<subseteq> ball c r

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
from ab
[PROOF STATE]
proof (chain)
picking this:
c \<in> box a b
box a b \<subseteq> ball c r
[PROOF STEP]
have "0 < content (box a b)"
[PROOF STATE]
proof (prove)
using this:
c \<in> box a b
box a b \<subseteq> ball c r

goal (1 subgoal):
 1. 0 < content (box a b)
[PROOF STEP]
by (subst measure_lborel_box_eq) (auto intro!: prod_pos simp: algebra_simps box_def)
[PROOF STATE]
proof (state)
this:
0 < content (box a b)

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
have "emeasure lborel (box a b) \<le> emeasure lborel (ball c r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel (box a b) \<le> emeasure lborel (ball c r)
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
c \<in> box a b
box a b \<subseteq> ball c r

goal (1 subgoal):
 1. emeasure lborel (box a b) \<le> emeasure lborel (ball c r)
[PROOF STEP]
by (intro emeasure_mono) auto
[PROOF STATE]
proof (state)
this:
emeasure lborel (box a b) \<le> emeasure lborel (ball c r)

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel (box a b) \<le> emeasure lborel (ball c r)

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
have "emeasure lborel (box a b) = ennreal (content (box a b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel (box a b) = ennreal (content (box a b))
[PROOF STEP]
using emeasure_lborel_box_finite[of a b]
[PROOF STATE]
proof (prove)
using this:
emeasure lborel (box a b) < \<infinity>

goal (1 subgoal):
 1. emeasure lborel (box a b) = ennreal (content (box a b))
[PROOF STEP]
by (intro emeasure_eq_ennreal_measure) auto
[PROOF STATE]
proof (state)
this:
emeasure lborel (box a b) = ennreal (content (box a b))

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lborel (box a b) = ennreal (content (box a b))

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
have "emeasure lborel (ball c r) = ennreal (content (ball c r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lborel (ball c r) = ennreal (content (ball c r))
[PROOF STEP]
using emeasure_lborel_ball_finite[of c r]
[PROOF STATE]
proof (prove)
using this:
emeasure lborel (ball c r) < \<infinity>

goal (1 subgoal):
 1. emeasure lborel (ball c r) = ennreal (content (ball c r))
[PROOF STEP]
by (intro emeasure_eq_ennreal_measure) auto
[PROOF STATE]
proof (state)
this:
emeasure lborel (ball c r) = ennreal (content (ball c r))

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (content (box a b)) \<le> ennreal (content (ball c r))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (content (box a b)) \<le> ennreal (content (ball c r))

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
using \<open>content (box a b) > 0\<close>
[PROOF STATE]
proof (prove)
using this:
ennreal (content (box a b)) \<le> ennreal (content (ball c r))
0 < content (box a b)

goal (1 subgoal):
 1. 0 < content (ball c r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < content (ball c r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_map_unique_vars:
  "sum_list (map num_unique_vars ts) \<ge> num_unique_vars (Fun f ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. num_unique_vars (Fun f ts) \<le> sum_list (map num_unique_vars ts)
[PROOF STEP]
proof (induct ts)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. num_unique_vars (Fun f []) \<le> sum_list (map num_unique_vars [])
 2. \<And>a ts. num_unique_vars (Fun f ts) \<le> sum_list (map num_unique_vars ts) \<Longrightarrow> num_unique_vars (Fun f (a # ts)) \<le> sum_list (map num_unique_vars (a # ts))
[PROOF STEP]
case (Cons t ts)
[PROOF STATE]
proof (state)
this:
num_unique_vars (Fun f ts) \<le> sum_list (map num_unique_vars ts)

goal (2 subgoals):
 1. num_unique_vars (Fun f []) \<le> sum_list (map num_unique_vars [])
 2. \<And>a ts. num_unique_vars (Fun f ts) \<le> sum_list (map num_unique_vars ts) \<Longrightarrow> num_unique_vars (Fun f (a # ts)) \<le> sum_list (map num_unique_vars (a # ts))
[PROOF STEP]
with num_unique_vars_Fun_Cons [of f t ts]
[PROOF STATE]
proof (chain)
picking this:
num_unique_vars (Fun f (t # ts)) \<le> num_unique_vars t + num_unique_vars (Fun f ts)
num_unique_vars (Fun f ts) \<le> sum_list (map num_unique_vars ts)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
num_unique_vars (Fun f (t # ts)) \<le> num_unique_vars t + num_unique_vars (Fun f ts)
num_unique_vars (Fun f ts) \<le> sum_list (map num_unique_vars ts)

goal (1 subgoal):
 1. num_unique_vars (Fun f (t # ts)) \<le> sum_list (map num_unique_vars (t # ts))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
num_unique_vars (Fun f (t # ts)) \<le> sum_list (map num_unique_vars (t # ts))

goal (1 subgoal):
 1. num_unique_vars (Fun f []) \<le> sum_list (map num_unique_vars [])
[PROOF STEP]
qed (simp add: num_unique_vars_def)


[STATEMENT]
lemma delete_dom_inj_on:
  assumes i: "i \<in> {0..<Suc n}" (is "_ \<in> ?N")
  assumes inj: "inj_on f ?N"
  shows "inj_on (delete_dom f i) {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (delete_dom f i) {0..<n}
[PROOF STEP]
proof (rule eq_card_imp_inj_on)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite {0..<n}
 2. card (delete_dom f i ` {0..<n}) = card {0..<n}
[PROOF STEP]
have "card ?N = card (f ` ?N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<Suc n} = card (f ` {0..<Suc n})
[PROOF STEP]
using card_image[OF inj]
[PROOF STATE]
proof (prove)
using this:
card (f ` {0..<Suc n}) = card {0..<Suc n}

goal (1 subgoal):
 1. card {0..<Suc n} = card (f ` {0..<Suc n})
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card {0..<Suc n} = card (f ` {0..<Suc n})

goal (2 subgoals):
 1. finite {0..<n}
 2. card (delete_dom f i ` {0..<n}) = card {0..<n}
[PROOF STEP]
hence "card {0..<n} = card (f ` ?N - {f i})"
[PROOF STATE]
proof (prove)
using this:
card {0..<Suc n} = card (f ` {0..<Suc n})

goal (1 subgoal):
 1. card {0..<n} = card (f ` {0..<Suc n} - {f i})
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
card {0..<Suc n} = card (f ` {0..<Suc n})
i \<in> {0..<Suc n}

goal (1 subgoal):
 1. card {0..<n} = card (f ` {0..<Suc n} - {f i})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {0..<n} = card (f ` {0..<Suc n} - {f i})

goal (2 subgoals):
 1. finite {0..<n}
 2. card (delete_dom f i ` {0..<n}) = card {0..<n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {0..<n} = card (f ` {0..<Suc n} - {f i})

goal (2 subgoals):
 1. finite {0..<n}
 2. card (delete_dom f i ` {0..<n}) = card {0..<n}
[PROOF STEP]
have "... = card (delete_dom f i ` {0..<n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (f ` {0..<Suc n} - {f i}) = card (delete_dom f i ` {0..<n})
[PROOF STEP]
apply(subst delete_dom_image[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. i \<in> {0..<Suc n}
 2. \<forall>i'\<in>{0..<Suc n}. f i' = f i \<longrightarrow> i' = i
 3. card (delete_dom f i ` {0..<n}) = card (delete_dom f i ` {0..<n})
[PROOF STEP]
using i inj
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<Suc n}
inj_on f {0..<Suc n}

goal (3 subgoals):
 1. i \<in> {0..<Suc n}
 2. \<forall>i'\<in>{0..<Suc n}. f i' = f i \<longrightarrow> i' = i
 3. card (delete_dom f i ` {0..<n}) = card (delete_dom f i ` {0..<n})
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<Suc n}
\<forall>x\<in>{0..<Suc n}. \<forall>y\<in>{0..<Suc n}. f x = f y \<longrightarrow> x = y

goal (3 subgoals):
 1. i \<in> {0..<Suc n}
 2. \<forall>i'\<in>{0..<Suc n}. f i' = f i \<longrightarrow> i' = i
 3. card (delete_dom f i ` {0..<n}) = card (delete_dom f i ` {0..<n})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (f ` {0..<Suc n} - {f i}) = card (delete_dom f i ` {0..<n})

goal (2 subgoals):
 1. finite {0..<n}
 2. card (delete_dom f i ` {0..<n}) = card {0..<n}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {0..<n} = card (delete_dom f i ` {0..<n})
[PROOF STEP]
show "card (delete_dom f i ` {0..<n}) = card {0..<n}"
[PROOF STATE]
proof (prove)
using this:
card {0..<n} = card (delete_dom f i ` {0..<n})

goal (1 subgoal):
 1. card (delete_dom f i ` {0..<n}) = card {0..<n}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card (delete_dom f i ` {0..<n}) = card {0..<n}

goal (1 subgoal):
 1. finite {0..<n}
[PROOF STEP]
qed simp


[STATEMENT]
lemma open_Collect_neg: "closed {x. P x} \<Longrightarrow> open {x. \<not> P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. P x} \<Longrightarrow> open {x. \<not> P x}
[PROOF STEP]
unfolding Collect_neg_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. P x} \<Longrightarrow> open (- {x. P x})
[PROOF STEP]
by (rule open_Compl)


[STATEMENT]
lemma (in linorder) set_iterator_linord_filter_correct :
  assumes it_OK: "set_iterator_linord it S"
  shows "set_iterator_linord (set_iterator_filter P it) {x. x \<in> S \<and> P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_iterator_linord (set_iterator_filter P it) {x \<in> S. P x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set_iterator_linord it S

goal (1 subgoal):
 1. set_iterator_linord (set_iterator_filter P it) {x \<in> S. P x}
[PROOF STEP]
unfolding set_iterator_linord_def
[PROOF STATE]
proof (prove)
using this:
set_iterator_genord it S (\<le>)

goal (1 subgoal):
 1. set_iterator_genord (set_iterator_filter P it) {x \<in> S. P x} (\<le>)
[PROOF STEP]
by (rule set_iterator_genord_filter_correct)


[STATEMENT]
lemma dvds_eq_Idl: "l dvd k \<and> k dvd l \<longleftrightarrow> Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
have a: "l dvd k \<longleftrightarrow> (Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l dvd k) = (Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
by (rule Idl_subset_eq_dvd[symmetric])
[PROOF STATE]
proof (state)
this:
(l dvd k) = (Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l})

goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
have b: "k dvd l \<longleftrightarrow> (Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k})
[PROOF STEP]
by (rule Idl_subset_eq_dvd[symmetric])
[PROOF STATE]
proof (state)
this:
(k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k})

goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
have "l dvd k \<and> k dvd l \<longleftrightarrow> Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l} \<and> Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l} \<and> Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k})
[PROOF STEP]
by (subst a, subst b, simp)
[PROOF STATE]
proof (state)
this:
(l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l} \<and> Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k})

goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l} \<and> Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k})

goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
have "Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l} \<and> Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k} \<longleftrightarrow> Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l} \<and> Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k}) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(Idl\<^bsub>\<Z>\<^esub> {k} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {l} \<and> Idl\<^bsub>\<Z>\<^esub> {l} \<subseteq> Idl\<^bsub>\<Z>\<^esub> {k}) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})

goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})

goal (1 subgoal):
 1. (l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(l dvd k \<and> k dvd l) = (Idl\<^bsub>\<Z>\<^esub> {k} = Idl\<^bsub>\<Z>\<^esub> {l})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Keys_to_list_sorted_wrt_aux:
  assumes "sorted_wrt (\<succ>\<^sub>t) ts"
  shows "sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p ts. merge_wrt (\<succ>\<^sub>t) (keys_to_list p) ts) ps ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) ps ts)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (\<succ>\<^sub>t) ts

goal (1 subgoal):
 1. sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) ps ts)
[PROOF STEP]
proof (induct ps arbitrary: ts)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ts. sorted_wrt (\<succ>\<^sub>t) ts \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) [] ts)
 2. \<And>a ps ts. \<lbrakk>\<And>ts. sorted_wrt (\<succ>\<^sub>t) ts \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) ps ts); sorted_wrt (\<succ>\<^sub>t) ts\<rbrakk> \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) (a # ps) ts)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
sorted_wrt (\<succ>\<^sub>t) ts

goal (2 subgoals):
 1. \<And>ts. sorted_wrt (\<succ>\<^sub>t) ts \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) [] ts)
 2. \<And>a ps ts. \<lbrakk>\<And>ts. sorted_wrt (\<succ>\<^sub>t) ts \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) ps ts); sorted_wrt (\<succ>\<^sub>t) ts\<rbrakk> \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) (a # ps) ts)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (\<succ>\<^sub>t) ts

goal (1 subgoal):
 1. sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) [] ts)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) [] ts)

goal (1 subgoal):
 1. \<And>a ps ts. \<lbrakk>\<And>ts. sorted_wrt (\<succ>\<^sub>t) ts \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) ps ts); sorted_wrt (\<succ>\<^sub>t) ts\<rbrakk> \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) (a # ps) ts)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ps ts. \<lbrakk>\<And>ts. sorted_wrt (\<succ>\<^sub>t) ts \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) ps ts); sorted_wrt (\<succ>\<^sub>t) ts\<rbrakk> \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) (a # ps) ts)
[PROOF STEP]
case (Cons p ps)
[PROOF STATE]
proof (state)
this:
sorted_wrt (\<succ>\<^sub>t) ?ts24 \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) ps ?ts24)
sorted_wrt (\<succ>\<^sub>t) ts

goal (1 subgoal):
 1. \<And>a ps ts. \<lbrakk>\<And>ts. sorted_wrt (\<succ>\<^sub>t) ts \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) ps ts); sorted_wrt (\<succ>\<^sub>t) ts\<rbrakk> \<Longrightarrow> sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) (a # ps) ts)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) (p # ps) ts)
[PROOF STEP]
proof (simp only: fold.simps o_def, rule Cons(1), rule sorted_merge_wrt)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. transp (\<succ>\<^sub>t)
 2. \<And>x y. x \<noteq> y \<Longrightarrow> x \<succ>\<^sub>t y \<or> y \<succ>\<^sub>t x
 3. sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)
 4. sorted_wrt (\<succ>\<^sub>t) ts
[PROOF STEP]
show "transp (\<succ>\<^sub>t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transp (\<succ>\<^sub>t)
[PROOF STEP]
unfolding transp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y z. x \<succ>\<^sub>t y \<longrightarrow> y \<succ>\<^sub>t z \<longrightarrow> x \<succ>\<^sub>t z
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
transp (\<succ>\<^sub>t)

goal (3 subgoals):
 1. \<And>x y. x \<noteq> y \<Longrightarrow> x \<succ>\<^sub>t y \<or> y \<succ>\<^sub>t x
 2. sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)
 3. sorted_wrt (\<succ>\<^sub>t) ts
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. x \<noteq> y \<Longrightarrow> x \<succ>\<^sub>t y \<or> y \<succ>\<^sub>t x
 2. sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)
 3. sorted_wrt (\<succ>\<^sub>t) ts
[PROOF STEP]
fix x y :: 't
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. x \<noteq> y \<Longrightarrow> x \<succ>\<^sub>t y \<or> y \<succ>\<^sub>t x
 2. sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)
 3. sorted_wrt (\<succ>\<^sub>t) ts
[PROOF STEP]
assume "x \<noteq> y"
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (3 subgoals):
 1. \<And>x y. x \<noteq> y \<Longrightarrow> x \<succ>\<^sub>t y \<or> y \<succ>\<^sub>t x
 2. sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)
 3. sorted_wrt (\<succ>\<^sub>t) ts
[PROOF STEP]
thus "x \<succ>\<^sub>t y \<or> y \<succ>\<^sub>t x"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y

goal (1 subgoal):
 1. x \<succ>\<^sub>t y \<or> y \<succ>\<^sub>t x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<succ>\<^sub>t y \<or> y \<succ>\<^sub>t x

goal (2 subgoals):
 1. sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)
 2. sorted_wrt (\<succ>\<^sub>t) ts
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)
 2. sorted_wrt (\<succ>\<^sub>t) ts
[PROOF STEP]
show "sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)
[PROOF STEP]
unfolding keys_to_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (\<succ>\<^sub>t) (pps_to_list (keys p))
[PROOF STEP]
by (fact pps_to_list_sorted_wrt)
[PROOF STATE]
proof (state)
this:
sorted_wrt (\<succ>\<^sub>t) (keys_to_list p)

goal (1 subgoal):
 1. sorted_wrt (\<succ>\<^sub>t) ts
[PROOF STEP]
qed fact
[PROOF STATE]
proof (state)
this:
sorted_wrt (\<succ>\<^sub>t) (fold (\<lambda>p. merge_wrt (\<succ>\<^sub>t) (keys_to_list p)) (p # ps) ts)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inorder_node31: "height m > 0 \<Longrightarrow>
  inorder (tree\<^sub>d (node31 l' a m b r)) = inorder (tree\<^sub>d l') @ a # inorder m @ b # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height m \<Longrightarrow> inorder (tree\<^sub>d (node31 l' a m b r)) = inorder (tree\<^sub>d l') @ a # inorder m @ b # inorder r
[PROOF STEP]
by(induct l' a m b r rule: node31.induct) auto


[STATEMENT]
lemma HLD_sconst[iff]: "HLD A (sconst a) \<longleftrightarrow> a \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HLD A (sconst a) = (a \<in> A)
[PROOF STEP]
unfolding HLD_def holds.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (shd (sconst a) \<in> A) = (a \<in> A)
[PROOF STEP]
by simp


[STATEMENT]
lemma sorted_wrt_iff_nth_Suc_transp: assumes "transp P"
  shows "sorted_wrt P xs \<longleftrightarrow> (\<forall>i.  Suc i < length xs \<longrightarrow> P (xs!i) (xs!(Suc i)))" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt P xs = (\<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sorted_wrt P xs \<Longrightarrow> \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i)
 2. \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i) \<Longrightarrow> sorted_wrt P xs
[PROOF STEP]
assume ?L
[PROOF STATE]
proof (state)
this:
sorted_wrt P xs

goal (2 subgoals):
 1. sorted_wrt P xs \<Longrightarrow> \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i)
 2. \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i) \<Longrightarrow> sorted_wrt P xs
[PROOF STEP]
thus ?R
[PROOF STATE]
proof (prove)
using this:
sorted_wrt P xs

goal (1 subgoal):
 1. \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i)
[PROOF STEP]
by (simp add: sorted_wrt_iff_nth_less)
[PROOF STATE]
proof (state)
this:
\<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i)

goal (1 subgoal):
 1. \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i) \<Longrightarrow> sorted_wrt P xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i) \<Longrightarrow> sorted_wrt P xs
[PROOF STEP]
assume ?R
[PROOF STATE]
proof (state)
this:
\<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i)

goal (1 subgoal):
 1. \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i) \<Longrightarrow> sorted_wrt P xs
[PROOF STEP]
have "i < j \<Longrightarrow> j < length xs \<Longrightarrow> P (xs ! i) (xs ! j)" for i j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < j; j < length xs\<rbrakk> \<Longrightarrow> P (xs ! i) (xs ! j)
[PROOF STEP]
by(induct i j rule: less_Suc_induct)(simp add: \<open>?R\<close>, meson assms transpE transp_less)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < ?j; ?j < length xs\<rbrakk> \<Longrightarrow> P (xs ! ?i) (xs ! ?j)

goal (1 subgoal):
 1. \<forall>i. Suc i < length xs \<longrightarrow> P (xs ! i) (xs ! Suc i) \<Longrightarrow> sorted_wrt P xs
[PROOF STEP]
thus ?L
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < ?j; ?j < length xs\<rbrakk> \<Longrightarrow> P (xs ! ?i) (xs ! ?j)

goal (1 subgoal):
 1. sorted_wrt P xs
[PROOF STEP]
by (simp add: sorted_wrt_iff_nth_less)
[PROOF STATE]
proof (state)
this:
sorted_wrt P xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_oFixD:
"\<lbrakk>x < oFix F a; mono F; F x = x\<rbrakk> \<Longrightarrow> x < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < oFix F a; mono F; F x = x\<rbrakk> \<Longrightarrow> x < a
[PROOF STEP]
apply (simp add: linorder_not_le[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> oFix F a \<le> x; mono F; F x = x\<rbrakk> \<Longrightarrow> \<not> a \<le> x
[PROOF STEP]
apply (erule contrapos_nn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono F; F x = x; a \<le> x\<rbrakk> \<Longrightarrow> oFix F a \<le> x
[PROOF STEP]
by (rule oFix_least)


[STATEMENT]
lemma list_ord_distinct: "
  \<lbrakk> irrefl {(a,b). ord a b}; transP ord; list_ord ord xs \<rbrakk> \<Longrightarrow>
  distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs\<rbrakk> \<Longrightarrow> distinct xs
[PROOF STEP]
apply (simp add: distinct_conv_nth, intro allI impI, rename_tac i j)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i \<noteq> j\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
[PROOF STEP]
apply (drule neq_iff[THEN iffD1], erule disjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; i < j\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
 2. \<And>i j. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; j < i\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
[PROOF STEP]
apply (simp add: list_ord_distinct_aux)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>irrefl {(a, b). ord a b}; trans {(x, y). ord x y}; list_ord ord xs; i < length xs; j < length xs; j < i\<rbrakk> \<Longrightarrow> xs ! i \<noteq> xs ! j
[PROOF STEP]
apply (simp add: list_ord_distinct_aux[THEN not_sym])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma le_divide_eq_1_pos [simp]:
  "0 < a \<Longrightarrow> (1 \<le> b/a) = (a \<le> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < a \<Longrightarrow> ((1::'a) \<le> b / a) = (a \<le> b)
[PROOF STEP]
by (simp add: local.pos_le_divide_eq)


[STATEMENT]
lemma QR_lemma_05: "card (Res_h p \<times> Res_l q) = r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({(int p - 1) div 2<..int p - 1} \<times> {0<..(int q - 1) div 2}) = r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({(int p - 1) div 2<..int p - 1} \<times> {0<..(int q - 1) div 2}) = r
[PROOF STEP]
have "card (Res_l q) = (q - 1) div 2" "card (Res_h p) = (p - 1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0<..(int q - 1) div 2} = (q - 1) div 2 &&& card {(int p - 1) div 2<..int p - 1} = (p - 1) div 2
[PROOF STEP]
using p_eq2
[PROOF STATE]
proof (prove)
using this:
int p = 2 * ((int p - 1) div 2) + 1

goal (1 subgoal):
 1. card {0<..(int q - 1) div 2} = (q - 1) div 2 &&& card {(int p - 1) div 2<..int p - 1} = (p - 1) div 2
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
card {0<..(int q - 1) div 2} = (q - 1) div 2
card {(int p - 1) div 2<..int p - 1} = (p - 1) div 2

goal (1 subgoal):
 1. card ({(int p - 1) div 2<..int p - 1} \<times> {0<..(int q - 1) div 2}) = r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card {0<..(int q - 1) div 2} = (q - 1) div 2
card {(int p - 1) div 2<..int p - 1} = (p - 1) div 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {0<..(int q - 1) div 2} = (q - 1) div 2
card {(int p - 1) div 2<..int p - 1} = (p - 1) div 2

goal (1 subgoal):
 1. card ({(int p - 1) div 2<..int p - 1} \<times> {0<..(int q - 1) div 2}) = r
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
using this:
card {0<..(int q - 1) div 2} = (q - 1) div 2
card {(int p - 1) div 2<..int p - 1} = (p - 1) div 2

goal (1 subgoal):
 1. card ({(int p - 1) div 2<..int p - 1} \<times> {0<..(int q - 1) div 2}) = (p - 1) div 2 * ((q - 1) div 2)
[PROOF STEP]
using card_cartesian_product[of "Res_h p" "Res_l q"]
[PROOF STATE]
proof (prove)
using this:
card {0<..(int q - 1) div 2} = (q - 1) div 2
card {(int p - 1) div 2<..int p - 1} = (p - 1) div 2
card ({(int p - 1) div 2<..int p - 1} \<times> {0<..(int q - 1) div 2}) = card {(int p - 1) div 2<..int p - 1} * card {0<..(int q - 1) div 2}

goal (1 subgoal):
 1. card ({(int p - 1) div 2<..int p - 1} \<times> {0<..(int q - 1) div 2}) = (p - 1) div 2 * ((q - 1) div 2)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
card ({(int p - 1) div 2<..int p - 1} \<times> {0<..(int q - 1) div 2}) = r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma kernel_compl_adj_range:
  shows \<open>kernel a = - (a* *\<^sub>S top)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel a = - (a* *\<^sub>S \<top>)
[PROOF STEP]
proof (rule ccsubspace_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
have \<open>x \<in> space_as_set (kernel a) \<longleftrightarrow> a x = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> space_as_set (kernel a)) = (a *\<^sub>V x = (0::'b))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x a. bounded_clinear a \<Longrightarrow> (x \<in> a -` {0::'b}) = (a x = (0::'b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<in> space_as_set (kernel a)) = (a *\<^sub>V x = (0::'b))

goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<in> space_as_set (kernel a)) = (a *\<^sub>V x = (0::'b))

goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
have \<open>a x = 0 \<longleftrightarrow> (\<forall>y. is_orthogonal y (a x))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a *\<^sub>V x = (0::'b)) = (\<forall>y. is_orthogonal y (a *\<^sub>V x))
[PROOF STEP]
by (metis cinner_gt_zero_iff cinner_zero_right)
[PROOF STATE]
proof (state)
this:
(a *\<^sub>V x = (0::'b)) = (\<forall>y. is_orthogonal y (a *\<^sub>V x))

goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a *\<^sub>V x = (0::'b)) = (\<forall>y. is_orthogonal y (a *\<^sub>V x))

goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
have \<open>\<dots> \<longleftrightarrow> (\<forall>y. is_orthogonal (a* *\<^sub>V y) x)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>y. is_orthogonal y (a *\<^sub>V x)) = (\<forall>y. is_orthogonal (a* *\<^sub>V y) x)
[PROOF STEP]
by (simp add: cinner_adj_left)
[PROOF STATE]
proof (state)
this:
(\<forall>y. is_orthogonal y (a *\<^sub>V x)) = (\<forall>y. is_orthogonal (a* *\<^sub>V y) x)

goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>y. is_orthogonal y (a *\<^sub>V x)) = (\<forall>y. is_orthogonal (a* *\<^sub>V y) x)

goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
have \<open>\<dots> \<longleftrightarrow> x \<in> space_as_set (- (a* *\<^sub>S top))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>y. is_orthogonal (a* *\<^sub>V y) x) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a x. bounded_clinear a \<Longrightarrow> (\<forall>y. is_orthogonal ((a\<^sup>\<dagger>) y) x) = (x \<in> orthogonal_complement (closure (range (a\<^sup>\<dagger>))))
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) UNIV_I image_iff is_orthogonal_sym orthogonal_complementI orthogonal_complement_of_closure orthogonal_complement_orthoI')
[PROOF STATE]
proof (state)
this:
(\<forall>y. is_orthogonal (a* *\<^sub>V y) x) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))

goal (1 subgoal):
 1. \<And>x. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
show \<open>x \<in> space_as_set (kernel a) \<longleftrightarrow> x \<in> space_as_set (- (a* *\<^sub>S top))\<close>
[PROOF STATE]
proof (prove)
using this:
(x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))

goal (1 subgoal):
 1. (x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))
[PROOF STEP]
by -
[PROOF STATE]
proof (state)
this:
(x \<in> space_as_set (kernel a)) = (x \<in> space_as_set (- (a* *\<^sub>S \<top>)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary11_gen_mult_sm:
  assumes "k \<noteq> 0" and "unitary11_gen M"
  shows "unitary11_gen (k *\<^sub>s\<^sub>m M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary11_gen (k *\<^sub>s\<^sub>m M)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. unitary11_gen (k *\<^sub>s\<^sub>m M)
[PROOF STEP]
have "k * cnj k = cor (Re (k * cnj k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * cnj k = cor (Re (k * cnj k))
[PROOF STEP]
by (subst complex_of_real_Re) auto
[PROOF STATE]
proof (state)
this:
k * cnj k = cor (Re (k * cnj k))

goal (1 subgoal):
 1. unitary11_gen (k *\<^sub>s\<^sub>m M)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
k * cnj k = cor (Re (k * cnj k))

goal (1 subgoal):
 1. unitary11_gen (k *\<^sub>s\<^sub>m M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k * cnj k = cor (Re (k * cnj k))
k \<noteq> 0
unitary11_gen M

goal (1 subgoal):
 1. unitary11_gen (k *\<^sub>s\<^sub>m M)
[PROOF STEP]
unfolding unitary11_gen_real
[PROOF STATE]
proof (prove)
using this:
k * cnj k = cor (Re (k * cnj k))
k \<noteq> 0
\<exists>k. k \<noteq> 0 \<and> congruence M (1, 0, 0, - 1) = cor k *\<^sub>s\<^sub>m (1, 0, 0, - 1)

goal (1 subgoal):
 1. \<exists>ka. ka \<noteq> 0 \<and> congruence (k *\<^sub>s\<^sub>m M) (1, 0, 0, - 1) = cor ka *\<^sub>s\<^sub>m (1, 0, 0, - 1)
[PROOF STEP]
by auto (rule_tac x="Re (k*cnj k) * ka" in exI, auto)
[PROOF STATE]
proof (state)
this:
unitary11_gen (k *\<^sub>s\<^sub>m M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dot2_rearrange_1:
  fixes u x :: "real^2"
  assumes "u \<bullet> x = 0" and "x$1 \<noteq> 0"
  shows "u = (u$2 / x$1) *\<^sub>R (rotate2 x)" (is "u = ?u'")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u = (u $ 2 / x $ 1) *\<^sub>R rotate2 x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u = (u $ 2 / x $ 1) *\<^sub>R rotate2 x
[PROOF STEP]
from \<open>u \<bullet> x = 0\<close>
[PROOF STATE]
proof (chain)
picking this:
u \<bullet> x = 0
[PROOF STEP]
have "u$1 * x$1 = -(u$2) * (x$2)"
[PROOF STATE]
proof (prove)
using this:
u \<bullet> x = 0

goal (1 subgoal):
 1. u $ 1 * x $ 1 = - u $ 2 * x $ 2
[PROOF STEP]
unfolding inner_vec_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>UNIV. u $ i \<bullet> x $ i) = 0

goal (1 subgoal):
 1. u $ 1 * x $ 1 = - u $ 2 * x $ 2
[PROOF STEP]
by (simp add: sum_2)
[PROOF STATE]
proof (state)
this:
u $ 1 * x $ 1 = - u $ 2 * x $ 2

goal (1 subgoal):
 1. u = (u $ 2 / x $ 1) *\<^sub>R rotate2 x
[PROOF STEP]
hence "u$1 * x$1 / x$1 = -u$2 / x$1 * x$2"
[PROOF STATE]
proof (prove)
using this:
u $ 1 * x $ 1 = - u $ 2 * x $ 2

goal (1 subgoal):
 1. u $ 1 * x $ 1 / x $ 1 = - u $ 2 / x $ 1 * x $ 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u $ 1 * x $ 1 / x $ 1 = - u $ 2 / x $ 1 * x $ 2

goal (1 subgoal):
 1. u = (u $ 2 / x $ 1) *\<^sub>R rotate2 x
[PROOF STEP]
with \<open>x$1 \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
x $ 1 \<noteq> 0
u $ 1 * x $ 1 / x $ 1 = - u $ 2 / x $ 1 * x $ 2
[PROOF STEP]
have "u$1 = ?u'$1"
[PROOF STATE]
proof (prove)
using this:
x $ 1 \<noteq> 0
u $ 1 * x $ 1 / x $ 1 = - u $ 2 / x $ 1 * x $ 2

goal (1 subgoal):
 1. u $ 1 = ((u $ 2 / x $ 1) *\<^sub>R rotate2 x) $ 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u $ 1 = ((u $ 2 / x $ 1) *\<^sub>R rotate2 x) $ 1

goal (1 subgoal):
 1. u = (u $ 2 / x $ 1) *\<^sub>R rotate2 x
[PROOF STEP]
from \<open>x$1 \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
x $ 1 \<noteq> 0
[PROOF STEP]
have "u$2 = ?u'$2"
[PROOF STATE]
proof (prove)
using this:
x $ 1 \<noteq> 0

goal (1 subgoal):
 1. u $ 2 = ((u $ 2 / x $ 1) *\<^sub>R rotate2 x) $ 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u $ 2 = ((u $ 2 / x $ 1) *\<^sub>R rotate2 x) $ 2

goal (1 subgoal):
 1. u = (u $ 2 / x $ 1) *\<^sub>R rotate2 x
[PROOF STEP]
with \<open>u$1 = ?u'$1\<close> and real2_eq
[PROOF STATE]
proof (chain)
picking this:
u $ 1 = ((u $ 2 / x $ 1) *\<^sub>R rotate2 x) $ 1
\<lbrakk>?u $ 1 = ?v $ 1; ?u $ 2 = ?v $ 2\<rbrakk> \<Longrightarrow> ?u = ?v
u $ 2 = ((u $ 2 / x $ 1) *\<^sub>R rotate2 x) $ 2
[PROOF STEP]
show "u = ?u'"
[PROOF STATE]
proof (prove)
using this:
u $ 1 = ((u $ 2 / x $ 1) *\<^sub>R rotate2 x) $ 1
\<lbrakk>?u $ 1 = ?v $ 1; ?u $ 2 = ?v $ 2\<rbrakk> \<Longrightarrow> ?u = ?v
u $ 2 = ((u $ 2 / x $ 1) *\<^sub>R rotate2 x) $ 2

goal (1 subgoal):
 1. u = (u $ 2 / x $ 1) *\<^sub>R rotate2 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u = (u $ 2 / x $ 1) *\<^sub>R rotate2 x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equivP_R2P[simp]: "equivP (S2P A) (R2P r) \<longleftrightarrow> equiv A r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equivP (S2P A) (R2P r) = equiv A r
[PROOF STEP]
unfolding equivP_def equiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (reflP (S2P A) (R2P r) \<and> symP (R2P r) \<and> transP (R2P r)) = (refl_on A r \<and> sym r \<and> trans r)
[PROOF STEP]
by auto


[STATEMENT]
lemma quotient_of_int_div: assumes q: "quotient_of (of_int x / of_int y) = (a, b)"
  and y: "y \<noteq> 0"
  shows "\<exists> z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
let ?r = "rat_of_int"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
define z where "z = gcd x y"
[PROOF STATE]
proof (state)
this:
z = gcd x y

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
define x' where "x' = x div z"
[PROOF STATE]
proof (state)
this:
x' = x div z

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
define y' where "y' = y div z"
[PROOF STATE]
proof (state)
this:
y' = y div z

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
have id: "x = z * x'" "y = z * y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = z * x' &&& y = z * y'
[PROOF STEP]
unfolding x'_def y'_def z_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = gcd x y * (x div gcd x y) &&& y = gcd x y * (y div gcd x y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = z * x'
y = z * y'

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from y
[PROOF STATE]
proof (chain)
picking this:
y \<noteq> 0
[PROOF STEP]
have y': "y' \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
y \<noteq> 0

goal (1 subgoal):
 1. y' \<noteq> 0
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
using this:
z * y' \<noteq> 0

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

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
have z: "z \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<noteq> 0
[PROOF STEP]
unfolding z_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd x y \<noteq> 0
[PROOF STEP]
using y
[PROOF STATE]
proof (prove)
using this:
y \<noteq> 0

goal (1 subgoal):
 1. gcd x y \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<noteq> 0

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
have cop: "coprime x' y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime x' y'
[PROOF STEP]
unfolding x'_def y'_def z_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (x div gcd x y) (y div gcd x y)
[PROOF STEP]
using div_gcd_coprime y
[PROOF STATE]
proof (prove)
using this:
?a \<noteq> (0::?'a) \<or> ?b \<noteq> (0::?'a) \<Longrightarrow> coprime (?a div gcd ?a ?b) (?b div gcd ?a ?b)
y \<noteq> 0

goal (1 subgoal):
 1. coprime (x div gcd x y) (y div gcd x y)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
coprime x' y'

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
have "?r x / ?r y = ?r x' / ?r y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int x / rat_of_int y = rat_of_int x' / rat_of_int y'
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int (z * x') / rat_of_int (z * y') = rat_of_int x' / rat_of_int y'
[PROOF STEP]
using z y y'
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
y \<noteq> 0
y' \<noteq> 0

goal (1 subgoal):
 1. rat_of_int (z * x') / rat_of_int (z * y') = rat_of_int x' / rat_of_int y'
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
rat_of_int x / rat_of_int y = rat_of_int x' / rat_of_int y'

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from assms[unfolded this]
[PROOF STATE]
proof (chain)
picking this:
quotient_of (rat_of_int x' / rat_of_int y') = (a, b)
y \<noteq> 0
[PROOF STEP]
have quot: "quotient_of (?r x' / ?r y') = (a, b)"
[PROOF STATE]
proof (prove)
using this:
quotient_of (rat_of_int x' / rat_of_int y') = (a, b)
y \<noteq> 0

goal (1 subgoal):
 1. quotient_of (rat_of_int x' / rat_of_int y') = (a, b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
quotient_of (rat_of_int x' / rat_of_int y') = (a, b)

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from quotient_of_coprime[OF quot]
[PROOF STATE]
proof (chain)
picking this:
coprime a b
[PROOF STEP]
have cop': "coprime a b"
[PROOF STATE]
proof (prove)
using this:
coprime a b

goal (1 subgoal):
 1. coprime a b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
coprime a b

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
hence cop: "coprime b a"
[PROOF STATE]
proof (prove)
using this:
coprime a b

goal (1 subgoal):
 1. coprime b a
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
coprime b a

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from quotient_of_denom_pos[OF quot]
[PROOF STATE]
proof (chain)
picking this:
0 < b
[PROOF STEP]
have b: "b > 0" "b \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < b

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

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from quotient_of_div[OF quot] quotient_of_denom_pos[OF quot] y'
[PROOF STATE]
proof (chain)
picking this:
rat_of_int x' / rat_of_int y' = rat_of_int a / rat_of_int b
0 < b
y' \<noteq> 0
[PROOF STEP]
have "?r x' * ?r b = ?r a * ?r y'"
[PROOF STATE]
proof (prove)
using this:
rat_of_int x' / rat_of_int y' = rat_of_int a / rat_of_int b
0 < b
y' \<noteq> 0

goal (1 subgoal):
 1. rat_of_int x' * rat_of_int b = rat_of_int a * rat_of_int y'
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
rat_of_int x' * rat_of_int b = rat_of_int a * rat_of_int y'

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
hence id': "x' * b = a * y'"
[PROOF STATE]
proof (prove)
using this:
rat_of_int x' * rat_of_int b = rat_of_int a * rat_of_int y'

goal (1 subgoal):
 1. x' * b = a * y'
[PROOF STEP]
unfolding of_int_mult[symmetric]
[PROOF STATE]
proof (prove)
using this:
rat_of_int (x' * b) = rat_of_int (a * y')

goal (1 subgoal):
 1. x' * b = a * y'
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
x' * b = a * y'

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from id'[symmetric]
[PROOF STATE]
proof (chain)
picking this:
a * y' = x' * b
[PROOF STEP]
have "b dvd y' * a"
[PROOF STATE]
proof (prove)
using this:
a * y' = x' * b

goal (1 subgoal):
 1. b dvd y' * a
[PROOF STEP]
unfolding mult.commute[of y']
[PROOF STATE]
proof (prove)
using this:
a * y' = x' * b

goal (1 subgoal):
 1. b dvd a * y'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b dvd y' * a

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
with cop y'
[PROOF STATE]
proof (chain)
picking this:
coprime b a
y' \<noteq> 0
b dvd y' * a
[PROOF STEP]
have "b dvd y'"
[PROOF STATE]
proof (prove)
using this:
coprime b a
y' \<noteq> 0
b dvd y' * a

goal (1 subgoal):
 1. b dvd y'
[PROOF STEP]
by (simp add: coprime_dvd_mult_left_iff)
[PROOF STATE]
proof (state)
this:
b dvd y'

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b dvd y'
[PROOF STEP]
obtain z' where ybz: "y' = b * z'"
[PROOF STATE]
proof (prove)
using this:
b dvd y'

goal (1 subgoal):
 1. (\<And>z'. y' = b * z' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. y' = b * k

goal (1 subgoal):
 1. (\<And>z'. y' = b * z' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y' = b * z'

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from id[unfolded y' this]
[PROOF STATE]
proof (chain)
picking this:
x = z * x'
y = z * (b * z')
[PROOF STEP]
have y: "y = b * (z * z')"
[PROOF STATE]
proof (prove)
using this:
x = z * x'
y = z * (b * z')

goal (1 subgoal):
 1. y = b * (z * z')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y = b * (z * z')

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
with \<open>y \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
y \<noteq> 0
y = b * (z * z')
[PROOF STEP]
have zz: "z * z' \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
y \<noteq> 0
y = b * (z * z')

goal (1 subgoal):
 1. z * z' \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z * z' \<noteq> 0

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from quotient_of_div[OF q] \<open>y \<noteq> 0\<close> \<open>b \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
rat_of_int x / rat_of_int y = rat_of_int a / rat_of_int b
y \<noteq> 0
b \<noteq> 0
[PROOF STEP]
have "?r x * ?r b = ?r y * ?r a"
[PROOF STATE]
proof (prove)
using this:
rat_of_int x / rat_of_int y = rat_of_int a / rat_of_int b
y \<noteq> 0
b \<noteq> 0

goal (1 subgoal):
 1. rat_of_int x * rat_of_int b = rat_of_int y * rat_of_int a
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
rat_of_int x * rat_of_int b = rat_of_int y * rat_of_int a

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
hence id': "x * b = y * a"
[PROOF STATE]
proof (prove)
using this:
rat_of_int x * rat_of_int b = rat_of_int y * rat_of_int a

goal (1 subgoal):
 1. x * b = y * a
[PROOF STEP]
unfolding of_int_mult[symmetric]
[PROOF STATE]
proof (prove)
using this:
rat_of_int (x * b) = rat_of_int (y * a)

goal (1 subgoal):
 1. x * b = y * a
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
x * b = y * a

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
from this[unfolded y] b
[PROOF STATE]
proof (chain)
picking this:
x * b = b * (z * z') * a
0 < b
b \<noteq> 0
[PROOF STEP]
have x: "x = a * (z * z')"
[PROOF STATE]
proof (prove)
using this:
x * b = b * (z * z') * a
0 < b
b \<noteq> 0

goal (1 subgoal):
 1. x = a * (z * z')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = a * (z * z')

goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z
[PROOF STEP]
unfolding x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>za. za \<noteq> 0 \<and> a * (z * z') = a * za \<and> b * (z * z') = b * za
[PROOF STEP]
using zz
[PROOF STATE]
proof (prove)
using this:
z * z' \<noteq> 0

goal (1 subgoal):
 1. \<exists>za. za \<noteq> 0 \<and> a * (z * z') = a * za \<and> b * (z * z') = b * za
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>z. z \<noteq> 0 \<and> x = a * z \<and> y = b * z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_on_many:
  assumes "(x, y) \<in> r"
  assumes "sorted_on r (y # zs)"
  shows "sorted_on r (x # y # zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_on r (x # y # zs)
[PROOF STEP]
using assms \<open>Linear_order r\<close>
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> r
sorted_on r (y # zs)
Linear_order r

goal (1 subgoal):
 1. sorted_on r (x # y # zs)
[PROOF STEP]
unfolding order_on_defs
[PROOF STATE]
proof (prove)
using this:
(x, y) \<in> r
sorted_on r (y # zs)
((Refl r \<and> trans r) \<and> antisym r) \<and> Total r

goal (1 subgoal):
 1. sorted_on r (x # y # zs)
[PROOF STEP]
by (auto elim: transE intro: FieldI1)


[STATEMENT]
lemma "((x::real) + y \<le> x + z) = (y \<le> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y \<le> x + z) = (y \<le> z)
[PROOF STEP]
by arith


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


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


[STATEMENT]
lemma null_sets_distr_iff:
  "f \<in> measurable M N \<Longrightarrow> A \<in> null_sets (distr M N f) \<longleftrightarrow> f -` A \<inter> space M \<in> null_sets M \<and> A \<in> sets N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M N \<Longrightarrow> (A \<in> null_sets (distr M N f)) = (f -` A \<inter> space M \<in> null_sets M \<and> A \<in> sets N)
[PROOF STEP]
by (auto simp add: null_sets_def emeasure_distr)


[STATEMENT]
theorem "y \<in> set (dfs g [x] []) = ((x,y) \<in> (set g)\<^sup>*)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<in> set (dfs g [x] [])) = ((x, y) \<in> (set g)\<^sup>*)
[PROOF STEP]
by(simp only:dfs_eq_reachable reachable_def, auto)


[STATEMENT]
lemma card_le2_ordering_loc:
  assumes finiteX: "finite X"
      and card_le2: "card X \<le> 2"
  shows "\<exists>f. local_ordering f ord X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. local_ordering f ord X
[PROOF STEP]
using assms total_implies_local card_le2_ordering
[PROOF STATE]
proof (prove)
using this:
finite X
card X \<le> 2
TernaryOrdering.ordering ?f ?ord ?X \<Longrightarrow> local_ordering ?f ?ord ?X
\<lbrakk>finite ?X; card ?X \<le> 2\<rbrakk> \<Longrightarrow> \<exists>f. TernaryOrdering.ordering f ?ord ?X

goal (1 subgoal):
 1. \<exists>f. local_ordering f ord X
[PROOF STEP]
by metis


[STATEMENT]
lemma cmult_in_bigo_iff    [simp]:  "(\<lambda>x. c * f x) \<in> O[F](g) \<longleftrightarrow> c = 0 \<or> f \<in> O[F](g)"
  and cmult_in_bigo_iff'   [simp]:  "(\<lambda>x. f x * c) \<in> O[F](g) \<longleftrightarrow> c = 0 \<or> f \<in> O[F](g)"
  and cmult_in_smallo_iff  [simp]:  "(\<lambda>x. c * f x) \<in> o[F](g) \<longleftrightarrow> c = 0 \<or> f \<in> o[F](g)"
  and cmult_in_smallo_iff' [simp]: "(\<lambda>x. f x * c) \<in> o[F](g) \<longleftrightarrow> c = 0 \<or> f \<in> o[F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((\<lambda>x. c * f x) \<in> O[F](g)) = (c = (0::'b) \<or> f \<in> O[F](g)) &&& ((\<lambda>x. f x * c) \<in> O[F](g)) = (c = (0::'b) \<or> f \<in> O[F](g))) &&& ((\<lambda>x. c * f x) \<in> o[F](g)) = (c = (0::'b) \<or> f \<in> o[F](g)) &&& ((\<lambda>x. f x * c) \<in> o[F](g)) = (c = (0::'b) \<or> f \<in> o[F](g))
[PROOF STEP]
by (cases "c = 0", simp, simp)+


[STATEMENT]
lemma subdesign_iso_implies:
  assumes "sub_set_system V B \<V> \<B>"
  shows "sub_set_system (\<pi> ` V) (blocks_image B \<pi>) \<V>' \<B>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_set_system (\<pi> ` V) (blocks_image B \<pi>) \<V>' \<B>'
[PROOF STEP]
proof (unfold_locales)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<pi> ` V \<subseteq> \<V>'
 2. blocks_image B \<pi> \<subseteq># \<B>'
[PROOF STEP]
show "\<pi> ` V \<subseteq> \<V>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> ` V \<subseteq> \<V>'
[PROOF STEP]
by (metis assms image_mono iso_points_map sub_set_system.points_subset)
[PROOF STATE]
proof (state)
this:
\<pi> ` V \<subseteq> \<V>'

goal (1 subgoal):
 1. blocks_image B \<pi> \<subseteq># \<B>'
[PROOF STEP]
show "blocks_image B \<pi> \<subseteq># \<B>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blocks_image B \<pi> \<subseteq># \<B>'
[PROOF STEP]
by (metis assms block_img blocks_image_def image_mset_subseteq_mono sub_set_system.blocks_subset)
[PROOF STATE]
proof (state)
this:
blocks_image B \<pi> \<subseteq># \<B>'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_cwand:
  assumes "\<And>a x. a \<in> A \<and> Some x = R a w \<oplus> a \<Longrightarrow> x \<in> B"
  shows "w \<in> cwand A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<in> cwand A B
[PROOF STEP]
using assms cwand_def
[PROOF STATE]
proof (prove)
using this:
?a \<in> A \<and> Some ?x = R ?a w \<oplus> ?a \<Longrightarrow> ?x \<in> B
cwand ?A ?B = {w |w. \<forall>a x. a \<in> ?A \<and> Some x = R a w \<oplus> a \<longrightarrow> x \<in> ?B}

goal (1 subgoal):
 1. w \<in> cwand A B
[PROOF STEP]
by force


[STATEMENT]
lemma incident_loops_alt: "incident_loops v = {e \<in> E. incident v e \<and> card e = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incident_loops v = {e \<in> E. incident v e \<and> card e = 1}
[PROOF STEP]
unfolding incident_loops_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {e \<in> E. e = {v}} = {e \<in> E. incident v e \<and> card e = 1}
[PROOF STEP]
using card1_incident_imp_vert incident_def
[PROOF STATE]
proof (prove)
using this:
incident ?v ?e \<and> card ?e = 1 \<Longrightarrow> ?e = {?v}
incident ?v ?e \<equiv> ?v \<in> ?e

goal (1 subgoal):
 1. {e \<in> E. e = {v}} = {e \<in> E. incident v e \<and> card e = 1}
[PROOF STEP]
by auto


[STATEMENT]
lemma (in idom_char_0) order:
  "([-a, 1] %^ n) divides p \<and> \<not> (([-a, 1] %^ Suc n) divides p) \<longleftrightarrow>
    n = order a p \<and> poly p \<noteq> poly []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p) = (n = order a p \<and> poly p \<noteq> poly [])
[PROOF STEP]
unfolding order_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p) = (n = (SOME n. [- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p) \<and> poly p \<noteq> poly [])
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. [- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p \<Longrightarrow> n = (SOME n. [- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p) \<and> poly p \<noteq> poly []
 2. n = (SOME n. [- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p) \<and> poly p \<noteq> poly [] \<Longrightarrow> [- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p
[PROOF STEP]
apply (blast dest: poly_divides_zero intro!: some1_equality [symmetric] poly_order)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = (SOME n. [- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p) \<and> poly p \<noteq> poly [] \<Longrightarrow> [- a, 1::'a] %^ n divides p \<and> \<not> [- a, 1::'a] %^ Suc n divides p
[PROOF STEP]
apply (blast intro!: poly_order [THEN [2] some1_equalityD])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma R_lin_independent_imp_same_scalars :
  "\<lbrakk> length rs = length ss; length rs \<le> length ms; set rs \<subseteq> R; set ss \<subseteq> R;
        set ms \<subseteq> M; R_lin_independent ms; rs \<bullet>\<cdot> ms = ss \<bullet>\<cdot> ms \<rbrakk> \<Longrightarrow> rs = ss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length rs = length ss; length rs \<le> length ms; set rs \<subseteq> R; set ss \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; rs \<bullet>\<cdot> ms = ss \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> rs = ss
[PROOF STEP]
proof (induct rs ss arbitrary: ms rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
case (Cons r rs s ss)
[PROOF STATE]
proof (state)
this:
length rs = length ss
\<lbrakk>length rs \<le> length ?ms2; set rs \<subseteq> R; set ss \<subseteq> R; set ?ms2 \<subseteq> M; R_lin_independent ?ms2; rs \<bullet>\<cdot> ?ms2 = ss \<bullet>\<cdot> ?ms2\<rbrakk> \<Longrightarrow> rs = ss
length (r # rs) \<le> length ms
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
R_lin_independent ms
(r # rs) \<bullet>\<cdot> ms = (s # ss) \<bullet>\<cdot> ms

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
length (r # rs) \<le> length ms
[PROOF STEP]
have "ms \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
length (r # rs) \<le> length ms

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

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
ms \<noteq> []
[PROOF STEP]
obtain n ns where ms: "ms = n#ns"
[PROOF STATE]
proof (prove)
using this:
ms \<noteq> []

goal (1 subgoal):
 1. (\<And>n ns. ms = n # ns \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using neq_Nil_conv[of ms]
[PROOF STATE]
proof (prove)
using this:
ms \<noteq> []
(ms \<noteq> []) = (\<exists>y ys. ms = y # ys)

goal (1 subgoal):
 1. (\<And>n ns. ms = n # ns \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
ms = n # ns

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
from Cons(4,5)
[PROOF STATE]
proof (chain)
picking this:
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
[PROOF STEP]
have "set ([a-b. (a,b)\<leftarrow>zip (r#rs) (s#ss)]) \<subseteq> R"
[PROOF STATE]
proof (prove)
using this:
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R

goal (1 subgoal):
 1. set (map2 (-) (r # rs) (s # ss)) \<subseteq> R
[PROOF STEP]
using Ring1 Ring1.list_diff_closed
[PROOF STATE]
proof (prove)
using this:
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
Ring1 R
\<lbrakk>Ring1 ?R; set ?gs \<subseteq> ?R; set ?hs \<subseteq> ?R\<rbrakk> \<Longrightarrow> set (map2 (-) ?gs ?hs) \<subseteq> ?R

goal (1 subgoal):
 1. set (map2 (-) (r # rs) (s # ss)) \<subseteq> R
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
set (map2 (-) (r # rs) (s # ss)) \<subseteq> R

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
hence "set ((r-s)#[a-b. (a,b)\<leftarrow>zip rs ss]) \<subseteq> R"
[PROOF STATE]
proof (prove)
using this:
set (map2 (-) (r # rs) (s # ss)) \<subseteq> R

goal (1 subgoal):
 1. set ((r - s) # map2 (-) rs ss) \<subseteq> R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set ((r - s) # map2 (-) rs ss) \<subseteq> R

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set ((r - s) # map2 (-) rs ss) \<subseteq> R

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
from Cons(1,4-6,8) ms
[PROOF STATE]
proof (chain)
picking this:
length rs = length ss
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
(r # rs) \<bullet>\<cdot> ms = (s # ss) \<bullet>\<cdot> ms
ms = n # ns
[PROOF STEP]
have  1: "((r-s)#[a-b. (a,b)\<leftarrow>zip rs ss]) \<bullet>\<cdot> (n#ns) = 0"
[PROOF STATE]
proof (prove)
using this:
length rs = length ss
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
(r # rs) \<bullet>\<cdot> ms = (s # ss) \<bullet>\<cdot> ms
ms = n # ns

goal (1 subgoal):
 1. ((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)
[PROOF STEP]
using lincomb_diff_left[of "r#rs" "s#ss"]
[PROOF STATE]
proof (prove)
using this:
length rs = length ss
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
(r # rs) \<bullet>\<cdot> ms = (s # ss) \<bullet>\<cdot> ms
ms = n # ns
\<lbrakk>set (r # rs) \<subseteq> R; set (s # ss) \<subseteq> R; set ?ms \<subseteq> M; length (r # rs) \<le> length (s # ss)\<rbrakk> \<Longrightarrow> map2 (-) (r # rs) (s # ss) \<bullet>\<cdot> ?ms = (r # rs) \<bullet>\<cdot> ?ms - take (length (r # rs)) (s # ss) \<bullet>\<cdot> ?ms

goal (1 subgoal):
 1. ((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)
[PROOF STEP]
by    simp
[PROOF STATE]
proof (state)
this:
((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set ((r - s) # map2 (-) rs ss) \<subseteq> R
((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)
[PROOF STEP]
have "r - s = 0"
[PROOF STATE]
proof (prove)
using this:
set ((r - s) # map2 (-) rs ss) \<subseteq> R
((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)

goal (1 subgoal):
 1. r - s = (0::'r)
[PROOF STEP]
using Cons(7) ms R_lin_independent_Cons
[PROOF STATE]
proof (prove)
using this:
set ((r - s) # map2 (-) rs ss) \<subseteq> R
((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)
R_lin_independent ms
ms = n # ns
R_lin_independent (?m # ?ms) = (R_lin_independent ?ms \<and> (\<forall>r rs. set (r # rs) \<subseteq> R \<and> (r # rs) \<bullet>\<cdot> (?m # ?ms) = (0::'m) \<longrightarrow> r = (0::'r)))

goal (1 subgoal):
 1. r - s = (0::'r)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
r - s = (0::'r)

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
hence 2: "r = s"
[PROOF STATE]
proof (prove)
using this:
r - s = (0::'r)

goal (1 subgoal):
 1. r = s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r = s

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
with 1 Cons(1,4-6) ms
[PROOF STATE]
proof (chain)
picking this:
((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)
length rs = length ss
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
ms = n # ns
r = s
[PROOF STEP]
have "rs \<bullet>\<cdot> ns = ss \<bullet>\<cdot> ns"
[PROOF STATE]
proof (prove)
using this:
((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)
length rs = length ss
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
ms = n # ns
r = s

goal (1 subgoal):
 1. rs \<bullet>\<cdot> ns = ss \<bullet>\<cdot> ns
[PROOF STEP]
using lincomb_Cons zero_smult lincomb_diff_left
[PROOF STATE]
proof (prove)
using this:
((r - s) # map2 (-) rs ss) \<bullet>\<cdot> (n # ns) = (0::'m)
length rs = length ss
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
ms = n # ns
r = s
(?r # ?rs) \<bullet>\<cdot> (?m # ?ms) = ?r \<cdot> ?m + ?rs \<bullet>\<cdot> ?ms
?m \<in> M \<Longrightarrow> (0::'r) \<cdot> ?m = (0::'m)
\<lbrakk>set ?rs \<subseteq> R; set ?ss \<subseteq> R; set ?ms \<subseteq> M; length ?rs \<le> length ?ss\<rbrakk> \<Longrightarrow> map2 (-) ?rs ?ss \<bullet>\<cdot> ?ms = ?rs \<bullet>\<cdot> ?ms - take (length ?rs) ?ss \<bullet>\<cdot> ?ms

goal (1 subgoal):
 1. rs \<bullet>\<cdot> ns = ss \<bullet>\<cdot> ns
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rs \<bullet>\<cdot> ns = ss \<bullet>\<cdot> ns

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
with Cons(2-7) ms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length rs \<le> length ?ms2; set rs \<subseteq> R; set ss \<subseteq> R; set ?ms2 \<subseteq> M; R_lin_independent ?ms2; rs \<bullet>\<cdot> ?ms2 = ss \<bullet>\<cdot> ?ms2\<rbrakk> \<Longrightarrow> rs = ss
length (r # rs) \<le> length ms
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
R_lin_independent ms
ms = n # ns
rs \<bullet>\<cdot> ns = ss \<bullet>\<cdot> ns
[PROOF STEP]
have "rs = ss"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length rs \<le> length ?ms2; set rs \<subseteq> R; set ss \<subseteq> R; set ?ms2 \<subseteq> M; R_lin_independent ?ms2; rs \<bullet>\<cdot> ?ms2 = ss \<bullet>\<cdot> ?ms2\<rbrakk> \<Longrightarrow> rs = ss
length (r # rs) \<le> length ms
set (r # rs) \<subseteq> R
set (s # ss) \<subseteq> R
set ms \<subseteq> M
R_lin_independent ms
ms = n # ns
rs \<bullet>\<cdot> ns = ss \<bullet>\<cdot> ns

goal (1 subgoal):
 1. rs = ss
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rs = ss

goal (2 subgoals):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
 2. \<And>x xs y ys ms. \<lbrakk>length xs = length ys; \<And>ms. \<lbrakk>length xs \<le> length ms; set xs \<subseteq> R; set ys \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; xs \<bullet>\<cdot> ms = ys \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> xs = ys; length (x # xs) \<le> length ms; set (x # xs) \<subseteq> R; set (y # ys) \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; (x # xs) \<bullet>\<cdot> ms = (y # ys) \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> x # xs = y # ys
[PROOF STEP]
with 2
[PROOF STATE]
proof (chain)
picking this:
r = s
rs = ss
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
r = s
rs = ss

goal (1 subgoal):
 1. r # rs = s # ss
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
r # rs = s # ss

goal (1 subgoal):
 1. \<And>ms. \<lbrakk>length [] \<le> length ms; set [] \<subseteq> R; set [] \<subseteq> R; set ms \<subseteq> M; R_lin_independent ms; [] \<bullet>\<cdot> ms = [] \<bullet>\<cdot> ms\<rbrakk> \<Longrightarrow> [] = []
[PROOF STEP]
qed fast


[STATEMENT]
lemma (in Order) ord_isom_restricted:
      "\<lbrakk>Order E; ord_isom D E f; D1 \<subseteq> carrier D\<rbrakk> \<Longrightarrow>
             ord_isom (Iod D D1) (Iod E (f ` D1)) (\<lambda>x\<in>D1. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Order E; ord_isom D E f; D1 \<subseteq> carrier D\<rbrakk> \<Longrightarrow> ord_isom (Iod D D1) (Iod E (f ` D1)) (restrict f D1)
[PROOF STEP]
apply (simp add:ord_isom_def[of D E f], erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Order E; D1 \<subseteq> carrier D; ord_inj D E f; surj_to f (carrier D) (carrier E)\<rbrakk> \<Longrightarrow> ord_isom (Iod D D1) (Iod E (f ` D1)) (restrict f D1)
[PROOF STEP]
apply (simp add:ord_inj_restrict_isom[of E f D1])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma exposed_face_of_Int_supporting_hyperplane_ge:
   "\<lbrakk>convex S; \<And>x. x \<in> S \<Longrightarrow> a \<bullet> x \<ge> b\<rbrakk> \<Longrightarrow> (S \<inter> {x. a \<bullet> x = b}) exposed_face_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex S; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> S \<inter> {x. a \<bullet> x = b} exposed_face_of S
[PROOF STEP]
using exposed_face_of_Int_supporting_hyperplane_le [of S "-a" "-b"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>convex S; \<And>x. x \<in> S \<Longrightarrow> - a \<bullet> x \<le> - b\<rbrakk> \<Longrightarrow> S \<inter> {x. - a \<bullet> x = - b} exposed_face_of S

goal (1 subgoal):
 1. \<lbrakk>convex S; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> S \<inter> {x. a \<bullet> x = b} exposed_face_of S
[PROOF STEP]
by simp


[STATEMENT]
lemma hausdorff_distance_self [simp]:
  "hausdorff_distance A A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hausdorff_distance A A = 0
[PROOF STEP]
unfolding hausdorff_distance_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if A = {} \<or> A = {} \<or> \<not> bounded A \<or> \<not> bounded A then 0 else max (SUP x\<in>A. infdist x A) (SUP x\<in>A. infdist x A)) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma Qp_to_IP_car:
  assumes "k \<in> carrier Q\<^sub>p"
  shows "Qp_to_IP k \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Qp.indexed_const k \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. Qp.indexed_const k \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
using this:
k \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. Qp.indexed_const k \<in> carrier (Pring Q\<^sub>p {..<n})
[PROOF STEP]
using Qp.indexed_const_closed
[PROOF STATE]
proof (prove)
using this:
k \<in> carrier Q\<^sub>p
?x \<in> carrier Q\<^sub>p \<Longrightarrow> Qp.indexed_const ?x \<in> carrier (Pring Q\<^sub>p ?I)

goal (1 subgoal):
 1. Qp.indexed_const k \<in> carrier (Pring Q\<^sub>p {..<n})
[PROOF STEP]
by blast


[STATEMENT]
lemma obs_consistent_trans [intro]:
  "\<lbrakk> obs_consistent R1 pi1 S1 S2; obs_consistent R2 pi2 S2 S3 \<rbrakk>
  \<Longrightarrow> obs_consistent (R1 O R2) (pi1 o pi2) S1 S3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>obs_consistent R1 pi1 S1 S2; obs_consistent R2 pi2 S2 S3\<rbrakk> \<Longrightarrow> obs_consistent (R1 O R2) (pi1 \<circ> pi2) S1 S3
[PROOF STEP]
by (auto simp add: obs_consistent_def)


[STATEMENT]
lemma log_exp2_gt: "2 * 2 ^ log n > n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < 2 * 2 ^ local.log n
[PROOF STEP]
proof (cases "n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> n < 2 * 2 ^ local.log n
 2. \<not> 0 < n \<Longrightarrow> n < 2 * 2 ^ local.log n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> n < 2 * 2 ^ local.log n
 2. \<not> 0 < n \<Longrightarrow> n < 2 * 2 ^ local.log n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. n < 2 * 2 ^ local.log n
[PROOF STEP]
proof (induct n rule: log_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 < 2 * 2 ^ local.log 1
 2. \<And>n. \<lbrakk>2 \<le> n; n div 2 < 2 * 2 ^ local.log (n div 2)\<rbrakk> \<Longrightarrow> n < 2 * 2 ^ local.log n
[PROOF STEP]
case (double n)
[PROOF STATE]
proof (state)
this:
2 \<le> n
n div 2 < 2 * 2 ^ local.log (n div 2)

goal (2 subgoals):
 1. 1 < 2 * 2 ^ local.log 1
 2. \<And>n. \<lbrakk>2 \<le> n; n div 2 < 2 * 2 ^ local.log (n div 2)\<rbrakk> \<Longrightarrow> n < 2 * 2 ^ local.log n
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
2 \<le> n
n div 2 < 2 * 2 ^ local.log (n div 2)

goal (1 subgoal):
 1. n < 2 * 2 ^ local.log n
[PROOF STEP]
by (cases "even n") (auto elim!: evenE oddE simp: field_simps log.simps)
[PROOF STATE]
proof (state)
this:
n < 2 * 2 ^ local.log n

goal (1 subgoal):
 1. 1 < 2 * 2 ^ local.log 1
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
n < 2 * 2 ^ local.log n

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> n < 2 * 2 ^ local.log n
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma S_hyp2_S_cart2_append1:
  assumes "p \<noteq> q" and "p \<in> S" and "q \<in> S" and "a \<in> hyp2"
  and "proj2_incident p l" and "proj2_incident q l" and "proj2_incident a l"
  shows "\<exists> k. k > 0 \<and> k < 1
  \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k>0. k < 1 \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k>0. k < 1 \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p
[PROOF STEP]
from \<open>p \<in> S\<close> and \<open>q \<in> S\<close> and \<open>a \<in> hyp2\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<in> S
q \<in> S
a \<in> hyp2
[PROOF STEP]
have "z_non_zero p" and "z_non_zero q" and "z_non_zero a"
[PROOF STATE]
proof (prove)
using this:
p \<in> S
q \<in> S
a \<in> hyp2

goal (1 subgoal):
 1. z_non_zero p &&& z_non_zero q &&& z_non_zero a
[PROOF STEP]
by (simp_all add: hyp2_S_z_non_zero)
[PROOF STATE]
proof (state)
this:
z_non_zero p
z_non_zero q
z_non_zero a

goal (1 subgoal):
 1. \<exists>k>0. k < 1 \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> q
p \<in> S
q \<in> S
a \<in> hyp2
proj2_incident p l
proj2_incident q l
proj2_incident a l
[PROOF STEP]
have "B\<^sub>\<real> (cart2_pt p) (cart2_pt a) (cart2_pt q)" (is "B\<^sub>\<real> ?cp ?ca ?cq")
[PROOF STATE]
proof (prove)
using this:
p \<noteq> q
p \<in> S
q \<in> S
a \<in> hyp2
proj2_incident p l
proj2_incident q l
proj2_incident a l

goal (1 subgoal):
 1. B\<^sub>\<real> cart2_pt p cart2_pt a cart2_pt q
[PROOF STEP]
by (simp add: hyp2_incident_in_middle)
[PROOF STATE]
proof (state)
this:
B\<^sub>\<real> cart2_pt p cart2_pt a cart2_pt q

goal (1 subgoal):
 1. \<exists>k>0. k < 1 \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p
[PROOF STEP]
from \<open>p \<in> S\<close> and \<open>q \<in> S\<close> and \<open>a \<in> hyp2\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<in> S
q \<in> S
a \<in> hyp2
[PROOF STEP]
have "a \<noteq> p" and "a \<noteq> q"
[PROOF STATE]
proof (prove)
using this:
p \<in> S
q \<in> S
a \<in> hyp2

goal (1 subgoal):
 1. a \<noteq> p &&& a \<noteq> q
[PROOF STEP]
by (simp_all add: hyp2_S_not_equal)
[PROOF STATE]
proof (state)
this:
a \<noteq> p
a \<noteq> q

goal (1 subgoal):
 1. \<exists>k>0. k < 1 \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p
[PROOF STEP]
with \<open>z_non_zero p\<close> and \<open>z_non_zero a\<close> and \<open>z_non_zero q\<close>
    and \<open>B\<^sub>\<real> ?cp ?ca ?cq\<close>
[PROOF STATE]
proof (chain)
picking this:
z_non_zero p
z_non_zero a
z_non_zero q
B\<^sub>\<real> cart2_pt p cart2_pt a cart2_pt q
a \<noteq> p
a \<noteq> q
[PROOF STEP]
show "\<exists> k. k > 0 \<and> k < 1
    \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p"
[PROOF STATE]
proof (prove)
using this:
z_non_zero p
z_non_zero a
z_non_zero q
B\<^sub>\<real> cart2_pt p cart2_pt a cart2_pt q
a \<noteq> p
a \<noteq> q

goal (1 subgoal):
 1. \<exists>k>0. k < 1 \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p
[PROOF STEP]
by (rule cart2_append1_between_strict)
[PROOF STATE]
proof (state)
this:
\<exists>k>0. k < 1 \<and> cart2_append1 a = k *\<^sub>R cart2_append1 q + (1 - k) *\<^sub>R cart2_append1 p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma singleton_space_subset_in_sets:
  fixes J
  assumes "J \<in> I"
  assumes "finite J"
  shows "space (PiF {J} M) \<in> sets (PiF I M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (Pi\<^sub>F {J} M) \<in> sets (Pi\<^sub>F I M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
J \<in> I
finite J

goal (1 subgoal):
 1. space (Pi\<^sub>F {J} M) \<in> sets (Pi\<^sub>F I M)
[PROOF STEP]
by (intro in_sets_PiFI[where J=J and S="\<lambda>i. space (M i)"])
      (auto simp: product_def space_PiF)


[STATEMENT]
lemma is_red_adds_iff:
  shows "(is_red F p) \<longleftrightarrow> (\<exists>f\<in>F. \<exists>v\<in>keys p. f \<noteq> 0 \<and> lt f adds\<^sub>t v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_red F p = (\<exists>f\<in>F. \<exists>v\<in>keys p. f \<noteq> 0 \<and> lt f adds\<^sub>t v)
[PROOF STEP]
using is_red_addsE' is_red_addsI
[PROOF STATE]
proof (prove)
using this:
is_red ?F ?p \<Longrightarrow> \<exists>f\<in>?F. \<exists>v\<in>keys ?p. f \<noteq> 0 \<and> lt f adds\<^sub>t v
\<lbrakk>?f \<in> ?F; ?f \<noteq> 0; ?v \<in> keys ?p; lt ?f adds\<^sub>t ?v\<rbrakk> \<Longrightarrow> is_red ?F ?p

goal (1 subgoal):
 1. is_red F p = (\<exists>f\<in>F. \<exists>v\<in>keys p. f \<noteq> 0 \<and> lt f adds\<^sub>t v)
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_nth_deriv_sum:
  "fps_nth_deriv n (sum f S) = sum (\<lambda>i. fps_nth_deriv n (f i :: 'a::ring_1 fps)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
[PROOF STEP]
proof (cases "finite S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite S \<Longrightarrow> fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
 2. infinite S \<Longrightarrow> fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite S

goal (2 subgoals):
 1. finite S \<Longrightarrow> fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
 2. infinite S \<Longrightarrow> fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
[PROOF STEP]
by (induct rule: finite_induct [OF True]) simp_all
[PROOF STATE]
proof (state)
this:
fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))

goal (1 subgoal):
 1. infinite S \<Longrightarrow> fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite S \<Longrightarrow> fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite S

goal (1 subgoal):
 1. infinite S \<Longrightarrow> fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite S

goal (1 subgoal):
 1. fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_nth_deriv n (sum f S) = (\<Sum>i\<in>S. fps_nth_deriv n (f i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_append_rows:
  assumes "dim_col A = dim_col B"
  assumes "i < dim_row A + dim_row B"
  shows "row (A @\<^sub>r B) i = (if i < dim_row A then row A i else row B (i-dim_row A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (A @\<^sub>r B) i = (if i < dim_row A then row A i else row B (i - dim_row A))
[PROOF STEP]
unfolding vec_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (row (A @\<^sub>r B) i) = dim_vec (if i < dim_row A then row A i else row B (i - dim_row A)) \<and> (\<forall>ia<dim_vec (if i < dim_row A then row A i else row B (i - dim_row A)). row (A @\<^sub>r B) i $ ia = (if i < dim_row A then row A i else row B (i - dim_row A)) $ ia)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_col A = dim_col B
i < dim_row A + dim_row B

goal (1 subgoal):
 1. dim_vec (row (A @\<^sub>r B) i) = dim_vec (if i < dim_row A then row A i else row B (i - dim_row A)) \<and> (\<forall>ia<dim_vec (if i < dim_row A then row A i else row B (i - dim_row A)). row (A @\<^sub>r B) i $ ia = (if i < dim_row A then row A i else row B (i - dim_row A)) $ ia)
[PROOF STEP]
by (auto simp add: append_rows_def)