[STATEMENT]
lemma add_power: "u < 2^x \<Longrightarrow> nat_to_set (u + 2^x) = nat_to_set u \<union> {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u < 2 ^ x \<Longrightarrow> nat_to_set (u + 2 ^ x) = nat_to_set u \<union> {x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u < 2 ^ x \<Longrightarrow> nat_to_set (u + 2 ^ x) = nat_to_set u \<union> {x}
[PROOF STEP]
assume A: "u < 2^x"
[PROOF STATE]
proof (state)
this:
u < 2 ^ x

goal (1 subgoal):
 1. u < 2 ^ x \<Longrightarrow> nat_to_set (u + 2 ^ x) = nat_to_set u \<union> {x}
[PROOF STEP]
have log2_is_x: "log2 (u+2^x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log2 (u + 2 ^ x) = x
[PROOF STEP]
proof (unfold log2_def, rule Least_equality)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u + 2 ^ x < 2 ^ (x + 1)
 2. \<And>y. u + 2 ^ x < 2 ^ (y + 1) \<Longrightarrow> x \<le> y
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
u < 2 ^ x
[PROOF STEP]
show "u+2^x < 2^(x+1)"
[PROOF STATE]
proof (prove)
using this:
u < 2 ^ x

goal (1 subgoal):
 1. u + 2 ^ x < 2 ^ (x + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u + 2 ^ x < 2 ^ (x + 1)

goal (1 subgoal):
 1. \<And>y. u + 2 ^ x < 2 ^ (y + 1) \<Longrightarrow> x \<le> y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. u + 2 ^ x < 2 ^ (y + 1) \<Longrightarrow> x \<le> y
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. u + 2 ^ x < 2 ^ (y + 1) \<Longrightarrow> x \<le> y
[PROOF STEP]
assume A1: "u + 2^x < 2^(z+1)"
[PROOF STATE]
proof (state)
this:
u + 2 ^ x < 2 ^ (z + 1)

goal (1 subgoal):
 1. \<And>y. u + 2 ^ x < 2 ^ (y + 1) \<Longrightarrow> x \<le> y
[PROOF STEP]
show "x \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> z
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x \<le> z \<Longrightarrow> False
[PROOF STEP]
assume "\<not> x \<le> z"
[PROOF STATE]
proof (state)
this:
\<not> x \<le> z

goal (1 subgoal):
 1. \<not> x \<le> z \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> x \<le> z
[PROOF STEP]
have "z < x"
[PROOF STATE]
proof (prove)
using this:
\<not> x \<le> z

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

goal (1 subgoal):
 1. \<not> x \<le> z \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z < x
[PROOF STEP]
have L1: "z+1 \<le> x"
[PROOF STATE]
proof (prove)
using this:
z < x

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

goal (1 subgoal):
 1. \<not> x \<le> z \<Longrightarrow> False
[PROOF STEP]
have L2: "1 \<le> (2::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 \<le> 2

goal (1 subgoal):
 1. \<not> x \<le> z \<Longrightarrow> False
[PROOF STEP]
from L1 L2
[PROOF STATE]
proof (chain)
picking this:
z + 1 \<le> x
1 \<le> 2
[PROOF STEP]
have L3: "(2::nat)^(z+1) \<le> (2::nat)^x"
[PROOF STATE]
proof (prove)
using this:
z + 1 \<le> x
1 \<le> 2

goal (1 subgoal):
 1. 2 ^ (z + 1) \<le> 2 ^ x
[PROOF STEP]
by (rule power_increasing)
[PROOF STATE]
proof (state)
this:
2 ^ (z + 1) \<le> 2 ^ x

goal (1 subgoal):
 1. \<not> x \<le> z \<Longrightarrow> False
[PROOF STEP]
with A1
[PROOF STATE]
proof (chain)
picking this:
u + 2 ^ x < 2 ^ (z + 1)
2 ^ (z + 1) \<le> 2 ^ x
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
u + 2 ^ x < 2 ^ (z + 1)
2 ^ (z + 1) \<le> 2 ^ x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<le> z

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
log2 (u + 2 ^ x) = x

goal (1 subgoal):
 1. u < 2 ^ x \<Longrightarrow> nat_to_set (u + 2 ^ x) = nat_to_set u \<union> {x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_set (u + 2 ^ x) = nat_to_set u \<union> {x}
[PROOF STEP]
proof (rule subset_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. nat_to_set (u + 2 ^ x) \<subseteq> nat_to_set u \<union> {x}
 2. nat_to_set u \<union> {x} \<subseteq> nat_to_set (u + 2 ^ x)
[PROOF STEP]
show "nat_to_set (u + 2 ^ x) \<subseteq> nat_to_set u \<union> {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_set (u + 2 ^ x) \<subseteq> nat_to_set u \<union> {x}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> nat_to_set (u + 2 ^ x) \<Longrightarrow> xa \<in> nat_to_set u \<union> {x}
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> nat_to_set (u + 2 ^ x) \<Longrightarrow> xa \<in> nat_to_set u \<union> {x}
[PROOF STEP]
assume A1: "y \<in> nat_to_set (u + 2 ^ x)"
[PROOF STATE]
proof (state)
this:
y \<in> nat_to_set (u + 2 ^ x)

goal (1 subgoal):
 1. \<And>xa. xa \<in> nat_to_set (u + 2 ^ x) \<Longrightarrow> xa \<in> nat_to_set u \<union> {x}
[PROOF STEP]
show "y \<in> nat_to_set u \<union> {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> nat_to_set u \<union> {x}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
assume "y \<notin> {x}"
[PROOF STATE]
proof (state)
this:
y \<notin> {x}

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<notin> {x}
[PROOF STEP]
have S1: "y \<noteq> x"
[PROOF STATE]
proof (prove)
using this:
y \<notin> {x}

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

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
have "y \<le> log2 (u + 2 ^ x)"
[PROOF STATE]
proof (prove)
using this:
y \<in> nat_to_set (u + 2 ^ x)

goal (1 subgoal):
 1. y \<le> log2 (u + 2 ^ x)
[PROOF STEP]
by (rule nat_to_set_lub)
[PROOF STATE]
proof (state)
this:
y \<le> log2 (u + 2 ^ x)

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
with log2_is_x
[PROOF STATE]
proof (chain)
picking this:
log2 (u + 2 ^ x) = x
y \<le> log2 (u + 2 ^ x)
[PROOF STEP]
have "y \<le> x"
[PROOF STATE]
proof (prove)
using this:
log2 (u + 2 ^ x) = x
y \<le> log2 (u + 2 ^ x)

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

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
with S1
[PROOF STATE]
proof (chain)
picking this:
y \<noteq> x
y \<le> x
[PROOF STEP]
have y_lt_x: "y < x"
[PROOF STATE]
proof (prove)
using this:
y \<noteq> x
y \<le> x

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

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
have "c_in y (u + 2 ^ x) = 1"
[PROOF STATE]
proof (prove)
using this:
y \<in> nat_to_set (u + 2 ^ x)

goal (1 subgoal):
 1. c_in y (u + 2 ^ x) = 1
[PROOF STEP]
by (simp add: x_in_u_eq)
[PROOF STATE]
proof (state)
this:
c_in y (u + 2 ^ x) = 1

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_in y (u + 2 ^ x) = 1
[PROOF STEP]
have S2: "((u + 2 ^ x) div 2^y) mod 2 = 1"
[PROOF STATE]
proof (prove)
using this:
c_in y (u + 2 ^ x) = 1

goal (1 subgoal):
 1. (u + 2 ^ x) div 2 ^ y mod 2 = 1
[PROOF STEP]
by (unfold c_in_def)
[PROOF STATE]
proof (state)
this:
(u + 2 ^ x) div 2 ^ y mod 2 = 1

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
from y_lt_x
[PROOF STATE]
proof (chain)
picking this:
y < x
[PROOF STEP]
have "((u + (2::nat) ^ x) div (2::nat)^y) mod 2 = (u div (2::nat)^y) mod 2"
[PROOF STATE]
proof (prove)
using this:
y < x

goal (1 subgoal):
 1. (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
by (rule div_mod_lm)
[PROOF STATE]
proof (state)
this:
(u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
with S2
[PROOF STATE]
proof (chain)
picking this:
(u + 2 ^ x) div 2 ^ y mod 2 = 1
(u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
have "(u div 2^y) mod 2 = 1"
[PROOF STATE]
proof (prove)
using this:
(u + 2 ^ x) div 2 ^ y mod 2 = 1
(u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2

goal (1 subgoal):
 1. u div 2 ^ y mod 2 = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u div 2 ^ y mod 2 = 1

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u div 2 ^ y mod 2 = 1
[PROOF STEP]
have "c_in y u = 1"
[PROOF STATE]
proof (prove)
using this:
u div 2 ^ y mod 2 = 1

goal (1 subgoal):
 1. c_in y u = 1
[PROOF STEP]
by (simp add: c_in_def)
[PROOF STATE]
proof (state)
this:
c_in y u = 1

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_in y u = 1
[PROOF STEP]
show "y \<in> nat_to_set u"
[PROOF STATE]
proof (prove)
using this:
c_in y u = 1

goal (1 subgoal):
 1. y \<in> nat_to_set u
[PROOF STEP]
by (simp add: x_in_u_eq)
[PROOF STATE]
proof (state)
this:
y \<in> nat_to_set u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> nat_to_set u \<union> {x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nat_to_set (u + 2 ^ x) \<subseteq> nat_to_set u \<union> {x}

goal (1 subgoal):
 1. nat_to_set u \<union> {x} \<subseteq> nat_to_set (u + 2 ^ x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat_to_set u \<union> {x} \<subseteq> nat_to_set (u + 2 ^ x)
[PROOF STEP]
show "nat_to_set u \<union> {x} \<subseteq> nat_to_set (u + 2 ^ x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_set u \<union> {x} \<subseteq> nat_to_set (u + 2 ^ x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> nat_to_set u \<union> {x} \<Longrightarrow> xa \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> nat_to_set u \<union> {x} \<Longrightarrow> xa \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
assume A1: "y \<in> nat_to_set u \<union> {x}"
[PROOF STATE]
proof (state)
this:
y \<in> nat_to_set u \<union> {x}

goal (1 subgoal):
 1. \<And>xa. xa \<in> nat_to_set u \<union> {x} \<Longrightarrow> xa \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
show "y \<in> nat_to_set (u + 2 ^ x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
 2. \<not> ?P \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
assume "y \<in> {x}"
[PROOF STATE]
proof (state)
this:
y \<in> {x}

goal (2 subgoals):
 1. ?P \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
 2. \<not> ?P \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> {x}
[PROOF STEP]
have "y=x"
[PROOF STATE]
proof (prove)
using this:
y \<in> {x}

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

goal (2 subgoals):
 1. ?P \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
 2. \<not> ?P \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = x
[PROOF STEP]
have "y = log2 (u + 2 ^ x)"
[PROOF STATE]
proof (prove)
using this:
y = x

goal (1 subgoal):
 1. y = log2 (u + 2 ^ x)
[PROOF STEP]
by (simp add: log2_is_x)
[PROOF STATE]
proof (state)
this:
y = log2 (u + 2 ^ x)

goal (2 subgoals):
 1. ?P \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
 2. \<not> ?P \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = log2 (u + 2 ^ x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y = log2 (u + 2 ^ x)

goal (1 subgoal):
 1. y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
by (simp add: log2_lm5)
[PROOF STATE]
proof (state)
this:
y \<in> nat_to_set (u + 2 ^ x)

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
assume y_notin: "y \<notin> {x}"
[PROOF STATE]
proof (state)
this:
y \<notin> {x}

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<notin> {x}
[PROOF STEP]
have y_ne_x: "y \<noteq> x"
[PROOF STATE]
proof (prove)
using this:
y \<notin> {x}

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

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
from A1 y_notin
[PROOF STATE]
proof (chain)
picking this:
y \<in> nat_to_set u \<union> {x}
y \<notin> {x}
[PROOF STEP]
have y_in: "y \<in> nat_to_set u"
[PROOF STATE]
proof (prove)
using this:
y \<in> nat_to_set u \<union> {x}
y \<notin> {x}

goal (1 subgoal):
 1. y \<in> nat_to_set u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> nat_to_set u

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
have y_lt_x: "y < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y < x
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> False
[PROOF STEP]
assume "\<not> y < x"
[PROOF STATE]
proof (state)
this:
\<not> y < x

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> False
[PROOF STEP]
with y_ne_x
[PROOF STATE]
proof (chain)
picking this:
y \<noteq> x
\<not> y < x
[PROOF STEP]
have y_gt_x: "x < y"
[PROOF STATE]
proof (prove)
using this:
y \<noteq> x
\<not> y < x

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

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> False
[PROOF STEP]
have "1 < (2::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < 2

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> False
[PROOF STEP]
from y_gt_x this
[PROOF STATE]
proof (chain)
picking this:
x < y
1 < 2
[PROOF STEP]
have L1: "(2::nat)^x < 2^y"
[PROOF STATE]
proof (prove)
using this:
x < y
1 < 2

goal (1 subgoal):
 1. 2 ^ x < 2 ^ y
[PROOF STEP]
by (rule power_strict_increasing)
[PROOF STATE]
proof (state)
this:
2 ^ x < 2 ^ y

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> False
[PROOF STEP]
from y_in
[PROOF STATE]
proof (chain)
picking this:
y \<in> nat_to_set u
[PROOF STEP]
have L2: "2^y \<le> u"
[PROOF STATE]
proof (prove)
using this:
y \<in> nat_to_set u

goal (1 subgoal):
 1. 2 ^ y \<le> u
[PROOF STEP]
by (rule nat_to_set_upper_bound)
[PROOF STATE]
proof (state)
this:
2 ^ y \<le> u

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> False
[PROOF STEP]
from L1 L2
[PROOF STATE]
proof (chain)
picking this:
2 ^ x < 2 ^ y
2 ^ y \<le> u
[PROOF STEP]
have "(2::nat)^x < u"
[PROOF STATE]
proof (prove)
using this:
2 ^ x < 2 ^ y
2 ^ y \<le> u

goal (1 subgoal):
 1. 2 ^ x < u
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
2 ^ x < u

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> False
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
u < 2 ^ x
2 ^ x < u
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
u < 2 ^ x
2 ^ x < u

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

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

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
from y_in
[PROOF STATE]
proof (chain)
picking this:
y \<in> nat_to_set u
[PROOF STEP]
have "c_in y u = 1"
[PROOF STATE]
proof (prove)
using this:
y \<in> nat_to_set u

goal (1 subgoal):
 1. c_in y u = 1
[PROOF STEP]
by (simp add: x_in_u_eq)
[PROOF STATE]
proof (state)
this:
c_in y u = 1

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_in y u = 1
[PROOF STEP]
have S2: "(u div 2^y) mod 2 = 1"
[PROOF STATE]
proof (prove)
using this:
c_in y u = 1

goal (1 subgoal):
 1. u div 2 ^ y mod 2 = 1
[PROOF STEP]
by (unfold c_in_def)
[PROOF STATE]
proof (state)
this:
u div 2 ^ y mod 2 = 1

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
from y_lt_x
[PROOF STATE]
proof (chain)
picking this:
y < x
[PROOF STEP]
have "((u + (2::nat) ^ x) div (2::nat)^y) mod 2 = (u div (2::nat)^y) mod 2"
[PROOF STATE]
proof (prove)
using this:
y < x

goal (1 subgoal):
 1. (u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
by (rule div_mod_lm)
[PROOF STATE]
proof (state)
this:
(u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
with S2
[PROOF STATE]
proof (chain)
picking this:
u div 2 ^ y mod 2 = 1
(u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2
[PROOF STEP]
have "((u + (2::nat) ^ x)div 2^y) mod 2 = 1"
[PROOF STATE]
proof (prove)
using this:
u div 2 ^ y mod 2 = 1
(u + 2 ^ x) div 2 ^ y mod 2 = u div 2 ^ y mod 2

goal (1 subgoal):
 1. (u + 2 ^ x) div 2 ^ y mod 2 = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(u + 2 ^ x) div 2 ^ y mod 2 = 1

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(u + 2 ^ x) div 2 ^ y mod 2 = 1
[PROOF STEP]
have "c_in y (u + (2::nat) ^ x) = 1"
[PROOF STATE]
proof (prove)
using this:
(u + 2 ^ x) div 2 ^ y mod 2 = 1

goal (1 subgoal):
 1. c_in y (u + 2 ^ x) = 1
[PROOF STEP]
by (simp add: c_in_def)
[PROOF STATE]
proof (state)
this:
c_in y (u + 2 ^ x) = 1

goal (1 subgoal):
 1. y \<notin> {x} \<Longrightarrow> y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_in y (u + 2 ^ x) = 1
[PROOF STEP]
show "y \<in> nat_to_set (u + (2::nat) ^ x)"
[PROOF STATE]
proof (prove)
using this:
c_in y (u + 2 ^ x) = 1

goal (1 subgoal):
 1. y \<in> nat_to_set (u + 2 ^ x)
[PROOF STEP]
by (simp add: x_in_u_eq)
[PROOF STATE]
proof (state)
this:
y \<in> nat_to_set (u + 2 ^ x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> nat_to_set (u + 2 ^ x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nat_to_set u \<union> {x} \<subseteq> nat_to_set (u + 2 ^ x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nat_to_set (u + 2 ^ x) = nat_to_set u \<union> {x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_minus: "summable f \<Longrightarrow> (\<Sum>n. - f n) = - (\<Sum>n. f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<Sum>n. - f n) = - (\<Sum>n. f n)
[PROOF STEP]
by (intro sums_unique [symmetric] sums_minus summable_sums)


[STATEMENT]
lemma single_valued_has_lubs:
  assumes "single_valued r"
    and in_r: "(x, u) \<in> r\<^sup>*" "(y, u) \<in> r\<^sup>*"
  shows "\<exists>z. is_lub (r\<^sup>*) x y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. is_lub (r\<^sup>*) x y z
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. is_lub (r\<^sup>*) x y z
[PROOF STEP]
using in_r
[PROOF STATE]
proof (prove)
using this:
(x, u) \<in> r\<^sup>*
(y, u) \<in> r\<^sup>*

goal (1 subgoal):
 1. \<exists>z. is_lub (r\<^sup>*) x y z
[PROOF STEP]
proof (induct arbitrary: y rule: converse_rtrancl_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>y. (y, u) \<in> r\<^sup>* \<Longrightarrow> Ex (is_lub (r\<^sup>*) u y)
 2. \<And>y z ya. \<lbrakk>(y, z) \<in> r; (z, u) \<in> r\<^sup>*; \<And>y. (y, u) \<in> r\<^sup>* \<Longrightarrow> Ex (is_lub (r\<^sup>*) z y); (ya, u) \<in> r\<^sup>*\<rbrakk> \<Longrightarrow> Ex (is_lub (r\<^sup>*) y ya)
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:
(y, u) \<in> r\<^sup>*

goal (2 subgoals):
 1. \<And>y. (y, u) \<in> r\<^sup>* \<Longrightarrow> Ex (is_lub (r\<^sup>*) u y)
 2. \<And>y z ya. \<lbrakk>(y, z) \<in> r; (z, u) \<in> r\<^sup>*; \<And>y. (y, u) \<in> r\<^sup>* \<Longrightarrow> Ex (is_lub (r\<^sup>*) z y); (ya, u) \<in> r\<^sup>*\<rbrakk> \<Longrightarrow> Ex (is_lub (r\<^sup>*) y ya)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(y, u) \<in> r\<^sup>*
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(y, u) \<in> r\<^sup>*

goal (1 subgoal):
 1. \<exists>a. is_lub (r\<^sup>*) u y a
[PROOF STEP]
by (induct rule: converse_rtrancl_induct)
    (blast, blast intro: converse_rtrancl_into_rtrancl)
[PROOF STATE]
proof (state)
this:
\<exists>a. is_lub (r\<^sup>*) u y a

goal (1 subgoal):
 1. \<And>y z ya. \<lbrakk>(y, z) \<in> r; (z, u) \<in> r\<^sup>*; \<And>y. (y, u) \<in> r\<^sup>* \<Longrightarrow> Ex (is_lub (r\<^sup>*) z y); (ya, u) \<in> r\<^sup>*\<rbrakk> \<Longrightarrow> Ex (is_lub (r\<^sup>*) y ya)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y z ya. \<lbrakk>(y, z) \<in> r; (z, u) \<in> r\<^sup>*; \<And>y. (y, u) \<in> r\<^sup>* \<Longrightarrow> Ex (is_lub (r\<^sup>*) z y); (ya, u) \<in> r\<^sup>*\<rbrakk> \<Longrightarrow> Ex (is_lub (r\<^sup>*) y ya)
[PROOF STEP]
case step
[PROOF STATE]
proof (state)
this:
(y_, z_) \<in> r
(z_, u) \<in> r\<^sup>*
(?y, u) \<in> r\<^sup>* \<Longrightarrow> \<exists>a. is_lub (r\<^sup>*) z_ ?y a
(y, u) \<in> r\<^sup>*

goal (1 subgoal):
 1. \<And>y z ya. \<lbrakk>(y, z) \<in> r; (z, u) \<in> r\<^sup>*; \<And>y. (y, u) \<in> r\<^sup>* \<Longrightarrow> Ex (is_lub (r\<^sup>*) z y); (ya, u) \<in> r\<^sup>*\<rbrakk> \<Longrightarrow> Ex (is_lub (r\<^sup>*) y ya)
[PROOF STEP]
with \<open>single_valued r\<close>
[PROOF STATE]
proof (chain)
picking this:
single_valued r
(y_, z_) \<in> r
(z_, u) \<in> r\<^sup>*
(?y, u) \<in> r\<^sup>* \<Longrightarrow> \<exists>a. is_lub (r\<^sup>*) z_ ?y a
(y, u) \<in> r\<^sup>*
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
single_valued r
(y_, z_) \<in> r
(z_, u) \<in> r\<^sup>*
(?y, u) \<in> r\<^sup>* \<Longrightarrow> \<exists>a. is_lub (r\<^sup>*) z_ ?y a
(y, u) \<in> r\<^sup>*

goal (1 subgoal):
 1. \<exists>a. is_lub (r\<^sup>*) y_ y a
[PROOF STEP]
by (blast intro: extend_lub)
[PROOF STATE]
proof (state)
this:
\<exists>a. is_lub (r\<^sup>*) y_ y a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma leadsETo_weaken_R:
     "[| F \<in> A leadsTo[CC] A';  A'<=B' |] ==> F \<in> A leadsTo[CC] B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> A leadsTo[CC] A'; A' \<subseteq> B'\<rbrakk> \<Longrightarrow> F \<in> A leadsTo[CC] B'
[PROOF STEP]
by (blast intro: subset_imp_leadsETo leadsETo_Trans)


[STATEMENT]
lemma cos_a_c: "cos (\<angle>a z1 z2) = abs (cos (\<angle>c z1 z2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
have "0 \<le> \<angle>c z1 z2" "\<angle>c z1 z2 \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<angle>c z1 z2 &&& \<angle>c z1 z2 \<le> pi
[PROOF STEP]
using ang_vec_c_bounded[of z1 z2]
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<angle>c z1 z2 \<and> \<angle>c z1 z2 \<le> pi

goal (1 subgoal):
 1. 0 \<le> \<angle>c z1 z2 &&& \<angle>c z1 z2 \<le> pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> \<angle>c z1 z2
\<angle>c z1 z2 \<le> pi

goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
proof (cases "\<angle>c z1 z2 = pi/2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<angle>c z1 z2 = pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
 2. \<angle>c z1 z2 \<noteq> pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<angle>c z1 z2 = pi / 2

goal (2 subgoals):
 1. \<angle>c z1 z2 = pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
 2. \<angle>c z1 z2 \<noteq> pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<angle>c z1 z2 = pi / 2

goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
unfolding ang_vec_a_def acute_ang_def
[PROOF STATE]
proof (prove)
using this:
\<angle>c z1 z2 = pi / 2

goal (1 subgoal):
 1. cos (if pi / 2 < \<angle>c z1 z2 then pi - \<angle>c z1 z2 else \<angle>c z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
by (smt cos_pi_half pi_def pi_half)
[PROOF STATE]
proof (state)
this:
cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>

goal (1 subgoal):
 1. \<angle>c z1 z2 \<noteq> pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<angle>c z1 z2 \<noteq> pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<angle>c z1 z2 \<noteq> pi / 2

goal (1 subgoal):
 1. \<angle>c z1 z2 \<noteq> pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
proof (cases "\<angle>c z1 z2 < pi / 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
 2. \<not> \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<angle>c z1 z2 < pi / 2

goal (2 subgoals):
 1. \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
 2. \<not> \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<angle>c z1 z2 < pi / 2

goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
using \<open>0 \<le> \<angle>c z1 z2\<close>
[PROOF STATE]
proof (prove)
using this:
\<angle>c z1 z2 < pi / 2
0 \<le> \<angle>c z1 z2

goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
using cos_gt_zero_pi[of "\<angle>c z1 z2"]
[PROOF STATE]
proof (prove)
using this:
\<angle>c z1 z2 < pi / 2
0 \<le> \<angle>c z1 z2
\<lbrakk>- (pi / 2) < \<angle>c z1 z2; \<angle>c z1 z2 < pi / 2\<rbrakk> \<Longrightarrow> 0 < cos (\<angle>c z1 z2)

goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
unfolding ang_vec_a_def
[PROOF STATE]
proof (prove)
using this:
\<angle>c z1 z2 < pi / 2
0 \<le> \<angle>c z1 z2
\<lbrakk>- (pi / 2) < \<angle>c z1 z2; \<angle>c z1 z2 < pi / 2\<rbrakk> \<Longrightarrow> 0 < cos (\<angle>c z1 z2)

goal (1 subgoal):
 1. cos (acute_ang (\<angle>c z1 z2)) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>

goal (1 subgoal):
 1. \<not> \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> \<angle>c z1 z2 < pi / 2

goal (1 subgoal):
 1. \<not> \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
hence "\<angle>c z1 z2 > pi/2"
[PROOF STATE]
proof (prove)
using this:
\<not> \<angle>c z1 z2 < pi / 2

goal (1 subgoal):
 1. pi / 2 < \<angle>c z1 z2
[PROOF STEP]
using \<open>\<angle>c z1 z2 \<noteq> pi/2\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> \<angle>c z1 z2 < pi / 2
\<angle>c z1 z2 \<noteq> pi / 2

goal (1 subgoal):
 1. pi / 2 < \<angle>c z1 z2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pi / 2 < \<angle>c z1 z2

goal (1 subgoal):
 1. \<not> \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
hence "cos (\<angle>c z1 z2) < 0"
[PROOF STATE]
proof (prove)
using this:
pi / 2 < \<angle>c z1 z2

goal (1 subgoal):
 1. cos (\<angle>c z1 z2) < 0
[PROOF STEP]
using \<open>\<angle>c z1 z2 \<le> pi\<close>
[PROOF STATE]
proof (prove)
using this:
pi / 2 < \<angle>c z1 z2
\<angle>c z1 z2 \<le> pi

goal (1 subgoal):
 1. cos (\<angle>c z1 z2) < 0
[PROOF STEP]
using cos_lt_zero_on_pi2_pi[of "\<angle>c z1 z2"]
[PROOF STATE]
proof (prove)
using this:
pi / 2 < \<angle>c z1 z2
\<angle>c z1 z2 \<le> pi
\<lbrakk>pi / 2 < \<angle>c z1 z2; \<angle>c z1 z2 \<le> pi\<rbrakk> \<Longrightarrow> cos (\<angle>c z1 z2) < 0

goal (1 subgoal):
 1. cos (\<angle>c z1 z2) < 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cos (\<angle>c z1 z2) < 0

goal (1 subgoal):
 1. \<not> \<angle>c z1 z2 < pi / 2 \<Longrightarrow> cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
cos (\<angle>c z1 z2) < 0

goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
using \<open>\<angle>c z1 z2 > pi/2\<close>
[PROOF STATE]
proof (prove)
using this:
cos (\<angle>c z1 z2) < 0
pi / 2 < \<angle>c z1 z2

goal (1 subgoal):
 1. cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
unfolding ang_vec_a_def
[PROOF STATE]
proof (prove)
using this:
cos (\<angle>c z1 z2) < 0
pi / 2 < \<angle>c z1 z2

goal (1 subgoal):
 1. cos (acute_ang (\<angle>c z1 z2)) = \<bar>cos (\<angle>c z1 z2)\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (\<angle>a z1 z2) = \<bar>cos (\<angle>c z1 z2)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma swap_identical_length:
  assumes
    "i < j" and
    "j < length t"
  shows
    "length t = length (swap_events i j t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length t = length (swap_events i j t)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length t = length (swap_events i j t)
[PROOF STEP]
have "length (take i t @ [t ! j, t ! i] @ take (j - (i+1)) (drop (i+1) t))
      = length (take i t) + length [t ! j, t ! i] + length (take (j - (i+1)) (drop (i+1) t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (take i t @ [t ! j, t ! i] @ take (j - (i + 1)) (drop (i + 1) t)) = length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (take i t @ [t ! j, t ! i] @ take (j - (i + 1)) (drop (i + 1) t)) = length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t))

goal (1 subgoal):
 1. length t = length (swap_events i j t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (take i t @ [t ! j, t ! i] @ take (j - (i + 1)) (drop (i + 1) t)) = length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t))
[PROOF STEP]
have "... = j+1"
[PROOF STATE]
proof (prove)
using this:
length (take i t @ [t ! j, t ! i] @ take (j - (i + 1)) (drop (i + 1) t)) = length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t))

goal (1 subgoal):
 1. length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t)) = j + 1
[PROOF STEP]
using assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
length (take i t @ [t ! j, t ! i] @ take (j - (i + 1)) (drop (i + 1) t)) = length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t))
i < j
j < length t

goal (1 subgoal):
 1. length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t)) = j + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t)) = j + 1

goal (1 subgoal):
 1. length t = length (swap_events i j t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t)) = j + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t)) = j + 1

goal (1 subgoal):
 1. length t = length (swap_events i j t)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
length (take i t) + length [t ! j, t ! i] + length (take (j - (i + 1)) (drop (i + 1) t)) = j + 1
j < length t

goal (1 subgoal):
 1. length t = length (swap_events i j t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length t = length (swap_events i j t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma halfspace_eq_empty_lt:
   "{x. a \<bullet> x < b} = {} \<longleftrightarrow> a = 0 \<and> b \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x. a \<bullet> x < b} = {}) = (a = (0::'a) \<and> b \<le> 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ({x. a \<bullet> x < b} = {}) = (a = (0::'a) \<and> b \<le> 0)
[PROOF STEP]
have "a = 0 \<and> b \<le> 0" if "{x. a \<bullet> x < b} \<subseteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = (0::'a) \<and> b \<le> 0
[PROOF STEP]
using subsetD [OF that, where c = "((b-1) / (a \<bullet> a)) *\<^sub>R a"]
[PROOF STATE]
proof (prove)
using this:
((b - 1) / (a \<bullet> a)) *\<^sub>R a \<in> {x. a \<bullet> x < b} \<Longrightarrow> ((b - 1) / (a \<bullet> a)) *\<^sub>R a \<in> {}

goal (1 subgoal):
 1. a = (0::'a) \<and> b \<le> 0
[PROOF STEP]
by (force simp add: field_split_simps split: if_split_asm)
[PROOF STATE]
proof (state)
this:
{x. a \<bullet> x < b} \<subseteq> {} \<Longrightarrow> a = (0::'a) \<and> b \<le> 0

goal (1 subgoal):
 1. ({x. a \<bullet> x < b} = {}) = (a = (0::'a) \<and> b \<le> 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x. a \<bullet> x < b} \<subseteq> {} \<Longrightarrow> a = (0::'a) \<and> b \<le> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x. a \<bullet> x < b} \<subseteq> {} \<Longrightarrow> a = (0::'a) \<and> b \<le> 0

goal (1 subgoal):
 1. ({x. a \<bullet> x < b} = {}) = (a = (0::'a) \<and> b \<le> 0)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
({x. a \<bullet> x < b} = {}) = (a = (0::'a) \<and> b \<le> 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_eq_card:
  assumes BV: "span B = span V" and B: "independent B"
  shows "dim V = card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim V = card B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim V = card B
[PROOF STEP]
define p where "p b \<equiv> independent b \<and> span b = span V" for b
[PROOF STATE]
proof (state)
this:
p ?b \<equiv> independent ?b \<and> span ?b = span V

goal (1 subgoal):
 1. dim V = card B
[PROOF STEP]
have "p (SOME B. p B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p (SOME B. p B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
span B = span V
independent B

goal (1 subgoal):
 1. p (SOME B. p B)
[PROOF STEP]
by (intro someI[of p B]) (auto simp: p_def)
[PROOF STATE]
proof (state)
this:
p (SOME B. p B)

goal (1 subgoal):
 1. dim V = card B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p (SOME B. p B)
[PROOF STEP]
have "\<exists>f. bij_betw f B (SOME B. p B)"
[PROOF STATE]
proof (prove)
using this:
p (SOME B. p B)

goal (1 subgoal):
 1. \<exists>f. bij_betw f B (SOME B. p B)
[PROOF STEP]
by (subst (asm) p_def, intro bij_if_span_eq_span_bases[OF B]) (simp_all add: BV)
[PROOF STATE]
proof (state)
this:
\<exists>f. bij_betw f B (SOME B. p B)

goal (1 subgoal):
 1. dim V = card B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>f. bij_betw f B (SOME B. p B)
[PROOF STEP]
have "card B = card (SOME B. p B)"
[PROOF STATE]
proof (prove)
using this:
\<exists>f. bij_betw f B (SOME B. p B)

goal (1 subgoal):
 1. card B = card (SOME B. p B)
[PROOF STEP]
by (auto intro: bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card B = card (SOME B. p B)

goal (1 subgoal):
 1. dim V = card B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card B = card (SOME B. p B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card B = card (SOME B. p B)

goal (1 subgoal):
 1. dim V = card B
[PROOF STEP]
using BV B
[PROOF STATE]
proof (prove)
using this:
card B = card (SOME B. p B)
span B = span V
independent B

goal (1 subgoal):
 1. dim V = card B
[PROOF STEP]
by (auto simp add: dim_def p_def)
[PROOF STATE]
proof (state)
this:
dim V = card B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compatible_complement_pair2:
  assumes [simp]: \<open>compatible F G\<close>
  shows \<open>compatible G (complement (F;G))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compatible G (complement (F;G))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compatible G (complement (F;G))
[PROOF STEP]
have \<open>compatible (F;G) (complement (F;G))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compatible (F;G) (complement (F;G))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
compatible (F;G) (complement (F;G))

goal (1 subgoal):
 1. compatible G (complement (F;G))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compatible (F;G) (complement (F;G))
[PROOF STEP]
have \<open>compatible ((F;G) o Snd) (complement (F;G))\<close>
[PROOF STATE]
proof (prove)
using this:
compatible (F;G) (complement (F;G))

goal (1 subgoal):
 1. compatible ((F;G) \<circ> Snd) (complement (F;G))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
compatible ((F;G) \<circ> Snd) (complement (F;G))

goal (1 subgoal):
 1. compatible G (complement (F;G))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compatible ((F;G) \<circ> Snd) (complement (F;G))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
compatible ((F;G) \<circ> Snd) (complement (F;G))

goal (1 subgoal):
 1. compatible G (complement (F;G))
[PROOF STEP]
by (auto simp: register_pair_Snd)
[PROOF STATE]
proof (state)
this:
compatible G (complement (F;G))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_witness_generat1:
  assumes "rel_generat A C R x y"
  shows "rel_generat (\<lambda>a (a', b). a = a' \<and> A a' b) (\<lambda>c (c', d). c = c' \<and> C c' d) (\<lambda>r (r', s). r = r' \<and> R r' s) x (rel_witness_generat (x, y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_generat (\<lambda>a (a', b). a = a' \<and> A a' b) (\<lambda>c (c', d). c = c' \<and> C c' d) (\<lambda>r (r', s). r = r' \<and> R r' s) x (rel_witness_generat (x, y))
[PROOF STEP]
using map1_rel_witness_generat[OF assms, symmetric]
[PROOF STATE]
proof (prove)
using this:
x = map_generat fst fst fst (rel_witness_generat (x, y))

goal (1 subgoal):
 1. rel_generat (\<lambda>a (a', b). a = a' \<and> A a' b) (\<lambda>c (c', d). c = c' \<and> C c' d) (\<lambda>r (r', s). r = r' \<and> R r' s) x (rel_witness_generat (x, y))
[PROOF STEP]
unfolding generat.rel_eq[symmetric] generat.rel_map
[PROOF STATE]
proof (prove)
using this:
rel_generat (\<lambda>x y. x = fst y) (\<lambda>x y. x = fst y) (\<lambda>x y. x = fst y) x (rel_witness_generat (x, y))

goal (1 subgoal):
 1. rel_generat (\<lambda>a (a', b). a = a' \<and> A a' b) (\<lambda>c (c', d). c = c' \<and> C c' d) (\<lambda>r (r', s). r = r' \<and> R r' s) x (rel_witness_generat (x, y))
[PROOF STEP]
by(rule generat.rel_mono_strong)(auto dest: set_rel_witness_generat[OF assms, THEN subsetD])


[STATEMENT]
lemma ex_cos_gt:
  assumes "-pi/2 \<le> \<alpha> \<and> \<alpha> \<le> pi/2"
  assumes "a < 1"
  shows "\<exists> \<alpha>'. -pi/2 \<le> \<alpha>' \<and> \<alpha>' \<le> pi/2 \<and> \<alpha>' \<noteq> \<alpha> \<and> cos (\<alpha> - \<alpha>') > a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<alpha>'\<ge>- pi / 2. \<alpha>' \<le> pi / 2 \<and> \<alpha>' \<noteq> \<alpha> \<and> a < cos (\<alpha> - \<alpha>')
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<alpha>'\<ge>- pi / 2. \<alpha>' \<le> pi / 2 \<and> \<alpha>' \<noteq> \<alpha> \<and> a < cos (\<alpha> - \<alpha>')
[PROOF STEP]
obtain a' where "a' \<ge> 0" "a' > a" "a' < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a'. \<lbrakk>0 \<le> a'; a < a'; a' < 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms(2) dense_le_bounded linear not_one_le_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> a'
a < a'
a' < 1

goal (1 subgoal):
 1. \<exists>\<alpha>'\<ge>- pi / 2. \<alpha>' \<le> pi / 2 \<and> \<alpha>' \<noteq> \<alpha> \<and> a < cos (\<alpha> - \<alpha>')
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> a'
a < a'
a' < 1

goal (1 subgoal):
 1. \<exists>\<alpha>'\<ge>- pi / 2. \<alpha>' \<le> pi / 2 \<and> \<alpha>' \<noteq> \<alpha> \<and> a < cos (\<alpha> - \<alpha>')
[PROOF STEP]
using ex_cos_eq[of \<alpha> a'] assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> a'
a < a'
a' < 1
\<lbrakk>- pi / 2 \<le> \<alpha> \<and> \<alpha> \<le> pi / 2; 0 \<le> a'; a' < 1\<rbrakk> \<Longrightarrow> \<exists>\<alpha>'\<ge>- pi / 2. \<alpha>' \<le> pi / 2 \<and> \<alpha>' \<noteq> \<alpha> \<and> cos (\<alpha> - \<alpha>') = a'
- pi / 2 \<le> \<alpha> \<and> \<alpha> \<le> pi / 2
a < 1

goal (1 subgoal):
 1. \<exists>\<alpha>'\<ge>- pi / 2. \<alpha>' \<le> pi / 2 \<and> \<alpha>' \<noteq> \<alpha> \<and> a < cos (\<alpha> - \<alpha>')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>\<alpha>'\<ge>- pi / 2. \<alpha>' \<le> pi / 2 \<and> \<alpha>' \<noteq> \<alpha> \<and> a < cos (\<alpha> - \<alpha>')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma restricted_graph_subset':
  assumes "g \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow> carrier Q\<^sub>p"
  assumes "S \<subseteq> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "restricted_graph n g S \<subseteq> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restricted_graph n g S \<subseteq> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> restricted_graph n g S \<Longrightarrow> x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> restricted_graph n g S \<Longrightarrow> x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
assume A: "a \<in> restricted_graph n g S"
[PROOF STATE]
proof (state)
this:
a \<in> restricted_graph n g S

goal (1 subgoal):
 1. \<And>x. x \<in> restricted_graph n g S \<Longrightarrow> x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> restricted_graph n g S
[PROOF STEP]
have "a = (take n a)@[g (take n a)]"
[PROOF STATE]
proof (prove)
using this:
a \<in> restricted_graph n g S

goal (1 subgoal):
 1. a = take n a @ [g (take n a)]
[PROOF STEP]
using restricted_graph_mem_formula
[PROOF STATE]
proof (prove)
using this:
a \<in> restricted_graph n g S
?a \<in> restricted_graph ?n ?g ?S \<Longrightarrow> ?a = take ?n ?a @ [?g (take ?n ?a)]

goal (1 subgoal):
 1. a = take n a @ [g (take n a)]
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a = take n a @ [g (take n a)]

goal (1 subgoal):
 1. \<And>x. x \<in> restricted_graph n g S \<Longrightarrow> x \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = take n a @ [g (take n a)]
[PROOF STEP]
show "a \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))"
[PROOF STATE]
proof (prove)
using this:
a = take n a @ [g (take n a)]

goal (1 subgoal):
 1. a \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
using cartesian_product_memI' A
[PROOF STATE]
proof (prove)
using this:
a = take n a @ [g (take n a)]
\<lbrakk>?A \<subseteq> carrier (?R\<^bsup>?n\<^esup>); ?B \<subseteq> carrier (?R\<^bsup>?m\<^esup>); ?a \<in> ?A; ?b \<in> ?B\<rbrakk> \<Longrightarrow> ?a @ ?b \<in> cartesian_product ?A ?B
a \<in> restricted_graph n g S

goal (1 subgoal):
 1. a \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
unfolding restricted_graph_def
[PROOF STATE]
proof (prove)
using this:
a = take n a @ [g (take n a)]
\<lbrakk>?A \<subseteq> carrier (?R\<^bsup>?n\<^esup>); ?B \<subseteq> carrier (?R\<^bsup>?m\<^esup>); ?a \<in> ?A; ?b \<in> ?B\<rbrakk> \<Longrightarrow> ?a @ ?b \<in> cartesian_product ?A ?B
a \<in> {as \<in> carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>). take n as \<in> S \<and> g (take n as) = as ! n}

goal (1 subgoal):
 1. a \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))
[PROOF STEP]
by (metis (mono_tags, lifting) assms(2) last_closed' mem_Collect_eq subsetI Qp.to_R1_closed)
[PROOF STATE]
proof (state)
this:
a \<in> cartesian_product S (carrier (Q\<^sub>p\<^bsup>1\<^esup>))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in PO) po_subset_po:
     "S \<subseteq> A ==> (| pset = S, order = induced S r |) \<in> PartialOrder"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> A \<Longrightarrow> \<lparr>pset = S, order = induced S r\<rparr> \<in> PartialOrder
[PROOF STEP]
apply (simp (no_asm) add: PartialOrder_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> A \<Longrightarrow> refl_on S (induced S r) \<and> antisym (induced S r) \<and> trans (induced S r)
[PROOF STEP]
apply auto
\<comment> \<open>refl\<close>
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. S \<subseteq> A \<Longrightarrow> refl_on S (induced S r)
 2. S \<subseteq> A \<Longrightarrow> antisym (induced S r)
 3. S \<subseteq> A \<Longrightarrow> trans (induced S r)
[PROOF STEP]
apply (simp add: refl_on_def induced_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. S \<subseteq> A \<Longrightarrow> {(a, b). a \<in> S \<and> b \<in> S \<and> (a, b) \<in> r} \<subseteq> S \<times> S \<and> (\<forall>x\<in>S. (x, x) \<in> r)
 2. S \<subseteq> A \<Longrightarrow> antisym (induced S r)
 3. S \<subseteq> A \<Longrightarrow> trans (induced S r)
[PROOF STEP]
apply (blast intro: reflE)
\<comment> \<open>antisym\<close>
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S \<subseteq> A \<Longrightarrow> antisym (induced S r)
 2. S \<subseteq> A \<Longrightarrow> trans (induced S r)
[PROOF STEP]
apply (simp add: antisym_def induced_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S \<subseteq> A \<Longrightarrow> \<forall>x y. x \<in> S \<and> y \<in> S \<and> (x, y) \<in> r \<longrightarrow> (y, x) \<in> r \<longrightarrow> x = y
 2. S \<subseteq> A \<Longrightarrow> trans (induced S r)
[PROOF STEP]
apply (blast intro: antisymE)
\<comment> \<open>trans\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> A \<Longrightarrow> trans (induced S r)
[PROOF STEP]
apply (simp add: trans_def induced_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> A \<Longrightarrow> \<forall>x y. x \<in> S \<and> y \<in> S \<and> (x, y) \<in> r \<longrightarrow> (\<forall>z. z \<in> S \<and> (y, z) \<in> r \<longrightarrow> (x, z) \<in> r)
[PROOF STEP]
apply (blast intro: transE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma assumes "w \<noteq> \<epsilon>" and "acyclic (rotate_rel w)" shows "\<not> bordered w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> bordered w
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> bordered w
[PROOF STEP]
obtain r where "strict_linear_order r" and "rotate_rel w \<subseteq> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. \<lbrakk>strict_linear_order r; rotate_rel w \<subseteq> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Lyndon_rotate_rel_iff assms
[PROOF STATE]
proof (prove)
using this:
acyclic (rotate_rel ?w) = (\<exists>r. strict_linear_order r \<and> rotate_rel ?w \<subseteq> r)
w \<noteq> \<epsilon>
acyclic (rotate_rel w)

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>strict_linear_order r; rotate_rel w \<subseteq> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
strict_linear_order r
rotate_rel w \<subseteq> r

goal (1 subgoal):
 1. \<not> bordered w
[PROOF STEP]
interpret r: linorder "\<lambda> a b. (a,b) \<in> r\<^sup>=" "\<lambda> a b. (a,b) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.linorder (\<lambda>a b. (a, b) \<in> r\<^sup>=) (\<lambda>a b. (a, b) \<in> r)
[PROOF STEP]
using slo_linorder[OF \<open>strict_linear_order r\<close>]
[PROOF STATE]
proof (prove)
using this:
class.linorder (\<lambda>a b. (a, b) \<in> r\<^sup>=) (\<lambda>a b. (a, b) \<in> r)

goal (1 subgoal):
 1. class.linorder (\<lambda>a b. (a, b) \<in> r\<^sup>=) (\<lambda>a b. (a, b) \<in> r)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> bordered w
[PROOF STEP]
have "r.Lyndon w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r.Lyndon w
[PROOF STEP]
using r.rotate_rel_iff[OF \<open>w \<noteq> \<epsilon>\<close>] \<open>rotate_rel w \<subseteq> r\<close>
[PROOF STATE]
proof (prove)
using this:
r.Lyndon w = (rotate_rel w \<subseteq> {(x, y). (x, y) \<in> r})
rotate_rel w \<subseteq> r

goal (1 subgoal):
 1. r.Lyndon w
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r.Lyndon w

goal (1 subgoal):
 1. \<not> bordered w
[PROOF STEP]
from r.Lyndon_unbordered[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<not> bordered w
[PROOF STEP]
show "\<not> bordered w"
[PROOF STATE]
proof (prove)
using this:
\<not> bordered w

goal (1 subgoal):
 1. \<not> bordered w
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<not> bordered w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma apply_cltn2_left_abs:
  assumes "v \<noteq> 0"
  shows "apply_cltn2 (proj2_abs v) C = proj2_abs (v v* cltn2_rep C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_cltn2 (proj2_abs v) C = proj2_abs (v v* cltn2_rep C)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. apply_cltn2 (proj2_abs v) C = proj2_abs (v v* cltn2_rep C)
[PROOF STEP]
have "cltn2_abs (cltn2_rep C) = C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cltn2_abs (cltn2_rep C) = C
[PROOF STEP]
by (rule cltn2_abs_rep)
[PROOF STATE]
proof (state)
this:
cltn2_abs (cltn2_rep C) = C

goal (1 subgoal):
 1. apply_cltn2 (proj2_abs v) C = proj2_abs (v v* cltn2_rep C)
[PROOF STEP]
with \<open>v \<noteq> 0\<close> and cltn2_rep_invertible and apply_cltn2_abs [of v "cltn2_rep C"]
[PROOF STATE]
proof (chain)
picking this:
v \<noteq> 0
invertible (cltn2_rep ?A)
\<lbrakk>v \<noteq> 0; invertible (cltn2_rep C)\<rbrakk> \<Longrightarrow> apply_cltn2 (proj2_abs v) (cltn2_abs (cltn2_rep C)) = proj2_abs (v v* cltn2_rep C)
cltn2_abs (cltn2_rep C) = C
[PROOF STEP]
show "apply_cltn2 (proj2_abs v) C = proj2_abs (v v* cltn2_rep C)"
[PROOF STATE]
proof (prove)
using this:
v \<noteq> 0
invertible (cltn2_rep ?A)
\<lbrakk>v \<noteq> 0; invertible (cltn2_rep C)\<rbrakk> \<Longrightarrow> apply_cltn2 (proj2_abs v) (cltn2_abs (cltn2_rep C)) = proj2_abs (v v* cltn2_rep C)
cltn2_abs (cltn2_rep C) = C

goal (1 subgoal):
 1. apply_cltn2 (proj2_abs v) C = proj2_abs (v v* cltn2_rep C)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
apply_cltn2 (proj2_abs v) C = proj2_abs (v v* cltn2_rep C)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uminus_interval_tendsto:
  fixes x :: "'a :: topological_group_add"
  assumes "X \<longlonglongrightarrow>\<^sub>i x"
  shows "(\<lambda>i. - X i) \<longlonglongrightarrow>\<^sub>i -x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. - X i) \<longlonglongrightarrow>\<^sub>i - x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>i. - X i) \<longlonglongrightarrow>\<^sub>i - x
[PROOF STEP]
have *: "- X i = Interval (- interval.upper (X i)) (- interval.lower (X i))" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - X i = Interval (- interval.upper (X i)) (- interval.lower (X i))
[PROOF STEP]
by (cases "X i", auto)
[PROOF STATE]
proof (state)
this:
- X ?i = Interval (- interval.upper (X ?i)) (- interval.lower (X ?i))

goal (1 subgoal):
 1. (\<lambda>i. - X i) \<longlonglongrightarrow>\<^sub>i - x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
X \<longlonglongrightarrow>\<^sub>i x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
X \<longlonglongrightarrow>\<^sub>i x

goal (1 subgoal):
 1. (\<lambda>i. - X i) \<longlonglongrightarrow>\<^sub>i - x
[PROOF STEP]
unfolding o_def * interval_tendsto_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. interval.upper (X x)) \<longlonglongrightarrow> x \<and> (\<lambda>x. interval.lower (X x)) \<longlonglongrightarrow> x

goal (1 subgoal):
 1. (\<lambda>x. interval.upper (Interval (- interval.upper (X x)) (- interval.lower (X x)))) \<longlonglongrightarrow> - x \<and> (\<lambda>x. interval.lower (Interval (- interval.upper (X x)) (- interval.lower (X x)))) \<longlonglongrightarrow> - x
[PROOF STEP]
by (auto intro: tendsto_intros)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. - X i) \<longlonglongrightarrow>\<^sub>i - x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_power_zero [tendsto_intros]: "norm x < 1 \<Longrightarrow> (\<lambda>n. x ^ n) \<longlonglongrightarrow> 0"
  for x :: "'a::real_normed_algebra_1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x < 1 \<Longrightarrow> (^) x \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
apply (drule LIMSEQ_realpow_zero [OF norm_ge_zero])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (^) (norm x) \<longlonglongrightarrow> 0 \<Longrightarrow> (^) x \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
by (simp add: Zfun_le norm_power_ineq tendsto_Zfun_iff)


[STATEMENT]
lemma imp_false:
    "[| H |- p;  H |- q->false |] ==> H |- (p->q)->false"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H |- p; H |- q -> false\<rbrakk> \<Longrightarrow> H |- (p -> q) -> false
[PROOF STEP]
apply (rule deduction)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H |- p; H |- q -> false\<rbrakk> \<Longrightarrow> insert (p -> q) H |- false
[PROOF STEP]
apply (metis H MP insert_iff weaken_left_insert)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma image_mset_eq_permutation:
  assumes "{#f x. x \<in># mset_set A#} = {#g x. x \<in># mset_set A#}" "finite A"
  obtains \<pi> where "\<pi> permutes A" "\<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
obtain xs where xs: "A = set xs" "distinct xs"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>A = set xs; distinct xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_distinct_list
[PROOF STATE]
proof (prove)
using this:
finite A
finite ?A \<Longrightarrow> \<exists>xs. set xs = ?A \<and> distinct xs

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>A = set xs; distinct xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A = set xs
distinct xs

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
image_mset f (mset_set A) = image_mset g (mset_set A)
finite A
A = set xs
distinct xs
[PROOF STEP]
have "mset (map f xs) = mset (map g xs)"
[PROOF STATE]
proof (prove)
using this:
image_mset f (mset_set A) = image_mset g (mset_set A)
finite A
A = set xs
distinct xs

goal (1 subgoal):
 1. mset (map f xs) = mset (map g xs)
[PROOF STEP]
by (simp add: mset_set_set)
[PROOF STATE]
proof (state)
this:
mset (map f xs) = mset (map g xs)

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from mset_eq_permutation[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>p. \<lbrakk>p permutes {..<length (map g xs)}; permute_list p (map g xs) = map f xs\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain \<pi> where
    \<pi>: "\<pi> permutes {0..<length xs}" "permute_list \<pi> (map g xs) = map f xs"
[PROOF STATE]
proof (prove)
using this:
(\<And>p. \<lbrakk>p permutes {..<length (map g xs)}; permute_list p (map g xs) = map f xs\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes {0..<length xs}; permute_list \<pi> (map g xs) = map f xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
\<pi> permutes {0..<length xs}
permute_list \<pi> (map g xs) = map f xs

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define \<pi>' where "\<pi>' x = (if x \<in> A then ((!) xs \<circ> \<pi> \<circ> index xs) x else x)" for x
[PROOF STATE]
proof (state)
this:
\<pi>' ?x = (if ?x \<in> A then ((!) xs \<circ> \<pi> \<circ> index xs) ?x else ?x)

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "bij_betw ((!) xs \<circ> \<pi> \<circ> index xs) A A" (is "?P")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((!) xs \<circ> \<pi> \<circ> index xs) A A
[PROOF STEP]
by (rule bij_betw_trans bij_betw_index xs refl permutes_imp_bij \<pi> bij_betw_nth)+
       (simp_all add: atLeast0LessThan xs)
[PROOF STATE]
proof (state)
this:
bij_betw ((!) xs \<circ> \<pi> \<circ> index xs) A A

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bij_betw ((!) xs \<circ> \<pi> \<circ> index xs) A A

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "?P \<longleftrightarrow> bij_betw \<pi>' A A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((!) xs \<circ> \<pi> \<circ> index xs) A A = bij_betw \<pi>' A A
[PROOF STEP]
by (intro bij_betw_cong) (simp_all add: \<pi>'_def)
[PROOF STATE]
proof (state)
this:
bij_betw ((!) xs \<circ> \<pi> \<circ> index xs) A A = bij_betw \<pi>' A A

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bij_betw \<pi>' A A
[PROOF STEP]
have "\<pi>' permutes A"
[PROOF STATE]
proof (prove)
using this:
bij_betw \<pi>' A A

goal (1 subgoal):
 1. \<pi>' permutes A
[PROOF STEP]
by (rule bij_imp_permutes) (simp_all add: \<pi>'_def)
[PROOF STATE]
proof (state)
this:
\<pi>' permutes A

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<pi>' permutes A

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from \<pi> xs(1)[symmetric] xs(2)
[PROOF STATE]
proof (chain)
picking this:
\<pi> permutes {0..<length xs}
permute_list \<pi> (map g xs) = map f xs
set xs = A
distinct xs
[PROOF STEP]
have "g (\<pi>' x) = f x" if "x \<in> A" for x
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes {0..<length xs}
permute_list \<pi> (map g xs) = map f xs
set xs = A
distinct xs

goal (1 subgoal):
 1. g (\<pi>' x) = f x
[PROOF STEP]
by (simp add: permute_list_map permute_list_distinct
          permutes_image \<pi>'_def that atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
?x \<in> A \<Longrightarrow> g (\<pi>' ?x) = f ?x

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes A; \<And>x. x \<in> A \<Longrightarrow> g (\<pi> x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<pi>' permutes A
?x \<in> A \<Longrightarrow> g (\<pi>' ?x) = f ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<pi>' permutes A
?x \<in> A \<Longrightarrow> g (\<pi>' ?x) = f ?x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tan_periodic_nat[simp]: "tan (x + real n * pi) = tan x"
  for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (x + real n * pi) = tan x
[PROOF STEP]
proof (induct n arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. tan (x + real 0 * pi) = tan x
 2. \<And>n x. (\<And>x. tan (x + real n * pi) = tan x) \<Longrightarrow> tan (x + real (Suc n) * pi) = tan x
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x. tan (x + real 0 * pi) = tan x
 2. \<And>n x. (\<And>x. tan (x + real n * pi) = tan x) \<Longrightarrow> tan (x + real (Suc n) * pi) = tan x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (x + real 0 * pi) = tan x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
tan (x + real 0 * pi) = tan x

goal (1 subgoal):
 1. \<And>n x. (\<And>x. tan (x + real n * pi) = tan x) \<Longrightarrow> tan (x + real (Suc n) * pi) = tan x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n x. (\<And>x. tan (x + real n * pi) = tan x) \<Longrightarrow> tan (x + real (Suc n) * pi) = tan x
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
tan (?x + real n * pi) = tan ?x

goal (1 subgoal):
 1. \<And>n x. (\<And>x. tan (x + real n * pi) = tan x) \<Longrightarrow> tan (x + real (Suc n) * pi) = tan x
[PROOF STEP]
have split_pi_off: "x + real (Suc n) * pi = (x + real n * pi) + pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + real (Suc n) * pi = x + real n * pi + pi
[PROOF STEP]
unfolding Suc_eq_plus1 of_nat_add  distrib_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + (real n * pi + real 1 * pi) = x + real n * pi + pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x + real (Suc n) * pi = x + real n * pi + pi

goal (1 subgoal):
 1. \<And>n x. (\<And>x. tan (x + real n * pi) = tan x) \<Longrightarrow> tan (x + real (Suc n) * pi) = tan x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (x + real (Suc n) * pi) = tan x
[PROOF STEP]
unfolding split_pi_off
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (x + real n * pi + pi) = tan x
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
tan (?x + real n * pi) = tan ?x

goal (1 subgoal):
 1. tan (x + real n * pi + pi) = tan x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
tan (x + real (Suc n) * pi) = tan x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vsubset_vdoubleton_leftD[dest]:
  assumes "set {a, b} \<subseteq>\<^sub>\<circ> A"
  shows "a \<in>\<^sub>\<circ> A" and "b \<in>\<^sub>\<circ> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in>\<^sub>\<circ> A &&& b \<in>\<^sub>\<circ> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set {a, b} \<subseteq>\<^sub>\<circ> A

goal (1 subgoal):
 1. a \<in>\<^sub>\<circ> A &&& b \<in>\<^sub>\<circ> A
[PROOF STEP]
by auto


[STATEMENT]
lemma Vfrom_mono1:
  assumes "a \<le> b" shows "Vfrom a i \<le> Vfrom b i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Vfrom a i \<le> Vfrom b i
[PROOF STEP]
proof (induction i rule: eps_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<And>y. y \<in> elts x \<Longrightarrow> Vfrom a y \<le> Vfrom b y) \<Longrightarrow> Vfrom a x \<le> Vfrom b x
[PROOF STEP]
case (step i)
[PROOF STATE]
proof (state)
this:
?y \<in> elts i \<Longrightarrow> Vfrom a ?y \<le> Vfrom b ?y

goal (1 subgoal):
 1. \<And>x. (\<And>y. y \<in> elts x \<Longrightarrow> Vfrom a y \<le> Vfrom b y) \<Longrightarrow> Vfrom a x \<le> Vfrom b x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y \<in> elts i \<Longrightarrow> Vfrom a ?y \<le> Vfrom b ?y
[PROOF STEP]
have "a \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom a j)) \<le> b \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom b j))"
[PROOF STATE]
proof (prove)
using this:
?y \<in> elts i \<Longrightarrow> Vfrom a ?y \<le> Vfrom b ?y

goal (1 subgoal):
 1. a \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom a j)) \<le> b \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom b j))
[PROOF STEP]
by (intro sup_mono cSUP_subset_mono \<open>a \<le> b\<close>) auto
[PROOF STATE]
proof (state)
this:
a \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom a j)) \<le> b \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom b j))

goal (1 subgoal):
 1. \<And>x. (\<And>y. y \<in> elts x \<Longrightarrow> Vfrom a y \<le> Vfrom b y) \<Longrightarrow> Vfrom a x \<le> Vfrom b x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom a j)) \<le> b \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom b j))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom a j)) \<le> b \<squnion> (\<Squnion>j\<in>elts i. VPow (Vfrom b j))

goal (1 subgoal):
 1. Vfrom a i \<le> Vfrom b i
[PROOF STEP]
by (metis Vfrom)
[PROOF STATE]
proof (state)
this:
Vfrom a i \<le> Vfrom b i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in monoid) inv_unique:
  assumes eq: "y \<otimes> x = \<one>"  "x \<otimes> y' = \<one>"
    and G: "x \<in> carrier G"  "y \<in> carrier G"  "y' \<in> carrier G"
  shows "y = y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = y'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y = y'
[PROOF STEP]
from G eq
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
y' \<in> carrier G
y \<otimes> x = \<one>
x \<otimes> y' = \<one>
[PROOF STEP]
have "y = y \<otimes> (x \<otimes> y')"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G
y' \<in> carrier G
y \<otimes> x = \<one>
x \<otimes> y' = \<one>

goal (1 subgoal):
 1. y = y \<otimes> (x \<otimes> y')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y = y \<otimes> (x \<otimes> y')

goal (1 subgoal):
 1. y = y'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y = y \<otimes> (x \<otimes> y')

goal (1 subgoal):
 1. y = y'
[PROOF STEP]
from G
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
y' \<in> carrier G
[PROOF STEP]
have "... = (y \<otimes> x) \<otimes> y'"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G
y' \<in> carrier G

goal (1 subgoal):
 1. y \<otimes> (x \<otimes> y') = y \<otimes> x \<otimes> y'
[PROOF STEP]
by (simp add: m_assoc)
[PROOF STATE]
proof (state)
this:
y \<otimes> (x \<otimes> y') = y \<otimes> x \<otimes> y'

goal (1 subgoal):
 1. y = y'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y \<otimes> (x \<otimes> y') = y \<otimes> x \<otimes> y'

goal (1 subgoal):
 1. y = y'
[PROOF STEP]
from G eq
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
y' \<in> carrier G
y \<otimes> x = \<one>
x \<otimes> y' = \<one>
[PROOF STEP]
have "... = y'"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G
y' \<in> carrier G
y \<otimes> x = \<one>
x \<otimes> y' = \<one>

goal (1 subgoal):
 1. y \<otimes> x \<otimes> y' = y'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y \<otimes> x \<otimes> y' = y'

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lc_uminus [simp]: "lc (- p) = - lc p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lc (- p) = - lc p
[PROOF STEP]
by (simp add: lc_def)


[STATEMENT]
lemma (in finite_measure) measure_real_sum_image_fn:
  assumes "e \<in> sets M"
  assumes "\<And> x. x \<in> s \<Longrightarrow> e \<inter> f x \<in> sets M"
  assumes "finite s"
  assumes disjoint: "\<And> x y. \<lbrakk>x \<in> s ; y \<in> s ; x \<noteq> y\<rbrakk> \<Longrightarrow> f x \<inter> f y = {}"
  assumes upper: "space M \<subseteq> (\<Union>i \<in> s. f i)"
  shows "measure M e = (\<Sum> x \<in> s. measure M (e \<inter> f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
have "e \<subseteq> (\<Union>i\<in>s. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e \<subseteq> \<Union> (f ` s)
[PROOF STEP]
using \<open>e \<in> sets M\<close> sets.sets_into_space upper
[PROOF STATE]
proof (prove)
using this:
e \<in> sets M
?x \<in> sets ?M \<Longrightarrow> ?x \<subseteq> space ?M
space M \<subseteq> \<Union> (f ` s)

goal (1 subgoal):
 1. e \<subseteq> \<Union> (f ` s)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
e \<subseteq> \<Union> (f ` s)

goal (1 subgoal):
 1. Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e \<subseteq> \<Union> (f ` s)
[PROOF STEP]
have e: "e = (\<Union>i \<in> s. e \<inter> f i)"
[PROOF STATE]
proof (prove)
using this:
e \<subseteq> \<Union> (f ` s)

goal (1 subgoal):
 1. e = (\<Union>i\<in>s. e \<inter> f i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e = (\<Union>i\<in>s. e \<inter> f i)

goal (1 subgoal):
 1. Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
hence "measure M e = measure M (\<Union>i \<in> s. e \<inter> f i)"
[PROOF STATE]
proof (prove)
using this:
e = (\<Union>i\<in>s. e \<inter> f i)

goal (1 subgoal):
 1. Sigma_Algebra.measure M e = Sigma_Algebra.measure M (\<Union>i\<in>s. e \<inter> f i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M e = Sigma_Algebra.measure M (\<Union>i\<in>s. e \<inter> f i)

goal (1 subgoal):
 1. Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M e = Sigma_Algebra.measure M (\<Union>i\<in>s. e \<inter> f i)

goal (1 subgoal):
 1. Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
have "\<dots> = (\<Sum> x \<in> s. measure M (e \<inter> f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union>i\<in>s. e \<inter> f i) = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
proof (rule finite_measure_finite_Union)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite s
 2. (\<lambda>i. e \<inter> f i) ` s \<subseteq> sets M
 3. disjoint_family_on (\<lambda>i. e \<inter> f i) s
[PROOF STEP]
show "finite s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite s
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
finite s

goal (2 subgoals):
 1. (\<lambda>i. e \<inter> f i) ` s \<subseteq> sets M
 2. disjoint_family_on (\<lambda>i. e \<inter> f i) s
[PROOF STEP]
show "(\<lambda>i. e \<inter> f i)`s \<subseteq> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. e \<inter> f i) ` s \<subseteq> sets M
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
?x \<in> s \<Longrightarrow> e \<inter> f ?x \<in> sets M

goal (1 subgoal):
 1. (\<lambda>i. e \<inter> f i) ` s \<subseteq> sets M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. e \<inter> f i) ` s \<subseteq> sets M

goal (1 subgoal):
 1. disjoint_family_on (\<lambda>i. e \<inter> f i) s
[PROOF STEP]
show "disjoint_family_on (\<lambda>i. e \<inter> f i) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_family_on (\<lambda>i. e \<inter> f i) s
[PROOF STEP]
using disjoint
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> s; ?y \<in> s; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> f ?x \<inter> f ?y = {}

goal (1 subgoal):
 1. disjoint_family_on (\<lambda>i. e \<inter> f i) s
[PROOF STEP]
by (auto simp: disjoint_family_on_def)
[PROOF STATE]
proof (state)
this:
disjoint_family_on (\<lambda>i. e \<inter> f i) s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (\<Union>i\<in>s. e \<inter> f i) = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))

goal (1 subgoal):
 1. Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))

goal (1 subgoal):
 1. Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M e = (\<Sum>x\<in>s. Sigma_Algebra.measure M (e \<inter> f x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_derived_clauses_are_finite:
  shows "derivable_ecl C S \<Longrightarrow> \<forall>x \<in> S. (finite (cl_ecl x)) \<Longrightarrow> finite (cl_ecl C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
proof (induction rule: derivable_ecl.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>C S. \<lbrakk>C \<in> S; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
 2. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 3. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
fix C :: "'a eclause"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>C S. \<lbrakk>C \<in> S; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
 2. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 3. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>C S. \<lbrakk>C \<in> S; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
 2. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 3. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
assume "C \<in> S"
[PROOF STATE]
proof (state)
this:
C \<in> S

goal (3 subgoals):
 1. \<And>C S. \<lbrakk>C \<in> S; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
 2. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 3. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
assume "\<forall>x \<in> S. (finite (cl_ecl x))"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. finite (cl_ecl x)

goal (3 subgoals):
 1. \<And>C S. \<lbrakk>C \<in> S; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
 2. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 3. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
from this \<open>C \<in> S\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>S. finite (cl_ecl x)
C \<in> S
[PROOF STEP]
show "finite (cl_ecl C)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. finite (cl_ecl x)
C \<in> S

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

goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
fix C S
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
fix D :: "'a eclause"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
assume "derivable_ecl C S"
[PROOF STATE]
proof (state)
this:
derivable_ecl C S

goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
assume "\<forall>x \<in> S. (finite (cl_ecl x))"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. finite (cl_ecl x)

goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
assume hyp_ind: "\<forall>x \<in> S. (finite (cl_ecl x)) \<Longrightarrow> finite (cl_ecl C)"
    "(renaming_cl C D)"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C)
renaming_cl C D

goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
from \<open>(renaming_cl C D)\<close>
[PROOF STATE]
proof (chain)
picking this:
renaming_cl C D
[PROOF STEP]
obtain \<eta> where "D = (subst_ecl C \<eta>)"
[PROOF STATE]
proof (prove)
using this:
renaming_cl C D

goal (1 subgoal):
 1. (\<And>\<eta>. D = subst_ecl C \<eta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding renaming_cl_def
[PROOF STATE]
proof (prove)
using this:
\<exists>\<eta>. renaming \<eta> (vars_of_cl (cl_ecl C)) \<and> D = subst_ecl C \<eta>

goal (1 subgoal):
 1. (\<And>\<eta>. D = subst_ecl C \<eta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D = subst_ecl C \<eta>

goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
obtain C_Cl T where "C = (Ecl C_Cl T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C_Cl T. C = Ecl C_Cl T \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using "eclause.exhaust"
[PROOF STATE]
proof (prove)
using this:
(\<And>x1 x2. ?y = Ecl x1 x2 \<Longrightarrow> ?P) \<Longrightarrow> ?P

goal (1 subgoal):
 1. (\<And>C_Cl T. C = Ecl C_Cl T \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C = Ecl C_Cl T

goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
from this and \<open>D = (subst_ecl C \<eta>)\<close>
[PROOF STATE]
proof (chain)
picking this:
C = Ecl C_Cl T
D = subst_ecl C \<eta>
[PROOF STEP]
have "(cl_ecl D) = (subst_cl (cl_ecl C) \<eta>)"
[PROOF STATE]
proof (prove)
using this:
C = Ecl C_Cl T
D = subst_ecl C \<eta>

goal (1 subgoal):
 1. cl_ecl D = subst_cl (cl_ecl C) \<eta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cl_ecl D = subst_cl (cl_ecl C) \<eta>

goal (2 subgoals):
 1. \<And>C S D. \<lbrakk>derivable_ecl C S; \<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C); renaming_cl C D; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl D)
 2. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
from this hyp_ind \<open>\<forall>x \<in> S. (finite (cl_ecl x))\<close>
[PROOF STATE]
proof (chain)
picking this:
cl_ecl D = subst_cl (cl_ecl C) \<eta>
\<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C)
renaming_cl C D
\<forall>x\<in>S. finite (cl_ecl x)
[PROOF STEP]
show "finite (cl_ecl D)"
[PROOF STATE]
proof (prove)
using this:
cl_ecl D = subst_cl (cl_ecl C) \<eta>
\<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C)
renaming_cl C D
\<forall>x\<in>S. finite (cl_ecl x)

goal (1 subgoal):
 1. finite (cl_ecl D)
[PROOF STEP]
using substs_preserve_finiteness
[PROOF STATE]
proof (prove)
using this:
cl_ecl D = subst_cl (cl_ecl C) \<eta>
\<forall>x\<in>S. finite (cl_ecl x) \<Longrightarrow> finite (cl_ecl C)
renaming_cl C D
\<forall>x\<in>S. finite (cl_ecl x)
finite ?C \<Longrightarrow> finite (subst_cl ?C ?\<sigma>)

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

goal (1 subgoal):
 1. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
fix P S C S' \<sigma> C'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
assume h: "\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x))"
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x))

goal (1 subgoal):
 1. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
assume "derivable C P S' \<sigma> FirstOrder C'"
[PROOF STATE]
proof (state)
this:
derivable C P S' \<sigma> FirstOrder C'

goal (1 subgoal):
 1. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
assume "\<forall>x\<in>S. finite (cl_ecl x)"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. finite (cl_ecl x)

goal (1 subgoal):
 1. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
from h and \<open>\<forall>x\<in>S. finite (cl_ecl x)\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x))
\<forall>x\<in>S. finite (cl_ecl x)
[PROOF STEP]
have "\<forall>x \<in> P. (finite (cl_ecl x))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x))
\<forall>x\<in>S. finite (cl_ecl x)

goal (1 subgoal):
 1. \<forall>x\<in>P. finite (cl_ecl x)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>P. finite (cl_ecl x)

goal (1 subgoal):
 1. \<And>P S C S' \<sigma> C'. \<lbrakk>\<forall>x. x \<in> P \<longrightarrow> derivable_ecl x S \<and> ((\<forall>x\<in>S. finite (cl_ecl x)) \<longrightarrow> finite (cl_ecl x)); derivable C P S' \<sigma> FirstOrder C'; \<forall>x\<in>S. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl C)
[PROOF STEP]
from this and \<open>derivable C P S' \<sigma> FirstOrder C'\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>P. finite (cl_ecl x)
derivable C P S' \<sigma> FirstOrder C'
[PROOF STEP]
show "finite (cl_ecl C)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>P. finite (cl_ecl x)
derivable C P S' \<sigma> FirstOrder C'

goal (1 subgoal):
 1. finite (cl_ecl C)
[PROOF STEP]
using derivable_clauses_are_finite
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>P. finite (cl_ecl x)
derivable C P S' \<sigma> FirstOrder C'
\<lbrakk>derivable ?C ?P ?S ?\<sigma> ?k ?C'; \<forall>x\<in>?P. finite (cl_ecl x)\<rbrakk> \<Longrightarrow> finite (cl_ecl ?C) \<and> finite ?C'

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_factorization_radical [simp]:
  assumes "x \<noteq> 0"
  shows   "prime_factorization (radical x) = mset_set (prime_factors x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
have "prime_factorization (radical x) = (\<Sum>p\<in>prime_factors x. prime_factorization p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (radical x) = sum prime_factorization (prime_factors x)
[PROOF STEP]
unfolding radical_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (if x = (0::'a) then 0::'a else \<Prod>(prime_factors x)) = sum prime_factorization (prime_factors x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)

goal (1 subgoal):
 1. prime_factorization (if x = (0::'a) then 0::'a else \<Prod>(prime_factors x)) = sum prime_factorization (prime_factors x)
[PROOF STEP]
by (auto intro!: prime_factorization_prod)
[PROOF STATE]
proof (state)
this:
prime_factorization (radical x) = sum prime_factorization (prime_factors x)

goal (1 subgoal):
 1. prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization (radical x) = sum prime_factorization (prime_factors x)

goal (1 subgoal):
 1. prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
have "\<dots> = (\<Sum>p\<in>prime_factors x. {#p#})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum prime_factorization (prime_factors x) = (\<Sum>p\<in>prime_factors x. {#p#})
[PROOF STEP]
by (intro Groups_Big.sum.cong) (auto intro!: prime_factorization_prime)
[PROOF STATE]
proof (state)
this:
sum prime_factorization (prime_factors x) = (\<Sum>p\<in>prime_factors x. {#p#})

goal (1 subgoal):
 1. prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum prime_factorization (prime_factors x) = (\<Sum>p\<in>prime_factors x. {#p#})

goal (1 subgoal):
 1. prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
have "\<dots> = mset_set (prime_factors x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>prime_factors x. {#p#}) = mset_set (prime_factors x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>prime_factors x. {#p#}) = mset_set (prime_factors x)

goal (1 subgoal):
 1. prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prime_factorization (radical x) = mset_set (prime_factors x)

goal (1 subgoal):
 1. prime_factorization (radical x) = mset_set (prime_factors x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prime_factorization (radical x) = mset_set (prime_factors x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tensor0_prod_right[simp]: "A \<otimes> tensor0 ds = tensor0 (dims A @ ds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<otimes> tensor0 ds = tensor0 (dims A @ ds)
[PROOF STEP]
proof (rule tensor_lookup_eqI,simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (A \<otimes> tensor0 ds) \<Longrightarrow> lookup (A \<otimes> tensor0 ds) is = lookup (tensor0 (dims A @ ds)) is
[PROOF STEP]
fix "is"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (A \<otimes> tensor0 ds) \<Longrightarrow> lookup (A \<otimes> tensor0 ds) is = lookup (tensor0 (dims A @ ds)) is
[PROOF STEP]
assume "is \<lhd> dims (A \<otimes> tensor0 ds)"
[PROOF STATE]
proof (state)
this:
is \<lhd> dims (A \<otimes> tensor0 ds)

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (A \<otimes> tensor0 ds) \<Longrightarrow> lookup (A \<otimes> tensor0 ds) is = lookup (tensor0 (dims A @ ds)) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is \<lhd> dims (A \<otimes> tensor0 ds)
[PROOF STEP]
obtain is1 is2 where "is1 \<lhd> dims A" "is2 \<lhd> dims (tensor0 ds)" "is = is1 @ is2"
[PROOF STATE]
proof (prove)
using this:
is \<lhd> dims (A \<otimes> tensor0 ds)

goal (1 subgoal):
 1. (\<And>is1 is2. \<lbrakk>is1 \<lhd> dims A; is2 \<lhd> dims (tensor0 ds); is = is1 @ is2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis dims_tensor0 dims_tensor_prod valid_index_split)
[PROOF STATE]
proof (state)
this:
is1 \<lhd> dims A
is2 \<lhd> dims (tensor0 ds)
is = is1 @ is2

goal (1 subgoal):
 1. \<And>is. is \<lhd> dims (A \<otimes> tensor0 ds) \<Longrightarrow> lookup (A \<otimes> tensor0 ds) is = lookup (tensor0 (dims A @ ds)) is
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is1 \<lhd> dims A
is2 \<lhd> dims (tensor0 ds)
is = is1 @ is2
[PROOF STEP]
show "lookup (A \<otimes> tensor0 ds) is = lookup (tensor0 (dims A @ ds)) is"
[PROOF STATE]
proof (prove)
using this:
is1 \<lhd> dims A
is2 \<lhd> dims (tensor0 ds)
is = is1 @ is2

goal (1 subgoal):
 1. lookup (A \<otimes> tensor0 ds) is = lookup (tensor0 (dims A @ ds)) is
[PROOF STEP]
by (metis (no_types, lifting) \<open>is \<lhd> dims (A \<otimes> tensor0 ds)\<close> dims_tensor0 dims_tensor_prod lookup_tensor0 lookup_tensor_prod mult_zero_right)
[PROOF STATE]
proof (state)
this:
lookup (A \<otimes> tensor0 ds) is = lookup (tensor0 (dims A @ ds)) is

goal:
No subgoals!
[PROOF STEP]
qed