[STATEMENT]
lemma triangle_encompassing_polychain_of:
  assumes "det3 p a b \<ge> 0" "det3 p b c \<ge> 0" "det3 p c a \<ge> 0"
  assumes "ccw' a b c"
  shows "p \<in> convex hull {a, b, c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> convex hull {a, b, c}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<in> convex hull {a, b, c}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 \<le> det3 p a b
0 \<le> det3 p b c
0 \<le> det3 p c a
ccw' a b c
[PROOF STEP]
have nn: "det3 b c p \<ge> 0" "det3 c a p \<ge> 0" "det3 a b p \<ge> 0" "det3 a b c \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> det3 p a b
0 \<le> det3 p b c
0 \<le> det3 p c a
ccw' a b c

goal (1 subgoal):
 1. (0 \<le> det3 b c p &&& 0 \<le> det3 c a p) &&& 0 \<le> det3 a b p &&& 0 \<le> det3 a b c
[PROOF STEP]
by (auto simp: det3_def' algebra_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> det3 b c p
0 \<le> det3 c a p
0 \<le> det3 a b p
0 \<le> det3 a b c

goal (1 subgoal):
 1. p \<in> convex hull {a, b, c}
[PROOF STEP]
have "det3 a b c *\<^sub>R p = det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det3 a b c *\<^sub>R p = det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c
[PROOF STEP]
by (auto simp: det3_def' algebra_simps prod_eq_iff)
[PROOF STATE]
proof (state)
this:
det3 a b c *\<^sub>R p = det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c

goal (1 subgoal):
 1. p \<in> convex hull {a, b, c}
[PROOF STEP]
hence "inverse (det3 a b c) *\<^sub>R (det3 a b c *\<^sub>R p) =
      inverse (det3 a b c) *\<^sub>R (det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c)"
[PROOF STATE]
proof (prove)
using this:
det3 a b c *\<^sub>R p = det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c

goal (1 subgoal):
 1. det3 a b c *\<^sub>R p /\<^sub>R det3 a b c = (det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c) /\<^sub>R det3 a b c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det3 a b c *\<^sub>R p /\<^sub>R det3 a b c = (det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c) /\<^sub>R det3 a b c

goal (1 subgoal):
 1. p \<in> convex hull {a, b, c}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 \<le> det3 p a b
0 \<le> det3 p b c
0 \<le> det3 p c a
ccw' a b c
det3 a b c *\<^sub>R p /\<^sub>R det3 a b c = (det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c) /\<^sub>R det3 a b c
[PROOF STEP]
have p_eq: "p =
    (det3 b c p / det3 a b c) *\<^sub>R a + (det3 c a p / det3 a b c) *\<^sub>R b + (det3 a b p / det3 a b c) *\<^sub>R c"
    (is "_ = scaleR ?u _ + scaleR ?v _ + scaleR ?w _")
[PROOF STATE]
proof (prove)
using this:
0 \<le> det3 p a b
0 \<le> det3 p b c
0 \<le> det3 p c a
ccw' a b c
det3 a b c *\<^sub>R p /\<^sub>R det3 a b c = (det3 b c p *\<^sub>R a + det3 c a p *\<^sub>R b + det3 a b p *\<^sub>R c) /\<^sub>R det3 a b c

goal (1 subgoal):
 1. p = (det3 b c p / det3 a b c) *\<^sub>R a + (det3 c a p / det3 a b c) *\<^sub>R b + (det3 a b p / det3 a b c) *\<^sub>R c
[PROOF STEP]
by (simp add: inverse_eq_divide algebra_simps ccw'_def)
[PROOF STATE]
proof (state)
this:
p = (det3 b c p / det3 a b c) *\<^sub>R a + (det3 c a p / det3 a b c) *\<^sub>R b + (det3 a b p / det3 a b c) *\<^sub>R c

goal (1 subgoal):
 1. p \<in> convex hull {a, b, c}
[PROOF STEP]
have det_eq: "det3 b c p / det3 a b c + det3 c a p / det3 a b c + det3 a b p / det3 a b c = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det3 b c p / det3 a b c + det3 c a p / det3 a b c + det3 a b p / det3 a b c = 1
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
ccw' a b c

goal (1 subgoal):
 1. det3 b c p / det3 a b c + det3 c a p / det3 a b c + det3 a b p / det3 a b c = 1
[PROOF STEP]
by (simp add: add_divide_distrib[symmetric] det3_def' algebra_simps ccw'_def)
[PROOF STATE]
proof (state)
this:
det3 b c p / det3 a b c + det3 c a p / det3 a b c + det3 a b p / det3 a b c = 1

goal (1 subgoal):
 1. p \<in> convex hull {a, b, c}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> convex hull {a, b, c}
[PROOF STEP]
unfolding convex_hull_3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> {u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c |u v w. 0 \<le> u \<and> 0 \<le> v \<and> 0 \<le> w \<and> u + v + w = 1}
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
ccw' a b c

goal (1 subgoal):
 1. p \<in> {u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c |u v w. 0 \<le> u \<and> 0 \<le> v \<and> 0 \<le> w \<and> u + v + w = 1}
[PROOF STEP]
by (blast intro: exI[where x="?u"] exI[where x="?v"] exI[where x="?w"]
      intro!: p_eq divide_nonneg_nonneg nn det_eq)
[PROOF STATE]
proof (state)
this:
p \<in> convex hull {a, b, c}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_inorder[simp]: "length (inorder t) = size t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Tree2.inorder t) = size t
[PROOF STEP]
by (induction t) auto


[STATEMENT]
lemma Abs_freelist_rev_append_alternating_list_in_Q:
  assumes "s\<in>S" "t\<in>S"
  shows "Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Abs_freelist (rev (alternating_list 0 s t) @ alternating_list 0 s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
 2. \<And>n. Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle> \<Longrightarrow> Abs_freelist (rev (alternating_list (Suc n) s t) @ alternating_list (Suc n) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>

goal (2 subgoals):
 1. Abs_freelist (rev (alternating_list 0 s t) @ alternating_list 0 s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
 2. \<And>n. Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle> \<Longrightarrow> Abs_freelist (rev (alternating_list (Suc n) s t) @ alternating_list (Suc n) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
define u where "u = (if even m then s else t)"
[PROOF STATE]
proof (state)
this:
u = (if even m then s else t)

goal (2 subgoals):
 1. Abs_freelist (rev (alternating_list 0 s t) @ alternating_list 0 s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
 2. \<And>n. Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle> \<Longrightarrow> Abs_freelist (rev (alternating_list (Suc n) s t) @ alternating_list (Suc n) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
define x where "x = Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)"
[PROOF STATE]
proof (state)
this:
x = Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)

goal (2 subgoals):
 1. Abs_freelist (rev (alternating_list 0 s t) @ alternating_list 0 s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
 2. \<And>n. Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle> \<Longrightarrow> Abs_freelist (rev (alternating_list (Suc n) s t) @ alternating_list (Suc n) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
from u_def x_def assms
[PROOF STATE]
proof (chain)
picking this:
u = (if even m then s else t)
x = Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)
s \<in> S
t \<in> S
[PROOF STEP]
have
    "Abs_freelist (rev (alternating_list (Suc m) s t) @
      alternating_list (Suc m) s t) =
        (pair_relator_freeword u u) + rconjby (Abs_freeletter u) x"
[PROOF STATE]
proof (prove)
using this:
u = (if even m then s else t)
x = Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)
s \<in> S
t \<in> S

goal (1 subgoal):
 1. Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) = pair_relator_freeword u u + rconjby (Abs_freeletter u) x
[PROOF STEP]
using Abs_freelist_append[of
            "u # rev (alternating_list m s t) @ alternating_list m s t"
            "[u]"
          ]
          Abs_freelist_Cons[of
            u
            "rev (alternating_list m s t) @ alternating_list m s t"
          ]
[PROOF STATE]
proof (prove)
using this:
u = (if even m then s else t)
x = Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)
s \<in> S
t \<in> S
Abs_freelist ((u # rev (alternating_list m s t) @ alternating_list m s t) @ [u]) = Abs_freelist (u # rev (alternating_list m s t) @ alternating_list m s t) + Abs_freelist [u]
Abs_freelist (u # rev (alternating_list m s t) @ alternating_list m s t) = Abs_freeletter u + Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)

goal (1 subgoal):
 1. Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) = pair_relator_freeword u u + rconjby (Abs_freeletter u) x
[PROOF STEP]
by    (simp add: add.assoc[THEN sym] S_relator_freeword)
[PROOF STATE]
proof (state)
this:
Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) = pair_relator_freeword u u + rconjby (Abs_freeletter u) x

goal (2 subgoals):
 1. Abs_freelist (rev (alternating_list 0 s t) @ alternating_list 0 s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
 2. \<And>n. Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle> \<Longrightarrow> Abs_freelist (rev (alternating_list (Suc n) s t) @ alternating_list (Suc n) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) = pair_relator_freeword u u + rconjby (Abs_freeletter u) x

goal (2 subgoals):
 1. Abs_freelist (rev (alternating_list 0 s t) @ alternating_list 0 s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
 2. \<And>n. Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle> \<Longrightarrow> Abs_freelist (rev (alternating_list (Suc n) s t) @ alternating_list (Suc n) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
from Suc assms u_def x_def
[PROOF STATE]
proof (chain)
picking this:
Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
s \<in> S
t \<in> S
u = (if even m then s else t)
x = Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)
[PROOF STEP]
have "rconjby (Abs_freeletter u) x \<in> Q"
[PROOF STATE]
proof (prove)
using this:
Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
s \<in> S
t \<in> S
u = (if even m then s else t)
x = Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)

goal (1 subgoal):
 1. rconjby (Abs_freeletter u) x \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
using Abs_freeletter_in_FreeGroup_iff[of _ S]
          FreeGroup_genby_set_lconjby_set_rconjby_closed
[PROOF STATE]
proof (prove)
using this:
Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
s \<in> S
t \<in> S
u = (if even m then s else t)
x = Abs_freelist (rev (alternating_list m s t) @ alternating_list m s t)
(Abs_freeletter ?s \<in> FreeGroup S) = (?s \<in> S)
\<lbrakk>?g \<in> FreeGroup ?S; ?x \<in> \<langle>\<Union>g\<in>FreeGroup ?S. lconjby g ` ?A\<rangle>\<rbrakk> \<Longrightarrow> rconjby ?g ?x \<in> \<langle>\<Union>g\<in>FreeGroup ?S. lconjby g ` ?A\<rangle>

goal (1 subgoal):
 1. rconjby (Abs_freeletter u) x \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
rconjby (Abs_freeletter u) x \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>

goal (2 subgoals):
 1. Abs_freelist (rev (alternating_list 0 s t) @ alternating_list 0 s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
 2. \<And>n. Abs_freelist (rev (alternating_list n s t) @ alternating_list n s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle> \<Longrightarrow> Abs_freelist (rev (alternating_list (Suc n) s t) @ alternating_list (Suc n) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) = pair_relator_freeword u u + rconjby (Abs_freeletter u) x
rconjby (Abs_freeletter u) x \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) = pair_relator_freeword u u + rconjby (Abs_freeletter u) x
rconjby (Abs_freeletter u) x \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>

goal (1 subgoal):
 1. Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
using u_def assms relator_freeword_Q genby_add_closed
[PROOF STATE]
proof (prove)
using this:
Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) = pair_relator_freeword u u + rconjby (Abs_freeletter u) x
rconjby (Abs_freeletter u) x \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
u = (if even m then s else t)
s \<in> S
t \<in> S
\<lbrakk>?s \<in> S; ?t \<in> S\<rbrakk> \<Longrightarrow> pair_relator_freeword ?s ?t \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
\<lbrakk>?g \<in> \<langle>?S\<rangle>; ?h \<in> \<langle>?S\<rangle>\<rbrakk> \<Longrightarrow> ?g + ?h \<in> \<langle>?S\<rangle>

goal (1 subgoal):
 1. Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Abs_freelist (rev (alternating_list (Suc m) s t) @ alternating_list (Suc m) s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>

goal (1 subgoal):
 1. Abs_freelist (rev (alternating_list 0 s t) @ alternating_list 0 s t) \<in> \<langle>\<Union>g\<in>FreeGroup S. lconjby g ` Abs_freeword ` map (charpair S) ` R\<rangle>
[PROOF STEP]
qed (simp add: zero_freeword.abs_eq[THEN sym] genby_0_closed)


[STATEMENT]
lemma card_of_nlists_Succ: "|nlists A (Suc n)| =o |A \<times> (nlists A n)|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
let ?B = "A \<times> (nlists A n)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
let ?h = "\<lambda>(a,l). a # l"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
have "inj_on ?h ?B \<and> ?h ` ?B \<le> nlists A (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>(a, l). a # l) (A \<times> nlists A n) \<and> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n) \<subseteq> nlists A (Suc n)
[PROOF STEP]
unfolding inj_on_def nlists_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>A \<times> {l. set l \<subseteq> A \<and> length l = n}. \<forall>y\<in>A \<times> {l. set l \<subseteq> A \<and> length l = n}. (case x of (x, xa) \<Rightarrow> x # xa) = (case y of (x, xa) \<Rightarrow> x # xa) \<longrightarrow> x = y) \<and> (\<lambda>(a, l). a # l) ` (A \<times> {l. set l \<subseteq> A \<and> length l = n}) \<subseteq> {l. set l \<subseteq> A \<and> length l = Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>(a, l). a # l) (A \<times> nlists A n) \<and> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n) \<subseteq> nlists A (Suc n)

goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>(a, l). a # l) (A \<times> nlists A n) \<and> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n) \<subseteq> nlists A (Suc n)

goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
have "nlists A (Suc n) \<le> ?h ` ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nlists A (Suc n) \<subseteq> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n)
[PROOF STEP]
proof(auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> nlists A (Suc n) \<Longrightarrow> x \<in> (\<lambda>x. case x of (a, l) \<Rightarrow> a # l) ` (A \<times> nlists A n)
[PROOF STEP]
fix l
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> nlists A (Suc n) \<Longrightarrow> x \<in> (\<lambda>x. case x of (a, l) \<Rightarrow> a # l) ` (A \<times> nlists A n)
[PROOF STEP]
assume "l \<in> nlists A (Suc n)"
[PROOF STATE]
proof (state)
this:
l \<in> nlists A (Suc n)

goal (1 subgoal):
 1. \<And>x. x \<in> nlists A (Suc n) \<Longrightarrow> x \<in> (\<lambda>x. case x of (a, l) \<Rightarrow> a # l) ` (A \<times> nlists A n)
[PROOF STEP]
hence 1: "length l = Suc n \<and> set l \<le> A"
[PROOF STATE]
proof (prove)
using this:
l \<in> nlists A (Suc n)

goal (1 subgoal):
 1. length l = Suc n \<and> set l \<subseteq> A
[PROOF STEP]
unfolding nlists_def
[PROOF STATE]
proof (prove)
using this:
l \<in> {l. set l \<subseteq> A \<and> length l = Suc n}

goal (1 subgoal):
 1. length l = Suc n \<and> set l \<subseteq> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length l = Suc n \<and> set l \<subseteq> A

goal (1 subgoal):
 1. \<And>x. x \<in> nlists A (Suc n) \<Longrightarrow> x \<in> (\<lambda>x. case x of (a, l) \<Rightarrow> a # l) ` (A \<times> nlists A n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length l = Suc n \<and> set l \<subseteq> A
[PROOF STEP]
obtain a and l' where 2: "l = a # l'"
[PROOF STATE]
proof (prove)
using this:
length l = Suc n \<and> set l \<subseteq> A

goal (1 subgoal):
 1. (\<And>a l'. l = a # l' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: length_Suc_conv)
[PROOF STATE]
proof (state)
this:
l = a # l'

goal (1 subgoal):
 1. \<And>x. x \<in> nlists A (Suc n) \<Longrightarrow> x \<in> (\<lambda>x. case x of (a, l) \<Rightarrow> a # l) ` (A \<times> nlists A n)
[PROOF STEP]
hence "a \<in> A \<and> set l' \<le> A \<and> length l' = n"
[PROOF STATE]
proof (prove)
using this:
l = a # l'

goal (1 subgoal):
 1. a \<in> A \<and> set l' \<subseteq> A \<and> length l' = n
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
l = a # l'
length l = Suc n \<and> set l \<subseteq> A

goal (1 subgoal):
 1. a \<in> A \<and> set l' \<subseteq> A \<and> length l' = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> A \<and> set l' \<subseteq> A \<and> length l' = n

goal (1 subgoal):
 1. \<And>x. x \<in> nlists A (Suc n) \<Longrightarrow> x \<in> (\<lambda>x. case x of (a, l) \<Rightarrow> a # l) ` (A \<times> nlists A n)
[PROOF STEP]
thus "l \<in> ?h ` ?B"
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<and> set l' \<subseteq> A \<and> length l' = n

goal (1 subgoal):
 1. l \<in> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<and> set l' \<subseteq> A \<and> length l' = n
l = a # l'

goal (1 subgoal):
 1. l \<in> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n)
[PROOF STEP]
unfolding nlists_def
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<and> set l' \<subseteq> A \<and> length l' = n
l = a # l'

goal (1 subgoal):
 1. l \<in> (\<lambda>(a, l). a # l) ` (A \<times> {l. set l \<subseteq> A \<and> length l = n})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l \<in> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nlists A (Suc n) \<subseteq> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n)

goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>(a, l). a # l) (A \<times> nlists A n) \<and> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n) \<subseteq> nlists A (Suc n)
nlists A (Suc n) \<subseteq> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n)
[PROOF STEP]
have "bij_betw ?h ?B (nlists A (Suc n))"
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>(a, l). a # l) (A \<times> nlists A n) \<and> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n) \<subseteq> nlists A (Suc n)
nlists A (Suc n) \<subseteq> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n)

goal (1 subgoal):
 1. bij_betw (\<lambda>(a, l). a # l) (A \<times> nlists A n) (nlists A (Suc n))
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>(a, l). a # l) (A \<times> nlists A n) \<and> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n) \<subseteq> nlists A (Suc n)
nlists A (Suc n) \<subseteq> (\<lambda>(a, l). a # l) ` (A \<times> nlists A n)

goal (1 subgoal):
 1. inj_on (\<lambda>(x, y). x # y) (A \<times> nlists A n) \<and> (\<lambda>(x, y). x # y) ` (A \<times> nlists A n) = nlists A (Suc n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>(a, l). a # l) (A \<times> nlists A n) (nlists A (Suc n))

goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>(a, l). a # l) (A \<times> nlists A n) (nlists A (Suc n))

goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
using card_of_ordIso ordIso_symmetric
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>(a, l). a # l) (A \<times> nlists A n) (nlists A (Suc n))
(\<exists>f. bij_betw f ?A ?B) = (|?A| =o |?B|)
?r =o ?r' \<Longrightarrow> ?r' =o ?r

goal (1 subgoal):
 1. |nlists A (Suc n)| =o |A \<times> nlists A n|
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
|nlists A (Suc n)| =o |A \<times> nlists A n|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hull_UNIV [simp]: "S hull UNIV = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S hull UNIV = UNIV
[PROOF STEP]
unfolding hull_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> {t. S t \<and> UNIV \<subseteq> t} = UNIV
[PROOF STEP]
by auto


[STATEMENT]
theorem regular_rev: "regular S \<Longrightarrow> regular (rev ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. regular S \<Longrightarrow> regular (rev ` S)
[PROOF STEP]
apply (auto simp: regular_def accepts_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>fsm. S = {xs. \<exists>st st'. reaches fsm st xs st' \<and> st \<^bold>\<in> init fsm \<and> st' \<^bold>\<in> final fsm} \<Longrightarrow> \<exists>fsma. rev ` {xs. \<exists>st st'. reaches fsm st xs st' \<and> st \<^bold>\<in> init fsm \<and> st' \<^bold>\<in> final fsm} = {xs. \<exists>st st'. reaches fsma st xs st' \<and> st \<^bold>\<in> init fsma \<and> st' \<^bold>\<in> final fsma}
[PROOF STEP]
apply (rule_tac x="Reverse fsm" in exI, force+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ring_hom_mult:
  fixes R (structure) and S (structure)
  shows "\<lbrakk> h \<in> ring_hom R S; x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>h \<in> ring_hom R S; x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y
[PROOF STEP]
by (simp add: ring_hom_def)


[STATEMENT]
lemma invariance_of_domain:
  fixes f :: "'a \<Rightarrow> 'a::euclidean_space"
  assumes "continuous_on S f" "open S" "inj_on f S" shows "open(f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (f ` S)
[PROOF STEP]
using invariance_of_domain_subspaces [of UNIV S UNIV] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>openin (top_of_set UNIV) S; subspace UNIV; subspace UNIV; dim UNIV \<le> dim UNIV; continuous_on S ?f; ?f ` S \<subseteq> UNIV; inj_on ?f S\<rbrakk> \<Longrightarrow> openin (top_of_set UNIV) (?f ` S)
continuous_on S f
open S
inj_on f S

goal (1 subgoal):
 1. open (f ` S)
[PROOF STEP]
by (force simp add: )


[STATEMENT]
lemma expands_to_exp_ln:
  assumes "trimmed_pos F" "basis_wf basis" "(f expands_to F) basis"
  shows   "((\<lambda>x. exp (ln (f x))) expands_to F) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp (ln (f x))) expands_to F) basis
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
(f expands_to F) basis

goal (1 subgoal):
 1. ((\<lambda>x. exp (ln (f x))) expands_to F) basis
[PROOF STEP]
proof (rule expands_to_cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x = exp (ln (f x))
[PROOF STEP]
from eval_pos_if_dominant_term_pos[of basis F] assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>basis_wf basis; is_expansion F basis; trimmed F; 0 < fst (dominant_term F)\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. 0 < eval F x
trimmed_pos F
basis_wf basis
(f expands_to F) basis
[PROOF STEP]
show "eventually (\<lambda>x. f x = exp (ln (f x))) at_top"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>basis_wf basis; is_expansion F basis; trimmed F; 0 < fst (dominant_term F)\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. 0 < eval F x
trimmed_pos F
basis_wf basis
(f expands_to F) basis

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x = exp (ln (f x))
[PROOF STEP]
by (auto simp: expands_to.simps trimmed_pos_def powr_def elim: eventually_elim2)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. f x = exp (ln (f x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_summable_on_Cauchy:
  "f abs_summable_on (UNIV :: nat set) \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n. (\<Sum>x = m..<n. norm (f x)) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f abs_summable_on UNIV) = (\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n. (\<Sum>x = m..<n. norm (f x)) < e)
[PROOF STEP]
by (simp add: abs_summable_on_nat_iff' summable_Cauchy sum_nonneg)


[STATEMENT]
lemma simplex_likeI:
  assumes "finite P" "OrderingSetIso less_eq less (\<subseteq>) (\<subset>) P f"
          "f`P = Pow (A::nat set)"
  shows   "simplex_like P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simplex_like P
[PROOF STEP]
using assms simplex_like_def
[PROOF STATE]
proof (prove)
using this:
finite P
OrderingSetIso (\<^bold>\<le>) (\<^bold><) (\<subseteq>) (\<subset>) P f
f ` P = Pow A
simplex_like ?P \<equiv> finite ?P \<and> (\<exists>f A. OrderingSetIso (\<^bold>\<le>) (\<^bold><) (\<subseteq>) (\<subset>) ?P f \<and> f ` ?P = Pow A)

goal (1 subgoal):
 1. simplex_like P
[PROOF STEP]
by auto


[STATEMENT]
lemma root_numeral_simproc_aux:
  assumes "Num.pow m n \<equiv> x"
  shows   "root (numeral n) (numeral x :: real) \<equiv> numeral m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root (numeral n) (numeral x) \<equiv> numeral m
[PROOF STEP]
by (subst assms [symmetric], subst numeral_pow, subst real_root_pos2) simp_all


[STATEMENT]
lemma one_times_ivl_right[simp]: "A * 1 = A" for A :: "'a::linordered_idom interval"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * 1 = A
[PROOF STEP]
by (metis interval_mul_commute one_times_ivl_left)


[STATEMENT]
lemma sup_continuous_enn2ereal[order_continuous_intros]:
  assumes f: "sup_continuous f" shows "sup_continuous (\<lambda>x. enn2ereal (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup_continuous (\<lambda>x. enn2ereal (f x))
[PROOF STEP]
proof (rule sup_continuous_compose[OF _ f])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sup_continuous enn2ereal
[PROOF STEP]
show "sup_continuous enn2ereal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup_continuous enn2ereal
[PROOF STEP]
by (simp add: continuous_at_enn2ereal continuous_at_left_imp_sup_continuous less_eq_ennreal.rep_eq mono_def)
[PROOF STATE]
proof (state)
this:
sup_continuous enn2ereal

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cut_le_inext_nth_card_eq1: "
  n < card I \<or> infinite I \<Longrightarrow> card (I \<down>\<le> (I \<rightarrow> n)) = Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < card I \<or> infinite I \<Longrightarrow> card (I \<down>\<le> (I \<rightarrow> n)) = Suc n
[PROOF STEP]
apply (case_tac "I = {}", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < card I \<or> infinite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> card (I \<down>\<le> (I \<rightarrow> n)) = Suc n
[PROOF STEP]
apply (simp add: cut_le_less_conv_if inext_nth_closed card_insert_if nat_cut_less_finite cut_less_mem_iff cut_less_inext_nth_card_eq1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma join_lc[simp]: "x \<squnion> (y \<squnion> z) = y \<squnion> (x \<squnion> (z::'a::Finite_Join_cpo))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> (y \<squnion> z) = y \<squnion> (x \<squnion> z)
[PROOF STEP]
by (metis join_assoc join_comm)


[STATEMENT]
lemma "mono (S::'a::boolean_algebra \<Rightarrow> 'b::boolean_algebra) \<Longrightarrow> (S = Fail) = (fail S = \<top>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono S \<Longrightarrow> (S = Fail) = (fail S = \<top>)
[PROOF STEP]
proof auto
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>mono Fail; S = Fail\<rbrakk> \<Longrightarrow> fail Fail = \<top>
 2. \<lbrakk>mono S; fail S = \<top>\<rbrakk> \<Longrightarrow> S = Fail
[PROOF STEP]
show "fail (Fail::'a \<Rightarrow> 'b) = \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fail Fail = \<top>
[PROOF STEP]
by (metis Fail_def bot_apply compl_bot_eq fail_def)
[PROOF STATE]
proof (state)
this:
fail Fail = \<top>

goal (1 subgoal):
 1. \<lbrakk>mono S; fail S = \<top>\<rbrakk> \<Longrightarrow> S = Fail
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>mono S; fail S = \<top>\<rbrakk> \<Longrightarrow> S = Fail
[PROOF STEP]
assume A: "mono S"
[PROOF STATE]
proof (state)
this:
mono S

goal (1 subgoal):
 1. \<lbrakk>mono S; fail S = \<top>\<rbrakk> \<Longrightarrow> S = Fail
[PROOF STEP]
assume B: "fail S = \<top>"
[PROOF STATE]
proof (state)
this:
fail S = \<top>

goal (1 subgoal):
 1. \<lbrakk>mono S; fail S = \<top>\<rbrakk> \<Longrightarrow> S = Fail
[PROOF STEP]
show "S = Fail"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = Fail
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S \<le> Fail
 2. Fail \<le> S
[PROOF STEP]
show "S \<le> Fail"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<le> Fail
[PROOF STEP]
by (metis (opaque_lifting, no_types) A B bot.extremum_unique compl_le_compl_iff fail_def le_fun_def monoD top_greatest)
[PROOF STATE]
proof (state)
this:
S \<le> Fail

goal (1 subgoal):
 1. Fail \<le> S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Fail \<le> S
[PROOF STEP]
show "Fail \<le> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fail \<le> S
[PROOF STEP]
by (metis Fail_def bot.extremum)
[PROOF STATE]
proof (state)
this:
Fail \<le> S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
S = Fail

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ediv_mydiv[simp]: "ediv (enat a) k \<le> enat f \<longleftrightarrow> mydiv a k \<le> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ediv (enat a) k \<le> enat f) = (mydiv a k \<le> f)
[PROOF STEP]
unfolding ediv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if enat a = \<infinity> then \<infinity> else enat (mydiv (THE i. enat a = enat i) k)) \<le> enat f) = (mydiv a k \<le> f)
[PROOF STEP]
by auto


[STATEMENT]
lemma Mp_coeff: "coeff (Mp f) i = M (coeff f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (Mp f) i = M (coeff f i)
[PROOF STEP]
unfolding Mp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (map_poly M f) i = M (coeff f i)
[PROOF STEP]
by (simp add: M_def coeff_map_poly)


[STATEMENT]
lemma log_2 [simp]:
  "Discrete.log 2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Discrete.log 2 = 1
[PROOF STEP]
using log_exp [of 1]
[PROOF STATE]
proof (prove)
using this:
Discrete.log (2 ^ 1) = 1

goal (1 subgoal):
 1. Discrete.log 2 = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma nat_of_minus_sat [simp, code abstract]:
  "nat_of (x - y) = nat_of x - nat_of y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_of (x - y) = nat_of x - nat_of y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat_of (x - y) = nat_of x - nat_of y
[PROOF STEP]
from nat_of_le_len_of [of x]
[PROOF STATE]
proof (chain)
picking this:
nat_of x \<le> LENGTH('a)
[PROOF STEP]
have "nat_of x - nat_of y \<le> LENGTH('a)"
[PROOF STATE]
proof (prove)
using this:
nat_of x \<le> LENGTH('a)

goal (1 subgoal):
 1. nat_of x - nat_of y \<le> LENGTH('a)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
nat_of x - nat_of y \<le> LENGTH('a)

goal (1 subgoal):
 1. nat_of (x - y) = nat_of x - nat_of y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_of x - nat_of y \<le> LENGTH('a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nat_of x - nat_of y \<le> LENGTH('a)

goal (1 subgoal):
 1. nat_of (x - y) = nat_of x - nat_of y
[PROOF STEP]
by (simp add: minus_sat_def)
[PROOF STATE]
proof (state)
this:
nat_of (x - y) = nat_of x - nat_of y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smcf_cn_cov_comp_ObjMap_vrange:
  assumes "\<GG> : \<BB> \<^sub>S\<^sub>M\<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret L: is_semifunctor \<alpha> \<open>op_smc \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_smc \<BB> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret R: is_semifunctor \<alpha> \<AA> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
by
      (
        rule dghm_cn_cov_comp_ObjMap_vrange
          [
            OF
              L.smcf_is_dghm[unfolded slicing_commute[symmetric]]
              R.smcf_is_dghm,
            unfolded slicing_commute slicing_simps
          ]
      )
[PROOF STATE]
proof (state)
this:
\<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma divides_ff_mult_right: "a \<noteq> 0 \<Longrightarrow> divides_ff (x * inverse a) y \<Longrightarrow> divides_ff x (a * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> 0; divides_ff (x * inverse a) y\<rbrakk> \<Longrightarrow> divides_ff x (a * y)
[PROOF STEP]
unfolding divides_ff_def divide_inverse[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> 0; \<exists>r. y = x / a * to_fract r\<rbrakk> \<Longrightarrow> \<exists>r. a * y = x * to_fract r
[PROOF STEP]
by auto


[STATEMENT]
lemma space_vimage_algebra[simp]: "space (vimage_algebra X f M) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (vimage_algebra X f M) = X
[PROOF STEP]
unfolding vimage_algebra_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (sigma X {f -` A \<inter> X |A. A \<in> sets M}) = X
[PROOF STEP]
by (rule space_measure_of) auto


[STATEMENT]
lemma minus_carrier_vec[simp]:
  "v\<^sub>1 \<in> carrier_vec n \<Longrightarrow> v\<^sub>2 \<in> carrier_vec n \<Longrightarrow> v\<^sub>1 - v\<^sub>2 \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v\<^sub>1 \<in> carrier_vec n; v\<^sub>2 \<in> carrier_vec n\<rbrakk> \<Longrightarrow> v\<^sub>1 - v\<^sub>2 \<in> carrier_vec n
[PROOF STEP]
unfolding carrier_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v\<^sub>1 \<in> {v. dim_vec v = n}; v\<^sub>2 \<in> {v. dim_vec v = n}\<rbrakk> \<Longrightarrow> v\<^sub>1 - v\<^sub>2 \<in> {v. dim_vec v = n}
[PROOF STEP]
by auto


[STATEMENT]
lemma Minr_strip_Suc[simp]: "Minr Rr xs w \<le> w \<Longrightarrow> Minr Rr xs (Suc w) = Minr Rr xs w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Minr Rr xs w \<le> w \<Longrightarrow> Minr Rr xs (Suc w) = Minr Rr xs w
[PROOF STEP]
by(cases "\<forall>x\<le>w. \<not> Rr (xs @ [x])",auto simp add: Minr.simps expand_conj_in_set)


[STATEMENT]
lemma norm_respects_equiv:
    assumes "equiv t u"
    shows "\<^bold>\<parallel>t\<^bold>\<parallel> = \<^bold>\<parallel>u\<^bold>\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>\<parallel>t\<^bold>\<parallel> = \<^bold>\<parallel>u\<^bold>\<parallel>
[PROOF STEP]
using assms norm_def
[PROOF STATE]
proof (prove)
using this:
local.equiv t u
\<^bold>\<parallel>?t\<^bold>\<parallel> = Inv (Cod ?t\<^bold>\<down>) \<^bold>\<cdot> \<^bold>\<lfloor>?t\<^bold>\<rfloor> \<^bold>\<cdot> Dom ?t\<^bold>\<down>

goal (1 subgoal):
 1. \<^bold>\<parallel>t\<^bold>\<parallel> = \<^bold>\<parallel>u\<^bold>\<parallel>
[PROOF STEP]
by simp


[STATEMENT]
lemma assert_Inf_ne: "A \<noteq> {} \<Longrightarrow> {\<cdot>Inf A} = Inf (assert ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> {\<cdot> \<Sqinter> A } = \<Sqinter> (assert ` A)
[PROOF STEP]
apply (unfold assert_Inf)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> \<Sqinter> (assert ` A) \<sqinter> (1::'a) = \<Sqinter> (assert ` A)
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. A \<noteq> {} \<Longrightarrow> \<Sqinter> (assert ` A) \<sqinter> (1::'a) \<le> \<Sqinter> (assert ` A)
 2. A \<noteq> {} \<Longrightarrow> \<Sqinter> (assert ` A) \<le> \<Sqinter> (assert ` A) \<sqinter> (1::'a)
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> \<Sqinter> (assert ` A) \<le> (1::'a)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<not> \<Sqinter> (assert ` A) \<le> (1::'a); x \<in> A\<rbrakk> \<Longrightarrow> x \<in> {}
[PROOF STEP]
apply (erule notE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> \<Sqinter> (assert ` A) \<le> (1::'a)
[PROOF STEP]
apply (rule_tac y = "{\<cdot>x}" in order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> A \<Longrightarrow> \<Sqinter> (assert ` A) \<le> {\<cdot> x }
 2. \<And>x. x \<in> A \<Longrightarrow> {\<cdot> x } \<le> (1::'a)
[PROOF STEP]
by (simp_all add: INF_lower)


[STATEMENT]
lemma closed_segment_idem [simp]: "closed_segment a a = {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment a a = {a}
[PROOF STEP]
unfolding segment
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(1 - u) *\<^sub>R a + u *\<^sub>R a |u. 0 \<le> u \<and> u \<le> 1} = {a}
[PROOF STEP]
by (auto simp add: algebra_simps)


[STATEMENT]
lemma domo_join: "domo (S \<squnion> T) \<subseteq> domo S \<union> domo T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domo (S \<squnion> T) \<subseteq> domo S \<union> domo T
[PROOF STEP]
by(auto simp: domo_def join_st_def split: option.split)


[STATEMENT]
lemma preserve_mat_point_index:
  assumes "inj_on_01_hom f"
  assumes "\<And> i. i \<in> I \<Longrightarrow> i < dim_row M"
  shows "mat_point_index M I = mat_point_index (map_mat f M) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_point_index M I = mat_point_index (map_mat f M) I
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_point_index M I = mat_point_index (map_mat f M) I
[PROOF STEP]
have "\<And> i j. i \<in> I \<Longrightarrow> j < dim_col M \<and> M $$ (i, j) = 1 \<longleftrightarrow>
      j < dim_col (map_mat f M) \<and> (map_mat f M) $$ (i, j) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. i \<in> I \<Longrightarrow> (j < dim_col M \<and> M $$ (i, j) = (1::'b)) = (j < dim_col (map_mat f M) \<and> map_mat f M $$ (i, j) = (1::'a))
[PROOF STEP]
using assms(2) inj_on_01_hom_index(1) assms(1)
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> ?i < dim_row M
\<lbrakk>inj_on_01_hom ?f; ?i < dim_row M; ?j < dim_col M\<rbrakk> \<Longrightarrow> (M $$ (?i, ?j) = (1::'b)) = (map_mat ?f M $$ (?i, ?j) = (1::?'a))
inj_on_01_hom f

goal (1 subgoal):
 1. \<And>i j. i \<in> I \<Longrightarrow> (j < dim_col M \<and> M $$ (i, j) = (1::'b)) = (j < dim_col (map_mat f M) \<and> map_mat f M $$ (i, j) = (1::'a))
[PROOF STEP]
by (metis index_map_mat(3))
[PROOF STATE]
proof (state)
this:
?i \<in> I \<Longrightarrow> (?j < dim_col M \<and> M $$ (?i, ?j) = (1::'b)) = (?j < dim_col (map_mat f M) \<and> map_mat f M $$ (?i, ?j) = (1::'a))

goal (1 subgoal):
 1. mat_point_index M I = mat_point_index (map_mat f M) I
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> (?j < dim_col M \<and> M $$ (?i, ?j) = (1::'b)) = (?j < dim_col (map_mat f M) \<and> map_mat f M $$ (?i, ?j) = (1::'a))

goal (1 subgoal):
 1. mat_point_index M I = mat_point_index (map_mat f M) I
[PROOF STEP]
unfolding mat_point_index_def
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> (?j < dim_col M \<and> M $$ (?i, ?j) = (1::'b)) = (?j < dim_col (map_mat f M) \<and> map_mat f M $$ (?i, ?j) = (1::'a))

goal (1 subgoal):
 1. card {j. j < dim_col M \<and> (\<forall>i\<in>I. M $$ (i, j) = (1::'b))} = card {j. j < dim_col (map_mat f M) \<and> (\<forall>i\<in>I. map_mat f M $$ (i, j) = (1::'a))}
[PROOF STEP]
by (metis (no_types, opaque_lifting) index_map_mat(3))
[PROOF STATE]
proof (state)
this:
mat_point_index M I = mat_point_index (map_mat f M) I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem insert'_correct: assumes "invar_vebt t n"
  shows "set_vebt (insert' t x) = (set_vebt t \<union> {x})\<inter>{0..2^n-1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
proof(cases t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x11 x12 x13 x14. t = Node x11 x12 x13 x14 \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<And>x21 x22. t = Leaf x21 x22 \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
case (Node x11 x12 x13 x14)
[PROOF STATE]
proof (state)
this:
t = Node x11 x12 x13 x14

goal (2 subgoals):
 1. \<And>x11 x12 x13 x14. t = Node x11 x12 x13 x14 \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<And>x21 x22. t = Leaf x21 x22 \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t = Node x11 x12 x13 x14
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t = Node x11 x12 x13 x14

goal (1 subgoal):
 1. set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
proof(cases "x < 2^n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>t = Node x11 x12 x13 x14; x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < 2 ^ n

goal (2 subgoals):
 1. \<lbrakk>t = Node x11 x12 x13 x14; x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
hence "set_vebt (insert'  t x) = set_vebt(vebt_insert t x)"
[PROOF STATE]
proof (prove)
using this:
x < 2 ^ n

goal (1 subgoal):
 1. set_vebt (insert' t x) = set_vebt (vebt_insert t x)
[PROOF STEP]
by (metis Node assms deg_deg_n insert'.simps(2) leD)
[PROOF STATE]
proof (state)
this:
set_vebt (insert' t x) = set_vebt (vebt_insert t x)

goal (2 subgoals):
 1. \<lbrakk>t = Node x11 x12 x13 x14; x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set_vebt (insert' t x) = set_vebt (vebt_insert t x)

goal (2 subgoals):
 1. \<lbrakk>t = Node x11 x12 x13 x14; x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
hence "set_vebt(vebt_insert t x) = set_vebt t \<union> {x}"
[PROOF STATE]
proof (prove)
using this:
set_vebt (insert' t x) = set_vebt (vebt_insert t x)

goal (1 subgoal):
 1. set_vebt (vebt_insert t x) = set_vebt t \<union> {x}
[PROOF STEP]
using True assms insert_correct
[PROOF STATE]
proof (prove)
using this:
set_vebt (insert' t x) = set_vebt (vebt_insert t x)
x < 2 ^ n
invar_vebt t n
\<lbrakk>invar_vebt ?t ?n; ?x < 2 ^ ?n\<rbrakk> \<Longrightarrow> set_vebt ?t \<union> {?x} = set_vebt (vebt_insert ?t ?x)

goal (1 subgoal):
 1. set_vebt (vebt_insert t x) = set_vebt t \<union> {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_vebt (vebt_insert t x) = set_vebt t \<union> {x}

goal (2 subgoals):
 1. \<lbrakk>t = Node x11 x12 x13 x14; x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set_vebt (vebt_insert t x) = set_vebt t \<union> {x}

goal (2 subgoals):
 1. \<lbrakk>t = Node x11 x12 x13 x14; x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
hence "set_vebt t \<union> {x} = (set_vebt t \<union> {x})\<inter>{0..2^n-1} "
[PROOF STATE]
proof (prove)
using this:
set_vebt (vebt_insert t x) = set_vebt t \<union> {x}

goal (1 subgoal):
 1. set_vebt t \<union> {x} = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
by (metis Diff_Diff_Int True assms calculation(1) inf_le1 inrange le_inf_iff order_refl subset_antisym set_vebt'_def set_vebt_def set_vebt_set_vebt'_valid valid_pres_insert)
[PROOF STATE]
proof (state)
this:
set_vebt t \<union> {x} = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}

goal (2 subgoals):
 1. \<lbrakk>t = Node x11 x12 x13 x14; x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
 2. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set_vebt (insert' t x) = set_vebt (vebt_insert t x)
set_vebt (vebt_insert t x) = set_vebt t \<union> {x}
set_vebt t \<union> {x} = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set_vebt (insert' t x) = set_vebt (vebt_insert t x)
set_vebt (vebt_insert t x) = set_vebt t \<union> {x}
set_vebt t \<union> {x} = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}

goal (1 subgoal):
 1. set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}

goal (1 subgoal):
 1. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < 2 ^ n

goal (1 subgoal):
 1. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
hence "set_vebt (insert'  t x) = set_vebt t"
[PROOF STATE]
proof (prove)
using this:
\<not> x < 2 ^ n

goal (1 subgoal):
 1. set_vebt (insert' t x) = set_vebt t
[PROOF STEP]
by (metis Node assms deg_deg_n insert'.simps(2) leI)
[PROOF STATE]
proof (state)
this:
set_vebt (insert' t x) = set_vebt t

goal (1 subgoal):
 1. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set_vebt (insert' t x) = set_vebt t

goal (1 subgoal):
 1. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
hence "set_vebt t = (set_vebt t \<union> {x})\<inter>{0..2^n-1} "
[PROOF STATE]
proof (prove)
using this:
set_vebt (insert' t x) = set_vebt t

goal (1 subgoal):
 1. set_vebt t = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
by (smt (z3) False Int_commute Int_insert_right_if0 Un_Int_assoc_eq assms atLeastAtMost_iff boolean_algebra_cancel.sup0 inf_bot_right inrange le_add_diff_inverse le_imp_less_Suc one_le_numeral one_le_power plus_1_eq_Suc sup_commute set_vebt_set_vebt'_valid)
[PROOF STATE]
proof (state)
this:
set_vebt t = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}

goal (1 subgoal):
 1. \<lbrakk>t = Node x11 x12 x13 x14; \<not> x < 2 ^ n\<rbrakk> \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set_vebt (insert' t x) = set_vebt t
set_vebt t = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set_vebt (insert' t x) = set_vebt t
set_vebt t = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}

goal (1 subgoal):
 1. set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}

goal (1 subgoal):
 1. \<And>x21 x22. t = Leaf x21 x22 \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x21 x22. t = Leaf x21 x22 \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
case (Leaf x21 x22)
[PROOF STATE]
proof (state)
this:
t = Leaf x21 x22

goal (1 subgoal):
 1. \<And>x21 x22. t = Leaf x21 x22 \<Longrightarrow> set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t = Leaf x21 x22
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t = Leaf x21 x22

goal (1 subgoal):
 1. set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}
[PROOF STEP]
apply(auto simp add:  insert'.simps vebt_insert.simps set_vebt_def both_member_options_def)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>t = Leaf x21 x22; x = Suc 0; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 3. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 4. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n

goal (4 subgoals):
 1. \<lbrakk>t = Leaf x21 x22; x = Suc 0; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 3. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 4. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (8 subgoals):
 1. \<And>a b. \<lbrakk>t = Leaf x21 x22; x = Suc 0; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Leaf a b; n = Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<And>treeList na summary m. \<lbrakk>t = Leaf x21 x22; x = Suc 0; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node None n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = na; n = na + m; \<not> Ex (both_member_options summary); \<forall>t\<in>set treeList. \<not> Ex (both_member_options t)\<rbrakk> \<Longrightarrow> False
 3. \<And>treeList na summary m. \<lbrakk>t = Leaf x21 x22; x = Suc 0; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node None n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = Suc na; n = na + m; \<not> Ex (both_member_options summary); \<forall>t\<in>set treeList. \<not> Ex (both_member_options t)\<rbrakk> \<Longrightarrow> False
 4. \<And>treeList na summary m mi ma. \<lbrakk>t = Leaf x21 x22; x = Suc 0; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node (Some (mi, ma)) n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = na; n = na + m; \<forall>i<2 ^ m. Ex (both_member_options (treeList ! i)) = both_member_options summary i; mi = ma \<longrightarrow> (\<forall>t\<in>set treeList. \<not> Ex (both_member_options t)); mi \<le> ma; ma < 2 ^ n; mi \<noteq> ma \<longrightarrow> (\<forall>i<2 ^ m. (high ma na = i \<longrightarrow> both_member_options (treeList ! i) (low ma na)) \<and> (\<forall>x. high x na = i \<and> both_member_options (treeList ! i) (low x na) \<longrightarrow> mi < x \<and> x \<le> ma))\<rbrakk> \<Longrightarrow> False
 5. \<And>treeList na summary m mi ma. \<lbrakk>t = Leaf x21 x22; x = Suc 0; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node (Some (mi, ma)) n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = Suc na; n = na + m; \<forall>i<2 ^ m. Ex (both_member_options (treeList ! i)) = both_member_options summary i; mi = ma \<longrightarrow> (\<forall>t\<in>set treeList. \<not> Ex (both_member_options t)); mi \<le> ma; ma < 2 ^ n; mi \<noteq> ma \<longrightarrow> (\<forall>i<2 ^ m. (high ma na = i \<longrightarrow> both_member_options (treeList ! i) (low ma na)) \<and> (\<forall>x. high x na = i \<and> both_member_options (treeList ! i) (low x na) \<longrightarrow> mi < x \<and> x \<le> ma))\<rbrakk> \<Longrightarrow> False
 6. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 7. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 8. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 3. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n

goal (3 subgoals):
 1. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 3. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. \<And>a b. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Leaf a b; n = Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<And>treeList na summary m. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node None n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = na; n = na + m; \<not> Ex (both_member_options summary); \<forall>t\<in>set treeList. \<not> Ex (both_member_options t)\<rbrakk> \<Longrightarrow> False
 3. \<And>treeList na summary m. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node None n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = Suc na; n = na + m; \<not> Ex (both_member_options summary); \<forall>t\<in>set treeList. \<not> Ex (both_member_options t)\<rbrakk> \<Longrightarrow> False
 4. \<And>treeList na summary m mi ma. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node (Some (mi, ma)) n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = na; n = na + m; \<forall>i<2 ^ m. Ex (both_member_options (treeList ! i)) = both_member_options summary i; mi = ma \<longrightarrow> (\<forall>t\<in>set treeList. \<not> Ex (both_member_options t)); mi \<le> ma; ma < 2 ^ n; mi \<noteq> ma \<longrightarrow> (\<forall>i<2 ^ m. (high ma na = i \<longrightarrow> both_member_options (treeList ! i) (low ma na)) \<and> (\<forall>x. high x na = i \<and> both_member_options (treeList ! i) (low x na) \<longrightarrow> mi < x \<and> x \<le> ma))\<rbrakk> \<Longrightarrow> False
 5. \<And>treeList na summary m mi ma. \<lbrakk>t = Leaf x21 True; x = 0; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node (Some (mi, ma)) n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = Suc na; n = na + m; \<forall>i<2 ^ m. Ex (both_member_options (treeList ! i)) = both_member_options summary i; mi = ma \<longrightarrow> (\<forall>t\<in>set treeList. \<not> Ex (both_member_options t)); mi \<le> ma; ma < 2 ^ n; mi \<noteq> ma \<longrightarrow> (\<forall>i<2 ^ m. (high ma na = i \<longrightarrow> both_member_options (treeList ! i) (low ma na)) \<and> (\<forall>x. high x na = i \<and> both_member_options (treeList ! i) (low x na) \<longrightarrow> mi < x \<and> x \<le> ma))\<rbrakk> \<Longrightarrow> False
 6. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 7. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n

goal (2 subgoals):
 1. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<And>a b. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Leaf a b; n = Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<And>treeList na summary m. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node None n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = na; n = na + m; \<not> Ex (both_member_options summary); \<forall>t\<in>set treeList. \<not> Ex (both_member_options t)\<rbrakk> \<Longrightarrow> False
 3. \<And>treeList na summary m. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node None n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = Suc na; n = na + m; \<not> Ex (both_member_options summary); \<forall>t\<in>set treeList. \<not> Ex (both_member_options t)\<rbrakk> \<Longrightarrow> False
 4. \<And>treeList na summary m mi ma. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node (Some (mi, ma)) n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = na; n = na + m; \<forall>i<2 ^ m. Ex (both_member_options (treeList ! i)) = both_member_options summary i; mi = ma \<longrightarrow> (\<forall>t\<in>set treeList. \<not> Ex (both_member_options t)); mi \<le> ma; ma < 2 ^ n; mi \<noteq> ma \<longrightarrow> (\<forall>i<2 ^ m. (high ma na = i \<longrightarrow> both_member_options (treeList ! i) (low ma na)) \<and> (\<forall>x. high x na = i \<and> both_member_options (treeList ! i) (low x na) \<longrightarrow> mi < x \<and> x \<le> ma))\<rbrakk> \<Longrightarrow> False
 5. \<And>treeList na summary m mi ma. \<lbrakk>t = Leaf x21 True; x \<noteq> Suc 0; 0 < x; x22; \<not> Suc 0 \<le> 2 ^ n - Suc 0; t = Node (Some (mi, ma)) n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = Suc na; n = na + m; \<forall>i<2 ^ m. Ex (both_member_options (treeList ! i)) = both_member_options summary i; mi = ma \<longrightarrow> (\<forall>t\<in>set treeList. \<not> Ex (both_member_options t)); mi \<le> ma; ma < 2 ^ n; mi \<noteq> ma \<longrightarrow> (\<forall>i<2 ^ m. (high ma na = i \<longrightarrow> both_member_options (treeList ! i) (low ma na)) \<and> (\<forall>x. high x na = i \<and> both_member_options (treeList ! i) (low x na) \<longrightarrow> mi < x \<and> x \<le> ma))\<rbrakk> \<Longrightarrow> False
 6. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invar_vebt t n

goal (1 subgoal):
 1. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>a b. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0; t = Leaf a b; n = Suc 0\<rbrakk> \<Longrightarrow> False
 2. \<And>treeList na summary m. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0; t = Node None n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = na; n = na + m; \<not> Ex (both_member_options summary); \<forall>t\<in>set treeList. \<not> Ex (both_member_options t)\<rbrakk> \<Longrightarrow> False
 3. \<And>treeList na summary m. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0; t = Node None n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = Suc na; n = na + m; \<not> Ex (both_member_options summary); \<forall>t\<in>set treeList. \<not> Ex (both_member_options t)\<rbrakk> \<Longrightarrow> False
 4. \<And>treeList na summary m mi ma. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0; t = Node (Some (mi, ma)) n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = na; n = na + m; \<forall>i<2 ^ m. Ex (both_member_options (treeList ! i)) = both_member_options summary i; mi = ma \<longrightarrow> (\<forall>t\<in>set treeList. \<not> Ex (both_member_options t)); mi \<le> ma; ma < 2 ^ n; mi \<noteq> ma \<longrightarrow> (\<forall>i<2 ^ m. (high ma na = i \<longrightarrow> both_member_options (treeList ! i) (low ma na)) \<and> (\<forall>x. high x na = i \<and> both_member_options (treeList ! i) (low x na) \<longrightarrow> mi < x \<and> x \<le> ma))\<rbrakk> \<Longrightarrow> False
 5. \<And>treeList na summary m mi ma. \<lbrakk>t = Leaf x21 x22; 0 < x; x \<le> 2 ^ n - Suc 0; x \<noteq> Suc 0; t = Node (Some (mi, ma)) n treeList summary; \<forall>t\<in>set treeList. invar_vebt t na; invar_vebt summary m; length treeList = 2 ^ m; m = Suc na; n = na + m; \<forall>i<2 ^ m. Ex (both_member_options (treeList ! i)) = both_member_options summary i; mi = ma \<longrightarrow> (\<forall>t\<in>set treeList. \<not> Ex (both_member_options t)); mi \<le> ma; ma < 2 ^ n; mi \<noteq> ma \<longrightarrow> (\<forall>i<2 ^ m. (high ma na = i \<longrightarrow> both_member_options (treeList ! i) (low ma na)) \<and> (\<forall>x. high x na = i \<and> both_member_options (treeList ! i) (low x na) \<longrightarrow> mi < x \<and> x \<le> ma))\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
set_vebt (insert' t x) = (set_vebt t \<union> {x}) \<inter> {0..2 ^ n - 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_sup_distrib_left: "a + sup b c = sup (a + b) (a + c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + sup b c = sup (a + b) (a + c)
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a + sup b c \<le> sup (a + b) (a + c)
 2. sup (a + b) (a + c) \<le> a + sup b c
[PROOF STEP]
apply (rule add_le_imp_le_left [of "uminus a"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. - a + (a + sup b c) \<le> - a + sup (a + b) (a + c)
 2. sup (a + b) (a + c) \<le> a + sup b c
[PROOF STEP]
apply (simp only: add.assoc [symmetric], simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. b \<le> sup (a + b) (a + c) - a \<and> c \<le> sup (a + b) (a + c) - a
 2. sup (a + b) (a + c) \<le> a + sup b c
[PROOF STEP]
apply (simp add: le_diff_eq add.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup (a + b) (a + c) \<le> a + sup b c
[PROOF STEP]
apply (rule le_supI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a + b \<le> a + sup b c
 2. a + c \<le> a + sup b c
[PROOF STEP]
apply (rule add_le_imp_le_left [of "a"], simp only: add.assoc[symmetric], simp)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma in_upd_image: "A \<subseteq> {..< n} \<Longrightarrow> i < n \<Longrightarrow> upd i \<in> upd ` A \<longleftrightarrow> i \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> {..<n}; i < n\<rbrakk> \<Longrightarrow> (upd i \<in> upd ` A) = (i \<in> A)
[PROOF STEP]
using inj_on_image_mem_iff[of upd "{..< n}"] upd
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>inj_on upd {..<n}; ?a \<in> {..<n}; ?A \<subseteq> {..<n}\<rbrakk> \<Longrightarrow> (upd ?a \<in> upd ` ?A) = (?a \<in> ?A)
bij_betw upd {..<n} {..<n}

goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> {..<n}; i < n\<rbrakk> \<Longrightarrow> (upd i \<in> upd ` A) = (i \<in> A)
[PROOF STEP]
by (auto simp: bij_betw_def)


[STATEMENT]
lemma integer_partitions_enum_aux_head_minus:
     "h \<le> m \<Longrightarrow> h > 0 \<Longrightarrow> n \<ge> h \<Longrightarrow>
  ys \<in> set (integer_partitions_enum_aux (n-h) h)\<Longrightarrow> h#ys \<in> set (integer_partitions_enum_aux n m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m)
[PROOF STEP]
proof(induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>h \<le> m; 0 < h; h \<le> 0; ys \<in> set (integer_partitions_enum_aux (0 - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux 0 m)
 2. \<And>n. \<lbrakk>\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m); h \<le> m; 0 < h; h \<le> Suc n; ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
h \<le> m
0 < h
h \<le> 0
ys \<in> set (integer_partitions_enum_aux (0 - h) h)

goal (2 subgoals):
 1. \<lbrakk>h \<le> m; 0 < h; h \<le> 0; ys \<in> set (integer_partitions_enum_aux (0 - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux 0 m)
 2. \<And>n. \<lbrakk>\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m); h \<le> m; 0 < h; h \<le> Suc n; ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h \<le> m
0 < h
h \<le> 0
ys \<in> set (integer_partitions_enum_aux (0 - h) h)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
h \<le> m
0 < h
h \<le> 0
ys \<in> set (integer_partitions_enum_aux (0 - h) h)

goal (1 subgoal):
 1. h # ys \<in> set (integer_partitions_enum_aux 0 m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
h # ys \<in> set (integer_partitions_enum_aux 0 m)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m); h \<le> m; 0 < h; h \<le> Suc n; ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m); h \<le> m; 0 < h; h \<le> Suc n; ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m)
h \<le> m
0 < h
h \<le> Suc n
ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m); h \<le> m; 0 < h; h \<le> Suc n; ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m)
h \<le> m
0 < h
h \<le> Suc n
ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)
[PROOF STEP]
have 1: "1 \<le> m"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m)
h \<le> m
0 < h
h \<le> Suc n
ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)

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

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m); h \<le> m; 0 < h; h \<le> Suc n; ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
have 2: "(\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys
      \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x)
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> {y. \<exists>xa\<in>set (integer_partitions_enum_aux (Suc n - x) x). y = x # xa}
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m)
h \<le> m
0 < h
h \<le> Suc n
ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)

goal (1 subgoal):
 1. \<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> {y. \<exists>xa\<in>set (integer_partitions_enum_aux (Suc n - x) x). y = x # xa}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m); h \<le> m; 0 < h; h \<le> Suc n; ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
from 1 2
[PROOF STATE]
proof (chain)
picking this:
1 \<le> m
\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x)
[PROOF STEP]
have "Suc 0 \<le> m \<and>(\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m)
         \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x))"
[PROOF STATE]
proof (prove)
using this:
1 \<le> m
\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x)

goal (1 subgoal):
 1. Suc 0 \<le> m \<and> (\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc 0 \<le> m \<and> (\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>h \<le> m; 0 < h; h \<le> n; ys \<in> set (integer_partitions_enum_aux (n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux n m); h \<le> m; 0 < h; h \<le> Suc n; ys \<in> set (integer_partitions_enum_aux (Suc n - h) h)\<rbrakk> \<Longrightarrow> h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc 0 \<le> m \<and> (\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<le> m \<and> (\<exists>x. (x = min (Suc n) m \<or> Suc 0 \<le> x \<and> x < Suc n \<and> x < m) \<and> h # ys \<in> (#) x ` set (integer_partitions_enum_aux (Suc n - x) x))

goal (1 subgoal):
 1. h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
h # ys \<in> set (integer_partitions_enum_aux (Suc n) m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_le_sgn_iff [simp]: "0 \<le> sgn x \<longleftrightarrow> 0 \<le> x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> sgn x) = (0 \<le> x)
[PROOF STEP]
by (cases "0::real" x rule: linorder_cases) simp_all


[STATEMENT]
lemma blinfun_to_matrix_matpow: "blinfun_to_matrix (X ^^ i) = matpow (blinfun_to_matrix X) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blinfun_to_matrix (X ^^ i) = matpow (blinfun_to_matrix X) i
[PROOF STEP]
by (induction i) (auto simp: blinfun_to_matrix_id blinfun_to_matrix_comp blinfunpow_assoc simp del: blinfunpow.simps(2))


[STATEMENT]
lemma powr_zero_eq_one_iff [simp]: "x pow\<^sub>\<real> 0 = (if x \<le> 0 then 0 else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<real> 0 = (if x \<le> 0 then 0 else 1)
[PROOF STEP]
using powreal_def powreal_zero_eq_one
[PROOF STATE]
proof (prove)
using this:
?a pow\<^sub>\<real> ?x = (if 0 < ?a \<and> ?a < 1 then inverse ?a powa - ?x else if 1 \<le> ?a then ?a powa ?x else 0)
0 < ?a \<Longrightarrow> ?a pow\<^sub>\<real> 0 = 1

goal (1 subgoal):
 1. x pow\<^sub>\<real> 0 = (if x \<le> 0 then 0 else 1)
[PROOF STEP]
by force


[STATEMENT]
lemma linorder_lattice_inf_le1: "inf (x::'a::linorder_lattice) y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf x y \<le> x
[PROOF STEP]
unfolding inf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x \<le> y then x else y) \<le> x
[PROOF STEP]
by (metis (full_types) linorder_linear)


[STATEMENT]
lemma cis_minus_pi_half [simp]: "cis (- (pi / 2)) = -\<i>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (- (pi / 2)) = - \<i>
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma singleton_fset_eq[simp]:
  shows "{|x|} = {|y|} \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({|x|} = {|y|}) = (x = y)
[PROOF STEP]
by (descending) (auto)


[STATEMENT]
lemma csqrt_of_real_nonpos [simp]: "Im x = 0 \<Longrightarrow> Re x \<le> 0 \<Longrightarrow> csqrt x = \<i> * sqrt \<bar>Re x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Im x = 0; Re x \<le> 0\<rbrakk> \<Longrightarrow> csqrt x = \<i> * complex_of_real (sqrt \<bar>Re x\<bar>)
[PROOF STEP]
by (simp add: complex_eq_iff norm_complex_def)


[STATEMENT]
lemma finPremSet:
fixes Ps :: "sequent list"
shows "finite (set_of_prem Ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set_of_prem Ps)
[PROOF STEP]
by (induct Ps) (auto simp add:finSeqSet)


[STATEMENT]
lemma mat_of_row_dim_row_1: "(dim_row A = 1) = (A = mat_of_row (row A 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dim_row A = 1) = (A = mat_of_row (row A 0))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_row A = 1 \<Longrightarrow> A = mat_of_row (row A 0)
 2. A = mat_of_row (row A 0) \<Longrightarrow> dim_row A = 1
[PROOF STEP]
show "dim_row A = 1 \<Longrightarrow> A = mat_of_row (row A 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row A = 1 \<Longrightarrow> A = mat_of_row (row A 0)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
dim_row A = 1 \<Longrightarrow> A = mat_of_row (row A 0)

goal (1 subgoal):
 1. A = mat_of_row (row A 0) \<Longrightarrow> dim_row A = 1
[PROOF STEP]
show "A = mat_of_row (row A 0) \<Longrightarrow> dim_row A = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = mat_of_row (row A 0) \<Longrightarrow> dim_row A = 1
[PROOF STEP]
using mat_of_row_dim(1)
[PROOF STATE]
proof (prove)
using this:
dim_row (mat_of_row ?y) = 1

goal (1 subgoal):
 1. A = mat_of_row (row A 0) \<Longrightarrow> dim_row A = 1
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
A = mat_of_row (row A 0) \<Longrightarrow> dim_row A = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_shift_altdef':
  fixes   f :: "'a::{semiring_1,inverse,uminus} fps"
  assumes "inverse (1::'a) = 1"
  shows   "fps_shift n f = f div fps_X^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_shift n f = f / fps_X ^ n
[PROOF STEP]
using   assms
[PROOF STATE]
proof (prove)
using this:
inverse (1::'a) = (1::'a)

goal (1 subgoal):
 1. fps_shift n f = f / fps_X ^ n
[PROOF STEP]
by      (simp add:
            fps_divide_def fps_X_power_subdegree fps_X_power_unit_factor fps_inverse_one'
          )


[STATEMENT]
lemma eqvt_fresh_star_cong3:
  assumes eqvt: "(\<And>p x y z. p \<bullet> (f x y z) = f (p \<bullet> x) (p \<bullet> y) (p \<bullet> z))"
  and fresh1: "a \<sharp>* x" and fresh2: "a \<sharp>* y" and fresh3: "a \<sharp>* z"
  shows "a \<sharp>* f x y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<sharp>* f x y z
[PROOF STEP]
by (metis fresh_star_def eqvt_fresh_cong3 assms)


[STATEMENT]
lemma stable_translation_length_nonneg [simp]:
  "stable_translation_length f \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> stable_translation_length f
[PROOF STEP]
unfolding stable_translation_length_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Inf {translation_length (f ^^ n) / real n |n. 0 < n}
[PROOF STEP]
by (rule cInf_greatest, auto)


[STATEMENT]
lemma null_sets_UN[intro]:
  "(\<And>i::'i::countable. N i \<in> null_sets M) \<Longrightarrow> (\<Union>i. N i) \<in> null_sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. N i \<in> null_sets M) \<Longrightarrow> \<Union> (range N) \<in> null_sets M
[PROOF STEP]
by (rule null_sets_UN') auto


[STATEMENT]
lemma imperative_reverse: "VARS y x
 {x=X}
 y:=[];
 WHILE x ~= []
 INV {rev(x)@y = rev(X)}
 DO y := (hd x # y); x := tl x OD
 {y=rev(X)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x = X}
y := []; WHILE x \<noteq> [] INV {rev x @ y = rev X}  VAR {0}
DO y := hd x # y; x := tl x OD
{y = rev X}
[PROOF STEP]
apply vcg_simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y x. rev x @ y = rev X \<and> x \<noteq> [] \<Longrightarrow> rev (tl x) @ hd x # y = rev X
[PROOF STEP]
apply(simp add: neq_Nil_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y x. rev x @ y = rev X \<and> (\<exists>y ys. x = y # ys) \<Longrightarrow> rev (tl x) @ hd x # y = rev X
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma trancl_Int_subset:
   "(R \<inter> (A \<times> A))\<^sup>+ \<subseteq> R\<^sup>+ \<inter> (A \<times> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Restr R A)\<^sup>+ \<subseteq> Restr (R\<^sup>+) A
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> (Restr R A)\<^sup>+ \<Longrightarrow> x \<in> Restr (R\<^sup>+) A
[PROOF STEP]
apply (rename_tac S)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S. S \<in> (Restr R A)\<^sup>+ \<Longrightarrow> S \<in> Restr (R\<^sup>+) A
[PROOF STEP]
apply (case_tac "S")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S a b. \<lbrakk>S \<in> (Restr R A)\<^sup>+; S = (a, b)\<rbrakk> \<Longrightarrow> S \<in> Restr (R\<^sup>+) A
[PROOF STEP]
apply (rename_tac T V)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>S T V. \<lbrakk>S \<in> (Restr R A)\<^sup>+; S = (T, V)\<rbrakk> \<Longrightarrow> S \<in> Restr (R\<^sup>+) A
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>T V. (T, V) \<in> (Restr R A)\<^sup>+ \<Longrightarrow> (T, V) \<in> R\<^sup>+
 2. \<And>T V. (T, V) \<in> (Restr R A)\<^sup>+ \<Longrightarrow> T \<in> A
 3. \<And>T V. (T, V) \<in> (Restr R A)\<^sup>+ \<Longrightarrow> V \<in> A
[PROOF STEP]
apply (rule_tac a=T and b=V and r="(R  \<inter> A \<times> A)" in converse_trancl_induct, auto)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in cring) const_term_simprules:
  shows "\<And>p. set p \<subseteq> carrier R \<Longrightarrow> const_term p \<in> carrier R"
    and "\<And>p q. \<lbrakk> set p \<subseteq> carrier R; set q \<subseteq> carrier R \<rbrakk> \<Longrightarrow>
                 const_term (poly_mult p q) = const_term p \<otimes> const_term q"
    and "\<And>p q. \<lbrakk> set p \<subseteq> carrier R; set q \<subseteq> carrier R \<rbrakk> \<Longrightarrow>
                 const_term (poly_add  p q) = const_term p \<oplus> const_term q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. set p \<subseteq> carrier R \<Longrightarrow> const_term p \<in> carrier R) &&& (\<And>p q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R\<rbrakk> \<Longrightarrow> const_term (poly_mult p q) = const_term p \<otimes> const_term q) &&& (\<And>p q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R\<rbrakk> \<Longrightarrow> const_term (poly_add p q) = const_term p \<oplus> const_term q)
[PROOF STEP]
using eval_poly_mult eval_poly_add eval_in_carrier zero_closed
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?p \<subseteq> carrier R; set ?q \<subseteq> carrier R; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (poly_mult ?p ?q) ?a = local.eval ?p ?a \<otimes> local.eval ?q ?a
\<lbrakk>set ?p \<subseteq> carrier R; set ?q \<subseteq> carrier R; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (poly_add ?p ?q) ?a = local.eval ?p ?a \<oplus> local.eval ?q ?a
\<lbrakk>set ?p \<subseteq> carrier R; ?x \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval ?p ?x \<in> carrier R
\<zero> \<in> carrier R

goal (1 subgoal):
 1. (\<And>p. set p \<subseteq> carrier R \<Longrightarrow> const_term p \<in> carrier R) &&& (\<And>p q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R\<rbrakk> \<Longrightarrow> const_term (poly_mult p q) = const_term p \<otimes> const_term q) &&& (\<And>p q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R\<rbrakk> \<Longrightarrow> const_term (poly_add p q) = const_term p \<oplus> const_term q)
[PROOF STEP]
unfolding const_term_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?p \<subseteq> carrier R; set ?q \<subseteq> carrier R; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (poly_mult ?p ?q) ?a = local.eval ?p ?a \<otimes> local.eval ?q ?a
\<lbrakk>set ?p \<subseteq> carrier R; set ?q \<subseteq> carrier R; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval (poly_add ?p ?q) ?a = local.eval ?p ?a \<oplus> local.eval ?q ?a
\<lbrakk>set ?p \<subseteq> carrier R; ?x \<in> carrier R\<rbrakk> \<Longrightarrow> local.eval ?p ?x \<in> carrier R
\<zero> \<in> carrier R

goal (1 subgoal):
 1. (\<And>p. set p \<subseteq> carrier R \<Longrightarrow> local.eval p \<zero> \<in> carrier R) &&& (\<And>p q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.eval (poly_mult p q) \<zero> = local.eval p \<zero> \<otimes> local.eval q \<zero>) &&& (\<And>p q. \<lbrakk>set p \<subseteq> carrier R; set q \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.eval (poly_add p q) \<zero> = local.eval p \<zero> \<oplus> local.eval q \<zero>)
[PROOF STEP]
by auto


[STATEMENT]
lemma f_rev_chain_in_rtrancl:
  assumes m_le_n: "m \<le> n" and f_chain: "\<forall>i \<in> {m..<n}. (f (Suc i), f i) \<in> R"
  shows "(f n, f m) \<in> R\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f n, f m) \<in> R\<^sup>*
[PROOF STEP]
by (rule f_chain_in_rtrancl[OF m_le_n, of "\<lambda>i. f (n + m - i)", simplified])
    (metis f_chain le_add_diff Suc_diff_Suc Suc_leI atLeastLessThan_iff diff_Suc_diff_eq1 diff_less
      le_add1 less_le_trans zero_less_Suc)


[STATEMENT]
lemma asymmetric_linorder_matrix:
  fixes f :: "('a::finite,'b::linorder_stone_relation_algebra_expansion) square"
  shows "matrix_stone_relation_algebra.asymmetric f \<longleftrightarrow> (\<forall>i j . f (i,j) = bot \<or> f (j,i) = bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_stone_relation_algebra.asymmetric f = (\<forall>i j. f (i, j) = bot \<or> f (j, i) = bot)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. matrix_stone_relation_algebra.asymmetric f = (\<forall>i j. f (i, j) = bot \<or> f (j, i) = bot)
[PROOF STEP]
have "matrix_stone_relation_algebra.asymmetric f \<longleftrightarrow> (\<forall>i j . f (i,j) \<sqinter> f (j,i) \<le> bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_stone_relation_algebra.asymmetric f = (\<forall>i j. f (i, j) \<sqinter> f (j, i) \<le> bot)
[PROOF STEP]
apply (unfold conv_matrix_def inf_matrix_def conv_def id_def bot_matrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>e. f e \<sqinter> (case e of (i, j) \<Rightarrow> f (j, i))) = (\<lambda>e. bot)) = (\<forall>i j. f (i, j) \<sqinter> f (j, i) \<le> bot)
[PROOF STEP]
by (metis (mono_tags, lifting) bot.extremum bot.extremum_uniqueI case_prod_conv old.prod.exhaust)
[PROOF STATE]
proof (state)
this:
matrix_stone_relation_algebra.asymmetric f = (\<forall>i j. f (i, j) \<sqinter> f (j, i) \<le> bot)

goal (1 subgoal):
 1. matrix_stone_relation_algebra.asymmetric f = (\<forall>i j. f (i, j) = bot \<or> f (j, i) = bot)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
matrix_stone_relation_algebra.asymmetric f = (\<forall>i j. f (i, j) \<sqinter> f (j, i) \<le> bot)

goal (1 subgoal):
 1. matrix_stone_relation_algebra.asymmetric f = (\<forall>i j. f (i, j) = bot \<or> f (j, i) = bot)
[PROOF STEP]
by (metis (no_types, opaque_lifting) inf.absorb_iff1 inf.cobounded1 inf_bot_right inf_dense)
[PROOF STATE]
proof (state)
this:
matrix_stone_relation_algebra.asymmetric f = (\<forall>i j. f (i, j) = bot \<or> f (j, i) = bot)

goal:
No subgoals!
[PROOF STEP]
qed