[STATEMENT]
lemma gcd_coprime:
  assumes c: "gcd a b \<noteq> 0"
    and a: "a = a' * gcd a b"
    and b: "b = b' * gcd a b"
  shows "coprime a' b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a' b'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime a' b'
[PROOF STEP]
from c
[PROOF STATE]
proof (chain)
picking this:
gcd a b \<noteq> (0::'a)
[PROOF STEP]
have "a \<noteq> 0 \<or> b \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
gcd a b \<noteq> (0::'a)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<or> b \<noteq> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a) \<or> b \<noteq> (0::'a)

goal (1 subgoal):
 1. coprime a' b'
[PROOF STEP]
with div_gcd_coprime
[PROOF STATE]
proof (chain)
picking this:
?a \<noteq> (0::'a) \<or> ?b \<noteq> (0::'a) \<Longrightarrow> coprime (?a div gcd ?a ?b) (?b div gcd ?a ?b)
a \<noteq> (0::'a) \<or> b \<noteq> (0::'a)
[PROOF STEP]
have "coprime (a div gcd a b) (b div gcd a b)"
[PROOF STATE]
proof (prove)
using this:
?a \<noteq> (0::'a) \<or> ?b \<noteq> (0::'a) \<Longrightarrow> coprime (?a div gcd ?a ?b) (?b div gcd ?a ?b)
a \<noteq> (0::'a) \<or> b \<noteq> (0::'a)

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

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

goal (1 subgoal):
 1. coprime a' b'
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
gcd a b \<noteq> (0::'a)
a = a' * gcd a b
b = b' * gcd a b
[PROOF STEP]
have "a div gcd a b = a'"
[PROOF STATE]
proof (prove)
using this:
gcd a b \<noteq> (0::'a)
a = a' * gcd a b
b = b' * gcd a b

goal (1 subgoal):
 1. a div gcd a b = a'
[PROOF STEP]
using dvd_div_eq_mult gcd_dvd1
[PROOF STATE]
proof (prove)
using this:
gcd a b \<noteq> (0::'a)
a = a' * gcd a b
b = b' * gcd a b
\<lbrakk>?a \<noteq> (0::'a); ?a dvd ?b\<rbrakk> \<Longrightarrow> (?b div ?a = ?c) = (?b = ?c * ?a)
gcd ?a ?b dvd ?a

goal (1 subgoal):
 1. a div gcd a b = a'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a div gcd a b = a'

goal (1 subgoal):
 1. coprime a' b'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a div gcd a b = a'

goal (1 subgoal):
 1. coprime a' b'
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
gcd a b \<noteq> (0::'a)
a = a' * gcd a b
b = b' * gcd a b
[PROOF STEP]
have "b div gcd a b = b'"
[PROOF STATE]
proof (prove)
using this:
gcd a b \<noteq> (0::'a)
a = a' * gcd a b
b = b' * gcd a b

goal (1 subgoal):
 1. b div gcd a b = b'
[PROOF STEP]
using dvd_div_eq_mult gcd_dvd1
[PROOF STATE]
proof (prove)
using this:
gcd a b \<noteq> (0::'a)
a = a' * gcd a b
b = b' * gcd a b
\<lbrakk>?a \<noteq> (0::'a); ?a dvd ?b\<rbrakk> \<Longrightarrow> (?b div ?a = ?c) = (?b = ?c * ?a)
gcd ?a ?b dvd ?a

goal (1 subgoal):
 1. b div gcd a b = b'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b div gcd a b = b'

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fin_numeral[code_post]: "Fin(numeral w) = numeral w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fin (numeral w) = numeral w
[PROOF STEP]
apply (induct w rule: num_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Fin Numeral1 = Numeral1
 2. \<And>x. Fin (numeral x) = numeral x \<Longrightarrow> Fin (numeral (Num.inc x)) = numeral (Num.inc x)
[PROOF STEP]
apply (simp only: numeral_One one_extended_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. Fin (numeral x) = numeral x \<Longrightarrow> Fin (numeral (Num.inc x)) = numeral (Num.inc x)
[PROOF STEP]
apply (simp only: numeral_inc one_extended_def plus_extended.simps(1)[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma open_contains_box:
  fixes x :: "'a :: euclidean_space"
  assumes "open A" "x \<in> A"
  obtains a b where "box a b \<subseteq> A" "x \<in> box a b" "\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>box a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>box a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
open A
x \<in> A
[PROOF STEP]
obtain a b where "cbox a b \<subseteq> A" "x \<in> box a b" "\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i"
[PROOF STATE]
proof (prove)
using this:
open A
x \<in> A

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>cbox a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule open_contains_cbox)
[PROOF STATE]
proof (state)
this:
cbox a b \<subseteq> A
x \<in> box a b
\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>box a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with that[of a b] box_subset_cbox[of a b]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>box a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis
box a b \<subseteq> cbox a b
cbox a b \<subseteq> A
x \<in> box a b
\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>box a b \<subseteq> A; x \<in> box a b; \<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i\<rbrakk> \<Longrightarrow> thesis
box a b \<subseteq> cbox a b
cbox a b \<subseteq> A
x \<in> box a b
\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalars_zero_if_basis:
  fixes X::"'a::{field}^'n^'n"
  assumes is_basis: "is_basis (set_of_vector X)" and sum: "(\<Sum>i\<in>(UNIV::'n set). f i *s X$i) = 0"
  shows "\<forall>i\<in>(UNIV::'n set). f i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
have ind_X: "vec.independent (set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (set_of_vector X)
[PROOF STEP]
using is_basis
[PROOF STATE]
proof (prove)
using this:
is_basis (set_of_vector X)

goal (1 subgoal):
 1. vec.independent (set_of_vector X)
[PROOF STEP]
unfolding is_basis_def
[PROOF STATE]
proof (prove)
using this:
vec.independent (set_of_vector X) \<and> vec.span (set_of_vector X) = UNIV

goal (1 subgoal):
 1. vec.independent (set_of_vector X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec.independent (set_of_vector X)

goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
have finite_X:"finite (set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set_of_vector X)
[PROOF STEP]
using basis_finite[OF is_basis]
[PROOF STATE]
proof (prove)
using this:
finite (set_of_vector X)

goal (1 subgoal):
 1. finite (set_of_vector X)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite (set_of_vector X)

goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
have 1: "(\<forall>g. (\<Sum>v\<in>(set_of_vector X). g v *s v) = 0 \<longrightarrow> (\<forall>v\<in>(set_of_vector X). g v = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>g. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0 \<longrightarrow> (\<forall>v\<in>set_of_vector X. g v = (0::'a))
[PROOF STEP]
using ind_X
[PROOF STATE]
proof (prove)
using this:
vec.independent (set_of_vector X)

goal (1 subgoal):
 1. \<forall>g. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0 \<longrightarrow> (\<forall>v\<in>set_of_vector X. g v = (0::'a))
[PROOF STEP]
unfolding vec.independent_explicit
[PROOF STATE]
proof (prove)
using this:
finite (set_of_vector X) \<and> (\<forall>c. (\<Sum>v\<in>set_of_vector X. c v *s v) = 0 \<longrightarrow> (\<forall>v\<in>set_of_vector X. c v = (0::'a)))

goal (1 subgoal):
 1. \<forall>g. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0 \<longrightarrow> (\<forall>v\<in>set_of_vector X. g v = (0::'a))
[PROOF STEP]
using finite_X
[PROOF STATE]
proof (prove)
using this:
finite (set_of_vector X) \<and> (\<forall>c. (\<Sum>v\<in>set_of_vector X. c v *s v) = 0 \<longrightarrow> (\<forall>v\<in>set_of_vector X. c v = (0::'a)))
finite (set_of_vector X)

goal (1 subgoal):
 1. \<forall>g. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0 \<longrightarrow> (\<forall>v\<in>set_of_vector X. g v = (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>g. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0 \<longrightarrow> (\<forall>v\<in>set_of_vector X. g v = (0::'a))

goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
define g where "g v = f (THE i. X $ i = v)" for v
[PROOF STATE]
proof (state)
this:
g ?v = f (THE i. X $ i = ?v)

goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
have "(\<Sum>v\<in>(set_of_vector X). g v *s v) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0
[PROOF STEP]
have "(\<Sum>v\<in>(set_of_vector X). g v *s v)  = (\<Sum>i\<in>(UNIV::'n set). f i *s X$i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
have inj: "inj (($) X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (($) X)
[PROOF STEP]
using inj_op_nth[OF is_basis]
[PROOF STATE]
proof (prove)
using this:
inj (($) X)

goal (1 subgoal):
 1. inj (($) X)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
inj (($) X)

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
have rw: "set_of_vector X = range (($) X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of_vector X = range (($) X)
[PROOF STEP]
unfolding set_of_vector_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {X $ i |i. i \<in> UNIV} = range (($) X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_of_vector X = range (($) X)

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
set_of_vector X = range (($) X)

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
have "f a = g (X $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a = g (X $ a)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a = f (THE i. X $ i = X $ a)
[PROOF STEP]
using inj_op_nth[OF is_basis]
[PROOF STATE]
proof (prove)
using this:
inj (($) X)

goal (1 subgoal):
 1. f a = f (THE i. X $ i = X $ a)
[PROOF STEP]
by (metis (lifting, mono_tags) injD the_equality)
[PROOF STATE]
proof (state)
this:
f a = g (X $ a)

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
f ?a2 = g (X $ ?a2)

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f ?a2 = g (X $ ?a2)

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
using sum.reindex[OF inj, of "\<lambda>v. g v *s v"]
[PROOF STATE]
proof (prove)
using this:
f ?a2 = g (X $ ?a2)
(\<Sum>v\<in>range (($) X). g v *s v) = sum ((\<lambda>v. g v *s v) \<circ> ($) X) UNIV

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
unfolding rw o_def
[PROOF STATE]
proof (prove)
using this:
f ?a2 = g (X $ ?a2)
(\<Sum>v\<in>range (($) X). g v *s v) = (\<Sum>x\<in>UNIV. g (X $ x) *s X $ x)

goal (1 subgoal):
 1. (\<Sum>v\<in>range (($) X). g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>set_of_vector X. g v *s v) = (\<Sum>i\<in>UNIV. f i *s X $ i)

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0
[PROOF STEP]
unfolding sum
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>set_of_vector X. g v *s v) = 0

goal (1 subgoal):
 1. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>set_of_vector X. g v *s v) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>set_of_vector X. g v *s v) = 0

goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
hence 2: "\<forall>v\<in>(set_of_vector X). g v = 0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>set_of_vector X. g v *s v) = 0

goal (1 subgoal):
 1. \<forall>v\<in>set_of_vector X. g v = (0::'a)
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>set_of_vector X. g v *s v) = 0
\<forall>g. (\<Sum>v\<in>set_of_vector X. g v *s v) = 0 \<longrightarrow> (\<forall>v\<in>set_of_vector X. g v = (0::'a))

goal (1 subgoal):
 1. \<forall>v\<in>set_of_vector X. g v = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>set_of_vector X. g v = (0::'a)

goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>UNIV. f i = (0::'a)
[PROOF STEP]
proof (clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> f i = (0::'a)
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> f i = (0::'a)
[PROOF STEP]
have "g (X$a) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (X $ a) = (0::'a)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>set_of_vector X. g v = (0::'a)

goal (1 subgoal):
 1. g (X $ a) = (0::'a)
[PROOF STEP]
unfolding set_of_vector_def
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>{X $ i |i. i \<in> UNIV}. g v = (0::'a)

goal (1 subgoal):
 1. g (X $ a) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g (X $ a) = (0::'a)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> f i = (0::'a)
[PROOF STEP]
thus "f a = 0"
[PROOF STATE]
proof (prove)
using this:
g (X $ a) = (0::'a)

goal (1 subgoal):
 1. f a = (0::'a)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
f (THE i. X $ i = X $ a) = (0::'a)

goal (1 subgoal):
 1. f a = (0::'a)
[PROOF STEP]
using inj_op_nth[OF is_basis]
[PROOF STATE]
proof (prove)
using this:
f (THE i. X $ i = X $ a) = (0::'a)
inj (($) X)

goal (1 subgoal):
 1. f a = (0::'a)
[PROOF STEP]
by (metis (lifting, mono_tags) injD the_equality)
[PROOF STATE]
proof (state)
this:
f a = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>UNIV. f i = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coord_partial_eval_hom:
  assumes "as \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "coord_partial_eval R S as \<in> ring_hom (R[\<X>\<^bsub>n\<^esub>]) (R[\<X>\<^bsub>n\<^esub>])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coord_partial_eval R S as \<in> ring_hom (R [\<X>\<^bsub>n\<^esub>]) (R [\<X>\<^bsub>n\<^esub>])
[PROOF STEP]
unfolding coord_partial_eval_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) \<in> ring_hom (R [\<X>\<^bsub>n\<^esub>]) (R [\<X>\<^bsub>n\<^esub>])
[PROOF STEP]
using point_to_eval_map_closed[of as n] assms
        R.poly_eval_ring_hom[of "{..<n}" "{..<n}" "point_to_eval_map R as" S]
[PROOF STATE]
proof (prove)
using this:
as \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> (\<lambda>i. if i < length as then as ! i else \<zero>) \<in> UNIV \<rightarrow> carrier R
as \<in> carrier (R\<^bsup>n\<^esup>)
\<lbrakk>{..<n} \<subseteq> {..<n}; (\<lambda>i. if i < length as then as ! i else \<zero>) \<in> UNIV \<rightarrow> carrier R; {..<n} - S \<subseteq> {..<n}\<rbrakk> \<Longrightarrow> ring_hom_ring (Pring R {..<n}) (Pring R {..<n}) (poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>))

goal (1 subgoal):
 1. poly_eval R S (\<lambda>i. if i < length as then as ! i else \<zero>) \<in> ring_hom (R [\<X>\<^bsub>n\<^esub>]) (R [\<X>\<^bsub>n\<^esub>])
[PROOF STEP]
by (metis (mono_tags, lifting) Diff_subset coord_ring_def order_refl ring_hom_ring.homh)


[STATEMENT]
lemma remdups_adj_rev[simp]: "remdups_adj (rev xs) = rev (remdups_adj xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. remdups_adj (rev xs) = rev (remdups_adj xs)
[PROOF STEP]
by (induct xs rule: remdups_adj.induct, simp_all add: remdups_adj_append_two)


[STATEMENT]
lemma islimpt_Un: "x islimpt (S \<union> T) \<longleftrightarrow> x islimpt S \<or> x islimpt T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x islimpt S \<union> T = (x islimpt S \<or> x islimpt T)
[PROOF STEP]
by (simp add: islimpt_iff_eventually eventually_conj_iff)


[STATEMENT]
lemma continuous_polymonial_function:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space"
  assumes "polynomial_function f"
    shows "continuous (at x) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f x
[PROOF STEP]
proof (rule euclidean_isCont)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> isCont (\<lambda>x. (f x \<bullet> b) *\<^sub>R b) x
[PROOF STEP]
show "\<And>b. b \<in> Basis \<Longrightarrow> isCont (\<lambda>x. (f x \<bullet> b) *\<^sub>R b) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> isCont (\<lambda>x. (f x \<bullet> b) *\<^sub>R b) x
[PROOF STEP]
using assms continuous_real_polymonial_function
[PROOF STATE]
proof (prove)
using this:
polynomial_function f
real_polynomial_function ?f \<Longrightarrow> isCont ?f ?x

goal (1 subgoal):
 1. \<And>b. b \<in> Basis \<Longrightarrow> isCont (\<lambda>x. (f x \<bullet> b) *\<^sub>R b) x
[PROOF STEP]
by (force simp: polynomial_function_iff_Basis_inner intro: isCont_scaleR)
[PROOF STATE]
proof (state)
this:
?b \<in> Basis \<Longrightarrow> isCont (\<lambda>x. (f x \<bullet> ?b) *\<^sub>R ?b) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stutter_freeI:
  assumes "\<And>k n. \<lbrakk>\<sigma> (Suc k) = \<sigma> k; n>k\<rbrakk> \<Longrightarrow> \<sigma> n = \<sigma> k"
  shows "stutter_free \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stutter_free \<sigma>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<sigma> (Suc ?k) = \<sigma> ?k; ?k < ?n\<rbrakk> \<Longrightarrow> \<sigma> ?n = \<sigma> ?k

goal (1 subgoal):
 1. stutter_free \<sigma>
[PROOF STEP]
unfolding stutter_free_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<sigma> (Suc ?k) = \<sigma> ?k; ?k < ?n\<rbrakk> \<Longrightarrow> \<sigma> ?n = \<sigma> ?k

goal (1 subgoal):
 1. \<forall>k. \<sigma> (Suc k) = \<sigma> k \<longrightarrow> (\<forall>n>k. \<sigma> n = \<sigma> k)
[PROOF STEP]
by blast


[STATEMENT]
theorem maximalAllocationBridgingTheorem:
  assumes "finite N" "distinct \<Omega>"
  shows "maximalStrictAllocations N (set \<Omega>) b = maximalStrictAllocationsAlg N \<Omega> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. maximalStrictAllocations N (set \<Omega>) b = maximalStrictAllocationsAlg N \<Omega> b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. maximalStrictAllocations N (set \<Omega>) b = maximalStrictAllocationsAlg N \<Omega> b
[PROOF STEP]
let ?N = "{seller} \<union> N"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. maximalStrictAllocations N (set \<Omega>) b = maximalStrictAllocationsAlg N \<Omega> b
[PROOF STEP]
have "card ?N>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < card ({seller} \<union> N)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
finite N

goal (1 subgoal):
 1. 0 < card ({seller} \<union> N)
[PROOF STEP]
by (metis (full_types) card_gt_0_iff finite_insert insert_is_Un insert_not_empty)
[PROOF STATE]
proof (state)
this:
0 < card ({seller} \<union> N)

goal (1 subgoal):
 1. maximalStrictAllocations N (set \<Omega>) b = maximalStrictAllocationsAlg N \<Omega> b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < card ({seller} \<union> N)

goal (1 subgoal):
 1. maximalStrictAllocations N (set \<Omega>) b = maximalStrictAllocationsAlg N \<Omega> b
[PROOF STEP]
using assms(2) allAllocationsBridgingLemma
[PROOF STATE]
proof (prove)
using this:
0 < card ({seller} \<union> N)
distinct \<Omega>
\<lbrakk>0 < card ?N; distinct ?G\<rbrakk> \<Longrightarrow> allAllocations ?N (set ?G) = set (allAllocationsAlg ?N ?G)

goal (1 subgoal):
 1. maximalStrictAllocations N (set \<Omega>) b = maximalStrictAllocationsAlg N \<Omega> b
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
maximalStrictAllocations N (set \<Omega>) b = maximalStrictAllocationsAlg N \<Omega> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fold_mset_insort[simp]: "fold (\<lambda>x M. M + mset (f x)) (insort x xs) M =
  fold (\<lambda>x M. M + mset (f x)) xs (mset (f x) + M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>x M. M + mset (f x)) (insort x xs) M = fold (\<lambda>x M. M + mset (f x)) xs (mset (f x) + M)
[PROOF STEP]
by (induct xs arbitrary: M) (auto simp: ac_simps)


[STATEMENT]
lemma between_cong:
  assumes "Bet A C B" and
    "Cong A C A B"
  shows "C = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C = B
[PROOF STEP]
by (smt assms(1) assms(2) between_trivial cong_inner_transitivity five_segment l4_19 l4_3_1)


[STATEMENT]
lemma sets_empty_iffI[intro 0]:
    assumes "\<And> a. a \<in> A \<Longrightarrow> \<exists> b. b \<in> B"
    assumes "\<And> b. b \<in> B \<Longrightarrow> \<exists> a. a \<in> A"
    shows "A = {} \<longleftrightarrow> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = {}) = (B = {})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?a \<in> A \<Longrightarrow> \<exists>b. b \<in> B
?b \<in> B \<Longrightarrow> \<exists>a. a \<in> A

goal (1 subgoal):
 1. (A = {}) = (B = {})
[PROOF STEP]
by auto


[STATEMENT]
lemma Cauchy_Schwarz_ineq:
  "real_of (cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
define cnj_a where "cnj_a = - cnj (inner x y)/ (inner y y)"
[PROOF STATE]
proof (state)
this:
cnj_a = - cnj_class.cnj (inner x y) / inner y y

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
define a where "a = cnj (cnj_a)"
[PROOF STATE]
proof (state)
this:
a = cnj_class.cnj cnj_a

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have cnj_rw: "(cnj a) = cnj_a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj_class.cnj a = cnj_a
[PROOF STEP]
unfolding a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj_class.cnj (cnj_class.cnj cnj_a) = cnj_a
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
cnj_class.cnj a = cnj_a

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have rw_0: "(cnj (inner x y)) + (cnj a) * (inner y y) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y = (0::'a)
[PROOF STEP]
unfolding cnj_rw cnj_a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj_class.cnj (inner x y) + - cnj_class.cnj (inner x y) / inner y y * inner y y = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y = (0::'a)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have "0 \<le> real_of (inner x x + (cnj a) * (inner x y) + a * ((cnj (inner x y)) + (cnj a) * (inner y y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of (inner x x + cnj_class.cnj a * inner x y + a * (cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y))
[PROOF STEP]
using aux_Cauchy
[PROOF STATE]
proof (prove)
using this:
0 \<le> real_of (inner ?x ?x + cnj_class.cnj ?a * inner ?x ?y + ?a * (cnj_class.cnj (inner ?x ?y) + cnj_class.cnj ?a * inner ?y ?y))

goal (1 subgoal):
 1. 0 \<le> real_of (inner x x + cnj_class.cnj a * inner x y + a * (cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> real_of (inner x x + cnj_class.cnj a * inner x y + a * (cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y))

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 \<le> real_of (inner x x + cnj_class.cnj a * inner x y + a * (cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y))

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have "... = real_of (inner x x + (cnj a) * (inner x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner x x + cnj_class.cnj a * inner x y + a * (cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y)) = real_of (inner x x + cnj_class.cnj a * inner x y)
[PROOF STEP]
unfolding rw_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner x x + cnj_class.cnj a * inner x y + a * (0::'a)) = real_of (inner x x + cnj_class.cnj a * inner x y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of (inner x x + cnj_class.cnj a * inner x y + a * (cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y)) = real_of (inner x x + cnj_class.cnj a * inner x y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of (inner x x + cnj_class.cnj a * inner x y + a * (cnj_class.cnj (inner x y) + cnj_class.cnj a * inner y y)) = real_of (inner x x + cnj_class.cnj a * inner x y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have "... = real_of (inner x x - cnj (inner x y) * inner x y / inner y y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner x x + cnj_class.cnj a * inner x y) = real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)
[PROOF STEP]
unfolding cnj_rw cnj_a_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner x x + - cnj_class.cnj (inner x y) / inner y y * inner x y) = real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of (inner x x + cnj_class.cnj a * inner x y) = real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<le> real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)
[PROOF STEP]
have " 0 \<le> real_of (inner x x - cnj (inner x y) * inner x y / inner y y) "
[PROOF STATE]
proof (prove)
using this:
0 \<le> real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)

goal (1 subgoal):
 1. 0 \<le> real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
0 \<le> real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
hence "0 \<le> real_of (inner y y)  * real_of (inner x x - cnj (inner x y) * inner x y / inner y y)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)

goal (1 subgoal):
 1. 0 \<le> real_of (inner y y) * real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> real_of (inner y y) * real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 \<le> real_of (inner y y) * real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have "... = real_of (real_of (inner y y)*\<^sub>R(inner x x - cnj (inner x y) * inner x y / inner y y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner y y) * real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) = real_of (real_of (inner y y) *\<^sub>R (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y))
[PROOF STEP]
unfolding real_scalar_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner y y) * real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) = real_of (inner y y) * real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
real_of (inner y y) * real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) = real_of (real_of (inner y y) *\<^sub>R (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y))

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of (inner y y) * real_of (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) = real_of (real_of (inner y y) *\<^sub>R (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y))

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have "... = real_of ((inner y y) * (inner x x - cnj (inner x y) * inner x y / inner y y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (real_of (inner y y) *\<^sub>R (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)) = real_of (inner y y * (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y))
[PROOF STEP]
unfolding real_scalar_mult2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner y y * (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)) = real_of (inner y y * (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
real_of (real_of (inner y y) *\<^sub>R (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)) = real_of (inner y y * (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y))

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of (real_of (inner y y) *\<^sub>R (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)) = real_of (inner y y * (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y))

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have "... = real_of ((inner x x - cnj (inner x y) * inner x y / inner y y)*(inner y y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner y y * (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)) = real_of ((inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) * inner y y)
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
real_of (inner y y * (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)) = real_of ((inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) * inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of (inner y y * (inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y)) = real_of ((inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) * inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have "... = real_of (((inner x x)*(inner y y) - cnj (inner x y) * inner x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of ((inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) * inner y y) = real_of (inner x x * inner y y - cnj_class.cnj (inner x y) * inner x y)
[PROOF STEP]
by (simp add: left_diff_distrib)
[PROOF STATE]
proof (state)
this:
real_of ((inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) * inner y y) = real_of (inner x x * inner y y - cnj_class.cnj (inner x y) * inner x y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of ((inner x x - cnj_class.cnj (inner x y) * inner x y / inner y y) * inner y y) = real_of (inner x x * inner y y - cnj_class.cnj (inner x y) * inner x y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
have "... = real_of ((inner x x)*(inner y y)) - real_of (cnj (inner x y) * inner x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner x x * inner y y - cnj_class.cnj (inner x y) * inner x y) = real_of (inner x x * inner y y) - real_of (cnj_class.cnj (inner x y) * inner x y)
[PROOF STEP]
unfolding real_minus
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (inner x x * inner y y) - real_of (cnj_class.cnj (inner x y) * inner x y) = real_of (inner x x * inner y y) - real_of (cnj_class.cnj (inner x y) * inner x y)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
real_of (inner x x * inner y y - cnj_class.cnj (inner x y) * inner x y) = real_of (inner x x * inner y y) - real_of (cnj_class.cnj (inner x y) * inner x y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<le> real_of (inner x x * inner y y) - real_of (cnj_class.cnj (inner x y) * inner x y)
[PROOF STEP]
have "real_of (cnj (inner x y) * inner x y) \<le> real_of ((inner x x)*(inner y y))"
[PROOF STATE]
proof (prove)
using this:
0 \<le> real_of (inner x x * inner y y) - real_of (cnj_class.cnj (inner x y) * inner x y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x * inner y y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x * inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x * inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
unfolding real_inner_inner
[PROOF STATE]
proof (prove)
using this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_mod_left [simp]:
  "[b mod a = c] (mod a) \<longleftrightarrow> [b = c] (mod a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [b mod a = c] (mod a) = [b = c] (mod a)
[PROOF STEP]
by (simp add: cong_def)


[STATEMENT]
lemma Im_mult_real:
  assumes "is_real a"
  shows "Im (a * b) = (Re a) * (Im b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (a * b) = Re a * Im b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_real a

goal (1 subgoal):
 1. Im (a * b) = Re a * Im b
[PROOF STEP]
by simp


[STATEMENT]
lemma compact_translation_subtract:
  "compact ((\<lambda>x. x - a) ` s)" if "compact s" for s :: "'a::real_normed_vector set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact ((\<lambda>x. x - a) ` s)
[PROOF STEP]
using that compact_translation [of s "- a"]
[PROOF STATE]
proof (prove)
using this:
compact s
compact s \<Longrightarrow> compact ((+) (- a) ` s)

goal (1 subgoal):
 1. compact ((\<lambda>x. x - a) ` s)
[PROOF STEP]
by (simp cong: image_cong_simp)


[STATEMENT]
lemma K2_centre_non_zero: "vector [0,0,1] \<noteq> (0 :: real^3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector [0, 0, 1] \<noteq> 0
[PROOF STEP]
by (unfold vector_def) (simp add: vec_eq_iff forall_3)


[STATEMENT]
lemma G_simp:
    assumes "C.arr f"
    shows "G f = terminal_arrow_from_functor.the_coext D C F (Go (C.cod f)) (\<epsilon>o (C.cod f))
                                                             (Go (C.dom f)) (f \<cdot>\<^sub>C \<epsilon>o (C.dom f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G f = terminal_arrow_from_functor.the_coext (\<cdot>\<^sub>D) (\<cdot>\<^sub>C) F (Go (C.cod f)) (\<epsilon>o (C.cod f)) (Go (C.dom f)) (f \<cdot>\<^sub>C \<epsilon>o (C.dom f))
[PROOF STEP]
using assms G_def
[PROOF STATE]
proof (prove)
using this:
C.arr f
G ?f = (if C.arr ?f then terminal_arrow_from_functor.the_coext (\<cdot>\<^sub>D) (\<cdot>\<^sub>C) F (Go (C.cod ?f)) (\<epsilon>o (C.cod ?f)) (Go (C.dom ?f)) (?f \<cdot>\<^sub>C \<epsilon>o (C.dom ?f)) else D.null)

goal (1 subgoal):
 1. G f = terminal_arrow_from_functor.the_coext (\<cdot>\<^sub>D) (\<cdot>\<^sub>C) F (Go (C.cod f)) (\<epsilon>o (C.cod f)) (Go (C.dom f)) (f \<cdot>\<^sub>C \<epsilon>o (C.dom f))
[PROOF STEP]
by simp


[STATEMENT]
lemma (in Order) ord_isom_le:"\<lbrakk>Order E; ord_isom D E f;
      a \<in> carrier D; b \<in> carrier D\<rbrakk> \<Longrightarrow> (a \<preceq>\<^bsub>D\<^esub> b) = ((f a) \<preceq>\<^bsub>E\<^esub> (f b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Order E; ord_isom D E f; a \<in> carrier D; b \<in> carrier D\<rbrakk> \<Longrightarrow> a \<preceq> b = f a \<preceq>\<^bsub>E\<^esub> f b
[PROOF STEP]
apply (frule_tac a = a in ord_isom_mem[of "E" "f"], assumption+,
       frule_tac a = b in ord_isom_mem[of "E" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Order E; ord_isom D E f; a \<in> carrier D; b \<in> carrier D; f a \<in> carrier E; f b \<in> carrier E\<rbrakk> \<Longrightarrow> a \<preceq> b = f a \<preceq>\<^bsub>E\<^esub> f b
[PROOF STEP]
apply (simp add:le_imp_less_or_eq Order.le_imp_less_or_eq[of "E"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Order E; ord_isom D E f; a \<in> carrier D; b \<in> carrier D; f a \<in> carrier E; f b \<in> carrier E\<rbrakk> \<Longrightarrow> (a \<prec> b \<or> a = b) = (f a \<prec>\<^bsub>E\<^esub> f b \<or> f a = f b)
[PROOF STEP]
apply (simp add:ord_isom_less ord_isom_inj)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma transpose_mult[simp]:
  "transpose (A * B :: 'a::comm_semiring_0^^'n) = transpose B * transpose A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.transpose (A * B) = Square_Matrix.transpose B * Square_Matrix.transpose A
[PROOF STEP]
by transfer (simp add: field_simps)


[STATEMENT]
lemma lm008:
  assumes "n\<in>N"
  shows "{(G,n)} \<in> injections {G} N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(G, n)} \<in> injections {G} N
[PROOF STEP]
using assms injections_def singlePairInInjectionsUniverse
[PROOF STATE]
proof (prove)
using this:
n \<in> N
injections ?X ?Y = {R. Domain R = ?X \<and> Range R \<subseteq> ?Y \<and> runiq R \<and> runiq (R\<inverse>)}
{(?x, ?X)} \<in> injectionsUniverse

goal (1 subgoal):
 1. {(G, n)} \<in> injections {G} N
[PROOF STEP]
by fastforce


[STATEMENT]
lemma total_pseudo_ordered_set_cong:
  assumes r: "\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> r a b \<longleftrightarrow> r' a b"
  shows "total_pseudo_ordered_set A r \<longleftrightarrow> total_pseudo_ordered_set A r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. total_pseudo_ordered_set A r = total_pseudo_ordered_set A r'
[PROOF STEP]
by (simp add: total_pseudo_ordered_set_def r cong: connex_cong antisymmetric_cong)


[STATEMENT]
lemma isNSCont_LIM_iff: "(isNSCont f a) = (f \<midarrow>a\<rightarrow> (f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isNSCont f a = f \<midarrow>a\<rightarrow> f a
[PROOF STEP]
by (simp add: LIM_NSLIM_iff isNSCont_NSLIM_iff)


[STATEMENT]
lemma enc_atom_dec:
  "\<lbrakk>\<forall>p. length (snd (s !! p)) = n; \<forall>i \<in> FO. i < n \<longrightarrow> (\<exists>!p. snd (s !! p) ! i); a = fst (s !! p)\<rbrakk> \<Longrightarrow>
   enc_atom (stream_dec n FO s) p a = s !! p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p. length (snd (s !! p)) = n; \<forall>i\<in>FO. i < n \<longrightarrow> (\<exists>!p. snd (s !! p) ! i); a = fst (s !! p)\<rbrakk> \<Longrightarrow> enc_atom (stream_dec n FO s) p a = s !! p
[PROOF STEP]
unfolding stream_dec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p. length (snd (s !! p)) = n; \<forall>i\<in>FO. i < n \<longrightarrow> (\<exists>!p. snd (s !! p) ! i); a = fst (s !! p)\<rbrakk> \<Longrightarrow> enc_atom (map (\<lambda>i. if i \<in> FO then Inl (the_elem (positions_in_row s i)) else Inr (positions_in_row s i)) [0..<n]) p a = s !! p
[PROOF STEP]
by (rule sym, subst surjective_pairing[of "s !! p"])
    (auto intro!: nth_equalityI simp: positions_in_row simp del: prod.collapse split: if_split_asm,
    (metis positions_in_row positions_in_row_nth)+)


[STATEMENT]
lemma positively_invariant_conj:
  assumes "positively_invariant C"
  assumes "positively_invariant D"
  shows "positively_invariant (C \<inter> D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positively_invariant (C \<inter> D)
[PROOF STEP]
using assms positively_invariant_def
[PROOF STATE]
proof (prove)
using this:
positively_invariant C
positively_invariant D
positively_invariant ?M = (\<forall>x\<in>?M. trapped_forward x ?M)

goal (1 subgoal):
 1. positively_invariant (C \<inter> D)
[PROOF STEP]
using positively_invariant_left_inter
[PROOF STATE]
proof (prove)
using this:
positively_invariant C
positively_invariant D
positively_invariant ?M = (\<forall>x\<in>?M. trapped_forward x ?M)
\<lbrakk>positively_invariant ?C; \<forall>x\<in>?C \<inter> ?D. trapped_forward x ?D\<rbrakk> \<Longrightarrow> positively_invariant (?C \<inter> ?D)

goal (1 subgoal):
 1. positively_invariant (C \<inter> D)
[PROOF STEP]
by auto


[STATEMENT]
lemma gcd_0_int [simp]: "gcd x 0 = \<bar>x\<bar>"
  for x :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd x 0 = \<bar>x\<bar>
[PROOF STEP]
by (auto simp: gcd_int_def)


[STATEMENT]
lemma Suc_neq:"\<lbrakk>0 < i; i - Suc 0 < l\<rbrakk> \<Longrightarrow> i \<noteq> Suc l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < i; i - Suc 0 < l\<rbrakk> \<Longrightarrow> i \<noteq> Suc l
[PROOF STEP]
by (rule contrapos_pp, simp+)


[STATEMENT]
lemma drop_bv_prepend_help2: "\<lbrakk>x < y\<rbrakk> \<Longrightarrow> drop x (bv_prepend y b []) = bv_prepend (y-x) b []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < y \<Longrightarrow> drop x (bv_prepend y b []) = bv_prepend (y - x) b []
[PROOF STEP]
apply (insert bv_prepend_append2 [of "x" "y" b "[]"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < y; x < y \<Longrightarrow> bv_prepend y b [] = bv_prepend x b [] @ bv_prepend (y - x) b [] @ []\<rbrakk> \<Longrightarrow> drop x (bv_prepend y b []) = bv_prepend (y - x) b []
[PROOF STEP]
by (simp add: length_bv_prepend)


[STATEMENT]
lemma hcomplex_HFinite_iff:
  "(x \<in> HFinite) = (hRe x \<in> HFinite \<and> hIm x \<in> HFinite)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> HFinite) = (hRe x \<in> HFinite \<and> hIm x \<in> HFinite)
[PROOF STEP]
using HFinite_HComplex HFinite_hIm HFinite_hRe
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> HFinite; ?y \<in> HFinite\<rbrakk> \<Longrightarrow> HComplex ?x ?y \<in> HFinite
?x \<in> HFinite \<Longrightarrow> hIm ?x \<in> HFinite
?x \<in> HFinite \<Longrightarrow> hRe ?x \<in> HFinite

goal (1 subgoal):
 1. (x \<in> HFinite) = (hRe x \<in> HFinite \<and> hIm x \<in> HFinite)
[PROOF STEP]
by fastforce


[STATEMENT]
theorem reduce: "valid p \<longleftrightarrow> valid_in {1..card (props p)} p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid p = valid_in {1..card (props p)} p
[PROOF STEP]
using valid_in_valid transfer
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>card (props ?p) \<le> card ?U; valid_in ?U ?p\<rbrakk> \<Longrightarrow> valid ?p
\<not> valid_in ?U ?p \<Longrightarrow> \<not> valid ?p

goal (1 subgoal):
 1. valid p = valid_in {1..card (props p)} p
[PROOF STEP]
by force


[STATEMENT]
lemma finite_dom_ran [simp]: "finite (dom f) \<Longrightarrow> finite (ran f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (dom f) \<Longrightarrow> finite (ran f)
[PROOF STEP]
by (metis finite_Range finite_dom_graph ran_map_graph)


[STATEMENT]
lemma mset_map_split_orig: "!!M1 M2. \<lbrakk>f `# P = M1+M2; !!P1 P2. \<lbrakk>P=P1+P2; f `# P1 = M1; f `# P2 = M2\<rbrakk> \<Longrightarrow> Q \<rbrakk> \<Longrightarrow> Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>M1 M2. \<lbrakk>f `# P = M1 + M2; \<And>P1 P2. \<lbrakk>P = P1 + P2; f `# P1 = M1; f `# P2 = M2\<rbrakk> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q
[PROOF STEP]
by (induct P) (force elim!: mset_un_single_un_cases)+


[STATEMENT]
lemma sexp_rec_Scons: "[| M \<in> sexp;  N \<in> sexp |] ==>
     sexp_rec (Scons M N) c d h = h M N (sexp_rec M c d h) (sexp_rec N c d h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M \<in> sexp; N \<in> sexp\<rbrakk> \<Longrightarrow> sexp_rec (Scons M N) c d h = h M N (sexp_rec M c d h) (sexp_rec N c d h)
[PROOF STEP]
apply (rule sexp_rec_unfold [THEN trans])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>M \<in> sexp; N \<in> sexp\<rbrakk> \<Longrightarrow> sexp_case c d (\<lambda>N1 N2. h N1 N2 (cut (\<lambda>M. sexp_rec M c d h) pred_sexp (Scons M N) N1) (cut (\<lambda>M. sexp_rec M c d h) pred_sexp (Scons M N) N2)) (Scons M N) = h M N (sexp_rec M c d h) (sexp_rec N c d h)
[PROOF STEP]
apply (simp add: pred_sexpI1 pred_sexpI2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma perm_power_inverse:
  "inverse f ^ n = inverse ((f :: 'a perm) ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse f ^ n = inverse (f ^ n)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inverse f ^ 0 = inverse (f ^ 0)
 2. \<And>n. inverse f ^ n = inverse (f ^ n) \<Longrightarrow> inverse f ^ Suc n = inverse (f ^ Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. inverse f ^ 0 = inverse (f ^ 0)
 2. \<And>n. inverse f ^ n = inverse (f ^ n) \<Longrightarrow> inverse f ^ Suc n = inverse (f ^ Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse f ^ 0 = inverse (f ^ 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse f ^ 0 = inverse (f ^ 0)

goal (1 subgoal):
 1. \<And>n. inverse f ^ n = inverse (f ^ n) \<Longrightarrow> inverse f ^ Suc n = inverse (f ^ Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. inverse f ^ n = inverse (f ^ n) \<Longrightarrow> inverse f ^ Suc n = inverse (f ^ Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
inverse f ^ n = inverse (f ^ n)

goal (1 subgoal):
 1. \<And>n. inverse f ^ n = inverse (f ^ n) \<Longrightarrow> inverse f ^ Suc n = inverse (f ^ Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inverse f ^ n = inverse (f ^ n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
inverse f ^ n = inverse (f ^ n)

goal (1 subgoal):
 1. inverse f ^ Suc n = inverse (f ^ Suc n)
[PROOF STEP]
unfolding power_Suc2 [of f]
[PROOF STATE]
proof (prove)
using this:
inverse f ^ n = inverse (f ^ n)

goal (1 subgoal):
 1. inverse f ^ Suc n = inverse (f ^ n * f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse f ^ Suc n = inverse (f ^ Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arith1:
  assumes h1:"Suc n * t = Suc n * q"
  shows "t = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t = q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Suc n * t = Suc n * q

goal (1 subgoal):
 1. t = q
[PROOF STEP]
by (metis mult_cancel2 mult.commute neq0_conv zero_less_Suc)


[STATEMENT]
lemma homeomorphic_maps_involution:
   "\<lbrakk>continuous_map X X f; \<And>x. x \<in> topspace X \<Longrightarrow> f(f x) = x\<rbrakk> \<Longrightarrow> homeomorphic_maps X X f f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_map X X f; \<And>x. x \<in> topspace X \<Longrightarrow> f (f x) = x\<rbrakk> \<Longrightarrow> homeomorphic_maps X X f f
[PROOF STEP]
by (auto simp: homeomorphic_maps_def)


[STATEMENT]
lemma nat_cut_le_finite: "finite (I \<down>\<le> (t::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (I \<down>\<le> t)
[PROOF STEP]
by (fastforce simp: finite_nat_iff_bounded_le2 cut_le_def)


[STATEMENT]
lemma eq_on_xfer_ran_sorted: "\<lbrakk> a=a' on r'; {l..<h} \<subseteq> r' \<rbrakk> \<Longrightarrow> ran_sorted a l h \<longleftrightarrow> ran_sorted a' l h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a = a' on r'; {l..<h} \<subseteq> r'\<rbrakk> \<Longrightarrow> ran_sorted a l h = ran_sorted a' l h
[PROOF STEP]
unfolding ran_sorted_alt eq_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>r'. a x = a' x; {l..<h} \<subseteq> r'\<rbrakk> \<Longrightarrow> (\<forall>i j. l \<le> i \<and> i < j \<and> j < h \<longrightarrow> a i \<le> a j) = (\<forall>i j. l \<le> i \<and> i < j \<and> j < h \<longrightarrow> a' i \<le> a' j)
[PROOF STEP]
by (auto simp: subset_iff)


[STATEMENT]
lemma absolutely_integrable_linear:
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
    and h :: "'n::euclidean_space \<Rightarrow> 'p::euclidean_space"
  shows "f absolutely_integrable_on s \<Longrightarrow> bounded_linear h \<Longrightarrow> (h \<circ> f) absolutely_integrable_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f absolutely_integrable_on s; bounded_linear h\<rbrakk> \<Longrightarrow> h \<circ> f absolutely_integrable_on s
[PROOF STEP]
using integrable_bounded_linear[of h lebesgue "\<lambda>x. indicator s x *\<^sub>R f x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bounded_linear h; integrable lebesgue (\<lambda>x. indicat_real s x *\<^sub>R f x)\<rbrakk> \<Longrightarrow> integrable lebesgue (\<lambda>x. h (indicat_real s x *\<^sub>R f x))

goal (1 subgoal):
 1. \<lbrakk>f absolutely_integrable_on s; bounded_linear h\<rbrakk> \<Longrightarrow> h \<circ> f absolutely_integrable_on s
[PROOF STEP]
by (simp add: linear_simps[of h] set_integrable_def)


[STATEMENT]
lemma safe_regex_map_regex:
  "(\<And>g x. x \<in> atms r \<Longrightarrow> safe g x \<Longrightarrow>  safe g (f x)) \<Longrightarrow> (\<And>x. x \<in> atms r \<Longrightarrow> fv (f x) = fv x) \<Longrightarrow>
   safe_regex m g r \<Longrightarrow> safe_regex m g (map_regex f r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>g x. \<lbrakk>x \<in> atms r; safe g x\<rbrakk> \<Longrightarrow> safe g (f x); \<And>x. x \<in> atms r \<Longrightarrow> fv (f x) = fv x; safe_regex m g r\<rbrakk> \<Longrightarrow> safe_regex m g (map_regex f r)
[PROOF STEP]
by (induct m g r rule: safe_regex.induct) (auto simp: fv_regex_alt regex.set_map)


[STATEMENT]
lemma llexord_coinduct [consumes 1, case_names llexord, coinduct pred: llexord]:
  assumes X: "X xs ys"
  and step: "\<And>xs ys. \<lbrakk> X xs ys; \<not> lnull xs \<rbrakk>
    \<Longrightarrow> \<not> lnull ys \<and>
       (\<not> lnull ys \<longrightarrow> r (lhd xs) (lhd ys) \<or>
                     lhd xs = lhd ys \<and> (X (ltl xs) (ltl ys) \<or> llexord r (ltl xs) (ltl ys)))"
  shows "llexord r xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llexord r xs ys
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
X xs ys

goal (1 subgoal):
 1. llexord r xs ys
[PROOF STEP]
proof(coinduct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2. X x1 x2 \<Longrightarrow> (\<exists>xs ys x. x1 = LCons x xs \<and> x2 = LCons x ys \<and> (X xs ys \<or> llexord r xs ys)) \<or> (\<exists>x y xs ys. x1 = LCons x xs \<and> x2 = LCons y ys \<and> r x y) \<or> (\<exists>ys. x1 = LNil \<and> x2 = ys)
[PROOF STEP]
case (llexord xs ys)
[PROOF STATE]
proof (state)
this:
X xs ys

goal (1 subgoal):
 1. \<And>x1 x2. X x1 x2 \<Longrightarrow> (\<exists>xs ys x. x1 = LCons x xs \<and> x2 = LCons x ys \<and> (X xs ys \<or> llexord r xs ys)) \<or> (\<exists>x y xs ys. x1 = LCons x xs \<and> x2 = LCons y ys \<and> r x y) \<or> (\<exists>ys. x1 = LNil \<and> x2 = ys)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
X xs ys

goal (1 subgoal):
 1. (\<exists>xs ys x. xs = LCons x xs \<and> ys = LCons x ys \<and> (X xs ys \<or> llexord r xs ys)) \<or> (\<exists>x y xs ys. xs = LCons x xs \<and> ys = LCons y ys \<and> r x y) \<or> (\<exists>ys. xs = LNil \<and> ys = ys)
[PROOF STEP]
by(cases xs ys rule: llist.exhaust[case_product llist.exhaust])(auto dest: step)
[PROOF STATE]
proof (state)
this:
(\<exists>xs ys x. xs = LCons x xs \<and> ys = LCons x ys \<and> (X xs ys \<or> llexord r xs ys)) \<or> (\<exists>x y xs ys. xs = LCons x xs \<and> ys = LCons y ys \<and> r x y) \<or> (\<exists>ys. xs = LNil \<and> ys = ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_wf_nfa:
  shows "wf_dfa (det_nfa A) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
obtain bt ls where BT: "subset_dfs A (nfa_startnode A) = (bt, ls)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>bt ls. subset_dfs A (nfa_startnode A) = (bt, ls) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "subset_dfs A (nfa_startnode A)") auto
[PROOF STATE]
proof (state)
this:
subset_dfs A (nfa_startnode A) = (bt, ls)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
note Q = nfa_startnode_is_node[OF well_formed]
[PROOF STATE]
proof (state)
this:
nfa_is_node A (nfa_startnode A)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
from Q
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node A (nfa_startnode A)
[PROOF STEP]
have N:"list_all (nfa_is_node A) (snd (subset_dfs A (nfa_startnode A)))"
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A (nfa_startnode A)

goal (1 subgoal):
 1. list_all (nfa_is_node A) (snd (subset_dfs A (nfa_startnode A)))
[PROOF STEP]
by (simp add: subset_dfs_is_node)
[PROOF STATE]
proof (state)
this:
list_all (nfa_is_node A) (snd (subset_dfs A (nfa_startnode A)))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with BT
[PROOF STATE]
proof (chain)
picking this:
subset_dfs A (nfa_startnode A) = (bt, ls)
list_all (nfa_is_node A) (snd (subset_dfs A (nfa_startnode A)))
[PROOF STEP]
have L: "list_all (nfa_is_node A) ls"
[PROOF STATE]
proof (prove)
using this:
subset_dfs A (nfa_startnode A) = (bt, ls)
list_all (nfa_is_node A) (snd (subset_dfs A (nfa_startnode A)))

goal (1 subgoal):
 1. list_all (nfa_is_node A) ls
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_all (nfa_is_node A) ls

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
have D: "det_nfa A = (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls, map (\<lambda>q. nfa_accepting A q) ls)"
    (is "_ = (?bdt, ?atbl)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det_nfa A = (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls, map (nfa_accepting A) ls)
[PROOF STEP]
unfolding det_nfa_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (let (bdd, qss) = subset_dfs A (nfa_startnode A) in (map (\<lambda>qs. bdd_map (\<lambda>qs. the (bdd_lookup bdd qs)) (subsetbdd (fst A) qs (nfa_emptybdd (length qs)))) qss, map (nfa_accepting A) qss)) = (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls, map (nfa_accepting A) ls)
[PROOF STEP]
by (simp add: BT)
[PROOF STATE]
proof (state)
this:
det_nfa A = (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls, map (nfa_accepting A) ls)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
from well_formed L
[PROOF STATE]
proof (chain)
picking this:
wf_nfa A n
list_all (nfa_is_node A) ls
[PROOF STEP]
have "list_all (\<lambda>q. bddh n (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls"
[PROOF STATE]
proof (prove)
using this:
wf_nfa A n
list_all (nfa_is_node A) ls

goal (1 subgoal):
 1. list_all (\<lambda>q. bddh n (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls
[PROOF STEP]
by (induct ls) (simp add: bddh_subsetbdd wf_nfa_def nfa_emptybdd_def)+
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>q. bddh n (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
hence "list_all (\<lambda>q. bddh n (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q))))) ls"
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>q. bddh n (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls

goal (1 subgoal):
 1. list_all (\<lambda>q. bddh n (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q))))) ls
[PROOF STEP]
by (simp add: bddh_bdd_map)
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>q. bddh n (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q))))) ls

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
hence A: "list_all (bddh n) ?bdt"
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>q. bddh n (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q))))) ls

goal (1 subgoal):
 1. list_all (bddh n) (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls)
[PROOF STEP]
by (simp add: list_all_iff)
[PROOF STATE]
proof (state)
this:
list_all (bddh n) (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
list_all (bddh n) (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
fix q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
assume "\<exists>i < length ls. ls ! i = q"
[PROOF STATE]
proof (state)
this:
\<exists>i<length ls. ls ! i = q

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>i<length ls. ls ! i = q
[PROOF STEP]
obtain i where len_i: "i < length ls" and i: "q = ls ! i"
[PROOF STATE]
proof (prove)
using this:
\<exists>i<length ls. ls ! i = q

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length ls; q = ls ! i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i < length ls
q = ls ! i

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
from len_i i L
[PROOF STATE]
proof (chain)
picking this:
i < length ls
q = ls ! i
list_all (nfa_is_node A) ls
[PROOF STEP]
have Q': "nfa_is_node A q"
[PROOF STATE]
proof (prove)
using this:
i < length ls
q = ls ! i
list_all (nfa_is_node A) ls

goal (1 subgoal):
 1. nfa_is_node A q
[PROOF STEP]
by (simp add: list_all_iff)
[PROOF STATE]
proof (state)
this:
nfa_is_node A q

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node A q
[PROOF STEP]
have "(bdd_lookup (fst (subset_dfs A (nfa_startnode A))) q = Some i) =
      (i < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! i = q)"
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A q

goal (1 subgoal):
 1. (bdd_lookup (fst (subset_dfs A (nfa_startnode A))) q = Some i) = (i < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! i = q)
[PROOF STEP]
using Q
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A q
nfa_is_node A (nfa_startnode A)

goal (1 subgoal):
 1. (bdd_lookup (fst (subset_dfs A (nfa_startnode A))) q = Some i) = (i < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! i = q)
[PROOF STEP]
by (rule subset_dfs_bij)
[PROOF STATE]
proof (state)
this:
(bdd_lookup (fst (subset_dfs A (nfa_startnode A))) q = Some i) = (i < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! i = q)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with BT len_i i
[PROOF STATE]
proof (chain)
picking this:
subset_dfs A (nfa_startnode A) = (bt, ls)
i < length ls
q = ls ! i
(bdd_lookup (fst (subset_dfs A (nfa_startnode A))) q = Some i) = (i < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! i = q)
[PROOF STEP]
have "bdd_lookup bt q = Some i"
[PROOF STATE]
proof (prove)
using this:
subset_dfs A (nfa_startnode A) = (bt, ls)
i < length ls
q = ls ! i
(bdd_lookup (fst (subset_dfs A (nfa_startnode A))) q = Some i) = (i < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! i = q)

goal (1 subgoal):
 1. bdd_lookup bt q = Some i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bdd_lookup bt q = Some i

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with BT
[PROOF STATE]
proof (chain)
picking this:
subset_dfs A (nfa_startnode A) = (bt, ls)
bdd_lookup bt q = Some i
[PROOF STEP]
have "subset_memb q (subset_dfs A (nfa_startnode A))"
[PROOF STATE]
proof (prove)
using this:
subset_dfs A (nfa_startnode A) = (bt, ls)
bdd_lookup bt q = Some i

goal (1 subgoal):
 1. subset_memb q (subset_dfs A (nfa_startnode A))
[PROOF STEP]
by (simp add: subset_memb_def)
[PROOF STATE]
proof (state)
this:
subset_memb q (subset_dfs A (nfa_startnode A))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with Q' Q
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node A q
nfa_is_node A (nfa_startnode A)
subset_memb q (subset_dfs A (nfa_startnode A))
[PROOF STEP]
have TR: "(nfa_startnode A,q) \<in> (succsr (subset_succs A))\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A q
nfa_is_node A (nfa_startnode A)
subset_memb q (subset_dfs A (nfa_startnode A))

goal (1 subgoal):
 1. (nfa_startnode A, q) \<in> (succsr (subset_succs A))\<^sup>*
[PROOF STEP]
by (simp add: dfs_eq_rtrancl)
[PROOF STATE]
proof (state)
this:
(nfa_startnode A, q) \<in> (succsr (subset_succs A))\<^sup>*

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(nfa_startnode A, q) \<in> (succsr (subset_succs A))\<^sup>*

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
assume P: "p \<in> set (subset_succs A q)"
[PROOF STATE]
proof (state)
this:
p \<in> set (subset_succs A q)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with TR
[PROOF STATE]
proof (chain)
picking this:
(nfa_startnode A, q) \<in> (succsr (subset_succs A))\<^sup>*
p \<in> set (subset_succs A q)
[PROOF STEP]
have 3: "(nfa_startnode A,p) \<in> (succsr (subset_succs A))\<^sup>*"
[PROOF STATE]
proof (prove)
using this:
(nfa_startnode A, q) \<in> (succsr (subset_succs A))\<^sup>*
p \<in> set (subset_succs A q)

goal (1 subgoal):
 1. (nfa_startnode A, p) \<in> (succsr (subset_succs A))\<^sup>*
[PROOF STEP]
by (simp add: succsr_def rtrancl_into_rtrancl)
[PROOF STATE]
proof (state)
this:
(nfa_startnode A, p) \<in> (succsr (subset_succs A))\<^sup>*

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
from Q'
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node A q
[PROOF STEP]
have "list_all (nfa_is_node A) (subset_succs A q)"
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A q

goal (1 subgoal):
 1. list_all (nfa_is_node A) (subset_succs A q)
[PROOF STEP]
by (rule succs_is_node)
[PROOF STATE]
proof (state)
this:
list_all (nfa_is_node A) (subset_succs A q)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with P
[PROOF STATE]
proof (chain)
picking this:
p \<in> set (subset_succs A q)
list_all (nfa_is_node A) (subset_succs A q)
[PROOF STEP]
have 4: "nfa_is_node A p"
[PROOF STATE]
proof (prove)
using this:
p \<in> set (subset_succs A q)
list_all (nfa_is_node A) (subset_succs A q)

goal (1 subgoal):
 1. nfa_is_node A p
[PROOF STEP]
by (simp add: list_all_iff)
[PROOF STATE]
proof (state)
this:
nfa_is_node A p

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with Q 3
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node A (nfa_startnode A)
(nfa_startnode A, p) \<in> (succsr (subset_succs A))\<^sup>*
nfa_is_node A p
[PROOF STEP]
have "subset_memb p (subset_dfs A (nfa_startnode A))"
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A (nfa_startnode A)
(nfa_startnode A, p) \<in> (succsr (subset_succs A))\<^sup>*
nfa_is_node A p

goal (1 subgoal):
 1. subset_memb p (subset_dfs A (nfa_startnode A))
[PROOF STEP]
by (simp add: dfs_eq_rtrancl)
[PROOF STATE]
proof (state)
this:
subset_memb p (subset_dfs A (nfa_startnode A))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with BT
[PROOF STATE]
proof (chain)
picking this:
subset_dfs A (nfa_startnode A) = (bt, ls)
subset_memb p (subset_dfs A (nfa_startnode A))
[PROOF STEP]
have "bdd_lookup bt p \<noteq> None"
[PROOF STATE]
proof (prove)
using this:
subset_dfs A (nfa_startnode A) = (bt, ls)
subset_memb p (subset_dfs A (nfa_startnode A))

goal (1 subgoal):
 1. bdd_lookup bt p \<noteq> None
[PROOF STEP]
by (simp add: subset_memb_def)
[PROOF STATE]
proof (state)
this:
bdd_lookup bt p \<noteq> None

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with BT
[PROOF STATE]
proof (chain)
picking this:
subset_dfs A (nfa_startnode A) = (bt, ls)
bdd_lookup bt p \<noteq> None
[PROOF STEP]
obtain j where j: "bdd_lookup (fst (subset_dfs A (nfa_startnode A))) p = Some j"
[PROOF STATE]
proof (prove)
using this:
subset_dfs A (nfa_startnode A) = (bt, ls)
bdd_lookup bt p \<noteq> None

goal (1 subgoal):
 1. (\<And>j. bdd_lookup (fst (subset_dfs A (nfa_startnode A))) p = Some j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "bdd_lookup bt p") simp+
[PROOF STATE]
proof (state)
this:
bdd_lookup (fst (subset_dfs A (nfa_startnode A))) p = Some j

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
from 4 Q j
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node A p
nfa_is_node A (nfa_startnode A)
bdd_lookup (fst (subset_dfs A (nfa_startnode A))) p = Some j
[PROOF STEP]
have "j < length (snd (subset_dfs A (nfa_startnode A))) \<and> (snd (subset_dfs A (nfa_startnode A))) ! j = p"
[PROOF STATE]
proof (prove)
using this:
nfa_is_node A p
nfa_is_node A (nfa_startnode A)
bdd_lookup (fst (subset_dfs A (nfa_startnode A))) p = Some j

goal (1 subgoal):
 1. j < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! j = p
[PROOF STEP]
by (auto simp add: subset_dfs_bij)
[PROOF STATE]
proof (state)
this:
j < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! j = p

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with j BT 4
[PROOF STATE]
proof (chain)
picking this:
bdd_lookup (fst (subset_dfs A (nfa_startnode A))) p = Some j
subset_dfs A (nfa_startnode A) = (bt, ls)
nfa_is_node A p
j < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! j = p
[PROOF STEP]
have "\<exists>j. bdd_lookup bt p = Some j \<and> j < length ls"
[PROOF STATE]
proof (prove)
using this:
bdd_lookup (fst (subset_dfs A (nfa_startnode A))) p = Some j
subset_dfs A (nfa_startnode A) = (bt, ls)
nfa_is_node A p
j < length (snd (subset_dfs A (nfa_startnode A))) \<and> snd (subset_dfs A (nfa_startnode A)) ! j = p

goal (1 subgoal):
 1. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>j. bdd_lookup bt p = Some j \<and> j < length ls

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?p2 \<in> set (subset_succs A q) \<Longrightarrow> \<exists>j. bdd_lookup bt ?p2 = Some j \<and> j < length ls

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
hence "\<forall>p \<in> set (subset_succs A q). \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls"
[PROOF STATE]
proof (prove)
using this:
?p2 \<in> set (subset_succs A q) \<Longrightarrow> \<exists>j. bdd_lookup bt ?p2 = Some j \<and> j < length ls

goal (1 subgoal):
 1. \<forall>p\<in>set (subset_succs A q). \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>set (subset_succs A q). \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
hence "list_all (\<lambda>p. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls) (add_leaves (subsetbdd (fst A) q (nfa_emptybdd (length q))) [])"
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>set (subset_succs A q). \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls

goal (1 subgoal):
 1. list_all (\<lambda>p. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls) (add_leaves (subsetbdd (fst A) q (nfa_emptybdd (length q))) [])
[PROOF STEP]
by (simp add: list_all_iff subset_succs_def)
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>p. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls) (add_leaves (subsetbdd (fst A) q (nfa_emptybdd (length q))) [])

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
hence "bdd_all (\<lambda>p. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls) (subsetbdd (fst A) q (nfa_emptybdd (length q)))"
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>p. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls) (add_leaves (subsetbdd (fst A) q (nfa_emptybdd (length q))) [])

goal (1 subgoal):
 1. bdd_all (\<lambda>p. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls) (subsetbdd (fst A) q (nfa_emptybdd (length q)))
[PROOF STEP]
by (simp add: add_leaves_bdd_all_eq)
[PROOF STATE]
proof (state)
this:
bdd_all (\<lambda>p. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls) (subsetbdd (fst A) q (nfa_emptybdd (length q)))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
hence "bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q))))"
[PROOF STATE]
proof (prove)
using this:
bdd_all (\<lambda>p. \<exists>j. bdd_lookup bt p = Some j \<and> j < length ls) (subsetbdd (fst A) q (nfa_emptybdd (length q)))

goal (1 subgoal):
 1. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q))))
[PROOF STEP]
by (induct ("subsetbdd (fst A) q (nfa_emptybdd (length q))")) auto
[PROOF STATE]
proof (state)
this:
bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q))))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<exists>i<length ls. ls ! i = ?q2 \<Longrightarrow> bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) ?q2 (nfa_emptybdd (length ?q2))))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>i<length ls. ls ! i = ?q2 \<Longrightarrow> bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) ?q2 (nfa_emptybdd (length ?q2))))
[PROOF STEP]
have "\<forall>x \<in> set ls. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x))))"
[PROOF STATE]
proof (prove)
using this:
\<exists>i<length ls. ls ! i = ?q2 \<Longrightarrow> bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) ?q2 (nfa_emptybdd (length ?q2))))

goal (1 subgoal):
 1. \<forall>x\<in>set ls. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x))))
[PROOF STEP]
by (simp add: in_set_conv_nth)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set ls. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x))))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
hence "list_all (\<lambda>x. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x))))) ls"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set ls. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x))))

goal (1 subgoal):
 1. list_all (\<lambda>x. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x))))) ls
[PROOF STEP]
by (simp add: list_all_iff)
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>x. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x))))) ls

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
hence B: "list_all (bdd_all (\<lambda>l. l < length ls)) (map (\<lambda>x. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x)))) ls)"
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>x. bdd_all (\<lambda>l. l < length ls) (bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x))))) ls

goal (1 subgoal):
 1. list_all (bdd_all (\<lambda>l. l < length ls)) (map (\<lambda>x. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x)))) ls)
[PROOF STEP]
by (simp add: list_all_iff)
[PROOF STATE]
proof (state)
this:
list_all (bdd_all (\<lambda>l. l < length ls)) (map (\<lambda>x. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x)))) ls)

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
from well_formed
[PROOF STATE]
proof (chain)
picking this:
wf_nfa A n
[PROOF STEP]
have "bdd_lookup (fst (subset_dfs A (nfa_startnode A))) (nfa_startnode A) = Some 0"
[PROOF STATE]
proof (prove)
using this:
wf_nfa A n

goal (1 subgoal):
 1. bdd_lookup (fst (subset_dfs A (nfa_startnode A))) (nfa_startnode A) = Some 0
[PROOF STEP]
by (simp add: subset_dfs_start nfa_startnode_is_node)
[PROOF STATE]
proof (state)
this:
bdd_lookup (fst (subset_dfs A (nfa_startnode A))) (nfa_startnode A) = Some 0

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with well_formed
[PROOF STATE]
proof (chain)
picking this:
wf_nfa A n
bdd_lookup (fst (subset_dfs A (nfa_startnode A))) (nfa_startnode A) = Some 0
[PROOF STEP]
have "0 < length (snd (subset_dfs A (nfa_startnode A)))"
[PROOF STATE]
proof (prove)
using this:
wf_nfa A n
bdd_lookup (fst (subset_dfs A (nfa_startnode A))) (nfa_startnode A) = Some 0

goal (1 subgoal):
 1. 0 < length (snd (subset_dfs A (nfa_startnode A)))
[PROOF STEP]
by (simp add: subset_dfs_bij nfa_startnode_is_node)
[PROOF STATE]
proof (state)
this:
0 < length (snd (subset_dfs A (nfa_startnode A)))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
with A B D BT
[PROOF STATE]
proof (chain)
picking this:
list_all (bddh n) (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls)
list_all (bdd_all (\<lambda>l. l < length ls)) (map (\<lambda>x. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x)))) ls)
det_nfa A = (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls, map (nfa_accepting A) ls)
subset_dfs A (nfa_startnode A) = (bt, ls)
0 < length (snd (subset_dfs A (nfa_startnode A)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
list_all (bddh n) (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls)
list_all (bdd_all (\<lambda>l. l < length ls)) (map (\<lambda>x. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) x (nfa_emptybdd (length x)))) ls)
det_nfa A = (map (\<lambda>q. bdd_map (\<lambda>q. the (bdd_lookup bt q)) (subsetbdd (fst A) q (nfa_emptybdd (length q)))) ls, map (nfa_accepting A) ls)
subset_dfs A (nfa_startnode A) = (bt, ls)
0 < length (snd (subset_dfs A (nfa_startnode A)))

goal (1 subgoal):
 1. wf_dfa (det_nfa A) n
[PROOF STEP]
by (simp add: wf_dfa_def det_nfa_def dfa_is_node_def)
[PROOF STATE]
proof (state)
this:
wf_dfa (det_nfa A) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proots_line_code[code]:
    "proots_line p st tt =
        (if poly p st \<noteq>0 \<and> poly p tt \<noteq> 0 then
            (if st\<noteq>tt then
                (let pc = pcompose p [:st, tt - st:];
                     pR = map_poly Re pc;
                     pI = map_poly Im pc;
                     g  = gcd pR pI
                 in nat (changes_itv_smods_ext 0 1 g (pderiv g)))
            else 0)
   else  Code.abort (STR ''prootsline does not handle vanishing endpoints for now'')
                      (\<lambda>_. proots_line p st tt))" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
proof (cases "poly p st \<noteq>0 \<and> poly p tt \<noteq> 0 \<and> st\<noteq>tt")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
 2. \<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt) \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt)

goal (2 subgoals):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
 2. \<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt) \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt)

goal (2 subgoals):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
 2. \<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt) \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
have ?thesis if "st=tt" "p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
st = tt
p \<noteq> 0

goal (1 subgoal):
 1. proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
unfolding proots_line_def
[PROOF STATE]
proof (prove)
using this:
st = tt
p \<noteq> 0

goal (1 subgoal):
 1. proots_count p (open_segment st tt) = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_count p (open_segment st tt)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>st = tt; p \<noteq> 0\<rbrakk> \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))

goal (2 subgoals):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
 2. \<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt) \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt)
\<lbrakk>st = tt; p \<noteq> 0\<rbrakk> \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt)
\<lbrakk>st = tt; p \<noteq> 0\<rbrakk> \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))

goal (1 subgoal):
 1. proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt

goal (1 subgoal):
 1. poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt \<Longrightarrow> proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt

goal (1 subgoal):
 1. proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
using proots_line_smods
[PROOF STATE]
proof (prove)
using this:
poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 \<and> st \<noteq> tt
\<lbrakk>poly ?p ?st \<noteq> 0; poly ?p ?tt \<noteq> 0; ?st \<noteq> ?tt\<rbrakk> \<Longrightarrow> proots_line ?p ?st ?tt = (let pc = ?p \<circ>\<^sub>p [:?st, ?tt - ?st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)))

goal (1 subgoal):
 1. proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_line p st tt = (if poly p st \<noteq> 0 \<and> poly p tt \<noteq> 0 then if st \<noteq> tt then let pc = p \<circ>\<^sub>p [:st, tt - st:]; pR = map_poly Re pc; pI = map_poly Im pc; g = gcd pR pI in nat (changes_itv_smods_ext 0 1 g (pderiv g)) else 0 else Code.abort STR ''prootsline does not handle vanishing endpoints for now'' (\<lambda>_. proots_line p st tt))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eint_int_minus_distr:
"(eint n)*c - (eint m)*c = eint (n - m) * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eint n * c - eint m * c = eint (n - m) * c
[PROOF STEP]
by (metis add.right_neutral distrib_right eint_add_left_cancel eint_minus_distl idiff_eint_eint
      idiff_infinity idiff_self infinity_ne_i0 nat_mult_not_infty not_eint_eq times_eint_simps(4))


[STATEMENT]
lemma split_scaleR_neg_le: "(0 \<le> a \<and> x \<le> 0) \<or> (a \<le> 0 \<and> 0 \<le> x) \<Longrightarrow> a *\<^sub>R x \<le> 0"
  for x :: "'a::ordered_real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> a \<and> x \<le> (0::'a) \<or> a \<le> 0 \<and> (0::'a) \<le> x \<Longrightarrow> a *\<^sub>R x \<le> (0::'a)
[PROOF STEP]
by (auto simp: scaleR_nonneg_nonpos scaleR_nonpos_nonneg)


[STATEMENT]
lemma lax_aux:
  fixes X :: "'a::quantale set"
  assumes "\<forall>x.\<forall>y \<in> X. x \<rightarrow> y \<in> X"
  and "\<forall>x. \<forall>y \<in> X. y \<leftarrow> x \<in> X"
shows "\<Sqinter>{z \<in> X. x \<le> z} \<cdot> \<Sqinter>{z \<in> X. y \<le> z} \<le> \<Sqinter>{z \<in> X. x \<cdot> y \<le> z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
let ?\<phi> = "\<lambda>x. \<Sqinter>{w \<in> X. x \<le> w}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
assume a: "x \<cdot> y \<le> z"
  and b: "z \<in> X"
[PROOF STATE]
proof (state)
this:
x \<cdot> y \<le> z
z \<in> X

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
hence c: "x \<le> z \<leftarrow> y"
[PROOF STATE]
proof (prove)
using this:
x \<cdot> y \<le> z
z \<in> X

goal (1 subgoal):
 1. x \<le> z \<leftarrow> y
[PROOF STEP]
by (simp add: fres_galois)
[PROOF STATE]
proof (state)
this:
x \<le> z \<leftarrow> y

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
hence "z \<leftarrow> y \<in> X"
[PROOF STATE]
proof (prove)
using this:
x \<le> z \<leftarrow> y

goal (1 subgoal):
 1. z \<leftarrow> y \<in> X
[PROOF STEP]
by (simp add: assms(2) b)
[PROOF STATE]
proof (state)
this:
z \<leftarrow> y \<in> X

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
hence "?\<phi> x \<le> z \<leftarrow> y"
[PROOF STATE]
proof (prove)
using this:
z \<leftarrow> y \<in> X

goal (1 subgoal):
 1. \<Sqinter> {w \<in> X. x \<le> w} \<le> z \<leftarrow> y
[PROOF STEP]
by (simp add: Inf_lower c)
[PROOF STATE]
proof (state)
this:
\<Sqinter> {w \<in> X. x \<le> w} \<le> z \<leftarrow> y

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
hence d: "y \<le> ?\<phi> x \<rightarrow> z"
[PROOF STATE]
proof (prove)
using this:
\<Sqinter> {w \<in> X. x \<le> w} \<le> z \<leftarrow> y

goal (1 subgoal):
 1. y \<le> \<Sqinter> {w \<in> X. x \<le> w} \<rightarrow> z
[PROOF STEP]
by (simp add: bres_galois_imp fres_galois)
[PROOF STATE]
proof (state)
this:
y \<le> \<Sqinter> {w \<in> X. x \<le> w} \<rightarrow> z

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
hence "?\<phi> x  \<rightarrow> z \<in> X"
[PROOF STATE]
proof (prove)
using this:
y \<le> \<Sqinter> {w \<in> X. x \<le> w} \<rightarrow> z

goal (1 subgoal):
 1. \<Sqinter> {w \<in> X. x \<le> w} \<rightarrow> z \<in> X
[PROOF STEP]
by (simp add: assms(1) b)
[PROOF STATE]
proof (state)
this:
\<Sqinter> {w \<in> X. x \<le> w} \<rightarrow> z \<in> X

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
hence "?\<phi> x \<cdot> ?\<phi> y \<le> z"
[PROOF STATE]
proof (prove)
using this:
\<Sqinter> {w \<in> X. x \<le> w} \<rightarrow> z \<in> X

goal (1 subgoal):
 1. \<Sqinter> {w \<in> X. x \<le> w} \<cdot> \<Sqinter> {w \<in> X. y \<le> w} \<le> z
[PROOF STEP]
by (simp add: Inf_lower d bres_galois)
[PROOF STATE]
proof (state)
this:
\<Sqinter> {w \<in> X. x \<le> w} \<cdot> \<Sqinter> {w \<in> X. y \<le> w} \<le> z

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>x \<cdot> y \<le> ?z2; ?z2 \<in> X\<rbrakk> \<Longrightarrow> \<Sqinter> {w \<in> X. x \<le> w} \<cdot> \<Sqinter> {w \<in> X. y \<le> w} \<le> ?z2

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<cdot> y \<le> ?z2; ?z2 \<in> X\<rbrakk> \<Longrightarrow> \<Sqinter> {w \<in> X. x \<le> w} \<cdot> \<Sqinter> {w \<in> X. y \<le> w} \<le> ?z2

goal (1 subgoal):
 1. \<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}
[PROOF STEP]
by (simp add: le_Inf_iff)
[PROOF STATE]
proof (state)
this:
\<Sqinter> {z \<in> X. x \<le> z} \<cdot> \<Sqinter> {z \<in> X. y \<le> z} \<le> \<Sqinter> {z \<in> X. x \<cdot> y \<le> z}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fin_incidence_mat_elems: "finite (elements_mat (inc_mat_of Vs Bs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (elements_mat (inc_mat_of Vs Bs))
[PROOF STEP]
using finite_subset inc_mat_one_zero_elems
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
elements_mat (inc_mat_of ?Vs ?Bs) \<subseteq> {0::?'a, 1::?'a}

goal (1 subgoal):
 1. finite (elements_mat (inc_mat_of Vs Bs))
[PROOF STEP]
by auto


[STATEMENT]
lemma eventually_disj_distrib: "(\<diamond>(P \<^bold>\<or> Q)) = (\<diamond>P \<^bold>\<or> \<diamond>Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<diamond>(\<lambda>s. P s \<or> Q s) = (\<lambda>s. (\<diamond>P) s \<or> (\<diamond>Q) s)
[PROOF STEP]
unfolding defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>\<sigma>. \<exists>i. (P (\<sigma> |\<^sub>s i) \<or> Q (\<sigma> |\<^sub>s i)) \<and> (\<forall>k<i. True)) = (\<lambda>s. (\<exists>i. P (s |\<^sub>s i) \<and> (\<forall>k<i. True)) \<or> (\<exists>i. Q (s |\<^sub>s i) \<and> (\<forall>k<i. True)))
[PROOF STEP]
by auto