[STATEMENT]
lemma length_filter_le_axis_median:
  assumes "0 < length ps" "\<forall>k. distinct (map (\<lambda>p. p$k) ps)"
  shows "length (filter (\<lambda>p. p$k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
let ?n = "(length ps - 1) div 2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
let ?ps = "map (\<lambda>p. p$k) ps"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
let ?m = "fast_select ?n ?ps"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
have 0: "?n < length ?ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length ps - 1) div 2 < length (map (\<lambda>p. p $ k) ps)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
0 < length ps

goal (1 subgoal):
 1. (length ps - 1) div 2 < length (map (\<lambda>p. p $ k) ps)
[PROOF STEP]
by (auto, linarith)
[PROOF STATE]
proof (state)
this:
(length ps - 1) div 2 < length (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
have 1: "distinct ?ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map (\<lambda>p. p $ k) ps)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>k. distinct (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. distinct (map (\<lambda>p. p $ k) ps)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
distinct (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
have "?m = select ?n ?ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fast_select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps) = select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps)
[PROOF STEP]
using fast_select_correct[OF 0]
[PROOF STATE]
proof (prove)
using this:
fast_select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps) = select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. fast_select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps) = select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
fast_select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps) = select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
hence "length (filter (\<lambda>p. p$k \<le> axis_median k ps) ps) =
        length (filter (\<lambda>p. p$k \<le> sort ?ps ! ?n) ps)"
[PROOF STATE]
proof (prove)
using this:
fast_select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps) = select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = length (filter (\<lambda>p. p $ k \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) ps)
[PROOF STEP]
unfolding axis_median_def
[PROOF STATE]
proof (prove)
using this:
fast_select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps) = select ((length ps - 1) div 2) (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> (let n = (length ps - 1) div 2 in fast_select n (map (\<lambda>p. p $ k) ps))) ps) = length (filter (\<lambda>p. p $ k \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) ps)
[PROOF STEP]
by (auto simp add: Let_def select_def simp del: fast_select.simps)
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = length (filter (\<lambda>p. p $ k \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) ps)

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = length (filter (\<lambda>p. p $ k \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) ps)

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
have "... = length (filter (\<lambda>v. v \<le> sort ?ps ! ?n) ?ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) ps) = length (filter (\<lambda>v. v \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) (map (\<lambda>p. p $ k) ps))
[PROOF STEP]
by (induction ps) (auto, metis comp_apply)
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>p. p $ k \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) ps) = length (filter (\<lambda>v. v \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) (map (\<lambda>p. p $ k) ps))

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>p. p $ k \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) ps) = length (filter (\<lambda>v. v \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) (map (\<lambda>p. p $ k) ps))

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
have "... = ?n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter (\<lambda>v. v \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) (map (\<lambda>p. p $ k) ps)) = (length ps - 1) div 2 + 1
[PROOF STEP]
using length_filter_sort_nth[OF 1 0]
[PROOF STATE]
proof (prove)
using this:
length (filter (\<lambda>x. x \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) (map (\<lambda>p. p $ k) ps)) = (length ps - 1) div 2 + 1

goal (1 subgoal):
 1. length (filter (\<lambda>v. v \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) (map (\<lambda>p. p $ k) ps)) = (length ps - 1) div 2 + 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>v. v \<le> sort (map (\<lambda>p. p $ k) ps) ! ((length ps - 1) div 2)) (map (\<lambda>p. p $ k) ps)) = (length ps - 1) div 2 + 1

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1

goal (1 subgoal):
 1. length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length (filter (\<lambda>p. p $ k \<le> axis_median k ps) ps) = (length ps - 1) div 2 + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma propa_property2:
  fixes ss w qs q
  assumes step_bounded_pres: "\<forall>(q, \<tau>) \<in> set qs. q < size ss \<and> \<tau> \<in> A"
      and sorted_w:          "sorted (w ::nat list)"
      and subset_ss_A:       "set ss \<subseteq> A"
      and len_ss_n:          "length ss = n "
      and dist:              "distinct (map fst qs) "
      and q_nin:             "q \<notin> set(map fst qs) "
      and q_lt_len_ss:       "q < length ss "
    shows "(fst(propa f qs ss w))!q = ss!q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (propa f qs ss w) ! q = ss ! q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>(q, \<tau>)\<in>set qs. q < length ss \<and> \<tau> \<in> A
Sorted_Less.sorted w
set ss \<subseteq> A
length ss = n
distinct (map fst qs)
q \<notin> set (map fst qs)
q < length ss

goal (1 subgoal):
 1. fst (propa f qs ss w) ! q = ss ! q
[PROOF STEP]
apply (subgoal_tac "fst (propa f qs ss w) = merges f qs ss")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>(q, \<tau>)\<in>set qs. q < length ss \<and> \<tau> \<in> A; Sorted_Less.sorted w; set ss \<subseteq> A; length ss = n; distinct (map fst qs); q \<notin> set (map fst qs); q < length ss; fst (propa f qs ss w) = merges f qs ss\<rbrakk> \<Longrightarrow> fst (propa f qs ss w) ! q = ss ! q
 2. \<lbrakk>\<forall>(q, \<tau>)\<in>set qs. q < length ss \<and> \<tau> \<in> A; Sorted_Less.sorted w; set ss \<subseteq> A; length ss = n; distinct (map fst qs); q \<notin> set (map fst qs); q < length ss\<rbrakk> \<Longrightarrow> fst (propa f qs ss w) = merges f qs ss
[PROOF STEP]
apply(simp add: merges_property2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>(q, \<tau>)\<in>set qs. q < length ss \<and> \<tau> \<in> A; Sorted_Less.sorted w; set ss \<subseteq> A; length ss = n; distinct (map fst qs); q \<notin> set (map fst qs); q < length ss\<rbrakk> \<Longrightarrow> fst (propa f qs ss w) = merges f qs ss
[PROOF STEP]
by (auto dest:decomp_propa)


[STATEMENT]
lemma continuous_imp_tendsto:
  assumes "continuous (at x0) f"
    and "x \<longlonglongrightarrow> x0"
  shows "(f \<circ> x) \<longlonglongrightarrow> (f x0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<circ> x) \<longlonglongrightarrow> f x0
[PROOF STEP]
proof (rule topological_tendstoI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; f x0 \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. (f \<circ> x) xa \<in> S
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; f x0 \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. (f \<circ> x) xa \<in> S
[PROOF STEP]
assume "open S" "f x0 \<in> S"
[PROOF STATE]
proof (state)
this:
open S
f x0 \<in> S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; f x0 \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. (f \<circ> x) xa \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open S
f x0 \<in> S
[PROOF STEP]
obtain T where T_def: "open T" "x0 \<in> T" "\<forall>x\<in>T. f x \<in> S"
[PROOF STATE]
proof (prove)
using this:
open S
f x0 \<in> S

goal (1 subgoal):
 1. (\<And>T. \<lbrakk>open T; x0 \<in> T; \<forall>x\<in>T. f x \<in> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms continuous_at_open
[PROOF STATE]
proof (prove)
using this:
open S
f x0 \<in> S
isCont f x0
x \<longlonglongrightarrow> x0
isCont ?f ?x = (\<forall>t. open t \<and> ?f ?x \<in> t \<longrightarrow> (\<exists>s. open s \<and> ?x \<in> s \<and> (\<forall>x'\<in>s. ?f x' \<in> t)))

goal (1 subgoal):
 1. (\<And>T. \<lbrakk>open T; x0 \<in> T; \<forall>x\<in>T. f x \<in> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
open T
x0 \<in> T
\<forall>x\<in>T. f x \<in> S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; f x0 \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. (f \<circ> x) xa \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open T
x0 \<in> T
\<forall>x\<in>T. f x \<in> S
[PROOF STEP]
have "eventually (\<lambda>n. x n \<in> T) sequentially"
[PROOF STATE]
proof (prove)
using this:
open T
x0 \<in> T
\<forall>x\<in>T. f x \<in> S

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. x n \<in> T
[PROOF STEP]
using assms T_def
[PROOF STATE]
proof (prove)
using this:
open T
x0 \<in> T
\<forall>x\<in>T. f x \<in> S
isCont f x0
x \<longlonglongrightarrow> x0
open T
x0 \<in> T
\<forall>x\<in>T. f x \<in> S

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. x n \<in> T
[PROOF STEP]
by (auto simp: tendsto_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. x n \<in> T

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open S; f x0 \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. (f \<circ> x) xa \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. x n \<in> T
[PROOF STEP]
show "eventually (\<lambda>n. (f \<circ> x) n \<in> S) sequentially"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. x n \<in> T

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (f \<circ> x) n \<in> S
[PROOF STEP]
using T_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. x n \<in> T
open T
x0 \<in> T
\<forall>x\<in>T. f x \<in> S

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (f \<circ> x) n \<in> S
[PROOF STEP]
by (auto elim!: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. (f \<circ> x) n \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma setceilmax:  "invar_vebt s m \<Longrightarrow>\<forall> t \<in> set listy. invar_vebt t n
     \<Longrightarrow>m = Suc n \<Longrightarrow>(\<forall> t \<in> set listy. height t = \<lceil>lb n \<rceil> ) \<Longrightarrow> height s  =  \<lceil>lb m\<rceil>
      \<Longrightarrow> Max (height ` (insert s (set listy))) =  \<lceil>lb m\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
proof(induction listy)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>invar_vebt s m; \<forall>t\<in>set []. invar_vebt t n; m = Suc n; \<forall>t\<in>set []. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set []))) = \<lceil>log 2 (real m)\<rceil>
 2. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
invar_vebt s m
\<forall>t\<in>set []. invar_vebt t n
m = Suc n
\<forall>t\<in>set []. int (height t) = \<lceil>log 2 (real n)\<rceil>
int (height s) = \<lceil>log 2 (real m)\<rceil>

goal (2 subgoals):
 1. \<lbrakk>invar_vebt s m; \<forall>t\<in>set []. invar_vebt t n; m = Suc n; \<forall>t\<in>set []. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set []))) = \<lceil>log 2 (real m)\<rceil>
 2. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
hence "Max (height ` (insert s(set []))) = height s"
[PROOF STATE]
proof (prove)
using this:
invar_vebt s m
\<forall>t\<in>set []. invar_vebt t n
m = Suc n
\<forall>t\<in>set []. int (height t) = \<lceil>log 2 (real n)\<rceil>
int (height s) = \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. Max (height ` insert s (set [])) = height s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Max (height ` insert s (set [])) = height s

goal (2 subgoals):
 1. \<lbrakk>invar_vebt s m; \<forall>t\<in>set []. invar_vebt t n; m = Suc n; \<forall>t\<in>set []. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set []))) = \<lceil>log 2 (real m)\<rceil>
 2. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Max (height ` insert s (set [])) = height s
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Max (height ` insert s (set [])) = height s

goal (1 subgoal):
 1. int (Max (height ` insert s (set []))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
using Nil
[PROOF STATE]
proof (prove)
using this:
Max (height ` insert s (set [])) = height s
invar_vebt s m
\<forall>t\<in>set []. invar_vebt t n
m = Suc n
\<forall>t\<in>set []. int (height t) = \<lceil>log 2 (real n)\<rceil>
int (height s) = \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. int (Max (height ` insert s (set []))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (Max (height ` insert s (set []))) = \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
case (Cons a list)
[PROOF STATE]
proof (state)
this:
\<lbrakk>invar_vebt s m; \<forall>t\<in>set list. invar_vebt t n; m = Suc n; \<forall>t\<in>set list. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set list))) = \<lceil>log 2 (real m)\<rceil>
invar_vebt s m
\<forall>t\<in>set (a # list). invar_vebt t n
m = Suc n
\<forall>t\<in>set (a # list). int (height t) = \<lceil>log 2 (real n)\<rceil>
int (height s) = \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
have "Max (height ` insert s (set (a # list))) =
 max (height a) (Max (height ` insert s (set ( list))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (height ` insert s (set (a # list))) = max (height a) (Max (height ` insert s (set list)))
[PROOF STEP]
by (simp add: insert_commute)
[PROOF STATE]
proof (state)
this:
Max (height ` insert s (set (a # list))) = max (height a) (Max (height ` insert s (set list)))

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Max (height ` insert s (set (a # list))) = max (height a) (Max (height ` insert s (set list)))

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
have "max (height a) (Max (height ` insert s (set ( list)))) = max (height a) \<lceil>lb m \<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (max (height a) (Max (height ` insert s (set list)))) = max (int (height a)) \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
using Cons insert_iff list.simps(15) max_def of_nat_max
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invar_vebt s m; \<forall>t\<in>set list. invar_vebt t n; m = Suc n; \<forall>t\<in>set list. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set list))) = \<lceil>log 2 (real m)\<rceil>
invar_vebt s m
\<forall>t\<in>set (a # list). invar_vebt t n
m = Suc n
\<forall>t\<in>set (a # list). int (height t) = \<lceil>log 2 (real n)\<rceil>
int (height s) = \<lceil>log 2 (real m)\<rceil>
(?a \<in> insert ?b ?A) = (?a = ?b \<or> ?a \<in> ?A)
set (?x21.0 # ?x22.0) = insert ?x21.0 (set ?x22.0)
max ?a ?b = (if ?a \<le> ?b then ?b else ?a)
of_nat (max ?x ?y) = max (of_nat ?x) (of_nat ?y)

goal (1 subgoal):
 1. int (max (height a) (Max (height ` insert s (set list)))) = max (int (height a)) \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
int (max (height a) (Max (height ` insert s (set list)))) = max (int (height a)) \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
int (max (height a) (Max (height ` insert s (set list)))) = max (int (height a)) \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
have " \<forall> t \<in> set (a#list). invar_vebt t n "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t\<in>set (a # list). invar_vebt t n
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invar_vebt s m; \<forall>t\<in>set list. invar_vebt t n; m = Suc n; \<forall>t\<in>set list. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set list))) = \<lceil>log 2 (real m)\<rceil>
invar_vebt s m
\<forall>t\<in>set (a # list). invar_vebt t n
m = Suc n
\<forall>t\<in>set (a # list). int (height t) = \<lceil>log 2 (real n)\<rceil>
int (height s) = \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. \<forall>t\<in>set (a # list). invar_vebt t n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>t\<in>set (a # list). invar_vebt t n

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>t\<in>set (a # list). invar_vebt t n

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
hence "invar_vebt a n"
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>set (a # list). invar_vebt t n

goal (1 subgoal):
 1. invar_vebt a n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
invar_vebt a n

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
hence "m \<ge> n"
[PROOF STATE]
proof (prove)
using this:
invar_vebt a n

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

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
hence "lb m \<ge> lb n"
[PROOF STATE]
proof (prove)
using this:
n \<le> m

goal (1 subgoal):
 1. log 2 (real n) \<le> log 2 (real m)
[PROOF STEP]
using deg_not_0 \<open>invar_vebt a n\<close>
[PROOF STATE]
proof (prove)
using this:
n \<le> m
invar_vebt ?t ?n \<Longrightarrow> 0 < ?n
invar_vebt a n

goal (1 subgoal):
 1. log 2 (real n) \<le> log 2 (real m)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
log 2 (real n) \<le> log 2 (real m)

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
hence "\<lceil> lb m\<rceil> \<ge> \<lceil> lb n\<rceil>"
[PROOF STATE]
proof (prove)
using this:
log 2 (real n) \<le> log 2 (real m)

goal (1 subgoal):
 1. \<lceil>log 2 (real n)\<rceil> \<le> \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
by (simp add: ceiling_mono)
[PROOF STATE]
proof (state)
this:
\<lceil>log 2 (real n)\<rceil> \<le> \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lceil>log 2 (real n)\<rceil> \<le> \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
hence " max \<lceil>log 2 n \<rceil> \<lceil>log 2 m \<rceil> =  \<lceil>log 2 m \<rceil>"
[PROOF STATE]
proof (prove)
using this:
\<lceil>log 2 (real n)\<rceil> \<le> \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. max \<lceil>log 2 (real n)\<rceil> \<lceil>log 2 (real m)\<rceil> = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
max \<lceil>log 2 (real n)\<rceil> \<lceil>log 2 (real m)\<rceil> = \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. \<And>a listy. \<lbrakk>\<lbrakk>invar_vebt s m; \<forall>t\<in>set listy. invar_vebt t n; m = Suc n; \<forall>t\<in>set listy. int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set listy))) = \<lceil>log 2 (real m)\<rceil>; invar_vebt s m; \<forall>t\<in>set (a # listy). invar_vebt t n; m = Suc n; \<forall>t\<in>set (a # listy). int (height t) = \<lceil>log 2 (real n)\<rceil>; int (height s) = \<lceil>log 2 (real m)\<rceil>\<rbrakk> \<Longrightarrow> int (Max (height ` insert s (set (a # listy)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Max (height ` insert s (set (a # list))) = max (height a) (Max (height ` insert s (set list)))
int (max (height a) (Max (height ` insert s (set list)))) = max (int (height a)) \<lceil>log 2 (real m)\<rceil>
\<forall>t\<in>set (a # list). invar_vebt t n
\<lceil>log 2 (real n)\<rceil> \<le> \<lceil>log 2 (real m)\<rceil>
max \<lceil>log 2 (real n)\<rceil> \<lceil>log 2 (real m)\<rceil> = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Max (height ` insert s (set (a # list))) = max (height a) (Max (height ` insert s (set list)))
int (max (height a) (Max (height ` insert s (set list)))) = max (int (height a)) \<lceil>log 2 (real m)\<rceil>
\<forall>t\<in>set (a # list). invar_vebt t n
\<lceil>log 2 (real n)\<rceil> \<le> \<lceil>log 2 (real m)\<rceil>
max \<lceil>log 2 (real n)\<rceil> \<lceil>log 2 (real m)\<rceil> = \<lceil>log 2 (real m)\<rceil>

goal (1 subgoal):
 1. int (Max (height ` insert s (set (a # list)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
using Cons.prems(4) \<open>invar_vebt a n\<close>
[PROOF STATE]
proof (prove)
using this:
Max (height ` insert s (set (a # list))) = max (height a) (Max (height ` insert s (set list)))
int (max (height a) (Max (height ` insert s (set list)))) = max (int (height a)) \<lceil>log 2 (real m)\<rceil>
\<forall>t\<in>set (a # list). invar_vebt t n
\<lceil>log 2 (real n)\<rceil> \<le> \<lceil>log 2 (real m)\<rceil>
max \<lceil>log 2 (real n)\<rceil> \<lceil>log 2 (real m)\<rceil> = \<lceil>log 2 (real m)\<rceil>
\<forall>t\<in>set (a # list). int (height t) = \<lceil>log 2 (real n)\<rceil>
invar_vebt a n

goal (1 subgoal):
 1. int (Max (height ` insert s (set (a # list)))) = \<lceil>log 2 (real m)\<rceil>
[PROOF STEP]
by (metis list.set_intros(1))
[PROOF STATE]
proof (state)
this:
int (Max (height ` insert s (set (a # list)))) = \<lceil>log 2 (real m)\<rceil>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in cring)
  assumes "a \<in> carrier R" "b \<in> carrier R"
  shows "a [^] (10::nat) \<ominus> b [^] (10::nat) =
  (a \<ominus> b) \<otimes> (a [^] (9::nat) \<oplus> a [^] (8::nat) \<otimes> b \<oplus> a [^] (7::nat) \<otimes> b [^] (2::nat) \<oplus>
    a [^] (6::nat) \<otimes> b [^] (3::nat) \<oplus> a [^] (5::nat) \<otimes> b [^] (4::nat) \<oplus>
    a [^] (4::nat) \<otimes> b [^] (5::nat) \<oplus> a [^] (3::nat) \<otimes> b [^] (6::nat) \<oplus>
    a [^] (2::nat) \<otimes> b [^] (7::nat) \<oplus> a \<otimes> b [^] (8::nat) \<oplus> b [^] (9::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] 10 \<ominus> b [^] 10 = (a \<ominus> b) \<otimes> (a [^] 9 \<oplus> a [^] 8 \<otimes> b \<oplus> a [^] 7 \<otimes> b [^] 2 \<oplus> a [^] 6 \<otimes> b [^] 3 \<oplus> a [^] 5 \<otimes> b [^] 4 \<oplus> a [^] 4 \<otimes> b [^] 5 \<oplus> a [^] 3 \<otimes> b [^] 6 \<oplus> a [^] 2 \<otimes> b [^] 7 \<oplus> a \<otimes> b [^] 8 \<oplus> b [^] 9)
[PROOF STEP]
by ring


[STATEMENT]
lemma div_le_mult: "\<lbrakk>i \<le> k div x; 0 < x\<rbrakk> \<Longrightarrow> i * x \<le> k"
  for i k x :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> k div x; 0 < x\<rbrakk> \<Longrightarrow> i * x \<le> k
[PROOF STEP]
by (metis div_lt' less_mult_imp_div_less not_less unat_arith_simps(2) unat_div unat_mult_lem)


[STATEMENT]
lemma 26: \<open>\<turnstile> ((p \<rightarrow> q) \<rightarrow> r) \<rightarrow> (r \<rightarrow> p) \<rightarrow> p\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> ((p \<rightarrow> q) \<rightarrow> r) \<rightarrow> (r \<rightarrow> p) \<rightarrow> p
[PROOF STEP]
using MP 25 24
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<turnstile> ?p \<rightarrow> ?q; \<turnstile> ?p\<rbrakk> \<Longrightarrow> \<turnstile> ?q
\<turnstile> ((?p \<rightarrow> ?r) \<rightarrow> ?s) \<rightarrow> (?p \<rightarrow> ?q) \<rightarrow> (?q \<rightarrow> ?r) \<rightarrow> ?s
\<turnstile> ((?p \<rightarrow> ?q) \<rightarrow> ?p) \<rightarrow> ?p

goal (1 subgoal):
 1. \<turnstile> ((p \<rightarrow> q) \<rightarrow> r) \<rightarrow> (r \<rightarrow> p) \<rightarrow> p
[PROOF STEP]
.


[STATEMENT]
lemma cone_subset_domain:
  assumes "t \<in> T"
  shows "cball x0 (B * \<bar>t - t0\<bar>) \<subseteq> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cball x0 (B * \<bar>t - t0\<bar>) \<subseteq> X
[PROOF STEP]
using e_bounded[OF assms] B_nonneg b_pos
[PROOF STATE]
proof (prove)
using this:
dist t t0 \<le> b / B
0 \<le> B
0 \<le> b

goal (1 subgoal):
 1. cball x0 (B * \<bar>t - t0\<bar>) \<subseteq> X
[PROOF STEP]
unfolding cylinder
[PROOF STATE]
proof (prove)
using this:
dist t t0 \<le> b / B
0 \<le> B
0 \<le> b

goal (1 subgoal):
 1. cball x0 (B * \<bar>t - t0\<bar>) \<subseteq> cball x0 b
[PROOF STEP]
by (intro subset_cball) (auto simp: dist_real_def divide_simps algebra_simps split: if_splits)


[STATEMENT]
lemma numeral_power_Suc: "numeral n ^ Suc a = numeral n * numeral n ^ a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral n ^ Suc a = numeral n * numeral n ^ a
[PROOF STEP]
by (rule power.simps)


[STATEMENT]
lemma sigma_algebra_UNIV_finite[simp]: "sigma_algebra (UNIV :: 'a :: finite set) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_algebra UNIV UNIV
[PROOF STEP]
proof (unfold_locales, goal_cases)
[PROOF STATE]
proof (state)
goal (7 subgoals):
 1. UNIV \<subseteq> Pow UNIV
 2. {} \<in> UNIV
 3. \<And>a b. \<lbrakk>a \<in> UNIV; b \<in> UNIV\<rbrakk> \<Longrightarrow> a \<inter> b \<in> UNIV
 4. \<And>a b. \<lbrakk>a \<in> UNIV; b \<in> UNIV\<rbrakk> \<Longrightarrow> \<exists>C\<subseteq>UNIV. finite C \<and> disjoint C \<and> a - b = \<Union> C
 5. \<And>a b. \<lbrakk>a \<in> UNIV; b \<in> UNIV\<rbrakk> \<Longrightarrow> a \<union> b \<in> UNIV
 6. UNIV \<in> UNIV
 7. \<And>A. range A \<subseteq> UNIV \<Longrightarrow> \<Union> (range A) \<in> UNIV
[PROOF STEP]
case (4 a b)
[PROOF STATE]
proof (state)
this:
a \<in> UNIV
b \<in> UNIV

goal (7 subgoals):
 1. UNIV \<subseteq> Pow UNIV
 2. {} \<in> UNIV
 3. \<And>a b. \<lbrakk>a \<in> UNIV; b \<in> UNIV\<rbrakk> \<Longrightarrow> a \<inter> b \<in> UNIV
 4. \<And>a b. \<lbrakk>a \<in> UNIV; b \<in> UNIV\<rbrakk> \<Longrightarrow> \<exists>C\<subseteq>UNIV. finite C \<and> disjoint C \<and> a - b = \<Union> C
 5. \<And>a b. \<lbrakk>a \<in> UNIV; b \<in> UNIV\<rbrakk> \<Longrightarrow> a \<union> b \<in> UNIV
 6. UNIV \<in> UNIV
 7. \<And>A. range A \<subseteq> UNIV \<Longrightarrow> \<Union> (range A) \<in> UNIV
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C\<subseteq>UNIV. finite C \<and> disjoint C \<and> a - b = \<Union> C
[PROOF STEP]
by (intro exI[of _ "{a-b}"], auto)
[PROOF STATE]
proof (state)
this:
\<exists>C\<subseteq>UNIV. finite C \<and> disjoint C \<and> a - b = \<Union> C

goal (6 subgoals):
 1. UNIV \<subseteq> Pow UNIV
 2. {} \<in> UNIV
 3. \<And>a b. \<lbrakk>a \<in> UNIV; b \<in> UNIV\<rbrakk> \<Longrightarrow> a \<inter> b \<in> UNIV
 4. \<And>a b. \<lbrakk>a \<in> UNIV; b \<in> UNIV\<rbrakk> \<Longrightarrow> a \<union> b \<in> UNIV
 5. UNIV \<in> UNIV
 6. \<And>A. range A \<subseteq> UNIV \<Longrightarrow> \<Union> (range A) \<in> UNIV
[PROOF STEP]
qed auto


[STATEMENT]
lemma bigo_abs3: "O(f) = O(\<lambda>x. \<bar>f x\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O(f) = O(\<lambda>x. \<bar>f x\<bar>)
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. O(f) \<subseteq> O(\<lambda>x. \<bar>f x\<bar>)
 2. O(\<lambda>x. \<bar>f x\<bar>) \<subseteq> O(f)
[PROOF STEP]
apply (rule bigo_elt_subset)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f \<in> O(\<lambda>x. \<bar>f x\<bar>)
 2. O(\<lambda>x. \<bar>f x\<bar>) \<subseteq> O(f)
[PROOF STEP]
apply (rule bigo_abs2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O(\<lambda>x. \<bar>f x\<bar>) \<subseteq> O(f)
[PROOF STEP]
apply (rule bigo_elt_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<bar>f x\<bar>) \<in> O(f)
[PROOF STEP]
apply (rule bigo_abs)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma T3_complete: "\<lbrakk> v \<in> V\<^bsub>T3\<^esub>; w \<in> V\<^bsub>T3\<^esub>; v \<noteq> w \<rbrakk> \<Longrightarrow> v \<rightarrow>\<^bsub>T3\<^esub> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v \<in> V\<^bsub>T3\<^esub>; w \<in> V\<^bsub>T3\<^esub>; v \<noteq> w\<rbrakk> \<Longrightarrow> v \<rightarrow>\<^bsub>T3\<^esub> w
[PROOF STEP]
unfolding T3_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v \<in> V\<^bsub>\<lparr>verts = {u0, v0, w0}, arcs = {(u0, v0), (v0, u0), (v0, w0), (w0, v0), (w0, u0), (u0, w0)}\<rparr>\<^esub>; w \<in> V\<^bsub>\<lparr>verts = {u0, v0, w0}, arcs = {(u0, v0), (v0, u0), (v0, w0), (w0, v0), (w0, u0), (u0, w0)}\<rparr>\<^esub>; v \<noteq> w\<rbrakk> \<Longrightarrow> v \<rightarrow>\<^bsub>\<lparr>verts = {u0, v0, w0}, arcs = {(u0, v0), (v0, u0), (v0, w0), (w0, v0), (w0, u0), (u0, w0)}\<rparr>\<^esub> w
[PROOF STEP]
by auto


[STATEMENT]
lemma hmset_pair_decompose_less_eq:
  assumes "m1 \<le> m2"
  shows "\<exists>k n1 n2. m1 = k + n1 \<and> m2 = k + n2 \<and> (head_\<omega> n1 < head_\<omega> n2 \<or> n1 = 0 \<and> n2 = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k n1 n2. m1 = k + n1 \<and> m2 = k + n2 \<and> (head_\<omega> n1 < head_\<omega> n2 \<or> n1 = 0 \<and> n2 = 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<le> m2

goal (1 subgoal):
 1. \<exists>k n1 n2. m1 = k + n1 \<and> m2 = k + n2 \<and> (head_\<omega> n1 < head_\<omega> n2 \<or> n1 = 0 \<and> n2 = 0)
[PROOF STEP]
by (metis add_cancel_right_right hmset_pair_decompose_less order.not_eq_order_implies_strict)


[STATEMENT]
lemma disjoint_dverts_if_wf_aux:
  assumes "wf_dverts (Node r xs)"
      and "(t1,e1) \<in> fset xs" and "(t2,e2) \<in> fset xs" and "(t1,e1) \<noteq> (t2,e2)"
    shows "dverts t1 \<inter> dverts t2 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dverts t1 \<inter> dverts t2 = {}
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dverts t1 \<inter> dverts t2 \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
assume "dverts t1 \<inter> dverts t2 \<noteq> {}"
[PROOF STATE]
proof (state)
this:
dverts t1 \<inter> dverts t2 \<noteq> {}

goal (1 subgoal):
 1. dverts t1 \<inter> dverts t2 \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dverts t1 \<inter> dverts t2 \<noteq> {}
[PROOF STEP]
obtain x where x_def: "x \<in> dverts t1" "x \<in> dverts t2"
[PROOF STATE]
proof (prove)
using this:
dverts t1 \<inter> dverts t2 \<noteq> {}

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> dverts t1; x \<in> dverts t2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> dverts t1
x \<in> dverts t2

goal (1 subgoal):
 1. dverts t1 \<inter> dverts t2 \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> dverts t1
x \<in> dverts t2
[PROOF STEP]
have "2 \<le> count (dverts_mset (Node r xs)) x"
[PROOF STATE]
proof (prove)
using this:
x \<in> dverts t1
x \<in> dverts t2

goal (1 subgoal):
 1. 2 \<le> count (dverts_mset (Node r xs)) x
[PROOF STEP]
using dverts_children_count_ge2[OF assms(2-4)]
[PROOF STATE]
proof (prove)
using this:
x \<in> dverts t1
x \<in> dverts t2
\<lbrakk>?x \<in> dverts t1; ?x \<in> dverts t2\<rbrakk> \<Longrightarrow> 2 \<le> count (dverts_mset (Node ?r xs)) ?x

goal (1 subgoal):
 1. 2 \<le> count (dverts_mset (Node r xs)) x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
2 \<le> count (dverts_mset (Node r xs)) x

goal (1 subgoal):
 1. dverts t1 \<inter> dverts t2 \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 \<le> count (dverts_mset (Node r xs)) x

goal (1 subgoal):
 1. dverts t1 \<inter> dverts t2 \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
have "x \<in># (dverts_mset (Node r xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in># dverts_mset (Node r xs)
[PROOF STEP]
using assms(2) x_def(1)
[PROOF STATE]
proof (prove)
using this:
(t1, e1) \<in> fset xs
x \<in> dverts t1

goal (1 subgoal):
 1. x \<in># dverts_mset (Node r xs)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in># dverts_mset (Node r xs)

goal (1 subgoal):
 1. dverts t1 \<inter> dverts t2 \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
2 \<le> count (dverts_mset (Node r xs)) x
x \<in># dverts_mset (Node r xs)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
2 \<le> count (dverts_mset (Node r xs)) x
x \<in># dverts_mset (Node r xs)

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
2 \<le> count (dverts_mset (Node r xs)) x
x \<in># dverts_mset (Node r xs)
wf_dverts (Node r xs)

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding wf_dverts_def
[PROOF STATE]
proof (prove)
using this:
2 \<le> count (dverts_mset (Node r xs)) x
x \<in># dverts_mset (Node r xs)
\<forall>x\<in>#dverts_mset (Node r xs). count (dverts_mset (Node r xs)) x = 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma DirProds_finite_group_iff:
  assumes "finite I"
  shows "finite_group (DirProds G I) \<longleftrightarrow> (\<forall>i\<in>I. finite_group (G i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_group (DirProds G I) = (\<forall>i\<in>I. finite_group (G i))
[PROOF STEP]
using DirProds_is_finite_group DirProds_finite_imp_finite_groups assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i \<in> ?I \<Longrightarrow> finite_group (?G i); finite ?I\<rbrakk> \<Longrightarrow> finite_group (DirProds ?G ?I)
\<lbrakk>finite_group (DirProds ?G ?I); finite ?I; ?i \<in> ?I\<rbrakk> \<Longrightarrow> finite_group (?G ?i)
finite I

goal (1 subgoal):
 1. finite_group (DirProds G I) = (\<forall>i\<in>I. finite_group (G i))
[PROOF STEP]
by metis


[STATEMENT]
lemma t_fusion_assoc [simp]:
  "\<lbrakk> last x = first y; last y = first z \<rbrakk> \<Longrightarrow> t_fusion x (t_fusion y z) = t_fusion (t_fusion x y) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Dioid_Models_New.last x = first y; Dioid_Models_New.last y = first z\<rbrakk> \<Longrightarrow> t_fusion x (t_fusion y z) = t_fusion (t_fusion x y) z
[PROOF STEP]
by (cases x, cases y, cases z, simp add: t_fusion_def)


[STATEMENT]
lemma mod_range: "b>0 \<Longrightarrow> (a::int) mod (b::int) \<in> {0..b-1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < b \<Longrightarrow> a mod b \<in> {0..b - 1}
[PROOF STEP]
using range_mod
[PROOF STATE]
proof (prove)
using this:
0 < ?n \<Longrightarrow> range (\<lambda>m. m mod ?n) = {0..<?n}

goal (1 subgoal):
 1. 0 < b \<Longrightarrow> a mod b \<in> {0..b - 1}
[PROOF STEP]
by auto


[STATEMENT]
lemma disc_reward_tendsto:
  "(\<lambda>n. \<Sum>t<n. l^t *\<^sub>R \<P>\<^sub>X t (r_dec\<^sub>b (p t))) \<longlonglongrightarrow> (\<Sum>t. l^t *\<^sub>R \<P>\<^sub>X t (r_dec\<^sub>b (p t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>t<n. l ^ t *\<^sub>R \<P>\<^sub>X t (r_dec\<^sub>b (p t))) \<longlonglongrightarrow> (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>X t (r_dec\<^sub>b (p t)))
[PROOF STEP]
by (simp add: summable_LIMSEQ)


[STATEMENT]
lemma grand_parent_upper_bound: "parent l (parent l c) < c \<longleftrightarrow> l \<le> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (parent l (parent l c) < c) = (l \<le> c)
[PROOF STEP]
unfolding parent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l + (l + (c - l - 1) div 2 - l - 1) div 2 < c) = (l \<le> c)
[PROOF STEP]
by linarith


[STATEMENT]
lemma filt_equiv_space:
  assumes "filt_equiv F M N"
  shows "space M = space N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space M = space N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
filt_equiv F M N

goal (1 subgoal):
 1. space M = space N
[PROOF STEP]
unfolding filt_equiv_def
 filtration_def subalgebra_def
[PROOF STATE]
proof (prove)
using this:
sets M = sets N \<and> ((\<forall>t. space (F t) = space M \<and> sets (F t) \<subseteq> sets M) \<and> (\<forall>s t. s \<le> t \<longrightarrow> space (F s) = space (F t) \<and> sets (F s) \<subseteq> sets (F t))) \<and> (\<forall>t A. A \<in> sets (F t) \<longrightarrow> (emeasure M A = 0) = (emeasure N A = 0))

goal (1 subgoal):
 1. space M = space N
[PROOF STEP]
by (meson sets_eq_imp_space_eq)


[STATEMENT]
lemma filter_mset_is_empty_iff: "filter_mset P A = {#} \<longleftrightarrow> (\<forall>x. x \<in># A \<longrightarrow> \<not>P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filter_mset P A = {#}) = (\<forall>x. x \<in># A \<longrightarrow> \<not> P x)
[PROOF STEP]
by (auto simp: multiset_eq_iff count_eq_zero_iff)


[STATEMENT]
lemma lt_spair:
  assumes "rep_list p \<noteq> 0" and "punit.lt (rep_list p) \<oplus> lt q \<prec>\<^sub>t punit.lt (rep_list q) \<oplus> lt p"
  shows "lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
define l where "l = lcs (punit.lt (rep_list p)) (punit.lt (rep_list q))"
[PROOF STATE]
proof (state)
this:
l = lcs (punit.lt (rep_list p)) (punit.lt (rep_list q))

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
have 1: "punit.lt (rep_list p) adds l" and 2: "punit.lt (rep_list q) adds l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. punit.lt (rep_list p) adds l &&& punit.lt (rep_list q) adds l
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. punit.lt (rep_list p) adds lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) &&& punit.lt (rep_list q) adds lcs (punit.lt (rep_list p)) (punit.lt (rep_list q))
[PROOF STEP]
by (rule adds_lcs, rule adds_lcs_2)
[PROOF STATE]
proof (state)
this:
punit.lt (rep_list p) adds l
punit.lt (rep_list q) adds l

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
have eq1: "spair p q = (monom_mult (1 / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p) +
                         (monom_mult (- 1 / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spair p q = monom_mult ((1::'b) / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p + monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q
[PROOF STEP]
by (simp add: spair_def Let_def l_def monom_mult_uminus_left)
[PROOF STATE]
proof (state)
this:
spair p q = monom_mult ((1::'b) / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p + monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
rep_list p \<noteq> 0
[PROOF STEP]
have "punit.lc (rep_list p) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
rep_list p \<noteq> 0

goal (1 subgoal):
 1. punit.lc (rep_list p) \<noteq> (0::'b)
[PROOF STEP]
by (rule punit.lc_not_0)
[PROOF STATE]
proof (state)
this:
punit.lc (rep_list p) \<noteq> (0::'b)

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
hence "1 / punit.lc (rep_list p) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
punit.lc (rep_list p) \<noteq> (0::'b)

goal (1 subgoal):
 1. (1::'b) / punit.lc (rep_list p) \<noteq> (0::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1::'b) / punit.lc (rep_list p) \<noteq> (0::'b)

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1::'b) / punit.lc (rep_list p) \<noteq> (0::'b)

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
rep_list p \<noteq> 0
[PROOF STEP]
have "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
rep_list p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
by (auto simp: rep_list_zero)
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1::'b) / punit.lc (rep_list p) \<noteq> (0::'b)
p \<noteq> 0
[PROOF STEP]
have eq2: "lt (monom_mult (1 / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p) =
                        (l - punit.lt (rep_list p)) \<oplus> lt p"
[PROOF STATE]
proof (prove)
using this:
(1::'b) / punit.lc (rep_list p) \<noteq> (0::'b)
p \<noteq> 0

goal (1 subgoal):
 1. lt (monom_mult ((1::'b) / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p) = (l - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
by (rule lt_monom_mult)
[PROOF STATE]
proof (state)
this:
lt (monom_mult ((1::'b) / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p) = (l - punit.lt (rep_list p)) \<oplus> lt p

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
have "lt (monom_mult (- 1 / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q) \<preceq>\<^sub>t
                        (l - punit.lt (rep_list q)) \<oplus> lt q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lt (monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q) \<preceq>\<^sub>t (l - punit.lt (rep_list q)) \<oplus> lt q
[PROOF STEP]
by (fact lt_monom_mult_le)
[PROOF STATE]
proof (state)
this:
lt (monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q) \<preceq>\<^sub>t (l - punit.lt (rep_list q)) \<oplus> lt q

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lt (monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q) \<preceq>\<^sub>t (l - punit.lt (rep_list q)) \<oplus> lt q

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
punit.lt (rep_list p) \<oplus> lt q \<prec>\<^sub>t punit.lt (rep_list q) \<oplus> lt p
[PROOF STEP]
have "... \<prec>\<^sub>t (l - punit.lt (rep_list p)) \<oplus> lt p"
[PROOF STATE]
proof (prove)
using this:
punit.lt (rep_list p) \<oplus> lt q \<prec>\<^sub>t punit.lt (rep_list q) \<oplus> lt p

goal (1 subgoal):
 1. (l - punit.lt (rep_list q)) \<oplus> lt q \<prec>\<^sub>t (l - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
by (simp add: term_is_le_rel_minus_minus[OF _ 2 1])
[PROOF STATE]
proof (state)
this:
(l - punit.lt (rep_list q)) \<oplus> lt q \<prec>\<^sub>t (l - punit.lt (rep_list p)) \<oplus> lt p

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lt (monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q) \<prec>\<^sub>t (l - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lt (monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q) \<prec>\<^sub>t (l - punit.lt (rep_list p)) \<oplus> lt p

goal (1 subgoal):
 1. lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p
[PROOF STEP]
unfolding eq2[symmetric] eq1 l_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
lt (monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q) \<prec>\<^sub>t lt (monom_mult ((1::'b) / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p)

goal (1 subgoal):
 1. lt (monom_mult ((1::'b) / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p + monom_mult (- (1::'b) / punit.lc (rep_list q)) (l - punit.lt (rep_list q)) q) = lt (monom_mult ((1::'b) / punit.lc (rep_list p)) (l - punit.lt (rep_list p)) p)
[PROOF STEP]
by (rule lt_plus_eqI_2)
[PROOF STATE]
proof (state)
this:
lt (spair p q) = (lcs (punit.lt (rep_list p)) (punit.lt (rep_list q)) - punit.lt (rep_list p)) \<oplus> lt p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Busemann_function_le_dist [mono_intros]:
  "abs(Busemann_function_at xi x y) \<le> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Busemann_function_at xi x y\<bar> \<le> dist x y
[PROOF STEP]
using Busemann_function_mono[of xi x y y y] Busemann_function_mono[of xi x x x y]
[PROOF STATE]
proof (prove)
using this:
Busemann_function_at xi x y \<le> Busemann_function_at xi y y + dist x y + dist y y
Busemann_function_at xi x x \<le> Busemann_function_at xi x y + dist x x + dist x y

goal (1 subgoal):
 1. \<bar>Busemann_function_at xi x y\<bar> \<le> dist x y
[PROOF STEP]
by auto


[STATEMENT]
lemma MOST_Suc_iff: "(MOST n. P (Suc n)) \<longleftrightarrow> (MOST n. P n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>\<infinity>n. P (Suc n)) = (\<forall>\<^sub>\<infinity>n. P n)
[PROOF STEP]
by (simp add: cofinite_eq_sequentially)


[STATEMENT]
lemma sdiv_smod_id:
  \<open>(a sdiv b) * b + (a smod b) = a\<close>
  for a b :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a sdiv b * b + a smod b = a
[PROOF STEP]
by (fact sdiv_mult_smod_eq)


[STATEMENT]
lemma max_ins_scaled: " n* height x14 \<le> m + n* Max (insert (height x14) (height ` set x13))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n * height x14 \<le> m + n * Max (insert (height x14) (height ` set x13))
[PROOF STEP]
by (meson List.finite_set Max_ge finite_imageI finite_insert insertI1 mult_le_mono2 trans_le_add2)


[STATEMENT]
lemma arthan:
  fixes xs :: "'a :: linordered_idom list"
  assumes "xs \<noteq> []" "last xs \<noteq> 0" "sum_list xs = 0"
  shows   "sign_changes xs > sign_changes (psums xs) \<and>
           odd (sign_changes xs - sign_changes (psums xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_changes (psums xs) < sign_changes xs \<and> odd (sign_changes xs - sign_changes (psums xs))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
last xs \<noteq> (0::'a)
sum_list xs = (0::'a)

goal (1 subgoal):
 1. sign_changes (psums xs) < sign_changes xs \<and> odd (sign_changes xs - sign_changes (psums xs))
[PROOF STEP]
proof (induction xs rule: sign_changes_induct)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<lbrakk>[] \<noteq> []; last [] \<noteq> (0::'a); sum_list [] = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums []) < sign_changes [] \<and> odd (sign_changes [] - sign_changes (psums []))
 2. \<And>x. \<lbrakk>[x] \<noteq> []; last [x] \<noteq> (0::'a); sum_list [x] = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums [x]) < sign_changes [x] \<and> odd (sign_changes [x] - sign_changes (psums [x]))
 3. \<And>xs. \<lbrakk>\<lbrakk>xs \<noteq> []; last xs \<noteq> (0::'a); sum_list xs = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums xs) < sign_changes xs \<and> odd (sign_changes xs - sign_changes (psums xs)); (0::'a) # xs \<noteq> []; last ((0::'a) # xs) \<noteq> (0::'a); sum_list ((0::'a) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((0::'a) # xs)) < sign_changes ((0::'a) # xs) \<and> odd (sign_changes ((0::'a) # xs) - sign_changes (psums ((0::'a) # xs)))
 4. \<And>x y xs. \<lbrakk>x \<noteq> (0::'a); \<lbrakk>(x + y) # xs \<noteq> []; last ((x + y) # xs) \<noteq> (0::'a); sum_list ((x + y) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs))); x # y # xs \<noteq> []; last (x # y # xs) \<noteq> (0::'a); sum_list (x # y # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
case (nonzero x y xs)
[PROOF STATE]
proof (state)
this:
x \<noteq> (0::'a)
\<lbrakk>(x + y) # xs \<noteq> []; last ((x + y) # xs) \<noteq> (0::'a); sum_list ((x + y) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))
x # y # xs \<noteq> []
last (x # y # xs) \<noteq> (0::'a)
sum_list (x # y # xs) = (0::'a)

goal (4 subgoals):
 1. \<lbrakk>[] \<noteq> []; last [] \<noteq> (0::'a); sum_list [] = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums []) < sign_changes [] \<and> odd (sign_changes [] - sign_changes (psums []))
 2. \<And>x. \<lbrakk>[x] \<noteq> []; last [x] \<noteq> (0::'a); sum_list [x] = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums [x]) < sign_changes [x] \<and> odd (sign_changes [x] - sign_changes (psums [x]))
 3. \<And>xs. \<lbrakk>\<lbrakk>xs \<noteq> []; last xs \<noteq> (0::'a); sum_list xs = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums xs) < sign_changes xs \<and> odd (sign_changes xs - sign_changes (psums xs)); (0::'a) # xs \<noteq> []; last ((0::'a) # xs) \<noteq> (0::'a); sum_list ((0::'a) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((0::'a) # xs)) < sign_changes ((0::'a) # xs) \<and> odd (sign_changes ((0::'a) # xs) - sign_changes (psums ((0::'a) # xs)))
 4. \<And>x y xs. \<lbrakk>x \<noteq> (0::'a); \<lbrakk>(x + y) # xs \<noteq> []; last ((x + y) # xs) \<noteq> (0::'a); sum_list ((x + y) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs))); x # y # xs \<noteq> []; last (x # y # xs) \<noteq> (0::'a); sum_list (x # y # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
proof (cases "xs = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
 2. xs \<noteq> [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
xs \<noteq> []

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
 2. xs \<noteq> [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
define \<alpha> where "\<alpha> = int (sign_changes (x # y # xs)) - int (sign_changes ((x + y) # xs))"
[PROOF STATE]
proof (state)
this:
\<alpha> = int (sign_changes (x # y # xs)) - int (sign_changes ((x + y) # xs))

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
 2. xs \<noteq> [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
define \<beta> where "\<beta> = int (sign_changes (psums (x # y # xs))) - int (sign_changes (psums ((x+y) # xs)))"
[PROOF STATE]
proof (state)
this:
\<beta> = int (sign_changes (psums (x # y # xs))) - int (sign_changes (psums ((x + y) # xs)))

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
 2. xs \<noteq> [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
from nonzero False
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> (0::'a)
\<lbrakk>(x + y) # xs \<noteq> []; last ((x + y) # xs) \<noteq> (0::'a); sum_list ((x + y) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))
x # y # xs \<noteq> []
last (x # y # xs) \<noteq> (0::'a)
sum_list (x # y # xs) = (0::'a)
xs \<noteq> []
[PROOF STEP]
have "\<alpha> \<ge> \<beta> \<and> even (\<alpha> - \<beta>)"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
\<lbrakk>(x + y) # xs \<noteq> []; last ((x + y) # xs) \<noteq> (0::'a); sum_list ((x + y) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))
x # y # xs \<noteq> []
last (x # y # xs) \<noteq> (0::'a)
sum_list (x # y # xs) = (0::'a)
xs \<noteq> []

goal (1 subgoal):
 1. \<beta> \<le> \<alpha> \<and> even (\<alpha> - \<beta>)
[PROOF STEP]
unfolding \<alpha>_def \<beta>_def
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
\<lbrakk>(x + y) # xs \<noteq> []; last ((x + y) # xs) \<noteq> (0::'a); sum_list ((x + y) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))
x # y # xs \<noteq> []
last (x # y # xs) \<noteq> (0::'a)
sum_list (x # y # xs) = (0::'a)
xs \<noteq> []

goal (1 subgoal):
 1. int (sign_changes (psums (x # y # xs))) - int (sign_changes (psums ((x + y) # xs))) \<le> int (sign_changes (x # y # xs)) - int (sign_changes ((x + y) # xs)) \<and> even (int (sign_changes (x # y # xs)) - int (sign_changes ((x + y) # xs)) - (int (sign_changes (psums (x # y # xs))) - int (sign_changes (psums ((x + y) # xs)))))
[PROOF STEP]
by (intro arthan_aux1) auto
[PROOF STATE]
proof (state)
this:
\<beta> \<le> \<alpha> \<and> even (\<alpha> - \<beta>)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
 2. xs \<noteq> [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
from False and nonzero.prems
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
x # y # xs \<noteq> []
last (x # y # xs) \<noteq> (0::'a)
sum_list (x # y # xs) = (0::'a)
[PROOF STEP]
have
       "sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and>
        odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
x # y # xs \<noteq> []
last (x # y # xs) \<noteq> (0::'a)
sum_list (x # y # xs) = (0::'a)

goal (1 subgoal):
 1. sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))
[PROOF STEP]
by (intro nonzero.IH) (auto simp: add.assoc)
[PROOF STATE]
proof (state)
this:
sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
 2. xs \<noteq> [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
with arthan_aux1[of xs x y] nonzero(4,5) False(1)
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>xs \<noteq> []; last xs \<noteq> (0::'a); x + y + sum_list xs = (0::'a)\<rbrakk> \<Longrightarrow> int (sign_changes (psums (x # y # xs))) - int (sign_changes (psums ((x + y) # xs))) \<le> int (sign_changes (x # y # xs)) - int (sign_changes ((x + y) # xs)) \<and> even (int (sign_changes (x # y # xs)) - int (sign_changes ((x + y) # xs)) - (int (sign_changes (psums (x # y # xs))) - int (sign_changes (psums ((x + y) # xs)))))
last (x # y # xs) \<noteq> (0::'a)
sum_list (x # y # xs) = (0::'a)
xs \<noteq> []
sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>xs \<noteq> []; last xs \<noteq> (0::'a); x + y + sum_list xs = (0::'a)\<rbrakk> \<Longrightarrow> int (sign_changes (psums (x # y # xs))) - int (sign_changes (psums ((x + y) # xs))) \<le> int (sign_changes (x # y # xs)) - int (sign_changes ((x + y) # xs)) \<and> even (int (sign_changes (x # y # xs)) - int (sign_changes ((x + y) # xs)) - (int (sign_changes (psums (x # y # xs))) - int (sign_changes (psums ((x + y) # xs)))))
last (x # y # xs) \<noteq> (0::'a)
sum_list (x # y # xs) = (0::'a)
xs \<noteq> []
sign_changes (psums ((x + y) # xs)) < sign_changes ((x + y) # xs) \<and> odd (sign_changes ((x + y) # xs) - sign_changes (psums ((x + y) # xs)))

goal (1 subgoal):
 1. sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))

goal (1 subgoal):
 1. xs = [] \<Longrightarrow> sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))
[PROOF STEP]
qed (insert nonzero.prems, auto split: if_split_asm simp: sign_changes_two add_eq_0_iff)
[PROOF STATE]
proof (state)
this:
sign_changes (psums (x # y # xs)) < sign_changes (x # y # xs) \<and> odd (sign_changes (x # y # xs) - sign_changes (psums (x # y # xs)))

goal (3 subgoals):
 1. \<lbrakk>[] \<noteq> []; last [] \<noteq> (0::'a); sum_list [] = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums []) < sign_changes [] \<and> odd (sign_changes [] - sign_changes (psums []))
 2. \<And>x. \<lbrakk>[x] \<noteq> []; last [x] \<noteq> (0::'a); sum_list [x] = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums [x]) < sign_changes [x] \<and> odd (sign_changes [x] - sign_changes (psums [x]))
 3. \<And>xs. \<lbrakk>\<lbrakk>xs \<noteq> []; last xs \<noteq> (0::'a); sum_list xs = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums xs) < sign_changes xs \<and> odd (sign_changes xs - sign_changes (psums xs)); (0::'a) # xs \<noteq> []; last ((0::'a) # xs) \<noteq> (0::'a); sum_list ((0::'a) # xs) = (0::'a)\<rbrakk> \<Longrightarrow> sign_changes (psums ((0::'a) # xs)) < sign_changes ((0::'a) # xs) \<and> odd (sign_changes ((0::'a) # xs) - sign_changes (psums ((0::'a) # xs)))
[PROOF STEP]
qed (auto split: if_split_asm simp: add_eq_0_iff)


[STATEMENT]
lemma split_int_le_real':
  "(real_of_int (a::int) + b \<le> 0) = (real_of_int a - real_of_int \<lfloor>- b\<rfloor> \<le> 0 \<or> (real_of_int a - real_of_int \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b < 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_int a + b \<le> 0) = (real_of_int a - real_of_int \<lfloor>- b\<rfloor> \<le> 0 \<or> real_of_int a - real_of_int \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b < 0)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (real_of_int a + b \<le> 0) = (real_of_int a - real_of_int \<lfloor>- b\<rfloor> \<le> 0 \<or> real_of_int a - real_of_int \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b < 0)
[PROOF STEP]
have "(real_of_int a + b \<le>0) = (real_of_int a \<le> -b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_int a + b \<le> 0) = (real_of_int a \<le> - b)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
(real_of_int a + b \<le> 0) = (real_of_int a \<le> - b)

goal (1 subgoal):
 1. (real_of_int a + b \<le> 0) = (real_of_int a - real_of_int \<lfloor>- b\<rfloor> \<le> 0 \<or> real_of_int a - real_of_int \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b < 0)
[PROOF STEP]
with split_int_le_real[where a="a" and b="-b"]
[PROOF STATE]
proof (chain)
picking this:
(real_of_int a \<le> - b) = (a \<le> \<lfloor>- b\<rfloor> \<or> a = \<lfloor>- b\<rfloor> \<and> real_of_int \<lfloor>- b\<rfloor> < - b)
(real_of_int a + b \<le> 0) = (real_of_int a \<le> - b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(real_of_int a \<le> - b) = (a \<le> \<lfloor>- b\<rfloor> \<or> a = \<lfloor>- b\<rfloor> \<and> real_of_int \<lfloor>- b\<rfloor> < - b)
(real_of_int a + b \<le> 0) = (real_of_int a \<le> - b)

goal (1 subgoal):
 1. (real_of_int a + b \<le> 0) = (real_of_int a - real_of_int \<lfloor>- b\<rfloor> \<le> 0 \<or> real_of_int a - real_of_int \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b < 0)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
(real_of_int a + b \<le> 0) = (real_of_int a - real_of_int \<lfloor>- b\<rfloor> \<le> 0 \<or> real_of_int a - real_of_int \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b < 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma step_pop_size_big [simp]: "\<lbrakk>
  invar (States dir big small);
  0 < size big;
  Big.pop big = (x, bigP);
  step (States dir bigP small) = States dir' big' small'
\<rbrakk> \<Longrightarrow> Suc (size big') = size big"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); 0 < size big; Big.pop big = (x, bigP); step (States dir bigP small) = States dir' big' small'\<rbrakk> \<Longrightarrow> Suc (size big') = size big
[PROOF STEP]
using
    invar_pop_big[of dir big small x bigP]
    step_size_big[of dir bigP small dir' big' small']
    Big_Proof.size_pop[of big x bigP]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invar (States dir big small); 0 < size big; Big.pop big = (x, bigP)\<rbrakk> \<Longrightarrow> invar (States dir bigP small)
\<lbrakk>invar (States dir bigP small); step (States dir bigP small) = States dir' big' small'\<rbrakk> \<Longrightarrow> size big' = size bigP
\<lbrakk>invar big; 0 < size big; Big.pop big = (x, bigP)\<rbrakk> \<Longrightarrow> Suc (size bigP) = size big

goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); 0 < size big; Big.pop big = (x, bigP); step (States dir bigP small) = States dir' big' small'\<rbrakk> \<Longrightarrow> Suc (size big') = size big
[PROOF STEP]
by simp


[STATEMENT]
lemma newton_coefficients_int: assumes dist: "distinct xs"
  and len: "length xs = length fs"
  shows "newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map of_int fs)
    in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
from len
[PROOF STATE]
proof (chain)
picking this:
length xs = length fs
[PROOF STEP]
have len: "length (rev fs) = length (rev xs)" "length (rev xs) \<le> length xs"
[PROOF STATE]
proof (prove)
using this:
length xs = length fs

goal (1 subgoal):
 1. length (rev fs) = length (rev xs) &&& length (rev xs) \<le> length xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (rev fs) = length (rev xs)
length (rev xs) \<le> length xs

goal (1 subgoal):
 1. local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
proof (cases "newton_coefficients_main_int (rev fs) (rev xs)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
case (Some res)
[PROOF STATE]
proof (state)
this:
local.newton_coefficients_main_int (rev fs) (rev xs) = Some res

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
have rev: "\<And> xs. map rat_of_int (rev xs) = rev (map of_int xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. map rat_of_int (rev xs) = rev (map rat_of_int xs)
[PROOF STEP]
unfolding rev_map
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. map rat_of_int (rev xs) = map rat_of_int (rev xs)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
map rat_of_int (rev ?xs) = rev (map rat_of_int ?xs)

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
note n = newton_coefficients_main_int_Some[OF len Some, unfolded rev]
[PROOF STATE]
proof (state)
this:
newton_coefficients_main (map rat_of_int xs) (rev (map rat_of_int fs)) (rev (map rat_of_int xs)) = map (map rat_of_int) res \<and> (\<forall>x\<in>set res. x \<noteq> [] \<and> length x \<le> length (rev xs)) \<and> length res = length (rev fs)

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
newton_coefficients_main (map rat_of_int xs) (rev (map rat_of_int fs)) (rev (map rat_of_int xs)) = map (map rat_of_int) res \<and> (\<forall>x\<in>set res. x \<noteq> [] \<and> length x \<le> length (rev xs)) \<and> length res = length (rev fs)

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
fix row
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
assume "row \<in> set res"
[PROOF STATE]
proof (state)
this:
row \<in> set res

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
with n
[PROOF STATE]
proof (chain)
picking this:
newton_coefficients_main (map rat_of_int xs) (rev (map rat_of_int fs)) (rev (map rat_of_int xs)) = map (map rat_of_int) res \<and> (\<forall>x\<in>set res. x \<noteq> [] \<and> length x \<le> length (rev xs)) \<and> length res = length (rev fs)
row \<in> set res
[PROOF STEP]
have "row \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
newton_coefficients_main (map rat_of_int xs) (rev (map rat_of_int fs)) (rev (map rat_of_int xs)) = map (map rat_of_int) res \<and> (\<forall>x\<in>set res. x \<noteq> [] \<and> length x \<le> length (rev xs)) \<and> length res = length (rev fs)
row \<in> set res

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

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
hence id: "hd (map rat_of_int row) = rat_of_int (hd row)"
[PROOF STATE]
proof (prove)
using this:
row \<noteq> []

goal (1 subgoal):
 1. hd (map rat_of_int row) = rat_of_int (hd row)
[PROOF STEP]
by (cases row, auto)
[PROOF STATE]
proof (state)
this:
hd (map rat_of_int row) = rat_of_int (hd row)

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
hd (map rat_of_int row) = rat_of_int (hd row)

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
have "\<dots> \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int (hd row) \<in> \<int>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_of_int (hd row) \<in> \<int>

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
hd (map rat_of_int row) \<in> \<int>
[PROOF STEP]
have int: "hd (map rat_of_int row) \<in> \<int>"
[PROOF STATE]
proof (prove)
using this:
hd (map rat_of_int row) \<in> \<int>

goal (1 subgoal):
 1. hd (map rat_of_int row) \<in> \<int>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd (map rat_of_int row) \<in> \<int>

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
have "hd row = int_of_rat (hd (map rat_of_int row))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd row = int_of_rat (hd (map rat_of_int row))
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd row = int_of_rat (rat_of_int (hd row))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
hd row = int_of_rat (hd (map rat_of_int row))

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
note this int
[PROOF STATE]
proof (state)
this:
hd row = int_of_rat (hd (map rat_of_int row))
hd (map rat_of_int row) \<in> \<int>

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?row2 \<in> set res \<Longrightarrow> hd ?row2 = int_of_rat (hd (map rat_of_int ?row2))
?row2 \<in> set res \<Longrightarrow> hd (map rat_of_int ?row2) \<in> \<int>

goal (2 subgoals):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
 2. \<And>a. local.newton_coefficients_main_int (rev fs) (rev xs) = Some a \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?row2 \<in> set res \<Longrightarrow> hd ?row2 = int_of_rat (hd (map rat_of_int ?row2))
?row2 \<in> set res \<Longrightarrow> hd (map rat_of_int ?row2) \<in> \<int>

goal (1 subgoal):
 1. local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
unfolding newton_coefficients_int_def Some newton_coefficients_def n[THEN conjunct1] Let_def option.simps
[PROOF STATE]
proof (prove)
using this:
?row2 \<in> set res \<Longrightarrow> hd ?row2 = int_of_rat (hd (map rat_of_int ?row2))
?row2 \<in> set res \<Longrightarrow> hd (map rat_of_int ?row2) \<in> \<int>

goal (1 subgoal):
 1. Some (map hd res) = (if set (map hd (map (map rat_of_int) res)) \<subseteq> \<int> then Some (map int_of_rat (map hd (map (map rat_of_int) res))) else None)
[PROOF STEP]
by (auto simp: o_def)
[PROOF STATE]
proof (state)
this:
local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)

goal (1 subgoal):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
case None
[PROOF STATE]
proof (state)
this:
local.newton_coefficients_main_int (rev fs) (rev xs) = None

goal (1 subgoal):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
have "rev xs = drop (length xs - length (rev xs)) (rev xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev xs = drop (length xs - length (rev xs)) (rev xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rev xs = drop (length xs - length (rev xs)) (rev xs)

goal (1 subgoal):
 1. local.newton_coefficients_main_int (rev fs) (rev xs) = None \<Longrightarrow> local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
from newton_coefficients_main_int_None[OF dist len None this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>row\<in>set (newton_coefficients_main (map rat_of_int xs) (map rat_of_int (rev fs)) (map rat_of_int (rev xs))). hd row \<notin> \<int>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>row\<in>set (newton_coefficients_main (map rat_of_int xs) (map rat_of_int (rev fs)) (map rat_of_int (rev xs))). hd row \<notin> \<int>

goal (1 subgoal):
 1. local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
unfolding newton_coefficients_int_def newton_coefficients_def None
[PROOF STATE]
proof (prove)
using this:
\<exists>row\<in>set (newton_coefficients_main (map rat_of_int xs) (map rat_of_int (rev fs)) (map rat_of_int (rev xs))). hd row \<notin> \<int>

goal (1 subgoal):
 1. map_option (map hd) None = (let cs = map hd (newton_coefficients_main (map rat_of_int xs) (rev (map rat_of_int fs)) (rev (map rat_of_int xs))) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)
[PROOF STEP]
by (auto simp: Let_def rev_map)
[PROOF STATE]
proof (state)
this:
local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.newton_coefficients_int = (let cs = newton_coefficients (map rat_of_int xs) (map rat_of_int fs) in if set cs \<subseteq> \<int> then Some (map int_of_rat cs) else None)

goal:
No subgoals!
[PROOF STEP]
qed