[STATEMENT]
lemma distproj_self [simp]:
  assumes "x \<in> A"
  shows "proj_set x A = {x}"
        "distproj x A = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_set x A = {x} &&& distproj x A = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. proj_set x A = {x}
 2. distproj x A = x
[PROOF STEP]
show "proj_set x A = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_set x A = {x}
[PROOF STEP]
unfolding proj_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y \<in> A. dist x y = infdist x A} = {x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> A

goal (1 subgoal):
 1. {y \<in> A. dist x y = infdist x A} = {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proj_set x A = {x}

goal (1 subgoal):
 1. distproj x A = x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proj_set x A = {x}
[PROOF STEP]
show "distproj x A = x"
[PROOF STATE]
proof (prove)
using this:
proj_set x A = {x}

goal (1 subgoal):
 1. distproj x A = x
[PROOF STEP]
unfolding distproj_def
[PROOF STATE]
proof (prove)
using this:
proj_set x A = {x}

goal (1 subgoal):
 1. (if proj_set x A \<noteq> {} then SOME y. y \<in> proj_set x A else x) = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distproj x A = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gram_schmidt_sub_triv: "gram_schmidt_sub_triv n ((map (\<lambda> x. (x,sq_norm x)) us)) ws =
  map (\<lambda> x. (x, sq_norm x)) (gram_schmidt_sub n us ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gram_schmidt_sub_triv n (map (\<lambda>x. (x, \<parallel>x\<parallel>\<^sup>2)) us) ws = map (\<lambda>x. (x, \<parallel>x\<parallel>\<^sup>2)) (gram_schmidt_sub n us ws)
[PROOF STEP]
by (rule sym, induct ws arbitrary: us, auto simp: adjuster_triv o_def Let_def)


[STATEMENT]
lemma deg_comp_zero_min:
  assumes "comparator cmp" and "snd (rep_nat_term u) = snd (rep_nat_term v)" and "fst (rep_nat_term u) = 0"
  shows "deg_comp cmp u v \<noteq> Gt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg_comp cmp u v \<noteq> Gt
[PROOF STEP]
proof (simp add: deg_comp assms(3) comparator_of_def split: order.split, intro impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (rep_nat_term v) = 0 \<Longrightarrow> cmp u v \<noteq> Gt
[PROOF STEP]
assume "fst (rep_nat_term v) = 0"
[PROOF STATE]
proof (state)
this:
fst (rep_nat_term v) = 0

goal (1 subgoal):
 1. fst (rep_nat_term v) = 0 \<Longrightarrow> cmp u v \<noteq> Gt
[PROOF STEP]
with assms(3)
[PROOF STATE]
proof (chain)
picking this:
fst (rep_nat_term u) = 0
fst (rep_nat_term v) = 0
[PROOF STEP]
have "fst (rep_nat_term u) = fst (rep_nat_term v)"
[PROOF STATE]
proof (prove)
using this:
fst (rep_nat_term u) = 0
fst (rep_nat_term v) = 0

goal (1 subgoal):
 1. fst (rep_nat_term u) = fst (rep_nat_term v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fst (rep_nat_term u) = fst (rep_nat_term v)

goal (1 subgoal):
 1. fst (rep_nat_term v) = 0 \<Longrightarrow> cmp u v \<noteq> Gt
[PROOF STEP]
hence "rep_nat_term u = rep_nat_term v"
[PROOF STATE]
proof (prove)
using this:
fst (rep_nat_term u) = fst (rep_nat_term v)

goal (1 subgoal):
 1. rep_nat_term u = rep_nat_term v
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
fst (rep_nat_term u) = fst (rep_nat_term v)
snd (rep_nat_term u) = snd (rep_nat_term v)

goal (1 subgoal):
 1. rep_nat_term u = rep_nat_term v
[PROOF STEP]
by (rule prod_eqI)
[PROOF STATE]
proof (state)
this:
rep_nat_term u = rep_nat_term v

goal (1 subgoal):
 1. fst (rep_nat_term v) = 0 \<Longrightarrow> cmp u v \<noteq> Gt
[PROOF STEP]
hence "u = v"
[PROOF STATE]
proof (prove)
using this:
rep_nat_term u = rep_nat_term v

goal (1 subgoal):
 1. u = v
[PROOF STEP]
by (rule rep_nat_term_inj)
[PROOF STATE]
proof (state)
this:
u = v

goal (1 subgoal):
 1. fst (rep_nat_term v) = 0 \<Longrightarrow> cmp u v \<noteq> Gt
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
comparator cmp
[PROOF STEP]
interpret c: comparator cmp
[PROOF STATE]
proof (prove)
using this:
comparator cmp

goal (1 subgoal):
 1. comparator cmp
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fst (rep_nat_term v) = 0 \<Longrightarrow> cmp u v \<noteq> Gt
[PROOF STEP]
show "cmp u v \<noteq> Gt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmp u v \<noteq> Gt
[PROOF STEP]
by (simp add: \<open>u = v\<close>)
[PROOF STATE]
proof (state)
this:
cmp u v \<noteq> Gt

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pivot_eq_satisfies_eq:
  assumes "y \<in> rvars_eq e"
  shows "v \<Turnstile>\<^sub>e e = v \<Turnstile>\<^sub>e pivot_eq e y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<Turnstile>\<^sub>e e = v \<Turnstile>\<^sub>e pivot_eq e y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y \<in> rvars_eq e

goal (1 subgoal):
 1. v \<Turnstile>\<^sub>e e = v \<Turnstile>\<^sub>e pivot_eq e y
[PROOF STEP]
using scaleRat_right_distrib[of "1 / Rep_linear_poly (rhs e) y" "- (rhs e \<lbrace> v \<rbrace>)" "v (lhs e)"]
[PROOF STATE]
proof (prove)
using this:
y \<in> rvars_eq e
(1 / Rep_linear_poly (rhs e) y) *R (- rhs e \<lbrace> v \<rbrace> + v (lhs e)) = (1 / Rep_linear_poly (rhs e) y) *R - rhs e \<lbrace> v \<rbrace> + (1 / Rep_linear_poly (rhs e) y) *R v (lhs e)

goal (1 subgoal):
 1. v \<Turnstile>\<^sub>e e = v \<Turnstile>\<^sub>e pivot_eq e y
[PROOF STEP]
using Groups.group_add_class.minus_unique[of "- ((rhs e) \<lbrace> v \<rbrace>)" "v (lhs e)"]
[PROOF STATE]
proof (prove)
using this:
y \<in> rvars_eq e
(1 / Rep_linear_poly (rhs e) y) *R (- rhs e \<lbrace> v \<rbrace> + v (lhs e)) = (1 / Rep_linear_poly (rhs e) y) *R - rhs e \<lbrace> v \<rbrace> + (1 / Rep_linear_poly (rhs e) y) *R v (lhs e)
- rhs e \<lbrace> v \<rbrace> + v (lhs e) = (0::'a) \<Longrightarrow> - (- rhs e \<lbrace> v \<rbrace>) = v (lhs e)

goal (1 subgoal):
 1. v \<Turnstile>\<^sub>e e = v \<Turnstile>\<^sub>e pivot_eq e y
[PROOF STEP]
unfolding coeff_def vars_def
[PROOF STATE]
proof (prove)
using this:
y \<in> map_fun Rep_linear_poly id fun_vars (rhs e)
(1 / Rep_linear_poly (rhs e) y) *R (- rhs e \<lbrace> v \<rbrace> + v (lhs e)) = (1 / Rep_linear_poly (rhs e) y) *R - rhs e \<lbrace> v \<rbrace> + (1 / Rep_linear_poly (rhs e) y) *R v (lhs e)
- rhs e \<lbrace> v \<rbrace> + v (lhs e) = (0::'a) \<Longrightarrow> - (- rhs e \<lbrace> v \<rbrace>) = v (lhs e)

goal (1 subgoal):
 1. v \<Turnstile>\<^sub>e e = v \<Turnstile>\<^sub>e pivot_eq e y
[PROOF STEP]
by (simp add: coeff_def vars_def Let_def pivot_eq_def satisfies_eq_def)
    (auto simp add: rational_vector.scale_right_diff_distrib valuate_add valuate_minus valuate_uminus valuate_scaleRat valuate_Var)


[STATEMENT]
lemma padic_add_inv:
assumes "prime p"
shows "\<And>x. x \<in> carrier (padic_int p) \<Longrightarrow>
           \<exists>y\<in>carrier (padic_int p). y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<exists>y\<in>carrier (padic_int p). y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<exists>y\<in>carrier (padic_int p). y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<exists>y\<in>carrier (padic_int p). y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
assume Ax: " x \<in> carrier (padic_int p)"
[PROOF STATE]
proof (state)
this:
x \<in> carrier (padic_int p)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<exists>y\<in>carrier (padic_int p). y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
show "\<exists>y\<in>carrier (padic_int p). y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y\<in>carrier (padic_int p). y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
 2. ?y \<in> carrier (padic_int p)
[PROOF STEP]
let ?y = "(padic_a_inv p) x"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
 2. ?y \<in> carrier (padic_int p)
[PROOF STEP]
show "?y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) xa = \<zero>\<^bsub>padic_int p\<^esub> xa
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) xa = \<zero>\<^bsub>padic_int p\<^esub> xa
[PROOF STEP]
show  "(?y \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
proof(cases "n=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
 2. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
 2. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
using Ax assms padic_add_closed padic_set_zero_res
              padic_a_inv_in_padic_set padic_zero_def padic_int_simps
[PROOF STATE]
proof (prove)
using this:
n = 0
x \<in> carrier (padic_int p)
prime p
\<lbrakk>prime ?p; ?x \<in> carrier (padic_int ?p); ?y \<in> carrier (padic_int ?p)\<rbrakk> \<Longrightarrow> ?x \<oplus>\<^bsub>padic_int ?p\<^esub> ?y \<in> carrier (padic_int ?p)
\<lbrakk>prime ?p; ?f \<in> padic_set ?p\<rbrakk> \<Longrightarrow> ?f 0 = 0
\<lbrakk>?f \<in> padic_set ?p; prime ?p\<rbrakk> \<Longrightarrow> padic_a_inv ?p ?f \<in> padic_set ?p
padic_zero ?p \<equiv> \<lambda>n. 0
\<one>\<^bsub>padic_int ?p\<^esub> = padic_one ?p
\<zero>\<^bsub>padic_int ?p\<^esub> = padic_zero ?p
(\<oplus>\<^bsub>padic_int ?p\<^esub>) = padic_add ?p
(\<otimes>\<^bsub>padic_int ?p\<^esub>) = padic_mult ?p
carrier (padic_int ?p) = padic_set ?p

goal (1 subgoal):
 1. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
have C: "(x n) \<in> carrier (residue_ring (p^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
using Ax padic_set_res_closed padic_int_simps
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (padic_int p)
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))
\<one>\<^bsub>padic_int ?p\<^esub> = padic_one ?p
\<zero>\<^bsub>padic_int ?p\<^esub> = padic_zero ?p
(\<oplus>\<^bsub>padic_int ?p\<^esub>) = padic_add ?p
(\<otimes>\<^bsub>padic_int ?p\<^esub>) = padic_mult ?p
carrier (padic_int ?p) = padic_set ?p

goal (1 subgoal):
 1. x n \<in> carrier (residue_ring (p ^ n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x n \<in> carrier (residue_ring (p ^ n))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
have R: "residues (p^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residues (p ^ n)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. residues (p ^ n)
[PROOF STEP]
by (simp add: assms residues_n)
[PROOF STATE]
proof (state)
this:
residues (p ^ n)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
have "(?y \<oplus>\<^bsub>padic_int p\<^esub> x) n = (?y n) \<oplus>\<^bsub>residue_ring (p^n)\<^esub> x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = padic_a_inv p x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> x n
[PROOF STEP]
by (simp add: padic_int_def padic_add_res)
[PROOF STATE]
proof (state)
this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = padic_a_inv p x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> x n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = padic_a_inv p x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> x n
[PROOF STEP]
have "(?y \<oplus>\<^bsub>padic_int p\<^esub> x) n = 0"
[PROOF STATE]
proof (prove)
using this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = padic_a_inv p x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> x n

goal (1 subgoal):
 1. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = 0
[PROOF STEP]
using C R residue_ring_def[simp] residues.cring
[PROOF STATE]
proof (prove)
using this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = padic_a_inv p x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> x n
x n \<in> carrier (residue_ring (p ^ n))
residues (p ^ n)
residue_ring ?m = \<lparr>carrier = {0..?m - 1}, monoid.mult = \<lambda>x y. x * y mod ?m, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod ?m\<rparr>
residues ?m \<Longrightarrow> cring (residue_ring ?m)

goal (1 subgoal):
 1. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = 0
[PROOF STEP]
by (metis (no_types, lifting) cring.cring_simprules(9) padic_a_inv_def residues.zero_cong)
[PROOF STATE]
proof (state)
this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = 0

goal (1 subgoal):
 1. (padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n
[PROOF STEP]
by (simp add: padic_int_def padic_zero_def)
[PROOF STATE]
proof (state)
this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x) n = \<zero>\<^bsub>padic_int p\<^esub> n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. padic_a_inv p x \<in> carrier (padic_int p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
show "padic_a_inv p x \<in> carrier (padic_int p)"
[PROOF STATE]
proof (prove)
using this:
padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. padic_a_inv p x \<in> carrier (padic_int p)
[PROOF STEP]
using padic_a_inv_in_padic_set padic_int_simps
            Ax assms prime_gt_0_nat
[PROOF STATE]
proof (prove)
using this:
padic_a_inv p x \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>
\<lbrakk>?f \<in> padic_set ?p; prime ?p\<rbrakk> \<Longrightarrow> padic_a_inv ?p ?f \<in> padic_set ?p
\<one>\<^bsub>padic_int ?p\<^esub> = padic_one ?p
\<zero>\<^bsub>padic_int ?p\<^esub> = padic_zero ?p
(\<oplus>\<^bsub>padic_int ?p\<^esub>) = padic_add ?p
(\<otimes>\<^bsub>padic_int ?p\<^esub>) = padic_mult ?p
carrier (padic_int ?p) = padic_set ?p
x \<in> carrier (padic_int p)
prime p
prime ?p \<Longrightarrow> 0 < ?p

goal (1 subgoal):
 1. padic_a_inv p x \<in> carrier (padic_int p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
padic_a_inv p x \<in> carrier (padic_int p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>y\<in>carrier (padic_int p). y \<oplus>\<^bsub>padic_int p\<^esub> x = \<zero>\<^bsub>padic_int p\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma setv_col_subset_mat_elems:
  assumes "v \<in> set (cols M)"
  shows "set\<^sub>v v \<subseteq> elements_mat M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set\<^sub>v v \<subseteq> elements_mat M
[PROOF STEP]
proof (intro subsetI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in>$ v \<Longrightarrow> x \<in> elements_mat M
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in>$ v \<Longrightarrow> x \<in> elements_mat M
[PROOF STEP]
assume "x \<in>$ v"
[PROOF STATE]
proof (state)
this:
x \<in>$ v

goal (1 subgoal):
 1. \<And>x. x \<in>$ v \<Longrightarrow> x \<in> elements_mat M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in>$ v
[PROOF STEP]
obtain i where "v = col M i" and "i < dim_col M"
[PROOF STATE]
proof (prove)
using this:
x \<in>$ v

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>v = col M i; i < dim_col M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms obtain_col_index)
[PROOF STATE]
proof (state)
this:
v = col M i
i < dim_col M

goal (1 subgoal):
 1. \<And>x. x \<in>$ v \<Longrightarrow> x \<in> elements_mat M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v = col M i
i < dim_col M
[PROOF STEP]
show "x \<in> elements_mat M"
[PROOF STATE]
proof (prove)
using this:
v = col M i
i < dim_col M

goal (1 subgoal):
 1. x \<in> elements_mat M
[PROOF STEP]
by (metis \<open>x \<in>$ v\<close> vec_contains_col_elements_mat)
[PROOF STATE]
proof (state)
this:
x \<in> elements_mat M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_set_zip:
  "p \<in> set (zip xs ys) \<longleftrightarrow> (\<exists>n. xs ! n = fst p \<and> ys ! n = snd p
  \<and> n < length xs \<and> n < length ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<in> set (zip xs ys)) = (\<exists>n. xs ! n = fst p \<and> ys ! n = snd p \<and> n < length xs \<and> n < length ys)
[PROOF STEP]
by (cases p) (auto simp add: set_zip)


[STATEMENT]
lemma upper_rank_of_le: "upper_rank_of \<E> \<le> card \<E>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_rank_of \<E> \<le> card \<E>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. upper_rank_of \<E> \<le> card \<E>
[PROOF STEP]
have "\<forall>n \<in> {card B | B. basis_in \<E> B}. n \<le> card \<E>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
[PROOF STEP]
using card_mono[OF \<E>.carrier_finite basis_in_subset_carrier[OF *]]
[PROOF STATE]
proof (prove)
using this:
basis_in \<E> ?A \<Longrightarrow> card ?A \<le> card \<E>

goal (1 subgoal):
 1. \<forall>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>

goal (1 subgoal):
 1. upper_rank_of \<E> \<le> card \<E>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>

goal (1 subgoal):
 1. upper_rank_of \<E> \<le> card \<E>
[PROOF STEP]
unfolding upper_rank_of_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>

goal (1 subgoal):
 1. Max {card B |B. basis_in \<E> B} \<le> card \<E>
[PROOF STEP]
using basis_in_ex[OF *] collect_basis_in_finite
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<in>{card B |B. basis_in \<E> B}. n \<le> card \<E>
\<exists>B. basis_in \<E> B
finite (Collect (basis_in \<E>))

goal (1 subgoal):
 1. Max {card B |B. basis_in \<E> B} \<le> card \<E>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
upper_rank_of \<E> \<le> card \<E>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rev_iterateoi_correct:
    "invar S \<Longrightarrow> set_iterator_rev_linord (rev_iterateoi S) (\<alpha> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar S \<Longrightarrow> set_iterator_rev_linord (reverse_iterateoi S) (\<alpha> S)
[PROOF STEP]
unfolding rev_iterateoi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar S \<Longrightarrow> set_iterator_rev_linord (it_to_it (list_rev_it S)) (\<alpha> S)
[PROOF STEP]
apply (rule it_to_it_rev_linord_correct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar S \<Longrightarrow> set_iterator_rev_linord (list_rev_it S) (\<alpha> S)
[PROOF STEP]
by (rule list_rev_it_correct)


[STATEMENT]
lemma (in linearform) zero [iff]:
  assumes "vectorspace V"
  shows "f 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
interpret vectorspace V
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace V
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
have "f 0 = f (0 - 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (0::'a) = f ((0::'a) - (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f (0::'a) = f ((0::'a) - (0::'a))

goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (0::'a) = f ((0::'a) - (0::'a))

goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
have "\<dots> = f 0 - f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ((0::'a) - (0::'a)) = f (0::'a) - f (0::'a)
[PROOF STEP]
using \<open>vectorspace V\<close>
[PROOF STATE]
proof (prove)
using this:
vectorspace V

goal (1 subgoal):
 1. f ((0::'a) - (0::'a)) = f (0::'a) - f (0::'a)
[PROOF STEP]
by (rule diff) simp_all
[PROOF STATE]
proof (state)
this:
f ((0::'a) - (0::'a)) = f (0::'a) - f (0::'a)

goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f ((0::'a) - (0::'a)) = f (0::'a) - f (0::'a)

goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (0::'a) - f (0::'a) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f (0::'a) - f (0::'a) = 0

goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f (0::'a) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f (0::'a) = 0

goal (1 subgoal):
 1. f (0::'a) = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f (0::'a) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sym_inv_eq[simp]: "sym E \<Longrightarrow> E\<inverse> = E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sym E \<Longrightarrow> E\<inverse> = E
[PROOF STEP]
unfolding sym_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (x, y) \<in> E \<longrightarrow> (y, x) \<in> E \<Longrightarrow> E\<inverse> = E
[PROOF STEP]
by auto


[STATEMENT]
lemma adjacent_not_self[simp, intro!]: "v \<notin> adjacent_nodes v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<notin> adjacent_nodes v
[PROOF STEP]
unfolding adjacent_nodes_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<notin> E `` {v} \<union> E\<inverse> `` {v}
[PROOF STEP]
using no_self_loop
[PROOF STATE]
proof (prove)
using this:
\<forall>u. (u, u) \<notin> E

goal (1 subgoal):
 1. v \<notin> E `` {v} \<union> E\<inverse> `` {v}
[PROOF STEP]
by auto


[STATEMENT]
lemma countable_iff_le_Aleph0: "countable (elts A) \<longleftrightarrow> vcard A \<le> \<aleph>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (elts A) = (vcard A \<le> \<aleph>0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. countable (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
 2. vcard A \<le> \<aleph>0 \<Longrightarrow> countable (elts A)
[PROOF STEP]
show "vcard A \<le> \<aleph>0"
    if "countable (elts A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard A \<le> \<aleph>0
[PROOF STEP]
proof (cases "finite (elts A)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
 2. infinite (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite (elts A)

goal (2 subgoals):
 1. finite (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
 2. infinite (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (elts A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (elts A)

goal (1 subgoal):
 1. vcard A \<le> \<aleph>0
[PROOF STEP]
using vcard_finite_set
[PROOF STATE]
proof (prove)
using this:
finite (elts A)
finite ?A \<Longrightarrow> vcard (set ?A) = ord_of_nat (card ?A)

goal (1 subgoal):
 1. vcard A \<le> \<aleph>0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
vcard A \<le> \<aleph>0

goal (1 subgoal):
 1. infinite (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite (elts A)

goal (1 subgoal):
 1. infinite (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite (elts A)
[PROOF STEP]
have "elts \<omega> \<approx> elts A"
[PROOF STATE]
proof (prove)
using this:
infinite (elts A)

goal (1 subgoal):
 1. elts \<omega> \<approx> elts A
[PROOF STEP]
using countableE_infinite [OF that]
[PROOF STATE]
proof (prove)
using this:
infinite (elts A)
\<lbrakk>infinite (elts A); \<And>e. bij_betw e (elts A) UNIV \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. elts \<omega> \<approx> elts A
[PROOF STEP]
by (simp add: eqpoll_def \<omega>_def)
         (meson bij_betw_def bij_betw_inv bij_betw_trans inj_ord_of_nat)
[PROOF STATE]
proof (state)
this:
elts \<omega> \<approx> elts A

goal (1 subgoal):
 1. infinite (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
elts \<omega> \<approx> elts A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
elts \<omega> \<approx> elts A

goal (1 subgoal):
 1. vcard A \<le> \<aleph>0
[PROOF STEP]
using Card_\<omega> Card_def cardinal_cong vcard_def
[PROOF STATE]
proof (prove)
using this:
elts \<omega> \<approx> elts A
Card \<omega>
Card ?i \<equiv> ?i = vcard ?i
elts ?x \<approx> elts ?y \<Longrightarrow> vcard ?x = vcard ?y
vcard ?a \<equiv> LEAST i. Ord i \<and> elts i \<approx> elts ?a

goal (1 subgoal):
 1. vcard A \<le> \<aleph>0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vcard A \<le> \<aleph>0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
countable (elts A) \<Longrightarrow> vcard A \<le> \<aleph>0

goal (1 subgoal):
 1. vcard A \<le> \<aleph>0 \<Longrightarrow> countable (elts A)
[PROOF STEP]
show "countable (elts A)"
    if "vcard A \<le> Aleph 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (elts A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. countable (elts A)
[PROOF STEP]
have "elts A \<lesssim> elts \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts A \<lesssim> elts \<omega>
[PROOF STEP]
using cardinal_le_lepoll [OF that]
[PROOF STATE]
proof (prove)
using this:
elts A \<lesssim> elts (\<aleph>0)

goal (1 subgoal):
 1. elts A \<lesssim> elts \<omega>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
elts A \<lesssim> elts \<omega>

goal (1 subgoal):
 1. countable (elts A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
elts A \<lesssim> elts \<omega>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
elts A \<lesssim> elts \<omega>

goal (1 subgoal):
 1. countable (elts A)
[PROOF STEP]
by (simp add: countable_iff_lepoll \<omega>_def inj_ord_of_nat)
[PROOF STATE]
proof (state)
this:
countable (elts A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vcard A \<le> \<aleph>0 \<Longrightarrow> countable (elts A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prefixes_in_list_prop :
shows "list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev@ys | ys . ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}
[PROOF STEP]
proof (induction xs arbitrary: prev yss res)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>prev yss res. list.set (prefixes_in_list [] prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes []) \<and> ys \<in> list.set yss}
 2. \<And>a xs prev yss res. (\<And>prev yss res. list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}) \<Longrightarrow> list.set (prefixes_in_list (a # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (a # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>prev yss res. list.set (prefixes_in_list [] prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes []) \<and> ys \<in> list.set yss}
 2. \<And>a xs prev yss res. (\<And>prev yss res. list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}) \<Longrightarrow> list.set (prefixes_in_list (a # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (a # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_list [] prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes []) \<and> ys \<in> list.set yss}
[PROOF STEP]
unfolding prefixes_in_list.simps List.member_def prefixes_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (if [] \<in> list.set yss then prev # res else res) = list.set res \<union> {prev @ ys |ys. ys \<in> {xs'. \<exists>xs''. xs' @ xs'' = []} \<and> ys \<in> list.set yss}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list.set (prefixes_in_list [] prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes []) \<and> ys \<in> list.set yss}

goal (1 subgoal):
 1. \<And>a xs prev yss res. (\<And>prev yss res. list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}) \<Longrightarrow> list.set (prefixes_in_list (a # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (a # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs prev yss res. (\<And>prev yss res. list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}) \<Longrightarrow> list.set (prefixes_in_list (a # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (a # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
list.set (prefixes_in_list xs ?prev ?yss ?res) = list.set ?res \<union> {?prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set ?yss}

goal (1 subgoal):
 1. \<And>a xs prev yss res. (\<And>prev yss res. list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}) \<Longrightarrow> list.set (prefixes_in_list (a # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (a # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
obtain b yss' where "prefixes_in_list_helper x yss (False,[]) = (b,yss')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b yss'. prefixes_in_list_helper x yss (False, []) = (b, yss') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prod.exhaust
[PROOF STATE]
proof (prove)
using this:
(\<And>x1 x2. ?y = (x1, x2) \<Longrightarrow> ?P) \<Longrightarrow> ?P

goal (1 subgoal):
 1. (\<And>b yss'. prefixes_in_list_helper x yss (False, []) = (b, yss') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
prefixes_in_list_helper x yss (False, []) = (b, yss')

goal (1 subgoal):
 1. \<And>a xs prev yss res. (\<And>prev yss res. list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}) \<Longrightarrow> list.set (prefixes_in_list (a # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (a # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prefixes_in_list_helper x yss (False, []) = (b, yss')
[PROOF STEP]
have "b = ([] \<in> list.set yss)"
        and "list.set yss' = {ys . x#ys \<in> list.set yss}"
[PROOF STATE]
proof (prove)
using this:
prefixes_in_list_helper x yss (False, []) = (b, yss')

goal (1 subgoal):
 1. b = ([] \<in> list.set yss) &&& list.set yss' = {ys. x # ys \<in> list.set yss}
[PROOF STEP]
using prefixes_in_list_helper_prop[of x yss "(False,[])"]
[PROOF STATE]
proof (prove)
using this:
prefixes_in_list_helper x yss (False, []) = (b, yss')
fst (prefixes_in_list_helper x yss (False, [])) = (fst (False, []) \<or> [] \<in> list.set yss)
list.set (snd (prefixes_in_list_helper x yss (False, []))) = list.set (snd (False, [])) \<union> {ys. x # ys \<in> list.set yss}

goal (1 subgoal):
 1. b = ([] \<in> list.set yss) &&& list.set yss' = {ys. x # ys \<in> list.set yss}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b = ([] \<in> list.set yss)
list.set yss' = {ys. x # ys \<in> list.set yss}

goal (1 subgoal):
 1. \<And>a xs prev yss res. (\<And>prev yss res. list.set (prefixes_in_list xs prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set yss}) \<Longrightarrow> list.set (prefixes_in_list (a # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (a # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
proof (cases b)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
 2. \<not> b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b

goal (2 subgoals):
 1. b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
 2. \<not> b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b
[PROOF STEP]
have *: "prefixes_in_list (x#xs) prev yss res = prefixes_in_list xs (prev@[x]) yss' (prev # res)"
[PROOF STATE]
proof (prove)
using this:
b

goal (1 subgoal):
 1. prefixes_in_list (x # xs) prev yss res = prefixes_in_list xs (prev @ [x]) yss' (prev # res)
[PROOF STEP]
using \<open>prefixes_in_list_helper x yss (False,[]) = (b,yss')\<close>
[PROOF STATE]
proof (prove)
using this:
b
prefixes_in_list_helper x yss (False, []) = (b, yss')

goal (1 subgoal):
 1. prefixes_in_list (x # xs) prev yss res = prefixes_in_list xs (prev @ [x]) yss' (prev # res)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prefixes_in_list (x # xs) prev yss res = prefixes_in_list xs (prev @ [x]) yss' (prev # res)

goal (2 subgoals):
 1. b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
 2. \<not> b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_list xs (prev @ [x]) yss' (prev # res)) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
unfolding Cons \<open>list.set yss' = {ys . x#ys \<in> list.set yss}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prev # res) \<union> {(prev @ [x]) @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> {ys. x # ys \<in> list.set yss}} = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
b

goal (1 subgoal):
 1. list.set (prev # res) \<union> {(prev @ [x]) @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> {ys. x # ys \<in> list.set yss}} = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
unfolding \<open>b = ([] \<in> list.set yss)\<close>
[PROOF STATE]
proof (prove)
using this:
[] \<in> list.set yss

goal (1 subgoal):
 1. list.set (prev # res) \<union> {(prev @ [x]) @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> {ys. x # ys \<in> list.set yss}} = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}

goal (1 subgoal):
 1. \<not> b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> b

goal (1 subgoal):
 1. \<not> b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> b
[PROOF STEP]
have *: "prefixes_in_list (x#xs) prev yss res = prefixes_in_list xs (prev@[x]) yss' res"
[PROOF STATE]
proof (prove)
using this:
\<not> b

goal (1 subgoal):
 1. prefixes_in_list (x # xs) prev yss res = prefixes_in_list xs (prev @ [x]) yss' res
[PROOF STEP]
using \<open>prefixes_in_list_helper x yss (False,[]) = (b,yss')\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> b
prefixes_in_list_helper x yss (False, []) = (b, yss')

goal (1 subgoal):
 1. prefixes_in_list (x # xs) prev yss res = prefixes_in_list xs (prev @ [x]) yss' res
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prefixes_in_list (x # xs) prev yss res = prefixes_in_list xs (prev @ [x]) yss' res

goal (1 subgoal):
 1. \<not> b \<Longrightarrow> list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_list xs (prev @ [x]) yss' res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
unfolding Cons \<open>list.set yss' = {ys . x#ys \<in> list.set yss}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set res \<union> {(prev @ [x]) @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> {ys. x # ys \<in> list.set yss}} = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> b

goal (1 subgoal):
 1. list.set res \<union> {(prev @ [x]) @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> {ys. x # ys \<in> list.set yss}} = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
unfolding \<open>b = ([] \<in> list.set yss)\<close>
[PROOF STATE]
proof (prove)
using this:
[] \<notin> list.set yss

goal (1 subgoal):
 1. list.set res \<union> {(prev @ [x]) @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> {ys. x # ys \<in> list.set yss}} = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
list.set (prefixes_in_list (x # xs) prev yss res) = list.set res \<union> {prev @ ys |ys. ys \<in> list.set (prefixes (x # xs)) \<and> ys \<in> list.set yss}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SourcesA91_L1: "Sources level1 sA91 = {sA6, sA71, sA81, sA91}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sources level1 sA91 = {sA6, sA71, sA81, sA91}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sources level1 sA91 = {sA6, sA71, sA81, sA91}
[PROOF STEP]
have  "DSources level1 sA91 = {sA81}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. DSources level1 sA91 = {sA81}
[PROOF STEP]
by (rule DSourcesA91_L1)
[PROOF STATE]
proof (state)
this:
DSources level1 sA91 = {sA81}

goal (1 subgoal):
 1. Sources level1 sA91 = {sA6, sA71, sA81, sA91}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
DSources level1 sA91 = {sA81}

goal (1 subgoal):
 1. Sources level1 sA91 = {sA6, sA71, sA81, sA91}
[PROOF STEP]
by (metis SourcesA81_L1 Sources_singleDSource
          Un_empty_left Un_insert_left insert_absorb2 insert_commute)
[PROOF STATE]
proof (state)
this:
Sources level1 sA91 = {sA6, sA71, sA81, sA91}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma AE_in_main_part:
  assumes A: "A \<in> completion M" shows "AE x in M. x \<in> main_part M A \<longleftrightarrow> x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. (x \<in> main_part M A) = (x \<in> A)
[PROOF STEP]
using AE_notin_null_part[OF A]
[PROOF STATE]
proof (prove)
using this:
AE x in M. x \<notin> null_part M A

goal (1 subgoal):
 1. AE x in M. (x \<in> main_part M A) = (x \<in> A)
[PROOF STEP]
by (subst (2) main_part_null_part_Un[symmetric, OF A]) auto


[STATEMENT]
lemma K_mono:
  assumes "x \<subseteq> y"
  shows "K x \<subseteq> K y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K x \<subseteq> K y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<subseteq> y

goal (1 subgoal):
 1. K x \<subseteq> K y
[PROOF STEP]
unfolding K_def
[PROOF STATE]
proof (prove)
using this:
x \<subseteq> y

goal (1 subgoal):
 1. closure x \<subseteq> closure y
[PROOF STEP]
by (simp add: closure_mono)


[STATEMENT]
lemma append_rows_access1 [simp]:
  assumes "i < dim_row A"
  assumes "dim_col A = dim_col B"
  shows "row (A @\<^sub>r B) i = row A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (A @\<^sub>r B) i = row A i
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
 2. dim_vec (row (A @\<^sub>r B) i) = dim_vec (row A i)
[PROOF STEP]
show "dim_vec (Matrix.row (A @\<^sub>r B) i) = dim_vec (Matrix.row A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (row (A @\<^sub>r B) i) = dim_vec (row A i)
[PROOF STEP]
by (simp add: append_rows_def)
[PROOF STATE]
proof (state)
this:
dim_vec (row (A @\<^sub>r B) i) = dim_vec (row A i)

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
fix ia
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
assume "ia < dim_vec (row A i)"
[PROOF STATE]
proof (state)
this:
ia < dim_vec (row A i)

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
have "row (A @\<^sub>r B) i = (row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (A @\<^sub>r B) i = row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i
[PROOF STEP]
unfolding append_rows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (four_block_mat A (0\<^sub>m (dim_row A) 0) B (0\<^sub>m (dim_row B) 0)) i = row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i
[PROOF STEP]
using
      carrier_mat_triv[of A] row_four_block_mat(1)[of A "dim_row A"
        _ "0\<^sub>m (dim_row A) 0" 0 B "dim_row B" "0\<^sub>m (dim_row B) 0" i, OF _ _ _ _ assms(1)]
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat (dim_row A) (dim_col A)
\<lbrakk>A \<in> carrier_mat (dim_row A) ?nc1.0; 0\<^sub>m (dim_row A) 0 \<in> carrier_mat (dim_row A) 0; B \<in> carrier_mat (dim_row B) ?nc1.0; 0\<^sub>m (dim_row B) 0 \<in> carrier_mat (dim_row B) 0\<rbrakk> \<Longrightarrow> row (four_block_mat A (0\<^sub>m (dim_row A) 0) B (0\<^sub>m (dim_row B) 0)) i = row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i

goal (1 subgoal):
 1. row (four_block_mat A (0\<^sub>m (dim_row A) 0) B (0\<^sub>m (dim_row B) 0)) i = row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i
[PROOF STEP]
by (metis assms(2) carrier_mat_triv zero_carrier_mat)
[PROOF STATE]
proof (state)
this:
row (A @\<^sub>r B) i = row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row (A @\<^sub>r B) i = row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
have "... = row A i @\<^sub>v vNil"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i = row A i @\<^sub>v vNil
[PROOF STEP]
by (simp add: assms(1))
[PROOF STATE]
proof (state)
this:
row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i = row A i @\<^sub>v vNil

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row A i @\<^sub>v row (0\<^sub>m (dim_row A) 0) i = row A i @\<^sub>v vNil

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
have "... = row A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row A i @\<^sub>v vNil = row A i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row A i @\<^sub>v vNil = row A i

goal (1 subgoal):
 1. \<And>ia. ia < dim_vec (row A i) \<Longrightarrow> row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
row (A @\<^sub>r B) i = row A i
[PROOF STEP]
show "row (A @\<^sub>r B) i $ ia = row A i $ ia"
[PROOF STATE]
proof (prove)
using this:
row (A @\<^sub>r B) i = row A i

goal (1 subgoal):
 1. row (A @\<^sub>r B) i $ ia = row A i $ ia
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (A @\<^sub>r B) i $ ia = row A i $ ia

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gcd_uminus:
  fixes A::"int set"
  assumes "finite A"
  shows "Gcd A = Gcd (uminus ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd A = Gcd (uminus ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. Gcd A = Gcd (uminus ` A)
[PROOF STEP]
by (induct A, auto)


[STATEMENT]
lemma distrib: "F (\<lambda>x. g x \<^bold>* h x) A = F g A \<^bold>* F h A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F (\<lambda>x. g x \<^bold>* h x) A = F g A \<^bold>* F h A
[PROOF STEP]
by (induct A rule: infinite_finite_induct) (simp_all add: assoc commute left_commute)


[STATEMENT]
lemma interval_not_empty: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow> cbox a b \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i \<Longrightarrow> cbox a b \<noteq> {}
[PROOF STEP]
by (simp add: box_ne_empty)


[STATEMENT]
lemma extensional_Int[simp]: "extensional I \<inter> extensional I' = extensional (I \<inter> I')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extensional I \<inter> extensional I' = extensional (I \<inter> I')
[PROOF STEP]
unfolding extensional_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. \<forall>x. x \<notin> I \<longrightarrow> f x = undefined} \<inter> {f. \<forall>x. x \<notin> I' \<longrightarrow> f x = undefined} = {f. \<forall>x. x \<notin> I \<inter> I' \<longrightarrow> f x = undefined}
[PROOF STEP]
by auto


[STATEMENT]
lemma bounded_cbilinear_mult: "bounded_cbilinear ((*) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a::complex_normed_algebra)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_cbilinear (*)
[PROOF STEP]
proof (rule bounded_cbilinear.intro)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>a a' b. (a + a') * b = a * b + a' * b
 2. \<And>a b b'. a * (b + b') = a * b + a * b'
 3. \<And>r a b. r *\<^sub>C a * b = r *\<^sub>C (a * b)
 4. \<And>a r b. a * r *\<^sub>C b = r *\<^sub>C (a * b)
 5. \<exists>K. \<forall>a b. norm (a * b) \<le> norm a * norm b * K
[PROOF STEP]
show "\<exists>K. \<forall>a b::'a. norm (a * b) \<le> norm a * norm b * K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>K. \<forall>a b. norm (a * b) \<le> norm a * norm b * K
[PROOF STEP]
by (rule_tac x=1 in exI) (simp add: norm_mult_ineq)
[PROOF STATE]
proof (state)
this:
\<exists>K. \<forall>a b. norm (a * b) \<le> norm a * norm b * K

goal (4 subgoals):
 1. \<And>a a' b. (a + a') * b = a * b + a' * b
 2. \<And>a b b'. a * (b + b') = a * b + a * b'
 3. \<And>r a b. r *\<^sub>C a * b = r *\<^sub>C (a * b)
 4. \<And>a r b. a * r *\<^sub>C b = r *\<^sub>C (a * b)
[PROOF STEP]
qed (auto simp: algebra_simps)


[STATEMENT]
lemma CONSTRAINT_D:
  assumes "CONSTRAINT (P::'a => bool) x"
  shows "P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
CONSTRAINT P x

goal (1 subgoal):
 1. P x
[PROOF STEP]
unfolding CONSTRAINT_def
[PROOF STATE]
proof (prove)
using this:
P x

goal (1 subgoal):
 1. P x
[PROOF STEP]
by simp


[STATEMENT]
lemma run_rel_single_valued: "single_valued R
    \<Longrightarrow> (ra, rb) \<in> run_rel R \<longleftrightarrow> ((\<forall>i. the_br_invar R (ra i)) \<and> rb = the_br_\<alpha> R o ra)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. single_valued R \<Longrightarrow> ((ra, rb) \<in> run_rel R) = ((\<forall>i. ra i \<in> Domain R) \<and> rb = the_br_\<alpha> R \<circ> ra)
[PROOF STEP]
unfolding run_rel_def the_br_\<alpha>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. single_valued R \<Longrightarrow> ((ra, rb) \<in> {(ra, rb). \<forall>i. (ra i, rb i) \<in> R}) = ((\<forall>i. ra i \<in> Domain R) \<and> rb = (\<lambda>x. SOME y. (x, y) \<in> R) \<circ> ra)
[PROOF STEP]
apply (auto intro!: ext)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>single_valued R; \<forall>i. (ra i, rb i) \<in> R\<rbrakk> \<Longrightarrow> rb x = (SOME y. (ra x, y) \<in> R)
 2. \<And>i. \<lbrakk>single_valued R; \<forall>i. ra i \<in> Domain R; rb = (\<lambda>x. SOME y. (x, y) \<in> R) \<circ> ra\<rbrakk> \<Longrightarrow> (ra i, SOME y. (ra i, y) \<in> R) \<in> R
[PROOF STEP]
apply (metis single_valuedD someI_ex)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>single_valued R; \<forall>i. ra i \<in> Domain R; rb = (\<lambda>x. SOME y. (x, y) \<in> R) \<circ> ra\<rbrakk> \<Longrightarrow> (ra i, SOME y. (ra i, y) \<in> R) \<in> R
[PROOF STEP]
apply (metis DomainE someI_ex)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma all_edges_alt_pairs: "all_edges S = mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_edges S = mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}
[PROOF STEP]
unfolding all_edges_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} = mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}
[PROOF STEP]
proof (intro subset_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<subseteq> mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}
 2. mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} \<subseteq> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
[PROOF STEP]
have img: "mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} = {mk_edge (u, v) | u v. (u, v) \<in> S \<times> S \<and> u \<noteq>v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} = {mk_edge (u, v) |u v. (u, v) \<in> S \<times> S \<and> u \<noteq> v}
[PROOF STEP]
by (smt (z3) Collect_cong fst_conv prod.collapse setcompr_eq_image snd_conv)
[PROOF STATE]
proof (state)
this:
mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} = {mk_edge (u, v) |u v. (u, v) \<in> S \<times> S \<and> u \<noteq> v}

goal (2 subgoals):
 1. {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<subseteq> mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}
 2. mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} \<subseteq> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} = {mk_edge (u, v) |u v. (u, v) \<in> S \<times> S \<and> u \<noteq> v}
[PROOF STEP]
show " mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} \<subseteq> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}"
[PROOF STATE]
proof (prove)
using this:
mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} = {mk_edge (u, v) |u v. (u, v) \<in> S \<times> S \<and> u \<noteq> v}

goal (1 subgoal):
 1. mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} \<subseteq> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} \<subseteq> {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y}

goal (1 subgoal):
 1. {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<subseteq> mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}
[PROOF STEP]
show  "{{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<subseteq> mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<subseteq> mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}
[PROOF STEP]
using img
[PROOF STATE]
proof (prove)
using this:
mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv} = {mk_edge (u, v) |u v. (u, v) \<in> S \<times> S \<and> u \<noteq> v}

goal (1 subgoal):
 1. {{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<subseteq> mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{{x, y} |x y. x \<in> S \<and> y \<in> S \<and> x \<noteq> y} \<subseteq> mk_edge ` {uv \<in> S \<times> S. fst uv \<noteq> snd uv}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma C1_differentiable_on_components:
  assumes "\<And>i. i \<in> Basis \<Longrightarrow> (\<lambda>x. f x \<bullet> i) C1_differentiable_on s"
  shows "f C1_differentiable_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f C1_differentiable_on s
[PROOF STEP]
proof (clarsimp simp add: C1_differentiable_on_def has_vector_derivative_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>D. (\<forall>x\<in>s. (f has_derivative (\<lambda>xa. xa *\<^sub>R D x)) (at x)) \<and> continuous_on s D
[PROOF STEP]
have *:"\<forall>f i x. x *\<^sub>R (f \<bullet> i) = (x *\<^sub>R f) \<bullet> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f i x. x *\<^sub>R (f \<bullet> i) = x *\<^sub>R f \<bullet> i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>f i x. x *\<^sub>R (f \<bullet> i) = x *\<^sub>R f \<bullet> i

goal (1 subgoal):
 1. \<exists>D. (\<forall>x\<in>s. (f has_derivative (\<lambda>xa. xa *\<^sub>R D x)) (at x)) \<and> continuous_on s D
[PROOF STEP]
have "\<exists>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'
[PROOF STEP]
using assms lambda_skolem_euclidean[of "\<lambda>i D. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R D x)) (at x)) \<and> continuous_on s D"]
[PROOF STATE]
proof (prove)
using this:
?i \<in> Basis \<Longrightarrow> (\<lambda>x. f x \<bullet> ?i) C1_differentiable_on s
(\<forall>i\<in>Basis. \<exists>f'. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f') = (\<exists>f'. \<forall>i\<in>Basis. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R (f' x \<bullet> i))) (at x)) \<and> continuous_on s (\<lambda>x. f' x \<bullet> i))

goal (1 subgoal):
 1. \<exists>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'
[PROOF STEP]
apply (simp only: C1_differentiable_on_def has_vector_derivative_def *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>i. i \<in> Basis \<Longrightarrow> \<exists>D. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>xa. xa *\<^sub>R D x)) (at x)) \<and> continuous_on s D; (\<forall>i\<in>Basis. \<exists>f'. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f') = (\<exists>f'. \<forall>i\<in>Basis. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x)) \<and> continuous_on s (\<lambda>x. f' x \<bullet> i))\<rbrakk> \<Longrightarrow> \<exists>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'
[PROOF STEP]
using continuous_on_componentwise[of "s"]
[PROOF STATE]
proof (prove)
using this:
continuous_on s ?f = (\<forall>i\<in>Basis. continuous_on s (\<lambda>x. ?f x \<bullet> i))

goal (1 subgoal):
 1. \<lbrakk>\<And>i. i \<in> Basis \<Longrightarrow> \<exists>D. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>xa. xa *\<^sub>R D x)) (at x)) \<and> continuous_on s D; (\<forall>i\<in>Basis. \<exists>f'. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f') = (\<exists>f'. \<forall>i\<in>Basis. (\<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x)) \<and> continuous_on s (\<lambda>x. f' x \<bullet> i))\<rbrakk> \<Longrightarrow> \<exists>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'

goal (1 subgoal):
 1. \<exists>D. (\<forall>x\<in>s. (f has_derivative (\<lambda>xa. xa *\<^sub>R D x)) (at x)) \<and> continuous_on s D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'
[PROOF STEP]
obtain f' where f': "\<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'"
[PROOF STATE]
proof (prove)
using this:
\<exists>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'

goal (1 subgoal):
 1. (\<And>f'. \<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'

goal (1 subgoal):
 1. \<exists>D. (\<forall>x\<in>s. (f has_derivative (\<lambda>xa. xa *\<^sub>R D x)) (at x)) \<and> continuous_on s D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'
[PROOF STEP]
have 0: "(\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f'"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'

goal (1 subgoal):
 1. (\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f'
[PROOF STEP]
using f' has_derivative_componentwise_within[of "f", where S= UNIV]
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'
\<forall>i\<in>Basis. \<forall>x\<in>s. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>z. z *\<^sub>R f' x \<bullet> i)) (at x) \<and> continuous_on s f'
(f has_derivative ?f') (at ?a) = (\<forall>i\<in>Basis. ((\<lambda>x. f x \<bullet> i) has_derivative (\<lambda>x. ?f' x \<bullet> i)) (at ?a))

goal (1 subgoal):
 1. (\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f'

goal (1 subgoal):
 1. \<exists>D. (\<forall>x\<in>s. (f has_derivative (\<lambda>xa. xa *\<^sub>R D x)) (at x)) \<and> continuous_on s D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f'
[PROOF STEP]
show "\<exists>D. (\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R D x)) (at x)) \<and> continuous_on s D"
[PROOF STATE]
proof (prove)
using this:
(\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R f' x)) (at x)) \<and> continuous_on s f'

goal (1 subgoal):
 1. \<exists>D. (\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R D x)) (at x)) \<and> continuous_on s D
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>D. (\<forall>x\<in>s. (f has_derivative (\<lambda>z. z *\<^sub>R D x)) (at x)) \<and> continuous_on s D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_merge_wrt:
  assumes "transp rel" and "\<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x"
    and "sorted_wrt rel xs" and "sorted_wrt rel ys"
  shows "sorted_wrt rel (merge_wrt rel xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
proof (induct rel xs ys rule: merge_wrt.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>uu_ xs. \<lbrakk>transp uu_; \<And>x y. x \<noteq> y \<Longrightarrow> uu_ x y \<or> uu_ y x; sorted_wrt uu_ xs; sorted_wrt uu_ []\<rbrakk> \<Longrightarrow> sorted_wrt uu_ (merge_wrt uu_ xs [])
 2. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 3. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case (1 rel xs)
[PROOF STATE]
proof (state)
this:
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel []

goal (3 subgoals):
 1. \<And>uu_ xs. \<lbrakk>transp uu_; \<And>x y. x \<noteq> y \<Longrightarrow> uu_ x y \<or> uu_ y x; sorted_wrt uu_ xs; sorted_wrt uu_ []\<rbrakk> \<Longrightarrow> sorted_wrt uu_ (merge_wrt uu_ xs [])
 2. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 3. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
from 1(3)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel xs

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel xs [])

goal (2 subgoals):
 1. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 2. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 2. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case (2 rel y ys)
[PROOF STATE]
proof (state)
this:
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel []
sorted_wrt rel (y # ys)

goal (2 subgoals):
 1. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 2. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
from 2(4)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel [] (y # ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel [] (y # ys))

goal (1 subgoal):
 1. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case (3 rel x xs y ys)
[PROOF STATE]
proof (state)
this:
\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys)
\<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys))
\<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys)
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (cases "x = y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
 2. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = y

goal (2 subgoals):
 1. x = y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
 2. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (auto simp add: True)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> set (merge_wrt rel xs ys) \<Longrightarrow> rel y x
 2. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> set (merge_wrt rel xs ys) \<Longrightarrow> rel y x
 2. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
assume "z \<in> set (merge_wrt rel xs ys)"
[PROOF STATE]
proof (state)
this:
z \<in> set (merge_wrt rel xs ys)

goal (2 subgoals):
 1. \<And>x. x \<in> set (merge_wrt rel xs ys) \<Longrightarrow> rel y x
 2. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
hence "z \<in> set xs \<union> set ys"
[PROOF STATE]
proof (prove)
using this:
z \<in> set (merge_wrt rel xs ys)

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys
[PROOF STEP]
by (simp only: set_merge_wrt)
[PROOF STATE]
proof (state)
this:
z \<in> set xs \<union> set ys

goal (2 subgoals):
 1. \<And>x. x \<in> set (merge_wrt rel xs ys) \<Longrightarrow> rel y x
 2. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
thus "rel y z"
[PROOF STATE]
proof (prove)
using this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set xs"
[PROOF STATE]
proof (state)
this:
z \<in> set xs

goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
z \<in> set xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)
z \<in> set xs

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (simp add: True)
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set ys

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
z \<in> set ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)
z \<in> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
rel y z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
note True 3(4, 5)
[PROOF STATE]
proof (state)
this:
x = y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
from 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
[PROOF STEP]
have "sorted_wrt rel xs"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)

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

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sorted_wrt rel xs

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
from 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
[PROOF STEP]
have "sorted_wrt rel ys"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. sorted_wrt rel ys
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel ys
[PROOF STEP]
show "sorted_wrt rel (merge_wrt rel xs ys)"
[PROOF STATE]
proof (prove)
using this:
x = y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
by (rule 3(1))
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel xs ys)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (cases "rel x y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
 2. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
rel x y

goal (2 subgoals):
 1. rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
 2. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (auto simp add: False True)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel xs (y # ys)) \<Longrightarrow> rel x xa
 2. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel xs (y # ys)) \<Longrightarrow> rel x xa
 2. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
assume "z \<in> set (merge_wrt rel xs (y # ys))"
[PROOF STATE]
proof (state)
this:
z \<in> set (merge_wrt rel xs (y # ys))

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel xs (y # ys)) \<Longrightarrow> rel x xa
 2. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
hence "z \<in> insert y (set xs \<union> set ys)"
[PROOF STATE]
proof (prove)
using this:
z \<in> set (merge_wrt rel xs (y # ys))

goal (1 subgoal):
 1. z \<in> insert y (set xs \<union> set ys)
[PROOF STEP]
by (simp add: set_merge_wrt)
[PROOF STATE]
proof (state)
this:
z \<in> insert y (set xs \<union> set ys)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel xs (y # ys)) \<Longrightarrow> rel x xa
 2. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
thus "rel x z"
[PROOF STATE]
proof (prove)
using this:
z \<in> insert y (set xs \<union> set ys)

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z = y \<Longrightarrow> rel x z
 2. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
assume "z = y"
[PROOF STATE]
proof (state)
this:
z = y

goal (2 subgoals):
 1. z = y \<Longrightarrow> rel x z
 2. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
rel x y
z = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rel x y
z = y

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rel x z

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
assume "z \<in> set xs \<union> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel x z
 2. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
assume "z \<in> set xs"
[PROOF STATE]
proof (state)
this:
z \<in> set xs

goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel x z
 2. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
with 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
z \<in> set xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)
z \<in> set xs

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
rel x z

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
assume "z \<in> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set ys

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
with 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
z \<in> set ys
[PROOF STEP]
have "rel y z"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)
z \<in> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
with 3(4) True
[PROOF STATE]
proof (chain)
picking this:
transp rel
rel x y
rel y z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
transp rel
rel x y
rel y z

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
by (rule transpD)
[PROOF STATE]
proof (state)
this:
rel x z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
rel x z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
rel x z

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
note False True 3(4, 5)
[PROOF STATE]
proof (state)
this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
from 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
[PROOF STEP]
have "sorted_wrt rel xs"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)

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

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
[PROOF STEP]
show "sorted_wrt rel (merge_wrt rel xs (y # ys))"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
using 3(7)
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
by (rule 3(2))
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel xs (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
assume "\<not> rel x y"
[PROOF STATE]
proof (state)
this:
\<not> rel x y

goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
from \<open>x \<noteq> y\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
[PROOF STEP]
have "rel x y \<or> rel y x"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y

goal (1 subgoal):
 1. rel x y \<or> rel y x
[PROOF STEP]
by (rule 3(5))
[PROOF STATE]
proof (state)
this:
rel x y \<or> rel y x

goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
with \<open>\<not> rel x y\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> rel x y
rel x y \<or> rel y x
[PROOF STEP]
have *: "rel y x"
[PROOF STATE]
proof (prove)
using this:
\<not> rel x y
rel x y \<or> rel y x

goal (1 subgoal):
 1. rel y x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rel y x

goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (auto simp add: False \<open>\<not> rel x y\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel (x # xs) ys) \<Longrightarrow> rel y xa
 2. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel (x # xs) ys) \<Longrightarrow> rel y xa
 2. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
assume "z \<in> set (merge_wrt rel (x # xs) ys)"
[PROOF STATE]
proof (state)
this:
z \<in> set (merge_wrt rel (x # xs) ys)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel (x # xs) ys) \<Longrightarrow> rel y xa
 2. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
hence "z \<in> insert x (set xs \<union> set ys)"
[PROOF STATE]
proof (prove)
using this:
z \<in> set (merge_wrt rel (x # xs) ys)

goal (1 subgoal):
 1. z \<in> insert x (set xs \<union> set ys)
[PROOF STEP]
by (simp add: set_merge_wrt)
[PROOF STATE]
proof (state)
this:
z \<in> insert x (set xs \<union> set ys)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel (x # xs) ys) \<Longrightarrow> rel y xa
 2. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
thus "rel y z"
[PROOF STATE]
proof (prove)
using this:
z \<in> insert x (set xs \<union> set ys)

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z = x \<Longrightarrow> rel y z
 2. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z = x"
[PROOF STATE]
proof (state)
this:
z = x

goal (2 subgoals):
 1. z = x \<Longrightarrow> rel y z
 2. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
rel y x
z = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rel y x
z = x

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set xs \<union> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set xs"
[PROOF STATE]
proof (state)
this:
z \<in> set xs

goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
z \<in> set xs
[PROOF STEP]
have "rel x z"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)
z \<in> set xs

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
rel x z

goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(4) *
[PROOF STATE]
proof (chain)
picking this:
transp rel
rel y x
rel x z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
transp rel
rel y x
rel x z

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (rule transpD)
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set ys

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
z \<in> set ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)
z \<in> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
rel y z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
rel y z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
note False \<open>\<not> rel x y\<close> 3(4, 5, 6)
[PROOF STATE]
proof (state)
this:
x \<noteq> y
\<not> rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<noteq> y
\<not> rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
from 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
[PROOF STEP]
have "sorted_wrt rel ys"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. sorted_wrt rel ys
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
\<not> rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)
sorted_wrt rel ys
[PROOF STEP]
show "sorted_wrt rel (merge_wrt rel (x # xs) ys)"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
\<not> rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
by (rule 3(3))
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) ys)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed