[STATEMENT]
theorem avl_update:
  assumes "avl t"
  shows "avl(update x y t)"
        "(height (update x y t) = height t \<or> height (update x y t) = height t + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. avl (update x y t) &&& height (update x y t) = height t \<or> height (update x y t) = height t + 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
avl t

goal (1 subgoal):
 1. avl (update x y t) &&& height (update x y t) = height t \<or> height (update x y t) = height t + 1
[PROOF STEP]
proof (induction x y t rule: update.induct)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> avl (update x y \<langle>\<rangle>)
 2. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> \<or> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> + 1
 3. \<And>x y l a b h r. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
 4. \<And>x y l a b h r. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>\<rbrakk> \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case eq2: (2 x y l a b h r)
[PROOF STATE]
proof (state)
this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1

goal (4 subgoals):
 1. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> avl (update x y \<langle>\<rangle>)
 2. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> \<or> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> + 1
 3. \<And>x y l a b h r. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
 4. \<And>x y l a b h r. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>\<rbrakk> \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
avl \<langle>l, ((a, b), h), r\<rangle>

goal (4 subgoals):
 1. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> avl (update x y \<langle>\<rangle>)
 2. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> \<or> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> + 1
 3. \<And>x y l a b h r. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
 4. \<And>x y l a b h r. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>\<rbrakk> \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
proof(cases "x = a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = a \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
 2. x \<noteq> a \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = a

goal (2 subgoals):
 1. x = a \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
 2. x \<noteq> a \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
with eq2 1
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x = a

goal (1 subgoal):
 1. avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
avl (update x y \<langle>l, ((a, b), h), r\<rangle>)

goal (1 subgoal):
 1. x \<noteq> a \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> a \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> a

goal (1 subgoal):
 1. x \<noteq> a \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
with eq2 1
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x \<noteq> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x \<noteq> a

goal (1 subgoal):
 1. avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
proof(cases "x<a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>; x \<noteq> a; x < a\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
 2. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>; x \<noteq> a; \<not> x < a\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < a

goal (2 subgoals):
 1. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>; x \<noteq> a; x < a\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
 2. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>; x \<noteq> a; \<not> x < a\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
with eq2 1
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x < a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x < a

goal (1 subgoal):
 1. avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
by (auto intro!: avl_balL)
[PROOF STATE]
proof (state)
this:
avl (update x y \<langle>l, ((a, b), h), r\<rangle>)

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>; x \<noteq> a; \<not> x < a\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>; x \<noteq> a; \<not> x < a\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < a

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>; x \<noteq> a; \<not> x < a\<rbrakk> \<Longrightarrow> avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
with eq2 1 \<open>x\<noteq>a\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x \<noteq> a
\<not> x < a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x \<noteq> a
\<not> x < a

goal (1 subgoal):
 1. avl (update x y \<langle>l, ((a, b), h), r\<rangle>)
[PROOF STEP]
by (auto intro!: avl_balR)
[PROOF STATE]
proof (state)
this:
avl (update x y \<langle>l, ((a, b), h), r\<rangle>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
avl (update x y \<langle>l, ((a, b), h), r\<rangle>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
avl (update x y \<langle>l, ((a, b), h), r\<rangle>)

goal (3 subgoals):
 1. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> avl (update x y \<langle>\<rangle>)
 2. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> \<or> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> + 1
 3. \<And>x y l a b h r. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>\<rbrakk> \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
avl \<langle>l, ((a, b), h), r\<rangle>

goal (3 subgoals):
 1. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> avl (update x y \<langle>\<rangle>)
 2. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> \<or> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> + 1
 3. \<And>x y l a b h r. \<lbrakk>\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l); \<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1; \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r); \<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1; avl \<langle>l, ((a, b), h), r\<rangle>\<rbrakk> \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
proof(cases "x = a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. x \<noteq> a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = a

goal (2 subgoals):
 1. x = a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. x \<noteq> a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
with eq2 1
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x = a

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal (1 subgoal):
 1. x \<noteq> a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> a

goal (1 subgoal):
 1. x \<noteq> a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
proof(cases "x<a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x < a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. \<not> x < a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < a

goal (2 subgoals):
 1. x < a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. \<not> x < a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
proof(cases "height (update x y l) = height r + 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height (update x y l) = height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. height (update x y l) \<noteq> height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
height (update x y l) \<noteq> height r + 2

goal (2 subgoals):
 1. height (update x y l) = height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. height (update x y l) \<noteq> height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
with eq2 2 \<open>x < a\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x < a
height (update x y l) \<noteq> height r + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x < a
height (update x y l) \<noteq> height r + 2

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
by (auto simp: height_balL2)
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal (1 subgoal):
 1. height (update x y l) = height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. height (update x y l) = height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
height (update x y l) = height r + 2

goal (1 subgoal):
 1. height (update x y l) = height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
hence "(height (balL (update x y l) (a,b) r) = height r + 2) \<or>
          (height (balL (update x y l) (a,b) r) = height r + 3)" (is "?A \<or> ?B")
[PROOF STATE]
proof (prove)
using this:
height (update x y l) = height r + 2

goal (1 subgoal):
 1. height (balL (update x y l) (a, b) r) = height r + 2 \<or> height (balL (update x y l) (a, b) r) = height r + 3
[PROOF STEP]
using eq2 2 \<open>x<a\<close> height_balL[OF _ _ True]
[PROOF STATE]
proof (prove)
using this:
height (update x y l) = height r + 2
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
x < a
\<lbrakk>avl (update x y l); avl r\<rbrakk> \<Longrightarrow> height (balL (update x y l) ?a r) \<in> {height r + 2, height r + 3}

goal (1 subgoal):
 1. height (balL (update x y l) (a, b) r) = height r + 2 \<or> height (balL (update x y l) (a, b) r) = height r + 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
height (balL (update x y l) (a, b) r) = height r + 2 \<or> height (balL (update x y l) (a, b) r) = height r + 3

goal (1 subgoal):
 1. height (update x y l) = height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
height (balL (update x y l) (a, b) r) = height r + 2 \<or> height (balL (update x y l) (a, b) r) = height r + 3

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height (balL (update x y l) (a, b) r) = height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. height (balL (update x y l) (a, b) r) = height r + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
assume ?A
[PROOF STATE]
proof (state)
this:
height (balL (update x y l) (a, b) r) = height r + 2

goal (2 subgoals):
 1. height (balL (update x y l) (a, b) r) = height r + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. height (balL (update x y l) (a, b) r) = height r + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
with 2 \<open>x < a\<close>
[PROOF STATE]
proof (chain)
picking this:
avl \<langle>l, ((a, b), h), r\<rangle>
x < a
height (balL (update x y l) (a, b) r) = height r + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl \<langle>l, ((a, b), h), r\<rangle>
x < a
height (balL (update x y l) (a, b) r) = height r + 2

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal (1 subgoal):
 1. height (balL (update x y l) (a, b) r) = height r + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. height (balL (update x y l) (a, b) r) = height r + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
assume ?B
[PROOF STATE]
proof (state)
this:
height (balL (update x y l) (a, b) r) = height r + 3

goal (1 subgoal):
 1. height (balL (update x y l) (a, b) r) = height r + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
with True 1 eq2(2) \<open>x < a\<close>
[PROOF STATE]
proof (chain)
picking this:
height (update x y l) = height r + 2
avl \<langle>l, ((a, b), h), r\<rangle>
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
x < a
height (balL (update x y l) (a, b) r) = height r + 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
height (update x y l) = height r + 2
avl \<langle>l, ((a, b), h), r\<rangle>
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
x < a
height (balL (update x y l) (a, b) r) = height r + 3

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
by (simp) arith
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal (1 subgoal):
 1. \<not> x < a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < a

goal (1 subgoal):
 1. \<not> x < a \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
proof(cases "height (update x y r) = height l + 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height (update x y r) = height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. height (update x y r) \<noteq> height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
height (update x y r) \<noteq> height l + 2

goal (2 subgoals):
 1. height (update x y r) = height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. height (update x y r) \<noteq> height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
with eq2 2 \<open>\<not>x < a\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
\<not> x < a
height (update x y r) \<noteq> height l + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
\<not> x < a
height (update x y r) \<noteq> height l + 2

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
by (auto simp: height_balR2)
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal (1 subgoal):
 1. height (update x y r) = height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. height (update x y r) = height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
height (update x y r) = height l + 2

goal (1 subgoal):
 1. height (update x y r) = height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
hence "(height (balR l (a,b) (update x y r)) = height l + 2) \<or>
          (height (balR l (a,b) (update x y r)) = height l + 3)"  (is "?A \<or> ?B")
[PROOF STATE]
proof (prove)
using this:
height (update x y r) = height l + 2

goal (1 subgoal):
 1. height (balR l (a, b) (update x y r)) = height l + 2 \<or> height (balR l (a, b) (update x y r)) = height l + 3
[PROOF STEP]
using eq2 2 \<open>\<not>x < a\<close> \<open>x \<noteq> a\<close> height_balR[OF _ _ True]
[PROOF STATE]
proof (prove)
using this:
height (update x y r) = height l + 2
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> avl (update x y l)
\<lbrakk>cmp x a = LT; avl l\<rbrakk> \<Longrightarrow> height (update x y l) = height l \<or> height (update x y l) = height l + 1
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> avl (update x y r)
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
avl \<langle>l, ((a, b), h), r\<rangle>
\<not> x < a
x \<noteq> a
\<lbrakk>avl l; avl (update x y r)\<rbrakk> \<Longrightarrow> height (balR l ?a (update x y r)) \<in> {height l + 2, height l + 3}

goal (1 subgoal):
 1. height (balR l (a, b) (update x y r)) = height l + 2 \<or> height (balR l (a, b) (update x y r)) = height l + 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
height (balR l (a, b) (update x y r)) = height l + 2 \<or> height (balR l (a, b) (update x y r)) = height l + 3

goal (1 subgoal):
 1. height (update x y r) = height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
height (balR l (a, b) (update x y r)) = height l + 2 \<or> height (balR l (a, b) (update x y r)) = height l + 3

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height (balR l (a, b) (update x y r)) = height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. height (balR l (a, b) (update x y r)) = height l + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
assume ?A
[PROOF STATE]
proof (state)
this:
height (balR l (a, b) (update x y r)) = height l + 2

goal (2 subgoals):
 1. height (balR l (a, b) (update x y r)) = height l + 2 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
 2. height (balR l (a, b) (update x y r)) = height l + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
with 2 \<open>\<not>x < a\<close>
[PROOF STATE]
proof (chain)
picking this:
avl \<langle>l, ((a, b), h), r\<rangle>
\<not> x < a
height (balR l (a, b) (update x y r)) = height l + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl \<langle>l, ((a, b), h), r\<rangle>
\<not> x < a
height (balR l (a, b) (update x y r)) = height l + 2

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal (1 subgoal):
 1. height (balR l (a, b) (update x y r)) = height l + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. height (balR l (a, b) (update x y r)) = height l + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
assume ?B
[PROOF STATE]
proof (state)
this:
height (balR l (a, b) (update x y r)) = height l + 3

goal (1 subgoal):
 1. height (balR l (a, b) (update x y r)) = height l + 3 \<Longrightarrow> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
with True 1 eq2(4) \<open>\<not>x < a\<close>
[PROOF STATE]
proof (chain)
picking this:
height (update x y r) = height l + 2
avl \<langle>l, ((a, b), h), r\<rangle>
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
\<not> x < a
height (balR l (a, b) (update x y r)) = height l + 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
height (update x y r) = height l + 2
avl \<langle>l, ((a, b), h), r\<rangle>
\<lbrakk>cmp x a = GT; avl r\<rbrakk> \<Longrightarrow> height (update x y r) = height r \<or> height (update x y r) = height r + 1
\<not> x < a
height (balR l (a, b) (update x y r)) = height l + 3

goal (1 subgoal):
 1. height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1
[PROOF STEP]
by (simp) arith
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> \<or> height (update x y \<langle>l, ((a, b), h), r\<rangle>) = height \<langle>l, ((a, b), h), r\<rangle> + 1

goal (2 subgoals):
 1. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> avl (update x y \<langle>\<rangle>)
 2. \<And>x y. avl \<langle>\<rangle> \<Longrightarrow> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> \<or> height (update x y \<langle>\<rangle>) = height \<langle>\<rangle> + 1
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma (in order_topology) order_tendstoD:
  assumes "(f \<longlongrightarrow> y) F"
  shows "a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F"
    and "y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a < y \<Longrightarrow> \<forall>\<^sub>F x in F. a < f x) &&& (y < a \<Longrightarrow> \<forall>\<^sub>F x in F. f x < a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> y) F

goal (1 subgoal):
 1. (a < y \<Longrightarrow> \<forall>\<^sub>F x in F. a < f x) &&& (y < a \<Longrightarrow> \<forall>\<^sub>F x in F. f x < a)
[PROOF STEP]
by (auto simp: order_tendsto_iff)


[STATEMENT]
lemma twisted_cartesian_product_mem_length:
  assumes "card S = n"
  assumes "card S' = m"
  assumes "a \<in> Prod\<^bsub>S,S'\<^esub> A B"
  shows "length a = n + m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length a = n + m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card S = n
card S' = m
a \<in> Prod\<^bsub>S, S'\<^esub> A B

goal (1 subgoal):
 1. length a = n + m
[PROOF STEP]
unfolding twisted_cartesian_product_def
[PROOF STATE]
proof (prove)
using this:
card S = n
card S' = m
a \<in> {a. length a = card S + card S' \<and> nths a S \<in> A \<and> nths a S' \<in> B}

goal (1 subgoal):
 1. length a = n + m
[PROOF STEP]
by blast


[STATEMENT]
lemma length_chop:
  assumes "n > 0"
  shows   "length (chop n xs) = nat \<lceil>length xs / n\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
proof (induction n xs rule: chop.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n. 0 < n \<Longrightarrow> length (chop n []) = nat \<lceil>real (length []) / real n\<rceil>
 2. \<And>xs. 0 < 0 \<Longrightarrow> length (chop 0 xs) = nat \<lceil>real (length xs) / real 0\<rceil>
 3. \<And>n xs. \<lbrakk>0 < n; xs \<noteq> []; 0 < n \<Longrightarrow> length (chop n (drop n xs)) = nat \<lceil>real (length (drop n xs)) / real n\<rceil>; 0 < n\<rbrakk> \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
case (3 n xs)
[PROOF STATE]
proof (state)
this:
0 < n
xs \<noteq> []
0 < n \<Longrightarrow> length (chop n (drop n xs)) = nat \<lceil>real (length (drop n xs)) / real n\<rceil>
0 < n

goal (3 subgoals):
 1. \<And>n. 0 < n \<Longrightarrow> length (chop n []) = nat \<lceil>real (length []) / real n\<rceil>
 2. \<And>xs. 0 < 0 \<Longrightarrow> length (chop 0 xs) = nat \<lceil>real (length xs) / real 0\<rceil>
 3. \<And>n xs. \<lbrakk>0 < n; xs \<noteq> []; 0 < n \<Longrightarrow> length (chop n (drop n xs)) = nat \<lceil>real (length (drop n xs)) / real n\<rceil>; 0 < n\<rbrakk> \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
proof (cases "length xs \<ge> n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
 2. \<not> n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> n \<le> length xs

goal (2 subgoals):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
 2. \<not> n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
hence "\<lceil>real (length xs) / real n\<rceil> = 1"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> length xs

goal (1 subgoal):
 1. \<lceil>real (length xs) / real n\<rceil> = 1
[PROOF STEP]
using "3.hyps"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> length xs
0 < n
xs \<noteq> []

goal (1 subgoal):
 1. \<lceil>real (length xs) / real n\<rceil> = 1
[PROOF STEP]
by (intro ceiling_unique) auto
[PROOF STATE]
proof (state)
this:
\<lceil>real (length xs) / real n\<rceil> = 1

goal (2 subgoals):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
 2. \<not> n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> length xs
\<lceil>real (length xs) / real n\<rceil> = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> length xs
\<lceil>real (length xs) / real n\<rceil> = 1

goal (1 subgoal):
 1. length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
using "3.prems" "3.hyps"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> length xs
\<lceil>real (length xs) / real n\<rceil> = 1
0 < n
0 < n
xs \<noteq> []

goal (1 subgoal):
 1. length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
by (auto simp: chop_ge_length_eq not_le)
[PROOF STATE]
proof (state)
this:
length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n \<le> length xs

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
hence "real (length xs) = real n + real (length (drop n xs))"
[PROOF STATE]
proof (prove)
using this:
n \<le> length xs

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

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (length xs) = real n + real (length (drop n xs))

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
have "\<dots> / real n = real (length (drop n xs)) / real n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real n + real (length (drop n xs))) / real n = real (length (drop n xs)) / real n + 1
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (real n + real (length (drop n xs))) / real n = real (length (drop n xs)) / real n + 1
[PROOF STEP]
by (simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
(real n + real (length (drop n xs))) / real n = real (length (drop n xs)) / real n + 1

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real n + real (length (drop n xs))) / real n = real (length (drop n xs)) / real n + 1

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
have "ceiling \<dots> = ceiling (real (length (drop n xs)) / real n) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>real (length (drop n xs)) / real n + 1\<rceil> = \<lceil>real (length (drop n xs)) / real n\<rceil> + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lceil>real (length (drop n xs)) / real n + 1\<rceil> = \<lceil>real (length (drop n xs)) / real n\<rceil> + 1

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lceil>real (length (drop n xs)) / real n + 1\<rceil> = \<lceil>real (length (drop n xs)) / real n\<rceil> + 1

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
have "nat \<dots> = nat (ceiling (real (length (drop n xs)) / real n)) + nat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (\<lceil>real (length (drop n xs)) / real n\<rceil> + 1) = nat \<lceil>real (length (drop n xs)) / real n\<rceil> + nat 1
[PROOF STEP]
by (intro nat_add_distrib[OF order.trans[OF _ ceiling_mono[of 0]]]) auto
[PROOF STATE]
proof (state)
this:
nat (\<lceil>real (length (drop n xs)) / real n\<rceil> + 1) = nat \<lceil>real (length (drop n xs)) / real n\<rceil> + nat 1

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat (\<lceil>real (length (drop n xs)) / real n\<rceil> + 1) = nat \<lceil>real (length (drop n xs)) / real n\<rceil> + nat 1

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
have "\<dots> = length (chop n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat \<lceil>real (length (drop n xs)) / real n\<rceil> + nat 1 = length (chop n xs)
[PROOF STEP]
using \<open>n > 0\<close> "3.hyps"
[PROOF STATE]
proof (prove)
using this:
0 < n
0 < n
xs \<noteq> []

goal (1 subgoal):
 1. nat \<lceil>real (length (drop n xs)) / real n\<rceil> + nat 1 = length (chop n xs)
[PROOF STEP]
by (subst "3.IH" [symmetric]) auto
[PROOF STATE]
proof (state)
this:
nat \<lceil>real (length (drop n xs)) / real n\<rceil> + nat 1 = length (chop n xs)

goal (1 subgoal):
 1. n \<le> length xs \<Longrightarrow> length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
nat \<lceil>real (length xs) / real n\<rceil> = length (chop n xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nat \<lceil>real (length xs) / real n\<rceil> = length (chop n xs)

goal (1 subgoal):
 1. length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length (chop n xs) = nat \<lceil>real (length xs) / real n\<rceil>

goal (2 subgoals):
 1. \<And>n. 0 < n \<Longrightarrow> length (chop n []) = nat \<lceil>real (length []) / real n\<rceil>
 2. \<And>xs. 0 < 0 \<Longrightarrow> length (chop 0 xs) = nat \<lceil>real (length xs) / real 0\<rceil>
[PROOF STEP]
qed auto


[STATEMENT]
lemma fun_bit_count_est:
  assumes "f \<in> extensional (set xs)"
  assumes "\<And>x. x \<in> set xs \<Longrightarrow> bit_count (e (f x)) \<le> a"
  shows "bit_count  ((xs \<rightarrow>\<^sub>e e) f)  \<le> ereal (real (length xs)) * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
have "bit_count  ((xs \<rightarrow>\<^sub>e e) f) = (\<Sum>x \<leftarrow> xs. bit_count (e (f x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) = (\<Sum>x\<leftarrow>xs. bit_count (e (f x)))
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
f \<in> extensional (set xs)

goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) = (\<Sum>x\<leftarrow>xs. bit_count (e (f x)))
[PROOF STEP]
by (simp add:fun_bit_count)
[PROOF STATE]
proof (state)
this:
bit_count ((xs \<rightarrow>\<^sub>e e) f) = (\<Sum>x\<leftarrow>xs. bit_count (e (f x)))

goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bit_count ((xs \<rightarrow>\<^sub>e e) f) = (\<Sum>x\<leftarrow>xs. bit_count (e (f x)))

goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
have "... \<le> (\<Sum>x \<leftarrow> xs. a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>xs. bit_count (e (f x))) \<le> (\<Sum>x\<leftarrow>xs. a)
[PROOF STEP]
by (intro sum_list_mono assms(2), simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>xs. bit_count (e (f x))) \<le> (\<Sum>x\<leftarrow>xs. a)

goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>xs. bit_count (e (f x))) \<le> (\<Sum>x\<leftarrow>xs. a)

goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
have "... =  ereal (real (length xs)) * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>xs. a) = ereal (real (length xs)) * a
[PROOF STEP]
by (simp add:sum_list_triv_ereal)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>xs. a) = ereal (real (length xs)) * a

goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a

goal (1 subgoal):
 1. bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bit_count ((xs \<rightarrow>\<^sub>e e) f) \<le> ereal (real (length xs)) * a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [code]:
  "lexordp r xs [] = False"
  "lexordp r [] (y#ys) = True"
  "lexordp r (x # xs) (y # ys) = (r x y \<or> (x = y \<and> lexordp r xs ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.lexordp r xs [] = False &&& List.lexordp r [] (y # ys) = True &&& List.lexordp r (x # xs) (y # ys) = (r x y \<or> x = y \<and> List.lexordp r xs ys)
[PROOF STEP]
unfolding lexordp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((xs, []) \<in> lexord {(x, y). r x y}) = False &&& (([], y # ys) \<in> lexord {(x, y). r x y}) = True &&& ((x # xs, y # ys) \<in> lexord {(x, y). r x y}) = (r x y \<or> x = y \<and> (xs, ys) \<in> lexord {(x, y). r x y})
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_vector_mult_in_columnspace_gen:
  fixes A :: "'a::field^'n^'m"
  shows "(A *v x) \<in> vec.span(columns A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v x \<in> vec.span (columns A)
[PROOF STEP]
apply (simp add: matrix_vector_column columns_def transpose_def column_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. x $ i *s (\<chi>j. A $ j $ i)) \<in> vec.span {uu_. \<exists>i. uu_ = (\<chi>ia. A $ ia $ i)}
[PROOF STEP]
apply (intro vec.span_sum vec.span_scale)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> (\<chi>j. A $ j $ x) \<in> vec.span {uu_. \<exists>i. uu_ = (\<chi>ia. A $ ia $ i)}
[PROOF STEP]
apply (force intro: vec.span_base)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma neg_minus_divideC_le_eq [field_simps]:
  "- (b /\<^sub>C c) \<le> a \<longleftrightarrow> c *\<^sub>C a \<le> - b" if "c < 0"
for a b :: "'a :: ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (b /\<^sub>C c) \<le> a) = (c *\<^sub>C a \<le> - b)
[PROOF STEP]
using that pos_minus_divideC_le_eq [of "- c" "- b" a]
[PROOF STATE]
proof (prove)
using this:
c < 0
0 < - c \<Longrightarrow> (- (- b /\<^sub>C - c) \<le> a) = (- (- b) \<le> - c *\<^sub>C a)

goal (1 subgoal):
 1. (- (b /\<^sub>C c) \<le> a) = (c *\<^sub>C a \<le> - b)
[PROOF STEP]
by (metis Complex_Vector_Spaces0.neg_divideC_le_eq complex_vector.scale_minus_right)


[STATEMENT]
lemma base_case_invertible_mat_R:
  shows "invertible_mat (matrix_A_R [[1],[0], [- 1]] [([], []),([0], []),([], [0])])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])])
[PROOF STEP]
unfolding invertible_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_mat (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) \<and> (\<exists>B. inverts_mat (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) B \<and> inverts_mat B (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]))
[PROOF STEP]
using inverse_mat_base_case_R inverse_mat_base_case_2_R
[PROOF STATE]
proof (prove)
using this:
inverts_mat (mat_of_rows_list 3 [[1 / 2, - 1 / 2, 1 / 2], [0, 1, 0], [1 / 2, - 1 / 2, - 1 / 2]]) (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]])
inverts_mat (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]) (mat_of_rows_list 3 [[1 / 2, - 1 / 2, 1 / 2], [0, 1, 0], [1 / 2, - 1 / 2, - 1 / 2]])

goal (1 subgoal):
 1. square_mat (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) \<and> (\<exists>B. inverts_mat (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) B \<and> inverts_mat B (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]))
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>inverts_mat (mat_of_rows_list 3 [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]]) (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]); inverts_mat (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]) (mat_of_rows_list 3 [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]])\<rbrakk> \<Longrightarrow> dim_col (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) = dim_row (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])])
 2. \<lbrakk>inverts_mat (mat_of_rows_list 3 [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]]) (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]); inverts_mat (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]) (mat_of_rows_list 3 [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]])\<rbrakk> \<Longrightarrow> \<exists>B. inverts_mat (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) B \<and> inverts_mat B (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])])
[PROOF STEP]
apply (simp add: mat_base_case mat_of_rows_list_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>inverts_mat (mat (Suc (Suc (Suc 0))) 3 (\<lambda>(i, j). [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]] ! i ! j)) (mat (Suc (Suc (Suc 0))) 3 (\<lambda>(i, j). [[1, 1, 1], [0, 1, 0], [1, 0, - 1]] ! i ! j)); inverts_mat (mat (Suc (Suc (Suc 0))) 3 (\<lambda>(i, j). [[1, 1, 1], [0, 1, 0], [1, 0, - 1]] ! i ! j)) (mat (Suc (Suc (Suc 0))) 3 (\<lambda>(i, j). [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]] ! i ! j))\<rbrakk> \<Longrightarrow> dim_col (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) = dim_row (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])])
 2. \<lbrakk>inverts_mat (mat_of_rows_list 3 [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]]) (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]); inverts_mat (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]) (mat_of_rows_list 3 [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]])\<rbrakk> \<Longrightarrow> \<exists>B. inverts_mat (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) B \<and> inverts_mat B (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])])
[PROOF STEP]
using mat_base_case_R
[PROOF STATE]
proof (prove)
using this:
M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])] = mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]

goal (2 subgoals):
 1. \<lbrakk>inverts_mat (mat (Suc (Suc (Suc 0))) 3 (\<lambda>(i, j). [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]] ! i ! j)) (mat (Suc (Suc (Suc 0))) 3 (\<lambda>(i, j). [[1, 1, 1], [0, 1, 0], [1, 0, - 1]] ! i ! j)); inverts_mat (mat (Suc (Suc (Suc 0))) 3 (\<lambda>(i, j). [[1, 1, 1], [0, 1, 0], [1, 0, - 1]] ! i ! j)) (mat (Suc (Suc (Suc 0))) 3 (\<lambda>(i, j). [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]] ! i ! j))\<rbrakk> \<Longrightarrow> dim_col (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) = dim_row (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])])
 2. \<lbrakk>inverts_mat (mat_of_rows_list 3 [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]]) (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]); inverts_mat (mat_of_rows_list 3 [[1, 1, 1], [0, 1, 0], [1, 0, - 1]]) (mat_of_rows_list 3 [[1 / 2, - (1 / 2), 1 / 2], [0, 1, 0], [1 / 2, - (1 / 2), - (1 / 2)]])\<rbrakk> \<Longrightarrow> \<exists>B. inverts_mat (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])]) B \<and> inverts_mat B (M_mat_R [[1], [0], [- 1]] [([], []), ([0], []), ([], [0])])
[PROOF STEP]
by auto


[STATEMENT]
lemma boolfunc_from_sc_alt: "boolfunc_from_sc n K = vec_to_boolfunc n (bf_from_sc K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. boolfunc_from_sc n K = vec_to_boolfunc n (bf_from_sc K)
[PROOF STEP]
unfolding boolfunc_from_sc_def vec_to_boolfunc_def bf_from_sc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. {i. i < n \<and> \<not> p i} \<in> K) = (\<lambda>i. {ia. ia < dim_vec (vec n i) \<and> \<not> vec n i $ ia} \<in> K)
[PROOF STEP]
unfolding dim_vec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. {i. i < n \<and> \<not> p i} \<in> K) = (\<lambda>i. {ia. ia < n \<and> \<not> vec n i $ ia} \<in> K)
[PROOF STEP]
by(fastforce intro!: eqelem_imp_iff)


[STATEMENT]
lemma fps_XD_mult_const[simp]:"fps_XD (fps_const (c::'a::comm_ring_1) * a) = fps_const c * fps_XD a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_XD (fps_const c * a) = fps_const c * fps_XD a
[PROOF STEP]
by (simp add: fps_XD_def field_simps)


[STATEMENT]
lemma hrcis_inverse: "\<And>a r. inverse (hrcis r a) = hrcis (inverse r) (- a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a r. inverse (hrcis r a) = hrcis (inverse r) (- a)
[PROOF STEP]
by transfer (simp add: rcis_inverse inverse_eq_divide [symmetric])


[STATEMENT]
lemma integer_word32_bounded_eq:
   assumes "0 \<le> i"
    and "i \<le> 2 ^ LENGTH(32) - 1"
  shows "integer_of_word32 (word32_of_integer i) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integer_of_word32 (word32_of_integer i) = i
[PROOF STEP]
unfolding word32_of_integer_def integer_of_word32_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integer_of_word (word_of_integer i) = i
[PROOF STEP]
using integer_word_bounded_eq assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?i; ?i \<le> 2 ^ LENGTH(?'a) - 1\<rbrakk> \<Longrightarrow> integer_of_word (word_of_integer ?i) = ?i
0 \<le> i
i \<le> 2 ^ LENGTH(32) - 1

goal (1 subgoal):
 1. integer_of_word (word_of_integer i) = i
[PROOF STEP]
by blast


[STATEMENT]
lemma infsum_Sigma':
  fixes A :: "'a set" and B :: "'a \<Rightarrow> 'b set"
    and f :: \<open>'a \<Rightarrow> 'b \<Rightarrow> 'c::{comm_monoid_add, t2_space, uniform_space}\<close>
  assumes plus_cont: \<open>uniformly_continuous_on UNIV (\<lambda>(x::'c,y). x+y)\<close>
  assumes summableAB: "(\<lambda>(x,y). f x y) summable_on (Sigma A B)"
  assumes summableB: \<open>\<And>x. x\<in>A \<Longrightarrow> (f x) summable_on (B x)\<close>
  shows \<open>infsum (\<lambda>x. infsum (f x) (B x)) A = infsum (\<lambda>(x,y). f x y) (Sigma A B)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) (B x)) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>Sigma A B. f x y)
[PROOF STEP]
using infsum_Sigma[of \<open>\<lambda>(x,y). f x y\<close> A B]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>uniformly_continuous_on UNIV (\<lambda>(x, y). x + y); (\<lambda>(x, y). f x y) summable_on Sigma A B; \<And>x. x \<in> A \<Longrightarrow> (\<lambda>y. case (x, y) of (x, y) \<Rightarrow> f x y) summable_on B x\<rbrakk> \<Longrightarrow> (\<Sum>\<^sub>\<infinity>(x, y)\<in>Sigma A B. f x y) = (\<Sum>\<^sub>\<infinity>x\<in>A. \<Sum>\<^sub>\<infinity>y\<in>B x. case (x, y) of (x, y) \<Rightarrow> f x y)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) (B x)) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>Sigma A B. f x y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>uniformly_continuous_on UNIV (\<lambda>(x, y). x + y); (\<lambda>(x, y). f x y) summable_on Sigma A B; \<And>x. x \<in> A \<Longrightarrow> (\<lambda>y. case (x, y) of (x, y) \<Rightarrow> f x y) summable_on B x\<rbrakk> \<Longrightarrow> (\<Sum>\<^sub>\<infinity>(x, y)\<in>Sigma A B. f x y) = (\<Sum>\<^sub>\<infinity>x\<in>A. \<Sum>\<^sub>\<infinity>y\<in>B x. case (x, y) of (x, y) \<Rightarrow> f x y)
uniformly_continuous_on UNIV (\<lambda>(x, y). x + y)
(\<lambda>(x, y). f x y) summable_on Sigma A B
?x \<in> A \<Longrightarrow> f ?x summable_on B ?x

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) (B x)) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>Sigma A B. f x y)
[PROOF STEP]
by auto


[STATEMENT]
lemma card1_tr0:"\<lbrakk> finite A; card A = Suc 0; a \<in> A \<rbrakk> \<Longrightarrow> {a} = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; card A = Suc 0; a \<in> A\<rbrakk> \<Longrightarrow> {a} = A
[PROOF STEP]
apply (cut_tac card1[of "a"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; card A = Suc 0; a \<in> A; card {a} = 1\<rbrakk> \<Longrightarrow> {a} = A
[PROOF STEP]
apply (rule card_seteq[of "A" "{a}"], assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; card A = Suc 0; a \<in> A; card {a} = 1\<rbrakk> \<Longrightarrow> {a} \<subseteq> A
 2. \<lbrakk>finite A; card A = Suc 0; a \<in> A; card {a} = 1\<rbrakk> \<Longrightarrow> card A \<le> card {a}
[PROOF STEP]
apply (rule singleton_sub[of "a" "A"], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; card A = Suc 0; a \<in> A; card {a} = 1\<rbrakk> \<Longrightarrow> card A \<le> card {a}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem if_semi: "(((IF e THEN c1 ELSE c2);;c, s) -[eval]-> t)  =
                  ((IF e THEN (c1;;c) ELSE (c2;;c), s) -[eval]-> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((IF e THEN c1 ELSE c2;;c, s) -[eval]-> t) = ((IF e THEN c1;;c ELSE c2;;c, s) -[eval]-> t)
[PROOF STEP]
by (blast intro: if_semi1 if_semi2)


[STATEMENT]
lemma orthogonal_complement_orthogonal_complement_closure_cspan:
  \<open>orthogonal_complement (orthogonal_complement S) = closure (cspan S)\<close> for S :: \<open>'a::chilbert_space set\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement S) = closure (cspan S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement S) = closure (cspan S)
[PROOF STEP]
have \<open>orthogonal_complement (orthogonal_complement S) = orthogonal_complement (orthogonal_complement (closure (cspan S)))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement S) = orthogonal_complement (orthogonal_complement (closure (cspan S)))
[PROOF STEP]
by (simp flip: orthogonal_complement_of_closure orthogonal_complement_of_cspan)
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement S) = orthogonal_complement (orthogonal_complement (closure (cspan S)))

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement S) = closure (cspan S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement S) = orthogonal_complement (orthogonal_complement (closure (cspan S)))

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement S) = closure (cspan S)
[PROOF STEP]
have \<open>\<dots> = closure (cspan S)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement (closure (cspan S))) = closure (cspan S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement (closure (cspan S))) = closure (cspan S)

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement S) = closure (cspan S)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
orthogonal_complement (orthogonal_complement S) = closure (cspan S)
[PROOF STEP]
show \<open>orthogonal_complement (orthogonal_complement S) = closure (cspan S)\<close>
[PROOF STATE]
proof (prove)
using this:
orthogonal_complement (orthogonal_complement S) = closure (cspan S)

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement S) = closure (cspan S)
[PROOF STEP]
by -
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement S) = closure (cspan S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem removing_offending_flows_makes_invariant_hold:
      "\<forall>F \<in> set_offending_flows G nP. sinvar (delete_edges G F) nP"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
proof(cases "sinvar G nP")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
 2. \<not> sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
sinvar G nP

goal (2 subgoals):
 1. sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
 2. \<not> sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
hence no_offending: "set_offending_flows G nP = {}"
[PROOF STATE]
proof (prove)
using this:
sinvar G nP

goal (1 subgoal):
 1. set_offending_flows G nP = {}
[PROOF STEP]
using sinvar_no_offending
[PROOF STATE]
proof (prove)
using this:
sinvar G nP
sinvar ?G ?nP \<Longrightarrow> set_offending_flows ?G ?nP = {}

goal (1 subgoal):
 1. set_offending_flows G nP = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_offending_flows G nP = {}

goal (2 subgoals):
 1. sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
 2. \<not> sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
thus "\<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP"
[PROOF STATE]
proof (prove)
using this:
set_offending_flows G nP = {}

goal (1 subgoal):
 1. \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
using empty_iff
[PROOF STATE]
proof (prove)
using this:
set_offending_flows G nP = {}
(?c \<in> {}) = False

goal (1 subgoal):
 1. \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP

goal (1 subgoal):
 1. \<not> sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> sinvar G nP

goal (1 subgoal):
 1. \<not> sinvar G nP \<Longrightarrow> \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
thus "\<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP"
[PROOF STATE]
proof (prove)
using this:
\<not> sinvar G nP

goal (1 subgoal):
 1. \<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP
[PROOF STEP]
by(simp add: set_offending_flows_def is_offending_flows_def is_offending_flows_min_set_def graph_ops)
[PROOF STATE]
proof (state)
this:
\<forall>F\<in>set_offending_flows G nP. sinvar (delete_edges G F) nP

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frac_eq: "frac x = x \<longleftrightarrow> 0 \<le> x \<and> x < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (frac x = x) = ((0::'a) \<le> x \<and> x < (1::'a))
[PROOF STEP]
by (simp add: frac_unique_iff)


[STATEMENT]
lemma max_input_Times:
  "max_input (Times a1 a2) = max (max_input a1) (max_input a2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_input (Times a1 a2) = max (max_input a1) (max_input a2)
[PROOF STEP]
apply (simp add: max_input_def Let_def max.commute max_absorb2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enumerate_aexp_inputs a1 \<noteq> {} \<longrightarrow> enumerate_aexp_inputs a2 \<noteq> {} \<longrightarrow> Some (Max (enumerate_aexp_inputs a1 \<union> enumerate_aexp_inputs a2)) = max (Some (Max (enumerate_aexp_inputs a1))) (Some (Max (enumerate_aexp_inputs a2)))
[PROOF STEP]
by (metis List.finite_set Max.union enumerate_aexp_inputs_list sup_Some sup_max)


[STATEMENT]
lemma prodinf_prod: "(\<And>i. i \<in> I \<Longrightarrow> convergent_prod (f i)) \<Longrightarrow> (\<Prod>n. \<Prod>i\<in>I. f i n) = (\<Prod>i\<in>I. \<Prod>n. f i n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> convergent_prod (f i)) \<Longrightarrow> (\<Prod>n. \<Prod>i\<in>I. f i n) = (\<Prod>i\<in>I. \<Prod>n. f i n)
[PROOF STEP]
using has_prod_unique[OF has_prod_prod, OF convergent_prod_has_prod]
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> I \<Longrightarrow> convergent_prod (f i)) \<Longrightarrow> (\<Prod>i\<in>I. prodinf (f i)) = (\<Prod>n. \<Prod>i\<in>I. f i n)

goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> convergent_prod (f i)) \<Longrightarrow> (\<Prod>n. \<Prod>i\<in>I. f i n) = (\<Prod>i\<in>I. \<Prod>n. f i n)
[PROOF STEP]
by simp


[STATEMENT]
lemma LIMSEQ_stirling_integral:
  "n > 0 \<Longrightarrow> (\<lambda>x. integral {0..real x} (\<lambda>x. of_real (pbernpoly n x) / (of_real x + s) ^ n))
     \<longlonglongrightarrow> stirling_integral n s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> (\<lambda>x. integral {0..real x} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> stirling_integral n s
[PROOF STEP]
unfolding stirling_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> (\<lambda>x. integral {0..real x} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> lim (\<lambda>x. integral {0..real x} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n))
[PROOF STEP]
using convergent_stirling_integral[of n]
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> convergent (\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n))

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> (\<lambda>x. integral {0..real x} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> lim (\<lambda>x. integral {0..real x} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n))
[PROOF STEP]
by (simp only: convergent_LIMSEQ_iff)


[STATEMENT]
lemma test_suite_to_input_sequences_pass_alt_def :
  fixes T :: "('b::linorder \<times> 'c::linorder) prefix_tree"
  assumes "finite_tree T"
  and     "(L M = L M') \<longleftrightarrow> (L M \<inter> set T = L M' \<inter> set T)"
shows "(L M = L M') \<longleftrightarrow> (\<forall> xs \<in> list.set (test_suite_to_input_sequences T)  . \<forall> xs' \<in> list.set (prefixes xs) . {io \<in> L M . input_portion io = xs'} = {io \<in> L M' . input_portion io = xs'})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (L M = L M') = (\<forall>xs\<in>list.set (test_suite_to_input_sequences T). \<forall>xs'\<in>list.set (prefixes xs). {io \<in> L M. map fst io = xs'} = {io \<in> L M'. map fst io = xs'})
[PROOF STEP]
unfolding test_suite_to_input_sequences_pass[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({io \<in> L M. \<exists>xs\<in>list.set (test_suite_to_input_sequences T). Bex (list.set (prefixes xs)) ((=) (map fst io))} = {io \<in> L M'. \<exists>xs\<in>list.set (test_suite_to_input_sequences T). Bex (list.set (prefixes xs)) ((=) (map fst io))}) = (\<forall>xs\<in>list.set (test_suite_to_input_sequences T). \<forall>xs'\<in>list.set (prefixes xs). {io \<in> L M. map fst io = xs'} = {io \<in> L M'. map fst io = xs'})
[PROOF STEP]
by blast


[STATEMENT]
lemma cosh_zero_iff: "cosh x = 0 \<longleftrightarrow> exp x ^ 2 = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cosh x = (0::'a)) = ((exp x)\<^sup>2 = - (1::'a))
[PROOF STEP]
by (auto simp: cosh_def exp_minus field_simps power2_eq_square eq_neg_iff_add_eq_0)


[STATEMENT]
theorem per_all_exps: "\<lbrakk> m \<noteq> 0; k \<noteq> 0 \<rbrakk> \<Longrightarrow> (u \<le>p (r\<^sup>@m)\<^sup>\<omega>) \<longleftrightarrow> (u \<le>p (r\<^sup>@k)\<^sup>\<omega>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<noteq> 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> u \<le>p r \<^sup>@ m\<^sup>\<omega> = u \<le>p r \<^sup>@ k\<^sup>\<omega>
[PROOF STEP]
using per_drop_exp[of u r m, THEN per_add_exp[of u r k]] per_drop_exp[of u r k, THEN per_add_exp[of u r m]]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>u \<le>p r \<^sup>@ m\<^sup>\<omega>; k \<noteq> 0\<rbrakk> \<Longrightarrow> u \<le>p r \<^sup>@ k\<^sup>\<omega>
\<lbrakk>u \<le>p r \<^sup>@ k\<^sup>\<omega>; m \<noteq> 0\<rbrakk> \<Longrightarrow> u \<le>p r \<^sup>@ m\<^sup>\<omega>

goal (1 subgoal):
 1. \<lbrakk>m \<noteq> 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> u \<le>p r \<^sup>@ m\<^sup>\<omega> = u \<le>p r \<^sup>@ k\<^sup>\<omega>
[PROOF STEP]
by blast


[STATEMENT]
lemma sum_upto_divisor_sum2:
  "sum_upto (\<lambda>n. \<Sum>d | d dvd n. f d :: real) x = sum_upto (\<lambda>n. sum_upto f (x / n)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. \<Sum>d | d dvd n. f d) x = sum_upto (\<lambda>xa. sum_upto f (x / real xa)) x
[PROOF STEP]
using sum_upto_dirichlet_prod[of "\<lambda>_. 1" f x]
[PROOF STATE]
proof (prove)
using this:
sum_upto (dirichlet_prod (\<lambda>_. 1) f) x = sum_upto (\<lambda>d. 1 * sum_upto f (x / real d)) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. \<Sum>d | d dvd n. f d) x = sum_upto (\<lambda>xa. sum_upto f (x / real xa)) x
[PROOF STEP]
by (simp add: dirichlet_prod_altdef1)


[STATEMENT]
lemma "(((\<exists>x. P(x)) \<and> (\<exists>y. Q(y))) \<longrightarrow>
   (((\<forall>x. (P(x) \<longrightarrow> R(x))) \<and> (\<forall>y. (Q(y) \<longrightarrow> S(y)))) =
    (\<forall>x y. ((P(x) \<and> Q(y)) \<longrightarrow> (R(x) \<and> S(y))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x) \<and> (\<exists>y. Q y) \<longrightarrow> ((\<forall>x. P x \<longrightarrow> R x) \<and> (\<forall>y. Q y \<longrightarrow> S y)) = (\<forall>x y. P x \<and> Q y \<longrightarrow> R x \<and> S y)
[PROOF STEP]
by iprover


[STATEMENT]
lemma invertible_bezout_matrix_transpose:
 fixes A::"'a::{bezout_ring_div}^'cols::{finite,wellorder}^'rows"
  assumes ib: "is_bezout_ext bezout"
  and a_less_b: "a < b"
  and aj: "A $h i $h a \<noteq> 0"
shows "invertible (transpose (bezout_matrix (transpose A) a b i bezout))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout))
[PROOF STEP]
have "Determinants.det (bezout_matrix (transpose A) a b i bezout) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinants.det (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout) = (1::'a)
[PROOF STEP]
by (rule det_bezout_matrix[OF ib a_less_b], insert aj, auto simp add: transpose_def)
[PROOF STATE]
proof (state)
this:
Determinants.det (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout) = (1::'a)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout))
[PROOF STEP]
hence "Determinants.det (transpose (bezout_matrix (transpose A) a b i bezout)) = 1"
[PROOF STATE]
proof (prove)
using this:
Determinants.det (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout) = (1::'a)

goal (1 subgoal):
 1. Determinants.det (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout)) = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Determinants.det (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout)) = (1::'a)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Determinants.det (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout)) = (1::'a)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout))
[PROOF STEP]
by (simp add: invertible_iff_is_unit)
[PROOF STATE]
proof (state)
this:
invertible (Finite_Cartesian_Product.transpose (bezout_matrix (Finite_Cartesian_Product.transpose A) a b i bezout))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in ergodic_pmpt) birkhoff_sum_small_asymp_pos:
  fixes f::"'a \<Rightarrow> real"
  assumes [measurable]: "integrable M f" and "e>0"
  shows "AE x in M. infinite {n. birkhoff_sum f n x \<in> {n * (\<integral>x. f x \<partial>M) .. n * (\<integral>x. f x \<partial>M) + e}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + e}}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + e}}
[PROOF STEP]
have "AE x in M. infinite {n. birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x .. n * real_cond_exp M Invariants f x + e}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
using birkhoff_sum_small_asymp_pos_nonergodic[OF assms]
[PROOF STATE]
proof (prove)
using this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + e}}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + e}}
[PROOF STEP]
have "AE x in M. real_cond_exp M Invariants f x = (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants f x = expectation f
[PROOF STEP]
using Invariants_cond_exp_is_integral[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M Invariants f x = expectation f

goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants f x = expectation f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. real_cond_exp M Invariants f x = expectation f

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + e}}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
AE x in M. real_cond_exp M Invariants f x = expectation f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
AE x in M. real_cond_exp M Invariants f x = expectation f

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + e}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + e}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma kernel_one_mat: fixes A :: "'a :: field mat" and n :: nat
  defines A: "A \<equiv> 1\<^sub>m n"
  shows
    "kernel.dim n A = 0"
    "kernel.basis n A {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0 &&& vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
have Ac: "A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat n n
[PROOF STEP]
unfolding A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m n \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
have "pivot_fun A id n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pivot_fun A id n
[PROOF STEP]
unfolding A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pivot_fun (1\<^sub>m n) id n
[PROOF STEP]
by (rule pivot_funI, auto)
[PROOF STATE]
proof (state)
this:
pivot_fun A id n

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
hence row: "row_echelon_form A"
[PROOF STATE]
proof (prove)
using this:
pivot_fun A id n

goal (1 subgoal):
 1. row_echelon_form A
[PROOF STEP]
unfolding row_echelon_form_def A
[PROOF STATE]
proof (prove)
using this:
pivot_fun (1\<^sub>m n) id n

goal (1 subgoal):
 1. \<exists>f. pivot_fun (1\<^sub>m n) f (dim_col (1\<^sub>m n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_echelon_form A

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
have "{i. i < n \<and> row A i \<noteq> 0\<^sub>v n} = {0 ..< n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < n \<and> row A i \<noteq> 0\<^sub>v n} = {0..<n}
[PROOF STEP]
unfolding A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < n \<and> row (1\<^sub>m n) i \<noteq> 0\<^sub>v n} = {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i. i < n \<and> row A i \<noteq> 0\<^sub>v n} = {0..<n}

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
hence id: "card {i. i < n \<and> row A i \<noteq> 0\<^sub>v n} = n"
[PROOF STATE]
proof (prove)
using this:
{i. i < n \<and> row A i \<noteq> 0\<^sub>v n} = {0..<n}

goal (1 subgoal):
 1. card {i. i < n \<and> row A i \<noteq> 0\<^sub>v n} = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {i. i < n \<and> row A i \<noteq> 0\<^sub>v n} = n

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
interpret kernel n n A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Kernel.kernel n n A
[PROOF STEP]
by (unfold_locales, rule Ac)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim = 0
 2. basis {}
[PROOF STEP]
from find_base_vectors[OF row Ac, unfolded id]
[PROOF STATE]
proof (chain)
picking this:
set (find_base_vectors A) \<subseteq> mat_kernel A
0\<^sub>v n \<notin> set (find_base_vectors A)
basis (set (find_base_vectors A))
card (set (find_base_vectors A)) = n - n
length (pivot_positions A) = n
dim = n - n
[PROOF STEP]
show "dim = 0" "basis {}"
[PROOF STATE]
proof (prove)
using this:
set (find_base_vectors A) \<subseteq> mat_kernel A
0\<^sub>v n \<notin> set (find_base_vectors A)
basis (set (find_base_vectors A))
card (set (find_base_vectors A)) = n - n
length (pivot_positions A) = n
dim = n - n

goal (1 subgoal):
 1. dim = 0 &&& basis {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim = 0
basis {}

goal:
No subgoals!
[PROOF STEP]
qed