[STATEMENT]
lemma clocked_min_counter:
  assumes "evaluate True env s e (s',r')"
  shows "evaluate True env (s (| clock := (clock   s) - (clock   s') |)) e ((s' (| clock := 0 |)),r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evaluate True env (update_clock (\<lambda>_. clock s - clock s') s) e (update_clock (\<lambda>_. 0) s', r')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. evaluate True env (update_clock (\<lambda>_. clock s - clock s') s) e (update_clock (\<lambda>_. 0) s', r')
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
evaluate True env s e (s', r')
[PROOF STEP]
have "(clock   s) \<ge> (clock   s')"
[PROOF STATE]
proof (prove)
using this:
evaluate True env s e (s', r')

goal (1 subgoal):
 1. clock s' \<le> clock s
[PROOF STEP]
by (fastforce intro:clock_monotone(3)[rule_format])
[PROOF STATE]
proof (state)
this:
clock s' \<le> clock s

goal (1 subgoal):
 1. evaluate True env (update_clock (\<lambda>_. clock s - clock s') s) e (update_clock (\<lambda>_. 0) s', r')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
clock s' \<le> clock s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
clock s' \<le> clock s

goal (1 subgoal):
 1. evaluate True env (update_clock (\<lambda>_. clock s - clock s') s) e (update_clock (\<lambda>_. 0) s', r')
[PROOF STEP]
thm sub_from_counter(3)[rule_format]
[PROOF STATE]
proof (prove)
using this:
clock s' \<le> clock s

goal (1 subgoal):
 1. evaluate True env (update_clock (\<lambda>_. clock s - clock s') s) e (update_clock (\<lambda>_. 0) s', r')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
clock s' \<le> clock s
evaluate True env s e (s', r')

goal (1 subgoal):
 1. evaluate True env (update_clock (\<lambda>_. clock s - clock s') s) e (update_clock (\<lambda>_. 0) s', r')
[PROOF STEP]
by (auto intro!:sub_from_counter(3)[rule_format])
[PROOF STATE]
proof (state)
this:
evaluate True env (update_clock (\<lambda>_. clock s - clock s') s) e (update_clock (\<lambda>_. 0) s', r')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma relcomp_trans_3[trans]:
    assumes "(f, g) \<in> A\<^sub>1 \<rightarrow> B\<^sub>1 \<rightarrow> C\<^sub>1"
    assumes "(g, h) \<in> A\<^sub>2 \<rightarrow> B\<^sub>2 \<rightarrow> C\<^sub>2"
    shows "(f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
note assms(1)
[PROOF STATE]
proof (state)
this:
(f, g) \<in> A\<^sub>1 \<rightarrow> B\<^sub>1 \<rightarrow> C\<^sub>1

goal (1 subgoal):
 1. (f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f, g) \<in> A\<^sub>1 \<rightarrow> B\<^sub>1 \<rightarrow> C\<^sub>1

goal (1 subgoal):
 1. (f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
note assms(2)
[PROOF STATE]
proof (state)
this:
(g, h) \<in> A\<^sub>2 \<rightarrow> B\<^sub>2 \<rightarrow> C\<^sub>2

goal (1 subgoal):
 1. (f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(g, h) \<in> A\<^sub>2 \<rightarrow> B\<^sub>2 \<rightarrow> C\<^sub>2

goal (1 subgoal):
 1. (f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
note
      fun_rel_mono[OF order_refl
      fun_rel_comp_dist]
[PROOF STATE]
proof (state)
this:
?R1.0 \<rightarrow> (?R1.1 \<rightarrow> ?R2.1) O (?R3.1 \<rightarrow> ?R4.1) \<subseteq> ?R1.0 \<rightarrow> ?R1.1 O ?R3.1 \<rightarrow> ?R2.1 O ?R4.1

goal (1 subgoal):
 1. (f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2

goal (1 subgoal):
 1. (f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
(f, h) \<in> A\<^sub>1 O A\<^sub>2 \<rightarrow> B\<^sub>1 O B\<^sub>2 \<rightarrow> C\<^sub>1 O C\<^sub>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_open_vimage:
  "open s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s \<Longrightarrow> continuous_on s f = (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))
[PROOF STEP]
unfolding continuous_on_open_invariant
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s \<Longrightarrow> (\<forall>B. open B \<longrightarrow> (\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> s)) = (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))
[PROOF STEP]
by (metis open_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s])


[STATEMENT]
lemma ring_of_finite_sets: "ring_of_sets (space M) {A\<in>sets M. emeasure M A \<noteq> top}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_of_sets (space M) {A \<in> sets M. emeasure M A \<noteq> top}
[PROOF STEP]
proof (rule ring_of_setsI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. {A \<in> sets M. emeasure M A \<noteq> top} \<subseteq> Pow (space M)
 2. {} \<in> {A \<in> sets M. emeasure M A \<noteq> top}
 3. \<And>a b. \<lbrakk>a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> a \<union> b \<in> {A \<in> sets M. emeasure M A \<noteq> top}
 4. \<And>a b. \<lbrakk>a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> a - b \<in> {A \<in> sets M. emeasure M A \<noteq> top}
[PROOF STEP]
show "a \<in> {A \<in> sets M. emeasure M A \<noteq> top} \<Longrightarrow> b \<in> {A \<in> sets M. emeasure M A \<noteq> top} \<Longrightarrow>
    a \<union> b \<in> {A \<in> sets M. emeasure M A \<noteq> top}" for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> a \<union> b \<in> {A \<in> sets M. emeasure M A \<noteq> top}
[PROOF STEP]
using emeasure_subadditive[of a M b]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<in> sets M; b \<in> sets M\<rbrakk> \<Longrightarrow> emeasure M (a \<union> b) \<le> emeasure M a + emeasure M b

goal (1 subgoal):
 1. \<lbrakk>a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> a \<union> b \<in> {A \<in> sets M. emeasure M A \<noteq> top}
[PROOF STEP]
by (auto simp: top_unique)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; ?b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> ?a \<union> ?b \<in> {A \<in> sets M. emeasure M A \<noteq> top}

goal (3 subgoals):
 1. {A \<in> sets M. emeasure M A \<noteq> top} \<subseteq> Pow (space M)
 2. {} \<in> {A \<in> sets M. emeasure M A \<noteq> top}
 3. \<And>a b. \<lbrakk>a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> a - b \<in> {A \<in> sets M. emeasure M A \<noteq> top}
[PROOF STEP]
show "a \<in> {A \<in> sets M. emeasure M A \<noteq> top} \<Longrightarrow> b \<in> {A \<in> sets M. emeasure M A \<noteq> top} \<Longrightarrow>
    a - b \<in> {A \<in> sets M. emeasure M A \<noteq> top}" for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> a - b \<in> {A \<in> sets M. emeasure M A \<noteq> top}
[PROOF STEP]
using emeasure_mono[of "a - b" a M]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a - b \<subseteq> a; a \<in> sets M\<rbrakk> \<Longrightarrow> emeasure M (a - b) \<le> emeasure M a

goal (1 subgoal):
 1. \<lbrakk>a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> a - b \<in> {A \<in> sets M. emeasure M A \<noteq> top}
[PROOF STEP]
by (auto simp: top_unique)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<in> {A \<in> sets M. emeasure M A \<noteq> top}; ?b \<in> {A \<in> sets M. emeasure M A \<noteq> top}\<rbrakk> \<Longrightarrow> ?a - ?b \<in> {A \<in> sets M. emeasure M A \<noteq> top}

goal (2 subgoals):
 1. {A \<in> sets M. emeasure M A \<noteq> top} \<subseteq> Pow (space M)
 2. {} \<in> {A \<in> sets M. emeasure M A \<noteq> top}
[PROOF STEP]
qed (auto dest: sets.sets_into_space)


[STATEMENT]
lemma (in Ring) LSM_sub_submodule:"\<lbrakk>R module M; T \<subseteq> carrier M;
      submodule R M N; T \<subseteq> N \<rbrakk> \<Longrightarrow> (LSM\<^bsub>R\<^esub> M T) \<subseteq> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M; T \<subseteq> carrier M; submodule R M N; T \<subseteq> N\<rbrakk> \<Longrightarrow> LSM\<^bsub>R\<^esub> M T \<subseteq> N
[PROOF STEP]
by (rule subsetI, simp add:Least_submodule_def)


[STATEMENT]
lemma allocationRightUniqueRangeDomain:
  assumes "a \<in> possible_allocations_rel G N"
  shows "runiq a &
         runiq (a\<inverse>) &
         (Domain a) partitions G &
         Range a \<subseteq> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. runiq a \<and> runiq (a\<inverse>) \<and> Domain a partitions G \<and> Range a \<subseteq> N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. runiq a \<and> runiq (a\<inverse>) \<and> Domain a partitions G \<and> Range a \<subseteq> N
[PROOF STEP]
obtain Y where
  0: "a \<in> injections Y N & Y \<in> all_partitions G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Y. a \<in> injections Y N \<and> Y \<in> all_partitions G \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> possible_allocations_rel G N

goal (1 subgoal):
 1. (\<And>Y. a \<in> injections Y N \<and> Y \<in> all_partitions G \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> injections Y N \<and> Y \<in> all_partitions G

goal (1 subgoal):
 1. runiq a \<and> runiq (a\<inverse>) \<and> Domain a partitions G \<and> Range a \<subseteq> N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. runiq a \<and> runiq (a\<inverse>) \<and> Domain a partitions G \<and> Range a \<subseteq> N
[PROOF STEP]
using 0 injections_def all_partitions_def mem_Collect_eq
[PROOF STATE]
proof (prove)
using this:
a \<in> injections Y N \<and> Y \<in> all_partitions G
injections ?X ?Y = {R. Domain R = ?X \<and> Range R \<subseteq> ?Y \<and> runiq R \<and> runiq (R\<inverse>)}
all_partitions ?A = {P. P partitions ?A}
(?a \<in> Collect ?P) = ?P ?a

goal (1 subgoal):
 1. runiq a \<and> runiq (a\<inverse>) \<and> Domain a partitions G \<and> Range a \<subseteq> N
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
runiq a \<and> runiq (a\<inverse>) \<and> Domain a partitions G \<and> Range a \<subseteq> N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card2_inc_two:"\<lbrakk>0 < (n::nat); x \<in> {j. j \<le> n}\<rbrakk> \<Longrightarrow>
                                  \<exists>y \<in> {j. j \<le> n}. x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; x \<in> {j. j \<le> n}\<rbrakk> \<Longrightarrow> \<exists>y\<in>{j. j \<le> n}. x \<noteq> y
[PROOF STEP]
apply (rule contrapos_pp, simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; x \<le> n; \<forall>y\<le>n. x = y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (frule_tac m = 0 and n = n in Suc_leI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; x \<le> n; \<forall>y\<le>n. x = y; Suc 0 \<le> n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (
        frule_tac a = "Suc 0" in forall_spec, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; x \<le> n; \<forall>y\<le>n. x = y; Suc 0 \<le> n; x = Suc 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (frule_tac a = 0 in forall_spec)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < n; x \<le> n; \<forall>y\<le>n. x = y; Suc 0 \<le> n; x = Suc 0\<rbrakk> \<Longrightarrow> 0 \<le> n
 2. \<lbrakk>0 < n; x \<le> n; \<forall>y\<le>n. x = y; Suc 0 \<le> n; x = Suc 0; x = 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (rule less_imp_le, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; x \<le> n; \<forall>y\<le>n. x = y; Suc 0 \<le> n; x = Suc 0; x = 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cos_ge_1_arg:
  fixes x :: real
  assumes "0 \<le> x"
    shows "1 - x \<le> cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - x \<le> cos x
[PROOF STEP]
apply (rule gen_lower_bound_increasing [OF assms])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> ((\<lambda>x. 1 - x - cos x) has_real_derivative ?g y) (at y)
 2. \<And>y. \<lbrakk>0 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> ?g y \<le> 0
 3. 1 - 0 = cos 0
[PROOF STEP]
apply (intro derivative_eq_intros, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma msubst_nb:
  assumes "islin p"
    and "tmbound0 t"
    and "tmbound0 s"
  shows "bound0 (msubst p ((c,t),(d,s)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bound0 (msubst p ((c, t), d, s))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
islin p
tmbound0 t
tmbound0 s

goal (1 subgoal):
 1. bound0 (msubst p ((c, t), d, s))
[PROOF STEP]
by (induct p rule: islin.induct) (auto simp add: msubsteq_nb msubstneq_nb msubstlt_nb msubstle_nb)


[STATEMENT]
lemma psums_0_Cons [simp]:
  "psums (0#xs :: 'a :: monoid_add list) = 0 # psums xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. psums ((0::'a) # xs) = (0::'a) # psums xs
[PROOF STEP]
by (induction xs rule: psums.induct) (simp_all add: algebra_simps)


[STATEMENT]
lemma emeasure_T_const[simp]: "emeasure (T s) (space S) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (T s) (space (stream_space (count_space UNIV))) = 1
[PROOF STEP]
using T.emeasure_space_1[of s]
[PROOF STATE]
proof (prove)
using this:
emeasure (T s) (space (T s)) = 1

goal (1 subgoal):
 1. emeasure (T s) (space (stream_space (count_space UNIV))) = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma dropWhile_queue_rep: "linearize (dropWhile_queue f q) = dropWhile f (linearize q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linearize (dropWhile_queue f q) = dropWhile f (linearize q)
[PROOF STEP]
by (induction f q rule: dropWhile_queue.induct)
     (auto simp add: tl_queue_rep dropWhile_hd_tl is_empty_alt
      split: prod.splits option.splits dest: safe_hd_rep)


[STATEMENT]
lemma zip_map1:
  "zip (map f xs) ys = map (\<lambda>(x, y). (f x, y)) (zip xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip (map f xs) ys = map2 (\<lambda>x. Pair (f x)) xs ys
[PROOF STEP]
using zip_map_map[of f xs "\<lambda>x. x" ys]
[PROOF STATE]
proof (prove)
using this:
zip (map f xs) (map (\<lambda>x. x) ys) = map2 (\<lambda>x. Pair (f x)) xs ys

goal (1 subgoal):
 1. zip (map f xs) ys = map2 (\<lambda>x. Pair (f x)) xs ys
[PROOF STEP]
by simp


[STATEMENT]
lemma connectedin_eq_not_separated:
   "connectedin X S \<longleftrightarrow>
         S \<subseteq> topspace X \<and>
         (\<nexists>C1 C2. C1 \<union> C2 = S \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> separatedin X C1 C2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connectedin X S = (S \<subseteq> topspace X \<and> (\<nexists>C1 C2. C1 \<union> C2 = S \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> separatedin X C1 C2))
[PROOF STEP]
unfolding separatedin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connectedin X S = (S \<subseteq> topspace X \<and> (\<nexists>C1 C2. C1 \<union> C2 = S \<and> C1 \<noteq> {} \<and> C2 \<noteq> {} \<and> C1 \<subseteq> topspace X \<and> C2 \<subseteq> topspace X \<and> C1 \<inter> X closure_of C2 = {} \<and> C2 \<inter> X closure_of C1 = {}))
[PROOF STEP]
by (metis connectedin_separation sup.boundedE)


[STATEMENT]
lemma welltyped_Seqs_iff[simp]: "es ?? e ::: T \<longleftrightarrow>
  ((es \<noteq> [] \<longrightarrow> T = \<B>) \<and> (\<forall>e \<in> set es. e ::: \<B>) \<and> e ::: T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. es ?? e ::: T = ((es \<noteq> [] \<longrightarrow> T = \<B>) \<and> (\<forall>e\<in>set es. e ::: \<B>) \<and> e ::: T)
[PROOF STEP]
by (induct es arbitrary: e) (auto simp: Seqs_def)


[STATEMENT]
lemma ring_cfs_to_univ_poly_coeffs:
  assumes "as \<in> carrier (R\<^bsup>Suc n\<^esup>)"
  assumes "l \<le> n"
  shows "(ring_cfs_to_univ_poly n as) l = (ring_cfs_to_univ_poly l (take (Suc l) as)) l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_cfs_to_univ_poly n as l = ring_cfs_to_univ_poly l (take (Suc l) as) l
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ring_cfs_to_univ_poly n as l = ring_cfs_to_univ_poly l (take (Suc l) as) l
[PROOF STEP]
have "(take (Suc n) as) = as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take (Suc n) as = as
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
as \<in> carrier (R\<^bsup>Suc n\<^esup>)
l \<le> n

goal (1 subgoal):
 1. take (Suc n) as = as
[PROOF STEP]
by (metis cartesian_power_car_memE le_refl take_all)
[PROOF STATE]
proof (state)
this:
take (Suc n) as = as

goal (1 subgoal):
 1. ring_cfs_to_univ_poly n as l = ring_cfs_to_univ_poly l (take (Suc l) as) l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
take (Suc n) as = as
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
take (Suc n) as = as

goal (1 subgoal):
 1. ring_cfs_to_univ_poly n as l = ring_cfs_to_univ_poly l (take (Suc l) as) l
[PROOF STEP]
using ring_cfs_to_univ_poly_chain[of as n l n]
[PROOF STATE]
proof (prove)
using this:
take (Suc n) as = as
\<lbrakk>as \<in> carrier (R\<^bsup>Suc n\<^esup>); l \<le> n; l \<le> n \<and> n \<le> n\<rbrakk> \<Longrightarrow> ring_cfs_to_univ_poly n (take (Suc n) as) l = ring_cfs_to_univ_poly l (take (Suc l) as) l

goal (1 subgoal):
 1. ring_cfs_to_univ_poly n as l = ring_cfs_to_univ_poly l (take (Suc l) as) l
[PROOF STEP]
by (metis assms(1) assms(2) order_refl)
[PROOF STATE]
proof (state)
this:
ring_cfs_to_univ_poly n as l = ring_cfs_to_univ_poly l (take (Suc l) as) l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma greater_imp_iprev_ge: "\<lbrakk> b < a; a \<in> I; b \<in> I \<rbrakk> \<Longrightarrow> b \<le> iprev a I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b < a; a \<in> I; b \<in> I\<rbrakk> \<Longrightarrow> b \<le> iprev a I
[PROOF STEP]
apply (rule ccontr, simp add: linorder_not_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b < a; a \<in> I; b \<in> I; iprev a I < b\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (blast dest: iprev_min_step)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma hd_or_tl_gt: "length ys = length xs \<Longrightarrow> ext gt (y # ys) (x # xs) \<Longrightarrow> gt y x \<or> ext gt ys xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length ys = length xs; ext gt (y # ys) (x # xs)\<rbrakk> \<Longrightarrow> gt y x \<or> ext gt ys xs
[PROOF STEP]
by (rule hd_or_tl) (auto intro: gt_trans simp: gt_total)


[STATEMENT]
lemma setsetmapim_restrict1: "B\<subseteq>A \<Longrightarrow> restrict1 f (\<Union>A) \<turnstile> B = f\<turnstile>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> A \<Longrightarrow> restrict1 f (\<Union> A) \<turnstile> B = f \<turnstile> B
[PROOF STEP]
using setsetmapim_cong[of _ f] fun_eq_on_restrict1[of "\<Union>A" f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>fun_eq_on ?g f (\<Union> ?A); ?B \<subseteq> ?A\<rbrakk> \<Longrightarrow> ?g \<turnstile> ?B = f \<turnstile> ?B
fun_eq_on (restrict1 f (\<Union> A)) f (\<Union> A)

goal (1 subgoal):
 1. B \<subseteq> A \<Longrightarrow> restrict1 f (\<Union> A) \<turnstile> B = f \<turnstile> B
[PROOF STEP]
by simp


[STATEMENT]
lemma (in bounded_bilinear) tendsto_right_zero:
  "(f \<longlongrightarrow> 0) F \<Longrightarrow> ((\<lambda>x. c ** f x) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> (0::'b)) F \<Longrightarrow> ((\<lambda>x. c ** f x) \<longlongrightarrow> (0::'c)) F
[PROOF STEP]
by (rule bounded_linear.tendsto_zero [OF bounded_linear_right])


[STATEMENT]
lemma llast_conv_lnth: "llength xs = eSuc (enat n) \<Longrightarrow> llast xs = lnth xs n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength xs = eSuc (enat n) \<Longrightarrow> llast xs = lnth xs n
[PROOF STEP]
by(clarsimp simp add: llast_def zero_enat_def[symmetric] eSuc_enat split: nat.split)


[STATEMENT]
lemma left_inverse_matrix_dim: "left_inverse_matrix A Y \<Longrightarrow> ncols A = nrows Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. left_inverse_matrix A Y \<Longrightarrow> ncols A = nrows Y
[PROOF STEP]
apply (insert ncols_mult[of Y A], insert nrows_mult[of Y A])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>left_inverse_matrix A Y; ncols (Y * A) \<le> ncols A; nrows (Y * A) \<le> nrows Y\<rbrakk> \<Longrightarrow> ncols A = nrows Y
[PROOF STEP]
by (simp add: left_inverse_matrix_def)


[STATEMENT]
lemma sum_list_nlex_eq_zeroI:
  assumes nlex: "list_all (\<lambda>x. lex x 0) xs"
  assumes "sum_list xs = 0"
  assumes "x \<in> set xs"
  shows "x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = 0
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
sum_list xs = 0
[PROOF STEP]
have z1: "sum_list (map fst xs) = 0" and z2: "sum_list (map snd xs) = 0"
[PROOF STATE]
proof (prove)
using this:
sum_list xs = 0

goal (1 subgoal):
 1. sum_list (map fst xs) = 0 &&& sum_list (map snd xs) = 0
[PROOF STEP]
by (auto simp: prod_eq_iff fst_sum_list snd_sum_list)
[PROOF STATE]
proof (state)
this:
sum_list (map fst xs) = 0
sum_list (map snd xs) = 0

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
from nlex
[PROOF STATE]
proof (chain)
picking this:
list_all (\<lambda>x. Counterclockwise_2D_Arbitrary.lex x 0) xs
[PROOF STEP]
have "list_all (\<lambda>x. x \<le> 0) (map fst xs)"
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>x. Counterclockwise_2D_Arbitrary.lex x 0) xs

goal (1 subgoal):
 1. list_all (\<lambda>x. x \<le> 0) (map fst xs)
[PROOF STEP]
by (auto simp: lex_def list_all_iff)
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>x. x \<le> 0) (map fst xs)

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
from sum_list_eq_0_iff_nonpos[OF this] z1 nlex
[PROOF STATE]
proof (chain)
picking this:
(sum_list (map fst xs) = 0) = (\<forall>n\<in>set (map fst xs). n = 0)
sum_list (map fst xs) = 0
list_all (\<lambda>x. Counterclockwise_2D_Arbitrary.lex x 0) xs
[PROOF STEP]
have
    z1': "list_all (\<lambda>x. x = 0) (map fst xs)"
    and "list_all (\<lambda>x. x \<le> 0) (map snd xs)"
[PROOF STATE]
proof (prove)
using this:
(sum_list (map fst xs) = 0) = (\<forall>n\<in>set (map fst xs). n = 0)
sum_list (map fst xs) = 0
list_all (\<lambda>x. Counterclockwise_2D_Arbitrary.lex x 0) xs

goal (1 subgoal):
 1. list_all (\<lambda>x. x = 0) (map fst xs) &&& list_all (\<lambda>x. x \<le> 0) (map snd xs)
[PROOF STEP]
by (auto simp: list_all_iff lex_def)
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>x. x = 0) (map fst xs)
list_all (\<lambda>x. x \<le> 0) (map snd xs)

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
from sum_list_eq_0_iff_nonpos[OF this(2)] z2
[PROOF STATE]
proof (chain)
picking this:
(sum_list (map snd xs) = 0) = (\<forall>n\<in>set (map snd xs). n = 0)
sum_list (map snd xs) = 0
[PROOF STEP]
have "list_all (\<lambda>x. x = 0) (map snd xs)"
[PROOF STATE]
proof (prove)
using this:
(sum_list (map snd xs) = 0) = (\<forall>n\<in>set (map snd xs). n = 0)
sum_list (map snd xs) = 0

goal (1 subgoal):
 1. list_all (\<lambda>x. x = 0) (map snd xs)
[PROOF STEP]
by (simp add: list_all_iff)
[PROOF STATE]
proof (state)
this:
list_all (\<lambda>x. x = 0) (map snd xs)

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
with z1'
[PROOF STATE]
proof (chain)
picking this:
list_all (\<lambda>x. x = 0) (map fst xs)
list_all (\<lambda>x. x = 0) (map snd xs)
[PROOF STEP]
show "x = 0"
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>x. x = 0) (map fst xs)
list_all (\<lambda>x. x = 0) (map snd xs)

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
by (auto simp: list_all_iff zero_prod_def assms prod_eq_iff)
[PROOF STATE]
proof (state)
this:
x = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pos_divideR_less_eq [field_simps]:
  "b /\<^sub>R c < a \<longleftrightarrow> b < c *\<^sub>R a" if "c > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b /\<^sub>R c < a) = (b < c *\<^sub>R a)
[PROOF STEP]
using that pos_less_divideR_eq [of "inverse c" b a]
[PROOF STATE]
proof (prove)
using this:
0 < c
0 < inverse c \<Longrightarrow> (b < a /\<^sub>R inverse c) = (b /\<^sub>R c < a)

goal (1 subgoal):
 1. (b /\<^sub>R c < a) = (b < c *\<^sub>R a)
[PROOF STEP]
by simp


[STATEMENT]
lemma open_UN [continuous_intros, intro]: "\<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union>x\<in>A. B x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union> (B ` A))
[PROOF STEP]
using open_Union [of "B ` A"]
[PROOF STATE]
proof (prove)
using this:
Ball (B ` A) open \<Longrightarrow> open (\<Union> (B ` A))

goal (1 subgoal):
 1. \<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union> (B ` A))
[PROOF STEP]
by simp


[STATEMENT]
lemma aligned_leaves_list_inbetween: "aligned l (Node ts t) u \<Longrightarrow> \<forall>x \<in> set (leaves_list ts). l < x \<and> x \<le> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aligned l (Node ts t) u \<Longrightarrow> \<forall>x\<in>set (leaves_list ts). l < x \<and> x \<le> u
[PROOF STEP]
by (metis Un_iff aligned_leaves_inbetween leaves.simps(2) set_append)


[STATEMENT]
lemma left_unique_rel_pred: "left_total A \<Longrightarrow> left_unique (rel_pred A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. left_total A \<Longrightarrow> left_unique (rel_pred A)
[PROOF STEP]
unfolding rel_pred_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. left_total A \<Longrightarrow> left_unique (A ===> (=))
[PROOF STEP]
by (erule left_unique_fun) (rule left_unique_eq)


[STATEMENT]
lemma map_in_list_rel_conv:
  shows "(l, map \<alpha> l) \<in> \<langle>br \<alpha> I\<rangle>list_rel \<longleftrightarrow> (\<forall>x\<in>set l. I x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((l, map \<alpha> l) \<in> \<langle>br \<alpha> I\<rangle>list_rel) = (\<forall>x\<in>set l. I x)
[PROOF STEP]
by (induction l) (auto simp: in_br_conv)


[STATEMENT]
lemma continuous_on_open_vimage:
  "open s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s \<Longrightarrow> continuous_on s f = (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))
[PROOF STEP]
unfolding continuous_on_open_invariant
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s \<Longrightarrow> (\<forall>B. open B \<longrightarrow> (\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> s)) = (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))
[PROOF STEP]
by (metis open_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s])


[STATEMENT]
lemma finite_fold_fold_keys:
  assumes "comp_fun_commute f"
  shows "Finite_Set.fold f A (Set t) = fold_keys f t A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.fold f A (Set t) = fold_keys f t A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
comp_fun_commute f

goal (1 subgoal):
 1. Finite_Set.fold f A (Set t) = fold_keys f t A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. comp_fun_commute f \<Longrightarrow> Finite_Set.fold f A (Set t) = fold_keys f t A
[PROOF STEP]
interpret comp_fun_commute f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute f
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. comp_fun_commute f \<Longrightarrow> Finite_Set.fold f A (Set t) = fold_keys f t A
[PROOF STEP]
have "set (RBT.keys t) = fst ` (set (RBT.entries t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (RBT.keys t) = fst ` set (RBT.entries t)
[PROOF STEP]
by (auto simp: fst_eq_Domain keys_entries)
[PROOF STATE]
proof (state)
this:
set (RBT.keys t) = fst ` set (RBT.entries t)

goal (1 subgoal):
 1. comp_fun_commute f \<Longrightarrow> Finite_Set.fold f A (Set t) = fold_keys f t A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (RBT.keys t) = fst ` set (RBT.entries t)

goal (1 subgoal):
 1. comp_fun_commute f \<Longrightarrow> Finite_Set.fold f A (Set t) = fold_keys f t A
[PROOF STEP]
have "inj_on fst (set (RBT.entries t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on fst (set (RBT.entries t))
[PROOF STEP]
using distinct_entries distinct_map
[PROOF STATE]
proof (prove)
using this:
distinct (map fst (RBT.entries ?t))
distinct (map ?f ?xs) = (distinct ?xs \<and> inj_on ?f (set ?xs))

goal (1 subgoal):
 1. inj_on fst (set (RBT.entries t))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on fst (set (RBT.entries t))

goal (1 subgoal):
 1. comp_fun_commute f \<Longrightarrow> Finite_Set.fold f A (Set t) = fold_keys f t A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (RBT.keys t) = fst ` set (RBT.entries t)
inj_on fst (set (RBT.entries t))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (RBT.keys t) = fst ` set (RBT.entries t)
inj_on fst (set (RBT.entries t))

goal (1 subgoal):
 1. Finite_Set.fold f A (Set t) = fold_keys f t A
[PROOF STEP]
by (auto simp add: set_keys fold_keys_def curry_def fold_image finite_fold_rbt_fold_eq
      comp_comp_fun_commute)
[PROOF STATE]
proof (state)
this:
Finite_Set.fold f A (Set t) = fold_keys f t A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_stream_filtration1: "enat i \<le> n \<Longrightarrow> (\<lambda>\<omega>. \<omega> !! i) \<in> stream_filtration M n \<rightarrow>\<^sub>M M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enat i \<le> n \<Longrightarrow> (\<lambda>\<omega>. \<omega> !! i) \<in> stream_filtration M n \<rightarrow>\<^sub>M M
[PROOF STEP]
by (auto intro!: measurable_SUP1 measurable_vimage_algebra1 snth_in simp: stream_filtration_def)


[STATEMENT]
lemma tendsto_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> ((\<lambda>x. f x) \<longlongrightarrow> l) net"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in net. f x = l \<Longrightarrow> (f \<longlongrightarrow> l) net
[PROOF STEP]
by (rule topological_tendstoI) (auto elim: eventually_mono)


[STATEMENT]
lemma bounded_clinear_scaleC_right: "bounded_clinear (\<lambda>x. scaleC c x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_clinear ((*\<^sub>C) c)
[PROOF STEP]
using bounded_cbilinear_scaleC
[PROOF STATE]
proof (prove)
using this:
bounded_cbilinear (*\<^sub>C)

goal (1 subgoal):
 1. bounded_clinear ((*\<^sub>C) c)
[PROOF STEP]
by (rule bounded_cbilinear.bounded_clinear_right)


[STATEMENT]
lemma visits_empty: "visits s e s' r [] = (s = s')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. visits s e s' r [] = (s = s')
[PROOF STEP]
apply standard
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. visits s e s' r [] \<Longrightarrow> s = s'
 2. s = s' \<Longrightarrow> visits s e s' r []
[PROOF STEP]
by (rule visits.cases, auto)


[STATEMENT]
lemma extension_onI:
  "(\<And>x y. \<lbrakk>x \<in> A; y \<in> A; (x, y) \<in> s\<rbrakk> \<Longrightarrow> (x, y) \<in> r) \<Longrightarrow> extension_on A r s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> A; y \<in> A; (x, y) \<in> s\<rbrakk> \<Longrightarrow> (x, y) \<in> r) \<Longrightarrow> extension_on A r s
[PROOF STEP]
by (auto simp: extension_on_def)


[STATEMENT]
lemma Subseqs_compower [simp]: "Subseqs (A ^^ n) = Subseqs A ^^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Subseqs (A ^^ n) = Subseqs A ^^ n
[PROOF STEP]
by (induction n) simp_all


[STATEMENT]
lemma vreal_multiplication_law_of_order:
  assumes "x \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>"
    and "y \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>"
    and "z \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>"
    and "x <\<^sub>\<real> y"
    and "0\<^sub>\<real> <\<^sub>\<real> z"
  shows "x *\<^sub>\<real> z <\<^sub>\<real> y *\<^sub>\<real> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x *\<^sub>\<real> z <\<^sub>\<real> y *\<^sub>\<real> z
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x *\<^sub>\<real> z <\<^sub>\<real> y *\<^sub>\<real> z
[PROOF STEP]
have "x' < y' \<Longrightarrow> 0 < z' \<Longrightarrow> x' * z' < y' * z'" for x' y' z' :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x' < y'; 0 < z'\<rbrakk> \<Longrightarrow> x' * z' < y' * z'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x' < ?y'; 0 < ?z'\<rbrakk> \<Longrightarrow> ?x' * ?z' < ?y' * ?z'

goal (1 subgoal):
 1. x *\<^sub>\<real> z <\<^sub>\<real> y *\<^sub>\<real> z
[PROOF STEP]
from this[untransferred, OF assms]
[PROOF STATE]
proof (chain)
picking this:
x *\<^sub>\<real> z <\<^sub>\<real> y *\<^sub>\<real> z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x *\<^sub>\<real> z <\<^sub>\<real> y *\<^sub>\<real> z

goal (1 subgoal):
 1. x *\<^sub>\<real> z <\<^sub>\<real> y *\<^sub>\<real> z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x *\<^sub>\<real> z <\<^sub>\<real> y *\<^sub>\<real> z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nlistsI: "\<lbrakk> size xs = n; set xs \<subseteq> A \<rbrakk> \<Longrightarrow> xs \<in> nlists n A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = n; set xs \<subseteq> A\<rbrakk> \<Longrightarrow> xs \<in> nlists n A
[PROOF STEP]
by (simp add: nlists_def)


[STATEMENT]
lemma isEmpty_lookup: "isEmpty t \<longleftrightarrow> lookup t = Map.empty"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isEmpty t = (lookup t = Map.empty)
[PROOF STEP]
by(simp add: isEmpty_def lookup_def is_empty_lookup_empty)


[STATEMENT]
lemma vangle_refl [simp]: "u \<noteq> 0 \<Longrightarrow> vangle u u = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<noteq> (0::'a) \<Longrightarrow> vangle u u = 0
[PROOF STEP]
by (simp add: vangle_def dot_square_norm power2_eq_square)


[STATEMENT]
lemma jumpF_polyL_coprime':
  assumes "poly p x\<noteq>0 \<or> poly q x\<noteq>0"
  shows "jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x=0 then
                if even (order x p) \<longleftrightarrow> sign_r_pos p x \<longleftrightarrow> poly q x>0 then 1/2 else - 1/2 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof (cases "p=0 \<or> q=0 \<or> poly p x\<noteq>0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0 \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
 2. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0 \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
 2. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
using jumpF_poly_noroot
[PROOF STATE]
proof (prove)
using this:
p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0
poly ?p ?a \<noteq> 0 \<Longrightarrow> jumpF_polyL ?q ?p ?a = 0
poly ?p ?a \<noteq> 0 \<Longrightarrow> jumpF_polyR ?q ?p ?a = 0

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0)

goal (1 subgoal):
 1. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0)
[PROOF STEP]
have asm:"p\<noteq>0" "q\<noteq>0" "poly p x=0"
[PROOF STATE]
proof (prove)
using this:
\<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0)

goal (1 subgoal):
 1. p \<noteq> 0 &&& q \<noteq> 0 &&& poly p x = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0
q \<noteq> 0
poly p x = 0

goal (1 subgoal):
 1. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
q \<noteq> 0
poly p x = 0
[PROOF STEP]
have "poly q x\<noteq>0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
q \<noteq> 0
poly p x = 0

goal (1 subgoal):
 1. poly q x \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
q \<noteq> 0
poly p x = 0
poly p x \<noteq> 0 \<or> poly q x \<noteq> 0

goal (1 subgoal):
 1. poly q x \<noteq> 0
[PROOF STEP]
using coprime_poly_0
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
q \<noteq> 0
poly p x = 0
poly p x \<noteq> 0 \<or> poly q x \<noteq> 0
coprime ?p ?q \<Longrightarrow> poly ?p ?x \<noteq> (0::?'a) \<or> poly ?q ?x \<noteq> (0::?'a)

goal (1 subgoal):
 1. poly q x \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
poly q x \<noteq> 0

goal (1 subgoal):
 1. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have ?thesis when "even (order x p) \<longleftrightarrow> sign_r_pos p x \<longleftrightarrow> poly q x>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
consider (lt) "poly q x>0" | (gt) " poly q x<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < poly q x \<Longrightarrow> thesis; poly q x < 0 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using \<open>poly q x\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
poly q x \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>0 < poly q x \<Longrightarrow> thesis; poly q x < 0 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < poly q x \<Longrightarrow> ?thesis; poly q x < 0 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < poly q x \<Longrightarrow> ?thesis; poly q x < 0 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
have "sgnx (poly p) (at_left x) = sgn (poly q x)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < poly q x \<Longrightarrow> ?thesis; poly q x < 0 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. sgnx (poly p) (at_left x) = sgn (poly q x)
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < poly q x \<Longrightarrow> sgnx (poly p) (at_left x) = sgn (poly q x)
 2. poly q x < 0 \<Longrightarrow> sgnx (poly p) (at_left x) = sgn (poly q x)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < poly q x \<Longrightarrow> sgnx (poly p) (at_left x) = sgn (poly q x)
[PROOF STEP]
using that sign_r_pos_sgnx_iff poly_sgnx_values[OF \<open>p\<noteq>0\<close>,of x]
[PROOF STATE]
proof (prove)
using this:
even (order x p) = (sign_r_pos p x = (0 < poly q x))
sign_r_pos ?p ?a = (0 < sgnx (poly ?p) (at_right ?a))
sgnx (poly p) (at_left x) = 1 \<or> sgnx (poly p) (at_left x) = - 1
sgnx (poly p) (at_right x) = 1 \<or> sgnx (poly p) (at_right x) = - 1

goal (1 subgoal):
 1. 0 < poly q x \<Longrightarrow> sgnx (poly p) (at_left x) = sgn (poly q x)
[PROOF STEP]
apply (subst poly_sgnx_left_right[OF \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < poly q x; even (order x p) = (sign_r_pos p x = (0 < poly q x)); \<And>p a. sign_r_pos p a = (0 < sgnx (poly p) (at_right a)); sgnx (poly p) (at_left x) = 1 \<or> sgnx (poly p) (at_left x) = - 1; sgnx (poly p) (at_right x) = 1 \<or> sgnx (poly p) (at_right x) = - 1\<rbrakk> \<Longrightarrow> (if even (order x p) then sgnx (poly p) (at_right x) else - sgnx (poly p) (at_right x)) = sgn (poly q x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q x < 0 \<Longrightarrow> sgnx (poly p) (at_left x) = sgn (poly q x)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q x < 0 \<Longrightarrow> sgnx (poly p) (at_left x) = sgn (poly q x)
[PROOF STEP]
using that sign_r_pos_sgnx_iff poly_sgnx_values[OF \<open>p\<noteq>0\<close>,of x]
[PROOF STATE]
proof (prove)
using this:
even (order x p) = (sign_r_pos p x = (0 < poly q x))
sign_r_pos ?p ?a = (0 < sgnx (poly ?p) (at_right ?a))
sgnx (poly p) (at_left x) = 1 \<or> sgnx (poly p) (at_left x) = - 1
sgnx (poly p) (at_right x) = 1 \<or> sgnx (poly p) (at_right x) = - 1

goal (1 subgoal):
 1. poly q x < 0 \<Longrightarrow> sgnx (poly p) (at_left x) = sgn (poly q x)
[PROOF STEP]
apply (subst poly_sgnx_left_right[OF \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>poly q x < 0; even (order x p) = (sign_r_pos p x = (0 < poly q x)); \<And>p a. sign_r_pos p a = (0 < sgnx (poly p) (at_right a)); sgnx (poly p) (at_left x) = 1 \<or> sgnx (poly p) (at_left x) = - 1; sgnx (poly p) (at_right x) = 1 \<or> sgnx (poly p) (at_right x) = - 1\<rbrakk> \<Longrightarrow> (if even (order x p) then sgnx (poly p) (at_right x) else - sgnx (poly p) (at_right x)) = sgn (poly q x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
sgnx (poly p) (at_left x) = sgn (poly q x)

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sgnx (poly p) (at_left x) = sgn (poly q x)
[PROOF STEP]
have "(poly p has_sgnx sgn (poly q x)) (at_left x)"
[PROOF STATE]
proof (prove)
using this:
sgnx (poly p) (at_left x) = sgn (poly q x)

goal (1 subgoal):
 1. (poly p has_sgnx sgn (poly q x)) (at_left x)
[PROOF STEP]
by (metis sgnx_able_poly(2) sgnx_able_sgnx)
[PROOF STATE]
proof (state)
this:
(poly p has_sgnx sgn (poly q x)) (at_left x)

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(poly p has_sgnx sgn (poly q x)) (at_left x)
[PROOF STEP]
have "LIM x at_left x. poly q x / poly p x :> at_top"
[PROOF STATE]
proof (prove)
using this:
(poly p has_sgnx sgn (poly q x)) (at_left x)

goal (1 subgoal):
 1. LIM x at_left x. poly q x / poly p x :> at_top
[PROOF STEP]
apply (subst filterlim_divide_at_bot_at_top_iff[of _ "poly q x"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (poly p has_sgnx sgn (poly q x)) (at_left x) \<Longrightarrow> (poly q \<longlongrightarrow> poly q x) (at_left x)
 2. (poly p has_sgnx sgn (poly q x)) (at_left x) \<Longrightarrow> poly q x \<noteq> 0
 3. (poly p has_sgnx sgn (poly q x)) (at_left x) \<Longrightarrow> (poly p \<longlongrightarrow> 0) (at_left x) \<and> (poly p has_sgnx sgn (poly q x)) (at_left x)
[PROOF STEP]
apply (auto simp add:\<open>poly q x\<noteq>0\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p has_sgnx sgn (poly q x)) (at_left x) \<Longrightarrow> (poly p \<longlongrightarrow> 0) (at_left x)
[PROOF STEP]
by (metis asm(3) poly_tendsto(2))
[PROOF STATE]
proof (state)
this:
LIM x at_left x. poly q x / poly p x :> at_top

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x at_left x. poly q x / poly p x :> at_top
[PROOF STEP]
have "jumpF_polyL q p x = 1/2"
[PROOF STATE]
proof (prove)
using this:
LIM x at_left x. poly q x / poly p x :> at_top

goal (1 subgoal):
 1. jumpF_polyL q p x = 1 / 2
[PROOF STEP]
unfolding jumpF_polyL_def jumpF_def
[PROOF STATE]
proof (prove)
using this:
LIM x at_left x. poly q x / poly p x :> at_top

goal (1 subgoal):
 1. (if LIM x at_left x. poly q x / poly p x :> at_top then 1 / 2 else if LIM x at_left x. poly q x / poly p x :> at_bot then - 1 / 2 else 0) = 1 / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_polyL q p x = 1 / 2

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
jumpF_polyL q p x = 1 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jumpF_polyL q p x = 1 / 2

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
using that False
[PROOF STATE]
proof (prove)
using this:
jumpF_polyL q p x = 1 / 2
even (order x p) = (sign_r_pos p x = (0 < poly q x))
\<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0)

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
even (order x p) = (sign_r_pos p x = (0 < poly q x)) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
even (order x p) = (sign_r_pos p x = (0 < poly q x)) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
have ?thesis when "\<not> (even (order x p) \<longleftrightarrow> sign_r_pos p x \<longleftrightarrow> poly q x>0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
consider (lt) "poly q x>0" | (gt) " poly q x<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < poly q x \<Longrightarrow> thesis; poly q x < 0 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using \<open>poly q x\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
poly q x \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>0 < poly q x \<Longrightarrow> thesis; poly q x < 0 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < poly q x \<Longrightarrow> ?thesis; poly q x < 0 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < poly q x \<Longrightarrow> ?thesis; poly q x < 0 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
have "sgnx (poly p) (at_left x) = - sgn (poly q x)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < poly q x \<Longrightarrow> ?thesis; poly q x < 0 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. sgnx (poly p) (at_left x) = - sgn (poly q x)
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < poly q x \<Longrightarrow> sgnx (poly p) (at_left x) = - sgn (poly q x)
 2. poly q x < 0 \<Longrightarrow> sgnx (poly p) (at_left x) = - sgn (poly q x)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < poly q x \<Longrightarrow> sgnx (poly p) (at_left x) = - sgn (poly q x)
[PROOF STEP]
using that sign_r_pos_sgnx_iff poly_sgnx_values[OF \<open>p\<noteq>0\<close>,of x]
[PROOF STATE]
proof (prove)
using this:
even (order x p) \<noteq> (sign_r_pos p x = (0 < poly q x))
sign_r_pos ?p ?a = (0 < sgnx (poly ?p) (at_right ?a))
sgnx (poly p) (at_left x) = 1 \<or> sgnx (poly p) (at_left x) = - 1
sgnx (poly p) (at_right x) = 1 \<or> sgnx (poly p) (at_right x) = - 1

goal (1 subgoal):
 1. 0 < poly q x \<Longrightarrow> sgnx (poly p) (at_left x) = - sgn (poly q x)
[PROOF STEP]
apply (subst poly_sgnx_left_right[OF \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < poly q x; even (order x p) \<noteq> (sign_r_pos p x = (0 < poly q x)); \<And>p a. sign_r_pos p a = (0 < sgnx (poly p) (at_right a)); sgnx (poly p) (at_left x) = 1 \<or> sgnx (poly p) (at_left x) = - 1; sgnx (poly p) (at_right x) = 1 \<or> sgnx (poly p) (at_right x) = - 1\<rbrakk> \<Longrightarrow> (if even (order x p) then sgnx (poly p) (at_right x) else - sgnx (poly p) (at_right x)) = - sgn (poly q x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q x < 0 \<Longrightarrow> sgnx (poly p) (at_left x) = - sgn (poly q x)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q x < 0 \<Longrightarrow> sgnx (poly p) (at_left x) = - sgn (poly q x)
[PROOF STEP]
using that sign_r_pos_sgnx_iff poly_sgnx_values[OF \<open>p\<noteq>0\<close>,of x]
[PROOF STATE]
proof (prove)
using this:
even (order x p) \<noteq> (sign_r_pos p x = (0 < poly q x))
sign_r_pos ?p ?a = (0 < sgnx (poly ?p) (at_right ?a))
sgnx (poly p) (at_left x) = 1 \<or> sgnx (poly p) (at_left x) = - 1
sgnx (poly p) (at_right x) = 1 \<or> sgnx (poly p) (at_right x) = - 1

goal (1 subgoal):
 1. poly q x < 0 \<Longrightarrow> sgnx (poly p) (at_left x) = - sgn (poly q x)
[PROOF STEP]
apply (subst poly_sgnx_left_right[OF \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>poly q x < 0; even (order x p) \<noteq> (sign_r_pos p x = (0 < poly q x)); \<And>p a. sign_r_pos p a = (0 < sgnx (poly p) (at_right a)); sgnx (poly p) (at_left x) = 1 \<or> sgnx (poly p) (at_left x) = - 1; sgnx (poly p) (at_right x) = 1 \<or> sgnx (poly p) (at_right x) = - 1\<rbrakk> \<Longrightarrow> (if even (order x p) then sgnx (poly p) (at_right x) else - sgnx (poly p) (at_right x)) = - sgn (poly q x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
sgnx (poly p) (at_left x) = - sgn (poly q x)

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sgnx (poly p) (at_left x) = - sgn (poly q x)
[PROOF STEP]
have "(poly p has_sgnx - sgn (poly q x)) (at_left x)"
[PROOF STATE]
proof (prove)
using this:
sgnx (poly p) (at_left x) = - sgn (poly q x)

goal (1 subgoal):
 1. (poly p has_sgnx - sgn (poly q x)) (at_left x)
[PROOF STEP]
by (metis sgnx_able_poly(2) sgnx_able_sgnx)
[PROOF STATE]
proof (state)
this:
(poly p has_sgnx - sgn (poly q x)) (at_left x)

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(poly p has_sgnx - sgn (poly q x)) (at_left x)
[PROOF STEP]
have "LIM x at_left x. poly q x / poly p x :> at_bot"
[PROOF STATE]
proof (prove)
using this:
(poly p has_sgnx - sgn (poly q x)) (at_left x)

goal (1 subgoal):
 1. LIM x at_left x. poly q x / poly p x :> at_bot
[PROOF STEP]
apply (subst filterlim_divide_at_bot_at_top_iff[of _ "poly q x"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (poly p has_sgnx - sgn (poly q x)) (at_left x) \<Longrightarrow> (poly q \<longlongrightarrow> poly q x) (at_left x)
 2. (poly p has_sgnx - sgn (poly q x)) (at_left x) \<Longrightarrow> poly q x \<noteq> 0
 3. (poly p has_sgnx - sgn (poly q x)) (at_left x) \<Longrightarrow> (poly p \<longlongrightarrow> 0) (at_left x) \<and> (poly p has_sgnx - sgn (poly q x)) (at_left x)
[PROOF STEP]
apply (auto simp add:\<open>poly q x\<noteq>0\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p has_sgnx - sgn (poly q x)) (at_left x) \<Longrightarrow> (poly p \<longlongrightarrow> 0) (at_left x)
[PROOF STEP]
by (metis asm(3) poly_tendsto(2))
[PROOF STATE]
proof (state)
this:
LIM x at_left x. poly q x / poly p x :> at_bot

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x at_left x. poly q x / poly p x :> at_bot
[PROOF STEP]
have "jumpF_polyL q p x = - 1/2"
[PROOF STATE]
proof (prove)
using this:
LIM x at_left x. poly q x / poly p x :> at_bot

goal (1 subgoal):
 1. jumpF_polyL q p x = - 1 / 2
[PROOF STEP]
unfolding jumpF_polyL_def jumpF_def
[PROOF STATE]
proof (prove)
using this:
LIM x at_left x. poly q x / poly p x :> at_bot

goal (1 subgoal):
 1. (if LIM x at_left x. poly q x / poly p x :> at_top then 1 / 2 else if LIM x at_left x. poly q x / poly p x :> at_bot then - 1 / 2 else 0) = - 1 / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_polyL q p x = - 1 / 2

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
jumpF_polyL q p x = - 1 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jumpF_polyL q p x = - 1 / 2

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
using that False
[PROOF STATE]
proof (prove)
using this:
jumpF_polyL q p x = - 1 / 2
even (order x p) \<noteq> (sign_r_pos p x = (0 < poly q x))
\<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0)

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
even (order x p) \<noteq> (sign_r_pos p x = (0 < poly q x)) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. \<not> (p = 0 \<or> q = 0 \<or> poly p x \<noteq> 0) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
even (order x p) = (sign_r_pos p x = (0 < poly q x)) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
even (order x p) \<noteq> (sign_r_pos p x = (0 < poly q x)) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
even (order x p) = (sign_r_pos p x = (0 < poly q x)) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
even (order x p) \<noteq> (sign_r_pos p x = (0 < poly q x)) \<Longrightarrow> jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)

goal (1 subgoal):
 1. jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jumpF_polyL q p x = (if p \<noteq> 0 \<and> q \<noteq> 0 \<and> poly p x = 0 then if even (order x p) = (sign_r_pos p x = (0 < poly q x)) then 1 / 2 else - 1 / 2 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "nths' n m xs = nths xs {n..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths' n m xs = nths xs {n..<m}
[PROOF STEP]
apply (induct xs arbitrary: n m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n m. nths' n m [] = nths [] {n..<m}
 2. \<And>a xs n m. (\<And>n m. nths' n m xs = nths xs {n..<m}) \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs n m. (\<And>n m. nths' n m xs = nths xs {n..<m}) \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
[PROOF STEP]
apply (case_tac n, case_tac m)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a xs n m. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = 0; m = 0\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
 2. \<And>a xs n m nat. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = 0; m = Suc nat\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
 3. \<And>a xs n m nat. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = Suc nat\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n m nat. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = 0; m = Suc nat\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
 2. \<And>a xs n m nat. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = Suc nat\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n m nat. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = 0; m = Suc nat\<rbrakk> \<Longrightarrow> a # nths xs {0..<nat} = nths (a # xs) {0..<Suc nat}
 2. \<And>a xs n m nat. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = Suc nat\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
[PROOF STEP]
apply (simp add: nths_take')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs n m nat. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = Suc nat\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
[PROOF STEP]
apply (case_tac m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n m nat. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = Suc nat; m = 0\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
 2. \<And>a xs n m nat nata. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = Suc nat; m = Suc nata\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs n m nat nata. \<lbrakk>\<And>n m. nths' n m xs = nths xs {n..<m}; n = Suc nat; m = Suc nata\<rbrakk> \<Longrightarrow> nths' n m (a # xs) = nths (a # xs) {n..<m}
[PROOF STEP]
apply (simp add: nths_Cons nths'_nths)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma div_diff1_eq_if: "
  (b - a) div (m::nat) =
  b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
apply (case_tac "m = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
apply (case_tac "b < a")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>m \<noteq> 0; b < a\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<lbrakk>m \<noteq> 0; \<not> b < a\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
apply (frule less_imp_le[of b])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>m \<noteq> 0; b < a; b \<le> a\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<lbrakk>m \<noteq> 0; \<not> b < a\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
apply (frule div_le_mono[of _ _ m])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>m \<noteq> 0; b < a; b \<le> a; b div m \<le> a div m\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<lbrakk>m \<noteq> 0; \<not> b < a\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<noteq> 0; \<not> b < a\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
apply (simp only: linorder_not_less neq0_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
assume le_as: "a \<le> b"
    and m_as: "0 < m"
[PROOF STATE]
proof (state)
this:
a \<le> b
0 < m

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have div_le:"a div m \<le> b div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a div m \<le> b div m
[PROOF STEP]
using le_as
[PROOF STATE]
proof (prove)
using this:
a \<le> b

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

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "b - a = b div m * m + b mod m - (a div m * m + a mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b - a = b div m * m + b mod m - (a div m * m + a mod m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b - a = b div m * m + b mod m - (a div m * m + a mod m)

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b - a = b div m * m + b mod m - (a div m * m + a mod m)

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = b div m * m + b mod m - a div m * m - a mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m * m + b mod m - (a div m * m + a mod m) = b div m * m + b mod m - a div m * m - a mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - (a div m * m + a mod m) = b div m * m + b mod m - a div m * m - a mod m

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - (a div m * m + a mod m) = b div m * m + b mod m - a div m * m - a mod m

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = b div m * m - a div m * m + b mod m - a mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m * m + b mod m - a div m * m - a mod m = b div m * m - a div m * m + b mod m - a mod m
[PROOF STEP]
by (simp only: diff_add_assoc2[OF mult_le_mono1[OF div_le]])
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - a div m * m - a mod m = b div m * m - a div m * m + b mod m - a mod m

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
b - a = b div m * m - a div m * m + b mod m - a mod m
[PROOF STEP]
have b_a_s1: "b - a = (b div m - a div m) * m + b mod m - a mod m"
    (is "?b_a = ?b_a1")
[PROOF STATE]
proof (prove)
using this:
b - a = b div m * m - a div m * m + b mod m - a mod m

goal (1 subgoal):
 1. b - a = (b div m - a div m) * m + b mod m - a mod m
[PROOF STEP]
by (simp only: diff_mult_distrib)
[PROOF STATE]
proof (state)
this:
b - a = (b div m - a div m) * m + b mod m - a mod m

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
hence b_a_div_s: "(b - a) div m =
    ((b div m - a div m) * m + b mod m - a mod m) div m"
[PROOF STATE]
proof (prove)
using this:
b - a = (b div m - a div m) * m + b mod m - a mod m

goal (1 subgoal):
 1. (b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m
[PROOF STEP]
by (rule arg_cong)
[PROOF STATE]
proof (state)
this:
(b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<lbrakk>0 < m; a \<le> b\<rbrakk> \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
proof (cases "a mod m \<le> b mod m")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a mod m \<le> b mod m

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
hence as': "a mod m \<le> b mod m"
[PROOF STATE]
proof (prove)
using this:
a mod m \<le> b mod m

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

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "(b - a) div m = ?b_a1 div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m
[PROOF STEP]
using b_a_div_s
[PROOF STATE]
proof (prove)
using this:
(b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. (b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = ((b div m - a div m) * m + (b mod m - a mod m)) div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((b div m - a div m) * m + b mod m - a mod m) div m = ((b div m - a div m) * m + (b mod m - a mod m)) div m
[PROOF STEP]
using as'
[PROOF STATE]
proof (prove)
using this:
a mod m \<le> b mod m

goal (1 subgoal):
 1. ((b div m - a div m) * m + b mod m - a mod m) div m = ((b div m - a div m) * m + (b mod m - a mod m)) div m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((b div m - a div m) * m + b mod m - a mod m) div m = ((b div m - a div m) * m + (b mod m - a mod m)) div m

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((b div m - a div m) * m + b mod m - a mod m) div m = ((b div m - a div m) * m + (b mod m - a mod m)) div m

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = b div m - a div m + (b mod m - a mod m) div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((b div m - a div m) * m + (b mod m - a mod m)) div m = b div m - a div m + (b mod m - a mod m) div m
[PROOF STEP]
apply (simp only: add.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b mod m - a mod m + (b div m - a div m) * m) div m = b div m - a div m + (b mod m - a mod m) div m
[PROOF STEP]
by (simp only: div_mult_self1[OF less_imp_neq[OF m_as, THEN not_sym]])
[PROOF STATE]
proof (state)
this:
((b div m - a div m) * m + (b mod m - a mod m)) div m = b div m - a div m + (b mod m - a mod m) div m

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(b - a) div m = b div m - a div m + (b mod m - a mod m) div m
[PROOF STEP]
have b_a_div_s': "(b - a) div m = \<dots>"
[PROOF STATE]
proof (prove)
using this:
(b - a) div m = b div m - a div m + (b mod m - a mod m) div m

goal (1 subgoal):
 1. (b - a) div m = b div m - a div m + (b mod m - a mod m) div m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(b - a) div m = b div m - a div m + (b mod m - a mod m) div m

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "(b mod m - a mod m) div m = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b mod m - a mod m) div m = 0
[PROOF STEP]
by (rule div_less, rule less_imp_diff_less,
          rule mod_less_divisor, rule m_as)
[PROOF STATE]
proof (state)
this:
(b mod m - a mod m) div m = 0

goal (2 subgoals):
 1. a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
 2. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(b mod m - a mod m) div m = 0

goal (1 subgoal):
 1. (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
using b_a_div_s' as'
[PROOF STATE]
proof (prove)
using this:
(b mod m - a mod m) div m = 0
(b - a) div m = b div m - a div m + (b mod m - a mod m) div m
a mod m \<le> b mod m

goal (1 subgoal):
 1. (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> a mod m \<le> b mod m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
hence as1': "\<not> a mod m \<le> b mod m"
[PROOF STATE]
proof (prove)
using this:
\<not> a mod m \<le> b mod m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<not> a mod m \<le> b mod m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
hence as': "b mod m < a mod m"
[PROOF STATE]
proof (prove)
using this:
\<not> a mod m \<le> b mod m

goal (1 subgoal):
 1. b mod m < a mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b mod m < a mod m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have a_div_less: "a div m < b div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a div m < b div m
[PROOF STEP]
using le_as as'
[PROOF STATE]
proof (prove)
using this:
a \<le> b
b mod m < a mod m

goal (1 subgoal):
 1. a div m < b div m
[PROOF STEP]
by (blast intro: le_mod_greater_imp_div_less)
[PROOF STATE]
proof (state)
this:
a div m < b div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "b div m - a div m = b div m - a div m - (Suc 0 - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m - a div m = b div m - a div m - (Suc 0 - Suc 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b div m - a div m = b div m - a div m - (Suc 0 - Suc 0)

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b div m - a div m = b div m - a div m - (Suc 0 - Suc 0)

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = b div m - a div m + Suc 0 - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m - a div m - (Suc 0 - Suc 0) = b div m - a div m + Suc 0 - Suc 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b div m - a div m - (Suc 0 - Suc 0) = b div m - a div m + Suc 0 - Suc 0

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b div m - a div m - (Suc 0 - Suc 0) = b div m - a div m + Suc 0 - Suc 0

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = b div m - a div m - Suc 0 + Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m - a div m + Suc 0 - Suc 0 = b div m - a div m - Suc 0 + Suc 0
[PROOF STEP]
by (simp only: diff_add_assoc2
        a_div_less[THEN zero_less_diff[THEN iffD2], THEN Suc_le_eq[THEN iffD2]])
[PROOF STATE]
proof (state)
this:
b div m - a div m + Suc 0 - Suc 0 = b div m - a div m - Suc 0 + Suc 0

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
b div m - a div m = b div m - a div m - Suc 0 + Suc 0
[PROOF STEP]
have b_a_div_s': "b div m - a div m = \<dots>"
[PROOF STATE]
proof (prove)
using this:
b div m - a div m = b div m - a div m - Suc 0 + Suc 0

goal (1 subgoal):
 1. b div m - a div m = b div m - a div m - Suc 0 + Suc 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
b div m - a div m = b div m - a div m - Suc 0 + Suc 0

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "(b - a) div m = ?b_a1 div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m
[PROOF STEP]
using b_a_div_s
[PROOF STATE]
proof (prove)
using this:
(b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. (b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a) div m = ((b div m - a div m) * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = ((b div m - a div m - Suc 0 + Suc 0) * m
      + b mod m - a mod m ) div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((b div m - a div m) * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0 + Suc 0) * m + b mod m - a mod m) div m
[PROOF STEP]
using b_a_div_s'
[PROOF STATE]
proof (prove)
using this:
b div m - a div m = b div m - a div m - Suc 0 + Suc 0

goal (1 subgoal):
 1. ((b div m - a div m) * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0 + Suc 0) * m + b mod m - a mod m) div m
[PROOF STEP]
by (rule arg_cong)
[PROOF STATE]
proof (state)
this:
((b div m - a div m) * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0 + Suc 0) * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((b div m - a div m) * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0 + Suc 0) * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = ((b div m - a div m - Suc 0) * m
      + Suc 0 * m + b mod m - a mod m ) div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((b div m - a div m - Suc 0 + Suc 0) * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + Suc 0 * m + b mod m - a mod m) div m
[PROOF STEP]
by (simp only: add_mult_distrib)
[PROOF STATE]
proof (state)
this:
((b div m - a div m - Suc 0 + Suc 0) * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + Suc 0 * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((b div m - a div m - Suc 0 + Suc 0) * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + Suc 0 * m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = ((b div m - a div m - Suc 0) * m
      + m + b mod m - a mod m ) div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((b div m - a div m - Suc 0) * m + Suc 0 * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + m + b mod m - a mod m) div m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((b div m - a div m - Suc 0) * m + Suc 0 * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((b div m - a div m - Suc 0) * m + Suc 0 * m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = ((b div m - a div m - Suc 0) * m
      + (m + b mod m - a mod m) ) div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((b div m - a div m - Suc 0) * m + m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + (m + b mod m - a mod m)) div m
[PROOF STEP]
by (simp only: add.assoc m_as
        diff_add_assoc[of "a mod m" "m + b mod m"]
        trans_le_add1[of "a mod m" m, OF mod_le_divisor])
[PROOF STATE]
proof (state)
this:
((b div m - a div m - Suc 0) * m + m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + (m + b mod m - a mod m)) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((b div m - a div m - Suc 0) * m + m + b mod m - a mod m) div m = ((b div m - a div m - Suc 0) * m + (m + b mod m - a mod m)) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have "\<dots> = b div m - a div m - Suc 0
      + (m + b mod m - a mod m) div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((b div m - a div m - Suc 0) * m + (m + b mod m - a mod m)) div m = b div m - a div m - Suc 0 + (m + b mod m - a mod m) div m
[PROOF STEP]
by (simp only: add.commute div_mult_self1[OF less_imp_neq[OF m_as, THEN not_sym]])
[PROOF STATE]
proof (state)
this:
((b div m - a div m - Suc 0) * m + (m + b mod m - a mod m)) div m = b div m - a div m - Suc 0 + (m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(b - a) div m = b div m - a div m - Suc 0 + (m + b mod m - a mod m) div m
[PROOF STEP]
have b_a_div_s': "(b - a) div m = \<dots>"
[PROOF STATE]
proof (prove)
using this:
(b - a) div m = b div m - a div m - Suc 0 + (m + b mod m - a mod m) div m

goal (1 subgoal):
 1. (b - a) div m = b div m - a div m - Suc 0 + (m + b mod m - a mod m) div m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(b - a) div m = b div m - a div m - Suc 0 + (m + b mod m - a mod m) div m

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
have div_0_s: "(m + b mod m - a mod m) div m = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m + b mod m - a mod m) div m = 0
[PROOF STEP]
by (rule div_less, simp only: add_diff_less m_as as')
[PROOF STATE]
proof (state)
this:
(m + b mod m - a mod m) div m = 0

goal (1 subgoal):
 1. \<not> a mod m \<le> b mod m \<Longrightarrow> (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)
[PROOF STEP]
by (simp add: as1' b_a_div_s' div_0_s)
[PROOF STATE]
proof (state)
this:
(b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(b - a) div m = b div m - a div m - (if a mod m \<le> b mod m then 0 else Suc 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_char: "norm (\<chi> a) = (if a \<in> carrier G then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
proof (cases "a \<in> carrier G")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<in> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
 2. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a \<in> carrier G

goal (2 subgoals):
 1. a \<in> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
 2. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
have "norm (\<chi> a) ^ order G = norm (\<chi> a ^ order G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<chi> a) ^ order G = cmod (\<chi> a ^ order G)
[PROOF STEP]
by (simp add: norm_power)
[PROOF STATE]
proof (state)
this:
cmod (\<chi> a) ^ order G = cmod (\<chi> a ^ order G)

goal (2 subgoals):
 1. a \<in> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
 2. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (\<chi> a) ^ order G = cmod (\<chi> a ^ order G)

goal (2 subgoals):
 1. a \<in> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
 2. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
a \<in> carrier G
[PROOF STEP]
have "\<chi> a ^ order G = 1"
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G

goal (1 subgoal):
 1. \<chi> a ^ order G = 1
[PROOF STEP]
by (rule char_root')
[PROOF STATE]
proof (state)
this:
\<chi> a ^ order G = 1

goal (2 subgoals):
 1. a \<in> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
 2. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (\<chi> a) ^ order G = cmod 1
[PROOF STEP]
have "norm (\<chi> a) ^ order G = 1 ^ order G"
[PROOF STATE]
proof (prove)
using this:
cmod (\<chi> a) ^ order G = cmod 1

goal (1 subgoal):
 1. cmod (\<chi> a) ^ order G = 1 ^ order G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (\<chi> a) ^ order G = 1 ^ order G

goal (2 subgoals):
 1. a \<in> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
 2. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
hence "norm (\<chi> a) = 1"
[PROOF STATE]
proof (prove)
using this:
cmod (\<chi> a) ^ order G = 1 ^ order G

goal (1 subgoal):
 1. cmod (\<chi> a) = 1
[PROOF STEP]
by (subst (asm) power_eq_iff_eq_base) auto
[PROOF STATE]
proof (state)
this:
cmod (\<chi> a) = 1

goal (2 subgoals):
 1. a \<in> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
 2. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
a \<in> carrier G
cmod (\<chi> a) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
cmod (\<chi> a) = 1

goal (1 subgoal):
 1. cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)

goal (1 subgoal):
 1. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<notin> carrier G

goal (1 subgoal):
 1. a \<notin> carrier G \<Longrightarrow> cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<notin> carrier G

goal (1 subgoal):
 1. cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)
[PROOF STEP]
by (auto simp: char_eq_0)
[PROOF STATE]
proof (state)
this:
cmod (\<chi> a) = (if a \<in> carrier G then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_UN [continuous_intros, intro]: "\<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union>x\<in>A. B x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union> (B ` A))
[PROOF STEP]
using open_Union [of "B ` A"]
[PROOF STATE]
proof (prove)
using this:
Ball (B ` A) open \<Longrightarrow> open (\<Union> (B ` A))

goal (1 subgoal):
 1. \<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union> (B ` A))
[PROOF STEP]
by simp