[STATEMENT]
lemma HFinite_cos [simp]: "sumhr (0, whn, \<lambda>n. cos_coeff n * x ^ n) \<in> HFinite"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumhr (0, whn, \<lambda>n. cos_coeff n * x ^ n) \<in> HFinite
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sumhr (0, whn, \<lambda>n. cos_coeff n * x ^ n) \<in> HFinite
[PROOF STEP]
have "summable (\<lambda>i. cos_coeff i * x ^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>i. cos_coeff i * x ^ i)
[PROOF STEP]
using summable_norm_cos [of x]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. norm (cos_coeff n *\<^sub>R x ^ n))

goal (1 subgoal):
 1. summable (\<lambda>i. cos_coeff i * x ^ i)
[PROOF STEP]
by (simp add: summable_rabs_cancel)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>i. cos_coeff i * x ^ i)

goal (1 subgoal):
 1. sumhr (0, whn, \<lambda>n. cos_coeff n * x ^ n) \<in> HFinite
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>i. cos_coeff i * x ^ i)
[PROOF STEP]
have "(*f* (\<lambda>n. \<Sum>n<n. cos_coeff n * x ^ n)) whn \<in> HFinite"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>i. cos_coeff i * x ^ i)

goal (1 subgoal):
 1. (*f* (\<lambda>n. \<Sum>n<n. cos_coeff n * x ^ n)) whn \<in> HFinite
[PROOF STEP]
unfolding summable_sums_iff sums_NSsums_iff NSsums_def NSLIMSEQ_def
[PROOF STATE]
proof (prove)
using this:
\<forall>N\<in>HNatInfinite. (*f* (\<lambda>n. \<Sum>i<n. cos_coeff i * x ^ i)) N \<approx> hypreal_of_real (\<Sum>i. cos_coeff i * x ^ i)

goal (1 subgoal):
 1. (*f* (\<lambda>n. \<Sum>n<n. cos_coeff n * x ^ n)) whn \<in> HFinite
[PROOF STEP]
using HFinite_star_of HNatInfinite_whn approx_HFinite approx_sym
[PROOF STATE]
proof (prove)
using this:
\<forall>N\<in>HNatInfinite. (*f* (\<lambda>n. \<Sum>i<n. cos_coeff i * x ^ i)) N \<approx> hypreal_of_real (\<Sum>i. cos_coeff i * x ^ i)
star_of ?x \<in> HFinite
whn \<in> HNatInfinite
\<lbrakk>?x \<in> HFinite; ?x \<approx> ?y\<rbrakk> \<Longrightarrow> ?y \<in> HFinite
?x \<approx> ?y \<Longrightarrow> ?y \<approx> ?x

goal (1 subgoal):
 1. (*f* (\<lambda>n. \<Sum>n<n. cos_coeff n * x ^ n)) whn \<in> HFinite
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(*f* (\<lambda>n. \<Sum>n<n. cos_coeff n * x ^ n)) whn \<in> HFinite

goal (1 subgoal):
 1. sumhr (0, whn, \<lambda>n. cos_coeff n * x ^ n) \<in> HFinite
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(*f* (\<lambda>n. \<Sum>n<n. cos_coeff n * x ^ n)) whn \<in> HFinite
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(*f* (\<lambda>n. \<Sum>n<n. cos_coeff n * x ^ n)) whn \<in> HFinite

goal (1 subgoal):
 1. sumhr (0, whn, \<lambda>n. cos_coeff n * x ^ n) \<in> HFinite
[PROOF STEP]
unfolding sumhr_app
[PROOF STATE]
proof (prove)
using this:
(*f* (\<lambda>n. \<Sum>n<n. cos_coeff n * x ^ n)) whn \<in> HFinite

goal (1 subgoal):
 1. (*f2* (\<lambda>m n. \<Sum>n = m..<n. cos_coeff n * x ^ n)) 0 whn \<in> HFinite
[PROOF STEP]
by (simp only: star_zero_def starfun2_star_of atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
sumhr (0, whn, \<lambda>n. cos_coeff n * x ^ n) \<in> HFinite

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infdist_mono [mono_intros]:
  assumes "A \<subseteq> B" "A \<noteq> {}"
  shows "infdist x B \<le> infdist x A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infdist x B \<le> infdist x A
[PROOF STEP]
by (simp add: assms infdist_eq_setdist setdist_subset_right)


[STATEMENT]
lemma ikkbz_min_ikkbz_sub: "r \<in> verts G \<Longrightarrow> cost_l ikkbz \<le> cost_l (ikkbz_sub r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in> verts G \<Longrightarrow> cost_l ikkbz \<le> cost_l (ikkbz_sub r)
[PROOF STEP]
unfolding ikkbz_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in> verts G \<Longrightarrow> cost_l (arg_min_on cost_l {ikkbz_sub r |r. r \<in> verts G}) \<le> cost_l (ikkbz_sub r)
[PROOF STEP]
using ikkbz_sub_set_fin arg_min_least
[PROOF STATE]
proof (prove)
using this:
finite {ikkbz_sub r |r. r \<in> verts G}
\<lbrakk>finite ?S; ?S \<noteq> {}; ?y \<in> ?S\<rbrakk> \<Longrightarrow> ?f (arg_min_on ?f ?S) \<le> ?f ?y

goal (1 subgoal):
 1. r \<in> verts G \<Longrightarrow> cost_l (arg_min_on cost_l {ikkbz_sub r |r. r \<in> verts G}) \<le> cost_l (ikkbz_sub r)
[PROOF STEP]
by fast


[STATEMENT]
lemma rbt_lookup_delete:
  assumes "inv_12 t" "rbt_sorted t"
  shows "rbt_lookup (rbt_delete x t) k = (if x = k then None else rbt_lookup t k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rbt_lookup (rbt_delete x t) k = (if x = k then None else rbt_lookup t k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rbt_lookup (rbt_delete x t) k = (if x = k then None else rbt_lookup t k)
[PROOF STEP]
note rbt_sorted_del = rbt_del_rbt_sorted[OF assms(2), of x]
[PROOF STATE]
proof (state)
this:
rbt_sorted (rbt_del x t)

goal (1 subgoal):
 1. rbt_lookup (rbt_delete x t) k = (if x = k then None else rbt_lookup t k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rbt_lookup (rbt_delete x t) k = (if x = k then None else rbt_lookup t k)
[PROOF STEP]
using assms rbt_sorted_del rbt_del_in_tree rbt_lookup_from_in_tree[OF assms(2) rbt_sorted_del]
[PROOF STATE]
proof (prove)
using this:
inv_12 t
rbt_sorted t
rbt_sorted (rbt_del x t)
\<lbrakk>rbt_sorted ?t; inv1 ?t; inv2 ?t\<rbrakk> \<Longrightarrow> ((?k, ?v) \<in> set (entries (rbt_del ?x ?t))) = (False \<or> ?x \<noteq> ?k \<and> (?k, ?v) \<in> set (entries ?t))
(\<And>v. ((?k, v) \<in> set (entries t)) = ((?k, v) \<in> set (entries (rbt_del x t)))) \<Longrightarrow> rbt_lookup t ?k = rbt_lookup (rbt_del x t) ?k

goal (1 subgoal):
 1. rbt_lookup (rbt_delete x t) k = (if x = k then None else rbt_lookup t k)
[PROOF STEP]
by (fastforce simp: inv_12_def rbt_delete_def rbt_lookup_iff_keys(2) keys_entries)
[PROOF STATE]
proof (state)
this:
rbt_lookup (rbt_delete x t) k = (if x = k then None else rbt_lookup t k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_is_poincare_line_points':
  assumes i12: "i1 \<in> circline_set H \<inter> unit_circle_set"
               "i2 \<in> circline_set H \<inter> unit_circle_set"
               "i1 \<noteq> i2"
  assumes a: "a \<in> circline_set H" "a \<notin> unit_circle_set"
  shows "\<exists> b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
have "inversion a \<notin> unit_circle_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversion a \<notin> unit_circle_set
[PROOF STEP]
using \<open>a \<notin> unit_circle_set\<close>
[PROOF STATE]
proof (prove)
using this:
a \<notin> unit_circle_set

goal (1 subgoal):
 1. inversion a \<notin> unit_circle_set
[PROOF STEP]
unfolding unit_circle_set_def circline_set_def
[PROOF STATE]
proof (prove)
using this:
a \<notin> Collect (on_circline unit_circle)

goal (1 subgoal):
 1. inversion a \<notin> Collect (on_circline unit_circle)
[PROOF STEP]
by (metis inversion_id_iff_on_unit_circle inversion_involution mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
inversion a \<notin> unit_circle_set

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
have "a \<noteq> inversion a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> inversion a
[PROOF STEP]
using \<open>a \<notin> unit_circle_set\<close> inversion_id_iff_on_unit_circle[of a]
[PROOF STATE]
proof (prove)
using this:
a \<notin> unit_circle_set
(inversion a = a) = on_circline unit_circle a

goal (1 subgoal):
 1. a \<noteq> inversion a
[PROOF STEP]
unfolding unit_circle_set_def circline_set_def
[PROOF STATE]
proof (prove)
using this:
a \<notin> Collect (on_circline unit_circle)
(inversion a = a) = on_circline unit_circle a

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

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
have "a \<noteq> i1" "a \<noteq> i2" "inversion a \<noteq> i1" "inversion a \<noteq> i2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<noteq> i1 &&& a \<noteq> i2) &&& inversion a \<noteq> i1 &&& inversion a \<noteq> i2
[PROOF STEP]
using assms \<open>inversion a \<notin> unit_circle_set\<close>
[PROOF STATE]
proof (prove)
using this:
i1 \<in> circline_set H \<inter> unit_circle_set
i2 \<in> circline_set H \<inter> unit_circle_set
i1 \<noteq> i2
a \<in> circline_set H
a \<notin> unit_circle_set
inversion a \<notin> unit_circle_set

goal (1 subgoal):
 1. (a \<noteq> i1 &&& a \<noteq> i2) &&& inversion a \<noteq> i1 &&& inversion a \<noteq> i2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<noteq> i1
a \<noteq> i2
inversion a \<noteq> i1
inversion a \<noteq> i2

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> i1
a \<noteq> i2
inversion a \<noteq> i1
inversion a \<noteq> i2
[PROOF STEP]
obtain b where cr2: "cross_ratio b i1 a i2 = of_complex 2"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> i1
a \<noteq> i2
inversion a \<noteq> i1
inversion a \<noteq> i2

goal (1 subgoal):
 1. (\<And>b. cross_ratio b i1 a i2 = of_complex 2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>i1 \<noteq> i2\<close>
[PROOF STATE]
proof (prove)
using this:
a \<noteq> i1
a \<noteq> i2
inversion a \<noteq> i1
inversion a \<noteq> i2
i1 \<noteq> i2

goal (1 subgoal):
 1. (\<And>b. cross_ratio b i1 a i2 = of_complex 2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_cross_ratio[of i1 a i2]
[PROOF STATE]
proof (prove)
using this:
a \<noteq> i1
a \<noteq> i2
inversion a \<noteq> i1
inversion a \<noteq> i2
i1 \<noteq> i2
\<lbrakk>i1 \<noteq> a; i1 \<noteq> i2; a \<noteq> i2\<rbrakk> \<Longrightarrow> \<exists>z. cross_ratio z i1 a i2 = ?c

goal (1 subgoal):
 1. (\<And>b. cross_ratio b i1 a i2 = of_complex 2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cross_ratio b i1 a i2 = of_complex 2

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
have distinct_b: "b \<noteq> i1" "b \<noteq> i2" "b \<noteq> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<noteq> i1 &&& b \<noteq> i2 &&& b \<noteq> a
[PROOF STEP]
using \<open>i1 \<noteq> i2\<close> \<open>a \<noteq> i1\<close> \<open>a \<noteq> i2\<close>
[PROOF STATE]
proof (prove)
using this:
i1 \<noteq> i2
a \<noteq> i1
a \<noteq> i2

goal (1 subgoal):
 1. b \<noteq> i1 &&& b \<noteq> i2 &&& b \<noteq> a
[PROOF STEP]
using ex1_cross_ratio[of i1 a i2]
[PROOF STATE]
proof (prove)
using this:
i1 \<noteq> i2
a \<noteq> i1
a \<noteq> i2
\<lbrakk>i1 \<noteq> a; i1 \<noteq> i2; a \<noteq> i2\<rbrakk> \<Longrightarrow> \<exists>!z. cross_ratio z i1 a i2 = ?c

goal (1 subgoal):
 1. b \<noteq> i1 &&& b \<noteq> i2 &&& b \<noteq> a
[PROOF STEP]
using cross_ratio_0[of i1 a i2] cross_ratio_1[of i1 a i2] cross_ratio_inf[of i1 i2 a]
[PROOF STATE]
proof (prove)
using this:
i1 \<noteq> i2
a \<noteq> i1
a \<noteq> i2
\<lbrakk>i1 \<noteq> a; i1 \<noteq> i2; a \<noteq> i2\<rbrakk> \<Longrightarrow> \<exists>!z. cross_ratio z i1 a i2 = ?c
\<lbrakk>i1 \<noteq> a; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio i1 i1 a i2 = 0\<^sub>h
\<lbrakk>i1 \<noteq> a; a \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio a i1 a i2 = 1\<^sub>h
\<lbrakk>i1 \<noteq> i2; a \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio i2 i1 a i2 = \<infinity>\<^sub>h

goal (1 subgoal):
 1. b \<noteq> i1 &&& b \<noteq> i2 &&& b \<noteq> a
[PROOF STEP]
using cr2
[PROOF STATE]
proof (prove)
using this:
i1 \<noteq> i2
a \<noteq> i1
a \<noteq> i2
\<lbrakk>i1 \<noteq> a; i1 \<noteq> i2; a \<noteq> i2\<rbrakk> \<Longrightarrow> \<exists>!z. cross_ratio z i1 a i2 = ?c
\<lbrakk>i1 \<noteq> a; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio i1 i1 a i2 = 0\<^sub>h
\<lbrakk>i1 \<noteq> a; a \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio a i1 a i2 = 1\<^sub>h
\<lbrakk>i1 \<noteq> i2; a \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio i2 i1 a i2 = \<infinity>\<^sub>h
cross_ratio b i1 a i2 = of_complex 2

goal (1 subgoal):
 1. b \<noteq> i1 &&& b \<noteq> i2 &&& b \<noteq> a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<noteq> i1
b \<noteq> i2
b \<noteq> a

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
hence "b \<in> circline_set H"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> i1
b \<noteq> i2
b \<noteq> a

goal (1 subgoal):
 1. b \<in> circline_set H
[PROOF STEP]
using assms four_points_on_circline_iff_cross_ratio_real[of b i1 a i2] cr2
[PROOF STATE]
proof (prove)
using this:
b \<noteq> i1
b \<noteq> i2
b \<noteq> a
i1 \<in> circline_set H \<inter> unit_circle_set
i2 \<in> circline_set H \<inter> unit_circle_set
i1 \<noteq> i2
a \<in> circline_set H
a \<notin> unit_circle_set
distinct [b, i1, a, i2] \<Longrightarrow> is_real (to_complex (cross_ratio b i1 a i2)) = (\<exists>H. {b, i1, a, i2} \<subseteq> circline_set H)
cross_ratio b i1 a i2 = of_complex 2

goal (1 subgoal):
 1. b \<in> circline_set H
[PROOF STEP]
using unique_circline_set[of i1 i2 a]
[PROOF STATE]
proof (prove)
using this:
b \<noteq> i1
b \<noteq> i2
b \<noteq> a
i1 \<in> circline_set H \<inter> unit_circle_set
i2 \<in> circline_set H \<inter> unit_circle_set
i1 \<noteq> i2
a \<in> circline_set H
a \<notin> unit_circle_set
distinct [b, i1, a, i2] \<Longrightarrow> is_real (to_complex (cross_ratio b i1 a i2)) = (\<exists>H. {b, i1, a, i2} \<subseteq> circline_set H)
cross_ratio b i1 a i2 = of_complex 2
\<lbrakk>i1 \<noteq> i2; i1 \<noteq> a; i2 \<noteq> a\<rbrakk> \<Longrightarrow> \<exists>!H. i1 \<in> circline_set H \<and> i2 \<in> circline_set H \<and> a \<in> circline_set H

goal (1 subgoal):
 1. b \<in> circline_set H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> circline_set H

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<in> circline_set H

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
have "b \<noteq> inversion a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<noteq> inversion a
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> b \<noteq> inversion a \<Longrightarrow> False
[PROOF STEP]
assume *: "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> b \<noteq> inversion a

goal (1 subgoal):
 1. \<not> b \<noteq> inversion a \<Longrightarrow> False
[PROOF STEP]
have "inversion i1 = i1" "inversion i2 = i2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversion i1 = i1 &&& inversion i2 = i2
[PROOF STEP]
using i12
[PROOF STATE]
proof (prove)
using this:
i1 \<in> circline_set H \<inter> unit_circle_set
i2 \<in> circline_set H \<inter> unit_circle_set
i1 \<noteq> i2

goal (1 subgoal):
 1. inversion i1 = i1 &&& inversion i2 = i2
[PROOF STEP]
unfolding unit_circle_set_def
[PROOF STATE]
proof (prove)
using this:
i1 \<in> circline_set H \<inter> circline_set unit_circle
i2 \<in> circline_set H \<inter> circline_set unit_circle
i1 \<noteq> i2

goal (1 subgoal):
 1. inversion i1 = i1 &&& inversion i2 = i2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inversion i1 = i1
inversion i2 = i2

goal (1 subgoal):
 1. \<not> b \<noteq> inversion a \<Longrightarrow> False
[PROOF STEP]
hence "cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2"
[PROOF STATE]
proof (prove)
using this:
inversion i1 = i1
inversion i2 = i2

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2
[PROOF STEP]
using * cross_ratio_inversion[of i1 a i2 b] \<open>a \<noteq> i1\<close> \<open>a \<noteq> i2\<close> \<open>i1 \<noteq> i2\<close> \<open>b \<noteq> i1\<close>
[PROOF STATE]
proof (prove)
using this:
inversion i1 = i1
inversion i2 = i2
\<not> b \<noteq> inversion a
\<lbrakk>i1 \<noteq> a; a \<noteq> i2; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio (inversion b) (inversion i1) (inversion a) (inversion i2) = conjugate (cross_ratio b i1 a i2)
a \<noteq> i1
a \<noteq> i2
i1 \<noteq> i2
b \<noteq> i1

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2
[PROOF STEP]
using four_points_on_circline_iff_cross_ratio_real[of b i1 a i2]
[PROOF STATE]
proof (prove)
using this:
inversion i1 = i1
inversion i2 = i2
\<not> b \<noteq> inversion a
\<lbrakk>i1 \<noteq> a; a \<noteq> i2; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio (inversion b) (inversion i1) (inversion a) (inversion i2) = conjugate (cross_ratio b i1 a i2)
a \<noteq> i1
a \<noteq> i2
i1 \<noteq> i2
b \<noteq> i1
distinct [b, i1, a, i2] \<Longrightarrow> is_real (to_complex (cross_ratio b i1 a i2)) = (\<exists>H. {b, i1, a, i2} \<subseteq> circline_set H)

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2
[PROOF STEP]
using i12 distinct_b conjugate_id_iff[of "cross_ratio b i1 a i2"]
[PROOF STATE]
proof (prove)
using this:
inversion i1 = i1
inversion i2 = i2
\<not> b \<noteq> inversion a
\<lbrakk>i1 \<noteq> a; a \<noteq> i2; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio (inversion b) (inversion i1) (inversion a) (inversion i2) = conjugate (cross_ratio b i1 a i2)
a \<noteq> i1
a \<noteq> i2
i1 \<noteq> i2
b \<noteq> i1
distinct [b, i1, a, i2] \<Longrightarrow> is_real (to_complex (cross_ratio b i1 a i2)) = (\<exists>H. {b, i1, a, i2} \<subseteq> circline_set H)
i1 \<in> circline_set H \<inter> unit_circle_set
i2 \<in> circline_set H \<inter> unit_circle_set
i1 \<noteq> i2
b \<noteq> i1
b \<noteq> i2
b \<noteq> a
(conjugate (cross_ratio b i1 a i2) = cross_ratio b i1 a i2) = (is_real (to_complex (cross_ratio b i1 a i2)) \<or> cross_ratio b i1 a i2 = \<infinity>\<^sub>h)

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2
[PROOF STEP]
using i12 a \<open>b \<in> circline_set H\<close>
[PROOF STATE]
proof (prove)
using this:
inversion i1 = i1
inversion i2 = i2
\<not> b \<noteq> inversion a
\<lbrakk>i1 \<noteq> a; a \<noteq> i2; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> cross_ratio (inversion b) (inversion i1) (inversion a) (inversion i2) = conjugate (cross_ratio b i1 a i2)
a \<noteq> i1
a \<noteq> i2
i1 \<noteq> i2
b \<noteq> i1
distinct [b, i1, a, i2] \<Longrightarrow> is_real (to_complex (cross_ratio b i1 a i2)) = (\<exists>H. {b, i1, a, i2} \<subseteq> circline_set H)
i1 \<in> circline_set H \<inter> unit_circle_set
i2 \<in> circline_set H \<inter> unit_circle_set
i1 \<noteq> i2
b \<noteq> i1
b \<noteq> i2
b \<noteq> a
(conjugate (cross_ratio b i1 a i2) = cross_ratio b i1 a i2) = (is_real (to_complex (cross_ratio b i1 a i2)) \<or> cross_ratio b i1 a i2 = \<infinity>\<^sub>h)
i1 \<in> circline_set H \<inter> unit_circle_set
i2 \<in> circline_set H \<inter> unit_circle_set
i1 \<noteq> i2
a \<in> circline_set H
a \<notin> unit_circle_set
b \<in> circline_set H

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2

goal (1 subgoal):
 1. \<not> b \<noteq> inversion a \<Longrightarrow> False
[PROOF STEP]
hence "cross_ratio (inversion a) i1 a i2 \<noteq> of_complex 2"
[PROOF STATE]
proof (prove)
using this:
cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 \<noteq> of_complex 2
[PROOF STEP]
using cross_ratio_commute_13[of "inversion a" i1 a i2]
[PROOF STATE]
proof (prove)
using this:
cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2
cross_ratio (inversion a) i1 a i2 = reciprocal (cross_ratio a i1 (inversion a) i2)

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 \<noteq> of_complex 2
[PROOF STEP]
using reciprocal_id_iff
[PROOF STATE]
proof (prove)
using this:
cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2
cross_ratio (inversion a) i1 a i2 = reciprocal (cross_ratio a i1 (inversion a) i2)
(reciprocal ?z = ?z) = (?z = of_complex 1 \<or> ?z = of_complex (- 1))

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 \<noteq> of_complex 2
[PROOF STEP]
using of_complex_inj
[PROOF STATE]
proof (prove)
using this:
cross_ratio (inversion a) i1 a i2 = cross_ratio a i1 (inversion a) i2
cross_ratio (inversion a) i1 a i2 = reciprocal (cross_ratio a i1 (inversion a) i2)
(reciprocal ?z = ?z) = (?z = of_complex 1 \<or> ?z = of_complex (- 1))
of_complex ?x = of_complex ?y \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. cross_ratio (inversion a) i1 a i2 \<noteq> of_complex 2
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
cross_ratio (inversion a) i1 a i2 \<noteq> of_complex 2

goal (1 subgoal):
 1. \<not> b \<noteq> inversion a \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
cross_ratio (inversion a) i1 a i2 \<noteq> of_complex 2

goal (1 subgoal):
 1. False
[PROOF STEP]
using * cr2
[PROOF STATE]
proof (prove)
using this:
cross_ratio (inversion a) i1 a i2 \<noteq> of_complex 2
\<not> b \<noteq> inversion a
cross_ratio b i1 a i2 = of_complex 2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<noteq> inversion a

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b \<in> circline_set H
b \<noteq> inversion a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<in> circline_set H
b \<noteq> inversion a

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
using assms \<open>b \<noteq> i1\<close> \<open>b \<noteq> i2\<close> \<open>b \<noteq> a\<close>
[PROOF STATE]
proof (prove)
using this:
b \<in> circline_set H
b \<noteq> inversion a
i1 \<in> circline_set H \<inter> unit_circle_set
i2 \<in> circline_set H \<inter> unit_circle_set
i1 \<noteq> i2
a \<in> circline_set H
a \<notin> unit_circle_set
b \<noteq> i1
b \<noteq> i2
b \<noteq> a

goal (1 subgoal):
 1. \<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>b. b \<noteq> i1 \<and> b \<noteq> i2 \<and> b \<noteq> a \<and> b \<noteq> inversion a \<and> b \<in> circline_set H

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_with_altdef':
    "zip_with f xs ys = [f (xs!i) (ys!i). i \<leftarrow> [0..<min (length xs) (length ys)]]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip_with f xs ys = map (\<lambda>i. f (xs ! i) (ys ! i)) [0..<min (length xs) (length ys)]
[PROOF STEP]
by (induction f xs ys rule: zip_with.induct) (simp_all add: map_upt_Suc del: upt_Suc)


[STATEMENT]
lemma closed_sequentially: (* TODO: move upwards *)
  assumes "closed s" and "\<forall>n. f n \<in> s" and "f \<longlonglongrightarrow> l"
  shows "l \<in> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<in> s
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l \<notin> s \<Longrightarrow> False
[PROOF STEP]
assume "l \<notin> s"
[PROOF STATE]
proof (state)
this:
l \<notin> s

goal (1 subgoal):
 1. l \<notin> s \<Longrightarrow> False
[PROOF STEP]
with \<open>closed s\<close> and \<open>f \<longlonglongrightarrow> l\<close>
[PROOF STATE]
proof (chain)
picking this:
closed s
f \<longlonglongrightarrow> l
l \<notin> s
[PROOF STEP]
have "eventually (\<lambda>n. f n \<in> - s) sequentially"
[PROOF STATE]
proof (prove)
using this:
closed s
f \<longlonglongrightarrow> l
l \<notin> s

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<in> - s
[PROOF STEP]
by (fast intro: topological_tendstoD)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. f n \<in> - s

goal (1 subgoal):
 1. l \<notin> s \<Longrightarrow> False
[PROOF STEP]
with \<open>\<forall>n. f n \<in> s\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. f n \<in> s
\<forall>\<^sub>F n in sequentially. f n \<in> - s
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
\<forall>n. f n \<in> s
\<forall>\<^sub>F n in sequentially. f n \<in> - s

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma singular_cycle:
   "singular_relcycle p X {} c \<longleftrightarrow> singular_chain p X c \<and> chain_boundary p c = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singular_relcycle p X {} c = (singular_chain p X c \<and> chain_boundary p c = 0)
[PROOF STEP]
by (simp add: singular_relcycle_def)


[STATEMENT]
lemma lcs_comm_fun:  "lcs s t = lcs t (s::'a \<Rightarrow> 'b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcs s t = lcs t s
[PROOF STEP]
unfolding lcs_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. max (s x) (t x)) = (\<lambda>x. max (t x) (s x))
[PROOF STEP]
by (auto simp: max_def intro!: ext)


[STATEMENT]
lemma unstream_splice_trans_Right_only: "unstream (splice_trans g h) (Right_only sh) = unstream h sh"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unstream (splice_trans g h) (Right_only sh) = unstream h sh
[PROOF STEP]
proof (induction sh taking: h rule: unstream.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator h s = Skip x2 \<Longrightarrow> unstream (splice_trans g h) (Right_only x2) = unstream h x2; \<And>x31 x32. generator h s = Yield x31 x32 \<Longrightarrow> unstream (splice_trans g h) (Right_only x32) = unstream h x32\<rbrakk> \<Longrightarrow> unstream (splice_trans g h) (Right_only s) = unstream h s
[PROOF STEP]
case (1 sh)
[PROOF STATE]
proof (state)
this:
generator h sh = Skip ?x2.0 \<Longrightarrow> unstream (splice_trans g h) (Right_only ?x2.0) = unstream h ?x2.0
generator h sh = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (splice_trans g h) (Right_only ?x32.0) = unstream h ?x32.0

goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator h s = Skip x2 \<Longrightarrow> unstream (splice_trans g h) (Right_only x2) = unstream h x2; \<And>x31 x32. generator h s = Yield x31 x32 \<Longrightarrow> unstream (splice_trans g h) (Right_only x32) = unstream h x32\<rbrakk> \<Longrightarrow> unstream (splice_trans g h) (Right_only s) = unstream h s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
generator h sh = Skip ?x2.0 \<Longrightarrow> unstream (splice_trans g h) (Right_only ?x2.0) = unstream h ?x2.0
generator h sh = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (splice_trans g h) (Right_only ?x32.0) = unstream h ?x32.0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
generator h sh = Skip ?x2.0 \<Longrightarrow> unstream (splice_trans g h) (Right_only ?x2.0) = unstream h ?x2.0
generator h sh = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (splice_trans g h) (Right_only ?x32.0) = unstream h ?x32.0

goal (1 subgoal):
 1. unstream (splice_trans g h) (Right_only sh) = unstream h sh
[PROOF STEP]
by (cases "generator h sh")(simp_all add: splice_trans.rep_eq)
[PROOF STATE]
proof (state)
this:
unstream (splice_trans g h) (Right_only sh) = unstream h sh

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ent_disj_star_mono:
  "\<lbrakk> A \<or>\<^sub>A C \<Longrightarrow>\<^sub>A E; B \<or>\<^sub>A D \<Longrightarrow>\<^sub>A F \<rbrakk> \<Longrightarrow> A*B \<or>\<^sub>A C*D \<Longrightarrow>\<^sub>A E*F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<or>\<^sub>A C \<Longrightarrow>\<^sub>A E; B \<or>\<^sub>A D \<Longrightarrow>\<^sub>A F\<rbrakk> \<Longrightarrow> A * B \<or>\<^sub>A C * D \<Longrightarrow>\<^sub>A E * F
[PROOF STEP]
by (metis ent_disjI1 ent_disjI2 ent_disjE ent_star_mono)


[STATEMENT]
lemma prod_coprime_right:
  "coprime a (\<Prod>i\<in>A. f i)" if "\<And>i. i \<in> A \<Longrightarrow> coprime a (f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a (prod f A)
[PROOF STEP]
using that prod_coprime_left [of A f a]
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> A \<Longrightarrow> coprime a (f ?i1)
(\<And>i. i \<in> A \<Longrightarrow> coprime (f i) a) \<Longrightarrow> coprime (prod f A) a

goal (1 subgoal):
 1. coprime a (prod f A)
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma periodic_continuous_onI:
  fixes f :: "real \<Rightarrow> real"
  assumes periodic: "\<And>x. f (x + p) = f x" "p > 0"
  assumes cont: "continuous_on {a..a+p} f"
  shows   "continuous_on UNIV f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on UNIV f
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
interpret f: periodic_fun_simple f p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. periodic_fun_simple f p
[PROOF STEP]
by unfold_locales (rule periodic)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
have "continuous_on {a-p..a} (f \<circ> (\<lambda>x. x + p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {a - p..a} (f \<circ> (\<lambda>x. x + p))
[PROOF STEP]
by (intro continuous_on_compose) (auto intro!: continuous_intros cont)
[PROOF STATE]
proof (state)
this:
continuous_on {a - p..a} (f \<circ> (\<lambda>x. x + p))

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
continuous_on {a - p..a} (f \<circ> (\<lambda>x. x + p))

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
have "f \<circ> (\<lambda>x. x + p) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> (\<lambda>x. x + p) = f
[PROOF STEP]
by (rule ext) (simp add: f.periodic_simps)
[PROOF STATE]
proof (state)
this:
f \<circ> (\<lambda>x. x + p) = f

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
continuous_on {a - p..a} f
[PROOF STEP]
have "continuous_on ({a-p..a} \<union> {a..a+p}) f"
[PROOF STATE]
proof (prove)
using this:
continuous_on {a - p..a} f

goal (1 subgoal):
 1. continuous_on ({a - p..a} \<union> {a..a + p}) f
[PROOF STEP]
using cont
[PROOF STATE]
proof (prove)
using this:
continuous_on {a - p..a} f
continuous_on {a..a + p} f

goal (1 subgoal):
 1. continuous_on ({a - p..a} \<union> {a..a + p}) f
[PROOF STEP]
by (intro continuous_on_closed_Un) simp_all
[PROOF STATE]
proof (state)
this:
continuous_on ({a - p..a} \<union> {a..a + p}) f

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
continuous_on ({a - p..a} \<union> {a..a + p}) f

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
have "{a-p..a} \<union> {a..a+p} = {a-p..a+p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a - p..a} \<union> {a..a + p} = {a - p..a + p}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a - p..a} \<union> {a..a + p} = {a - p..a + p}

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
continuous_on {a - p..a + p} f
[PROOF STEP]
have "continuous_on {a-p..a+p} f"
[PROOF STATE]
proof (prove)
using this:
continuous_on {a - p..a + p} f

goal (1 subgoal):
 1. continuous_on {a - p..a + p} f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
continuous_on {a - p..a + p} f

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
hence cont: "continuous_on {a-p<..<a+p} f"
[PROOF STATE]
proof (prove)
using this:
continuous_on {a - p..a + p} f

goal (1 subgoal):
 1. continuous_on {a - p<..<a + p} f
[PROOF STEP]
by (rule continuous_on_subset) auto
[PROOF STATE]
proof (state)
this:
continuous_on {a - p<..<a + p} f

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
define n :: int where "n = \<lceil>(a - x) / p\<rceil>"
[PROOF STATE]
proof (state)
this:
n = \<lceil>(a - x) / p\<rceil>

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
have "(a - x) / p \<le> n" "n < (a - x) / p + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - x) / p \<le> real_of_int n &&& real_of_int n < (a - x) / p + 1
[PROOF STEP]
unfolding n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - x) / p \<le> real_of_int \<lceil>(a - x) / p\<rceil> &&& real_of_int \<lceil>(a - x) / p\<rceil> < (a - x) / p + 1
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
(a - x) / p \<le> real_of_int n
real_of_int n < (a - x) / p + 1

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
with \<open>p > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < p
(a - x) / p \<le> real_of_int n
real_of_int n < (a - x) / p + 1
[PROOF STEP]
have "x + n * p \<in> {a-p<..<a + p}"
[PROOF STATE]
proof (prove)
using this:
0 < p
(a - x) / p \<le> real_of_int n
real_of_int n < (a - x) / p + 1

goal (1 subgoal):
 1. x + real_of_int n * p \<in> {a - p<..<a + p}
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
x + real_of_int n * p \<in> {a - p<..<a + p}

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
with cont
[PROOF STATE]
proof (chain)
picking this:
continuous_on {a - p<..<a + p} f
x + real_of_int n * p \<in> {a - p<..<a + p}
[PROOF STEP]
have "isCont f (x + n * p)"
[PROOF STATE]
proof (prove)
using this:
continuous_on {a - p<..<a + p} f
x + real_of_int n * p \<in> {a - p<..<a + p}

goal (1 subgoal):
 1. isCont f (x + real_of_int n * p)
[PROOF STEP]
by (subst (asm) continuous_on_eq_continuous_at) auto
[PROOF STATE]
proof (state)
this:
isCont f (x + real_of_int n * p)

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
hence *: "f \<midarrow>x+n*p\<rightarrow> f (x+n*p)"
[PROOF STATE]
proof (prove)
using this:
isCont f (x + real_of_int n * p)

goal (1 subgoal):
 1. f \<midarrow>x + real_of_int n * p\<rightarrow> f (x + real_of_int n * p)
[PROOF STEP]
by (simp add: isCont_def f.periodic_simps)
[PROOF STATE]
proof (state)
this:
f \<midarrow>x + real_of_int n * p\<rightarrow> f (x + real_of_int n * p)

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
have "(\<lambda>x. f (x + n*p)) \<midarrow>x\<rightarrow> f (x+n*p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (x + real_of_int n * p)) \<midarrow>x\<rightarrow> f (x + real_of_int n * p)
[PROOF STEP]
by (intro tendsto_compose[OF *] tendsto_intros)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (x + real_of_int n * p)) \<midarrow>x\<rightarrow> f (x + real_of_int n * p)

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
thus "f \<midarrow>x\<rightarrow> f x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f (x + real_of_int n * p)) \<midarrow>x\<rightarrow> f (x + real_of_int n * p)

goal (1 subgoal):
 1. f \<midarrow>x\<rightarrow> f x
[PROOF STEP]
by (simp add: f.periodic_simps)
[PROOF STATE]
proof (state)
this:
f \<midarrow>x\<rightarrow> f x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gr_incl: "Gr A f \<subseteq> A \<times> B \<longleftrightarrow> f ` A \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Gr A f \<subseteq> A \<times> B) = (f ` A \<subseteq> B)
[PROOF STEP]
unfolding Gr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({(a, f a) |a. a \<in> A} \<subseteq> A \<times> B) = (f ` A \<subseteq> B)
[PROOF STEP]
by auto


[STATEMENT]
lemma elts_subset_mono:
  assumes "S \<subseteq>\<^sub>\<circ> T"
  shows "elts S \<subseteq> elts T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts S \<subseteq> elts T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S \<subseteq>\<^sub>\<circ> T

goal (1 subgoal):
 1. elts S \<subseteq> elts T
[PROOF STEP]
by auto


[STATEMENT]
lemma bijections_in_range_permutation:
  assumes "finite A" "finite B"
  assumes "card A = card B"
  shows "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
finite B
card A = card B
[PROOF STEP]
obtain f where f: "f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card A = card B

goal (1 subgoal):
 1. (\<And>f. f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis finite_same_card_bij_on_ext_funcset mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B
[PROOF STEP]
have proj_f: "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = range_permutation A B `` {f}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = range_permutation A B `` {f}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> range_permutation A B `` {f}
 2. range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
from f
[PROOF STATE]
proof (chain)
picking this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
show "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> range_permutation A B `` {f}"
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> range_permutation A B `` {f}
[PROOF STEP]
unfolding range_permutation_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x)))} `` {f}
[PROOF STEP]
by (auto elim: obtain_range_permutation_for_two_bijections)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> range_permutation A B `` {f}

goal (1 subgoal):
 1. range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
show "range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
fix f'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
assume "f' \<in> range_permutation A B `` {f}"
[PROOF STATE]
proof (state)
this:
f' \<in> range_permutation A B `` {f}

goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
have "(f', f) \<in> range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f', f) \<in> range_permutation A B
[PROOF STEP]
using \<open>f' \<in> range_permutation A B `` {f}\<close> equiv_range_permutation[of A B]
[PROOF STATE]
proof (prove)
using this:
f' \<in> range_permutation A B `` {f}
equiv (A \<rightarrow>\<^sub>E B) (range_permutation A B)

goal (1 subgoal):
 1. (f', f) \<in> range_permutation A B
[PROOF STEP]
by (simp add: equiv_class_eq_iff)
[PROOF STATE]
proof (state)
this:
(f', f) \<in> range_permutation A B

goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(f', f) \<in> range_permutation A B
[PROOF STEP]
obtain p where "p permutes B" "\<forall>x\<in>A. f' x = p (f x)"
[PROOF STATE]
proof (prove)
using this:
(f', f) \<in> range_permutation A B

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p permutes B; \<forall>x\<in>A. f' x = p (f x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding range_permutation_def
[PROOF STATE]
proof (prove)
using this:
(f', f) \<in> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x)))}

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p permutes B; \<forall>x\<in>A. f' x = p (f x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p permutes B
\<forall>x\<in>A. f' x = p (f x)

goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
p permutes B
\<forall>x\<in>A. f' x = p (f x)
[PROOF STEP]
have "bij_betw (p \<circ> f) A B"
[PROOF STATE]
proof (prove)
using this:
p permutes B
\<forall>x\<in>A. f' x = p (f x)

goal (1 subgoal):
 1. bij_betw (p \<circ> f) A B
[PROOF STEP]
using bij_betw_comp_iff f permutes_imp_bij
[PROOF STATE]
proof (prove)
using this:
p permutes B
\<forall>x\<in>A. f' x = p (f x)
bij_betw ?f ?A ?A' \<Longrightarrow> bij_betw ?f' ?A' ?A'' = bij_betw (?f' \<circ> ?f) ?A ?A''
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
?p permutes ?S \<Longrightarrow> bij_betw ?p ?S ?S

goal (1 subgoal):
 1. bij_betw (p \<circ> f) A B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
bij_betw (p \<circ> f) A B

goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
bij_betw (p \<circ> f) A B
[PROOF STEP]
have "bij_betw f' A B"
[PROOF STATE]
proof (prove)
using this:
bij_betw (p \<circ> f) A B

goal (1 subgoal):
 1. bij_betw f' A B
[PROOF STEP]
using \<open>\<forall>x\<in>A. f' x = p (f x)\<close>
[PROOF STATE]
proof (prove)
using this:
bij_betw (p \<circ> f) A B
\<forall>x\<in>A. f' x = p (f x)

goal (1 subgoal):
 1. bij_betw f' A B
[PROOF STEP]
by (metis (mono_tags, lifting) bij_betw_cong comp_apply)
[PROOF STATE]
proof (state)
this:
bij_betw f' A B

goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bij_betw f' A B

goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
have "f' \<in> A \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
using \<open>f' \<in> range_permutation A B `` {f}\<close>
[PROOF STATE]
proof (prove)
using this:
f' \<in> range_permutation A B `` {f}

goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
unfolding range_permutation_def
[PROOF STATE]
proof (prove)
using this:
f' \<in> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x)))} `` {f}

goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. \<And>x. x \<in> range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bij_betw f' A B
f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
show "f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (prove)
using this:
bij_betw f' A B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = range_permutation A B `` {f}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = range_permutation A B `` {f}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = range_permutation A B `` {f}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B
[PROOF STEP]
by (simp add: quotientI)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // range_permutation A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma jump_poly_sgn:
  fixes p q:: "real poly"
  assumes "p\<noteq>0" "poly p x=0"
  shows "jump_poly (pderiv p * q) p x = sign (poly q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
proof (cases "q=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q = 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
 2. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
q = 0

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
 2. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
q = 0

goal (1 subgoal):
 1. jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jump_poly (pderiv p * q) p x = sign (poly q x)

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
q \<noteq> 0

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
have "pderiv p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv p \<noteq> 0
[PROOF STEP]
using \<open>p\<noteq>0\<close> \<open>poly p x=0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
poly p x = 0

goal (1 subgoal):
 1. pderiv p \<noteq> 0
[PROOF STEP]
by (metis mult_poly_0_left sign_r_pos_0 sign_r_pos_pderiv)
[PROOF STATE]
proof (state)
this:
pderiv p \<noteq> 0

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
have elim_p_order: "order x p - order x (pderiv p * q)=1 - order x q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order x p - order x (pderiv p * q) = 1 - order x q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. order x p - order x (pderiv p * q) = 1 - order x q
[PROOF STEP]
have "order x p - order x (pderiv p * q) = order x p - order x (pderiv p) - order x q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order x p - order x (pderiv p * q) = order x p - order x (pderiv p) - order x q
[PROOF STEP]
using order_mult \<open>pderiv p\<noteq>0\<close> False
[PROOF STATE]
proof (prove)
using this:
?p * ?q \<noteq> 0 \<Longrightarrow> order ?a (?p * ?q) = order ?a ?p + order ?a ?q
pderiv p \<noteq> 0
q \<noteq> 0

goal (1 subgoal):
 1. order x p - order x (pderiv p * q) = order x p - order x (pderiv p) - order x q
[PROOF STEP]
by (metis diff_diff_left mult_eq_0_iff)
[PROOF STATE]
proof (state)
this:
order x p - order x (pderiv p * q) = order x p - order x (pderiv p) - order x q

goal (1 subgoal):
 1. order x p - order x (pderiv p * q) = 1 - order x q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
order x p - order x (pderiv p * q) = order x p - order x (pderiv p) - order x q

goal (1 subgoal):
 1. order x p - order x (pderiv p * q) = 1 - order x q
[PROOF STEP]
have "order x p - order x (pderiv p) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order x p - order x (pderiv p) = 1
[PROOF STEP]
using order_pderiv[OF \<open>pderiv p\<noteq>0\<close>, of x] \<open>poly p x=0\<close> order_root[of p x] \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
order x p \<noteq> 0 \<Longrightarrow> order x p = Suc (order x (pderiv p))
poly p x = 0
(poly p x = 0) = (p = 0 \<or> order x p \<noteq> 0)
p \<noteq> 0

goal (1 subgoal):
 1. order x p - order x (pderiv p) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order x p - order x (pderiv p) = 1

goal (1 subgoal):
 1. order x p - order x (pderiv p * q) = 1 - order x q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
order x p - order x (pderiv p * q) = order x p - order x (pderiv p) - order x q
order x p - order x (pderiv p) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
order x p - order x (pderiv p * q) = order x p - order x (pderiv p) - order x q
order x p - order x (pderiv p) = 1

goal (1 subgoal):
 1. order x p - order x (pderiv p * q) = 1 - order x q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order x p - order x (pderiv p * q) = 1 - order x q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
order x p - order x (pderiv p * q) = 1 - order x q

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
have elim_p_sign_r_pos:"sign_r_pos (pderiv p * q * p) x=sign_r_pos q x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_r_pos (pderiv p * q * p) x = sign_r_pos q x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sign_r_pos (pderiv p * q * p) x = sign_r_pos q x
[PROOF STEP]
have "sign_r_pos (pderiv p * q * p) x = (sign_r_pos (pderiv p* p) x \<longleftrightarrow> sign_r_pos q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_r_pos (pderiv p * q * p) x = (sign_r_pos (pderiv p * p) x = sign_r_pos q x)
[PROOF STEP]
by (metis \<open>q \<noteq> 0\<close> \<open>pderiv p \<noteq> 0\<close> assms(1) no_zero_divisors sign_r_pos_mult)
[PROOF STATE]
proof (state)
this:
sign_r_pos (pderiv p * q * p) x = (sign_r_pos (pderiv p * p) x = sign_r_pos q x)

goal (1 subgoal):
 1. sign_r_pos (pderiv p * q * p) x = sign_r_pos q x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sign_r_pos (pderiv p * q * p) x = (sign_r_pos (pderiv p * p) x = sign_r_pos q x)

goal (1 subgoal):
 1. sign_r_pos (pderiv p * q * p) x = sign_r_pos q x
[PROOF STEP]
using sign_r_pos_pderiv[OF \<open>poly p x=0\<close> \<open>p\<noteq>0\<close>]
[PROOF STATE]
proof (prove)
using this:
sign_r_pos (pderiv p * q * p) x = (sign_r_pos (pderiv p * p) x = sign_r_pos q x)
sign_r_pos (pderiv p * p) x

goal (1 subgoal):
 1. sign_r_pos (pderiv p * q * p) x = sign_r_pos q x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sign_r_pos (pderiv p * q * p) x = sign_r_pos q x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sign_r_pos (pderiv p * q * p) x = sign_r_pos q x

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
define simpleL where "simpleL\<equiv>if pderiv p * q \<noteq> 0 \<and> odd (1 - order x q) then
      if sign_r_pos q x then 1::int else - 1 else 0"
[PROOF STATE]
proof (state)
this:
simpleL \<equiv> if pderiv p * q \<noteq> 0 \<and> odd (1 - order x q) then if sign_r_pos q x then 1 else - 1 else 0

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
have " jump_poly (pderiv p * q) p x =simpleL"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jump_poly (pderiv p * q) p x = simpleL
[PROOF STEP]
unfolding simpleL_def jump_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if p \<noteq> 0 \<and> pderiv p * q \<noteq> 0 \<and> odd (order x p - order x (pderiv p * q)) then if sign_r_pos (pderiv p * q * p) x then 1 else - 1 else 0) = (if pderiv p * q \<noteq> 0 \<and> odd (1 - order x q) then if sign_r_pos q x then 1 else - 1 else 0)
[PROOF STEP]
by (subst elim_p_order, subst elim_p_sign_r_pos,simp)
[PROOF STATE]
proof (state)
this:
jump_poly (pderiv p * q) p x = simpleL

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
jump_poly (pderiv p * q) p x = simpleL

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
have "poly q x=0 \<Longrightarrow> simpleL=sign (poly q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
assume "poly q x=0"
[PROOF STATE]
proof (state)
this:
poly q x = 0

goal (1 subgoal):
 1. poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
hence "1-order x q = 0"
[PROOF STATE]
proof (prove)
using this:
poly q x = 0

goal (1 subgoal):
 1. 1 - order x q = 0
[PROOF STEP]
using \<open>q\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
poly q x = 0
q \<noteq> 0

goal (1 subgoal):
 1. 1 - order x q = 0
[PROOF STEP]
by (metis less_one not_gr0 order_root zero_less_diff)
[PROOF STATE]
proof (state)
this:
1 - order x q = 0

goal (1 subgoal):
 1. poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
hence "simpleL=0"
[PROOF STATE]
proof (prove)
using this:
1 - order x q = 0

goal (1 subgoal):
 1. simpleL = 0
[PROOF STEP]
unfolding simpleL_def
[PROOF STATE]
proof (prove)
using this:
1 - order x q = 0

goal (1 subgoal):
 1. (if pderiv p * q \<noteq> 0 \<and> odd (1 - order x q) then if sign_r_pos q x then 1 else - 1 else 0) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
simpleL = 0

goal (1 subgoal):
 1. poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
simpleL = 0

goal (1 subgoal):
 1. poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
have "sign (poly q x)=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign (poly q x) = 0
[PROOF STEP]
using \<open>poly q x=0\<close>
[PROOF STATE]
proof (prove)
using this:
poly q x = 0

goal (1 subgoal):
 1. sign (poly q x) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sign (poly q x) = 0

goal (1 subgoal):
 1. poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
simpleL = 0
sign (poly q x) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
simpleL = 0
sign (poly q x) = 0

goal (1 subgoal):
 1. simpleL = sign (poly q x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
simpleL = sign (poly q x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
have "poly q x\<noteq>0\<Longrightarrow> simpleL=sign (poly q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
assume "poly q x\<noteq>0"
[PROOF STATE]
proof (state)
this:
poly q x \<noteq> 0

goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
hence "odd (1 - order x q)"
[PROOF STATE]
proof (prove)
using this:
poly q x \<noteq> 0

goal (1 subgoal):
 1. odd (1 - order x q)
[PROOF STEP]
by (simp add: order_root)
[PROOF STATE]
proof (state)
this:
odd (1 - order x q)

goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
odd (1 - order x q)

goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
have "pderiv p * q \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv p * q \<noteq> 0
[PROOF STEP]
by (metis False \<open>pderiv p \<noteq> 0\<close> no_zero_divisors)
[PROOF STATE]
proof (state)
this:
pderiv p * q \<noteq> 0

goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
pderiv p * q \<noteq> 0

goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
have "sign_r_pos q x = (poly q x > 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_r_pos q x = (0 < poly q x)
[PROOF STEP]
using sign_r_pos_rec[OF False] \<open>poly q x\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
sign_r_pos q ?x = (if poly q ?x = 0 then sign_r_pos (pderiv q) ?x else 0 < poly q ?x)
poly q x \<noteq> 0

goal (1 subgoal):
 1. sign_r_pos q x = (0 < poly q x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sign_r_pos q x = (0 < poly q x)

goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
odd (1 - order x q)
pderiv p * q \<noteq> 0
sign_r_pos q x = (0 < poly q x)
[PROOF STEP]
have "simpleL=(if poly q x>0 then 1 else - 1)"
[PROOF STATE]
proof (prove)
using this:
odd (1 - order x q)
pderiv p * q \<noteq> 0
sign_r_pos q x = (0 < poly q x)

goal (1 subgoal):
 1. simpleL = (if 0 < poly q x then 1 else - 1)
[PROOF STEP]
unfolding simpleL_def
[PROOF STATE]
proof (prove)
using this:
odd (1 - order x q)
pderiv p * q \<noteq> 0
sign_r_pos q x = (0 < poly q x)

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

goal (1 subgoal):
 1. poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
simpleL = (if 0 < poly q x then 1 else - 1)

goal (1 subgoal):
 1. simpleL = sign (poly q x)
[PROOF STEP]
using \<open>poly q x\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
simpleL = (if 0 < poly q x then 1 else - 1)
poly q x \<noteq> 0

goal (1 subgoal):
 1. simpleL = sign (poly q x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
simpleL = sign (poly q x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)

goal (1 subgoal):
 1. q \<noteq> 0 \<Longrightarrow> jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
jump_poly (pderiv p * q) p x = simpleL
poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
jump_poly (pderiv p * q) p x = simpleL
poly q x = 0 \<Longrightarrow> simpleL = sign (poly q x)
poly q x \<noteq> 0 \<Longrightarrow> simpleL = sign (poly q x)

goal (1 subgoal):
 1. jump_poly (pderiv p * q) p x = sign (poly q x)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
jump_poly (pderiv p * q) p x = sign (poly q x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Bseq_cmult_iff:
  fixes c :: "'a::real_normed_field"
  assumes "c \<noteq> 0"
  shows "Bseq (\<lambda>x. c * f x) \<longleftrightarrow> Bseq f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq (\<lambda>x. c * f x) = Bseq f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Bseq (\<lambda>x. c * f x) \<Longrightarrow> Bseq f
 2. Bseq f \<Longrightarrow> Bseq (\<lambda>x. c * f x)
[PROOF STEP]
assume "Bseq (\<lambda>x. c * f x)"
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>x. c * f x)

goal (2 subgoals):
 1. Bseq (\<lambda>x. c * f x) \<Longrightarrow> Bseq f
 2. Bseq f \<Longrightarrow> Bseq (\<lambda>x. c * f x)
[PROOF STEP]
with Bfun_const
[PROOF STATE]
proof (chain)
picking this:
Bfun (\<lambda>_. ?c) ?F
Bseq (\<lambda>x. c * f x)
[PROOF STEP]
have "Bseq (\<lambda>x. inverse c * (c * f x))"
[PROOF STATE]
proof (prove)
using this:
Bfun (\<lambda>_. ?c) ?F
Bseq (\<lambda>x. c * f x)

goal (1 subgoal):
 1. Bseq (\<lambda>x. inverse c * (c * f x))
[PROOF STEP]
by (rule Bseq_mult)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>x. inverse c * (c * f x))

goal (2 subgoals):
 1. Bseq (\<lambda>x. c * f x) \<Longrightarrow> Bseq f
 2. Bseq f \<Longrightarrow> Bseq (\<lambda>x. c * f x)
[PROOF STEP]
with \<open>c \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
Bseq (\<lambda>x. inverse c * (c * f x))
[PROOF STEP]
show "Bseq f"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)
Bseq (\<lambda>x. inverse c * (c * f x))

goal (1 subgoal):
 1. Bseq f
[PROOF STEP]
by (simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
Bseq f

goal (1 subgoal):
 1. Bseq f \<Longrightarrow> Bseq (\<lambda>x. c * f x)
[PROOF STEP]
qed (intro Bseq_mult Bfun_const)


[STATEMENT]
lemma deg_pm_map_scale: "deg_pm (k \<cdot> t) = (k::'b::semiring_0) * deg_pm t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
from keys_map_scale_subset finite_keys
[PROOF STATE]
proof (chain)
picking this:
keys (?k \<cdot> ?t) \<subseteq> keys ?t
finite (keys ?f)
[PROOF STEP]
have "deg_pm (k \<cdot> t) = sum (lookup (k \<cdot> t)) (keys t)"
[PROOF STATE]
proof (prove)
using this:
keys (?k \<cdot> ?t) \<subseteq> keys ?t
finite (keys ?f)

goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = sum (lookup (k \<cdot> t)) (keys t)
[PROOF STEP]
by (rule deg_pm_superset)
[PROOF STATE]
proof (state)
this:
deg_pm (k \<cdot> t) = sum (lookup (k \<cdot> t)) (keys t)

goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deg_pm (k \<cdot> t) = sum (lookup (k \<cdot> t)) (keys t)

goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
have "\<dots> = k * sum (lookup t) (keys t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (lookup (k \<cdot> t)) (keys t) = k * sum (lookup t) (keys t)
[PROOF STEP]
by (simp add: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
sum (lookup (k \<cdot> t)) (keys t) = k * sum (lookup t) (keys t)

goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (lookup (k \<cdot> t)) (keys t) = k * sum (lookup t) (keys t)

goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
from subset_refl finite_keys
[PROOF STATE]
proof (chain)
picking this:
?A \<subseteq> ?A
finite (keys ?f)
[PROOF STEP]
have "sum (lookup t) (keys t) = deg_pm t"
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> ?A
finite (keys ?f)

goal (1 subgoal):
 1. sum (lookup t) (keys t) = deg_pm t
[PROOF STEP]
by (rule deg_pm_superset[symmetric])
[PROOF STATE]
proof (state)
this:
sum (lookup t) (keys t) = deg_pm t

goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deg_pm (k \<cdot> t) = k * deg_pm t

goal (1 subgoal):
 1. deg_pm (k \<cdot> t) = k * deg_pm t
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
deg_pm (k \<cdot> t) = k * deg_pm t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_elem_in_0: "v \<notin> verts G \<Longrightarrow> in_degree G v = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<notin> verts G \<Longrightarrow> in_degree G v = 0
[PROOF STEP]
unfolding in_degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<notin> verts G \<Longrightarrow> card (in_arcs G v) = 0
[PROOF STEP]
using not_elem_no_in_arcs
[PROOF STATE]
proof (prove)
using this:
?v \<notin> verts G \<Longrightarrow> in_arcs G ?v = {}

goal (1 subgoal):
 1. v \<notin> verts G \<Longrightarrow> card (in_arcs G v) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma orbit_cong0:
  assumes "x \<in> A" "f \<in> A \<rightarrow> A" "\<And>y. y \<in> A \<Longrightarrow> f y = g y" shows "orbit f x = orbit g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orbit f x = orbit g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orbit f x = orbit g x
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orbit f x = orbit g x
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orbit f x = orbit g x
[PROOF STEP]
have "(f ^^ n) x = (g ^^ n) x \<and> (f ^^ n) x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ n) x = (g ^^ n) x \<and> (f ^^ n) x \<in> A
[PROOF STEP]
by (induct n rule: nat.induct) (insert assms, auto)
[PROOF STATE]
proof (state)
this:
(f ^^ n) x = (g ^^ n) x \<and> (f ^^ n) x \<in> A

goal (1 subgoal):
 1. orbit f x = orbit g x
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(f ^^ ?n2) x = (g ^^ ?n2) x \<and> (f ^^ ?n2) x \<in> A

goal (1 subgoal):
 1. orbit f x = orbit g x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f ^^ ?n2) x = (g ^^ ?n2) x \<and> (f ^^ ?n2) x \<in> A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f ^^ ?n2) x = (g ^^ ?n2) x \<and> (f ^^ ?n2) x \<in> A

goal (1 subgoal):
 1. orbit f x = orbit g x
[PROOF STEP]
by (auto simp: orbit_altdef)
[PROOF STATE]
proof (state)
this:
orbit f x = orbit g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma language_equivalence_classes_preserve_observability:
  assumes "transitions M' = (\<lambda> t . ({q \<in> states M . LS M q = LS M (t_source t)} , t_input t, t_output t, {q \<in> states M . LS M q = LS M (t_target t)})) ` transitions M"
  and     "observable M"
shows "observable M'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. observable M'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. observable M'
[PROOF STEP]
have "\<And> t1 t2 . t1 \<in> transitions M' \<Longrightarrow>
                   t2 \<in> transitions M' \<Longrightarrow>
                    t_source t1 = t_source t2 \<Longrightarrow>
                    t_input t1 = t_input t2 \<Longrightarrow>
                    t_output t1 = t_output t2 \<Longrightarrow>
                    t_target t1 = t_target t2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
fix t1 t2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
assume "t1 \<in> transitions M'" and "t2 \<in> transitions M'" and "t_source t1 = t_source t2" and "t_input t1 = t_input t2" and "t_output t1 = t_output t2"
[PROOF STATE]
proof (state)
this:
t1 \<in> FSM.transitions M'
t2 \<in> FSM.transitions M'
t_source t1 = t_source t2
t_input t1 = t_input t2
t_output t1 = t_output t2

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
obtain t1' where t1'_def: "t1 = ({q \<in> states M . LS M q = LS M (t_source t1')} , t_input t1', t_output t1', {q \<in> states M . LS M q = LS M (t_target t1')})"
                 and          "t1' \<in> transitions M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t1'. \<lbrakk>t1 = ({q \<in> FSM.states M. LS M q = LS M (t_source t1')}, t_input t1', t_output t1', {q \<in> FSM.states M. LS M q = LS M (t_target t1')}); t1' \<in> FSM.transitions M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>t1 \<in> transitions M'\<close> assms(1)
[PROOF STATE]
proof (prove)
using this:
t1 \<in> FSM.transitions M'
FSM.transitions M' = (\<lambda>t. ({q \<in> FSM.states M. LS M q = LS M (t_source t)}, t_input t, t_output t, {q \<in> FSM.states M. LS M q = LS M (t_target t)})) ` FSM.transitions M

goal (1 subgoal):
 1. (\<And>t1'. \<lbrakk>t1 = ({q \<in> FSM.states M. LS M q = LS M (t_source t1')}, t_input t1', t_output t1', {q \<in> FSM.states M. LS M q = LS M (t_target t1')}); t1' \<in> FSM.transitions M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t1 = ({q \<in> FSM.states M. LS M q = LS M (t_source t1')}, t_input t1', t_output t1', {q \<in> FSM.states M. LS M q = LS M (t_target t1')})
t1' \<in> FSM.transitions M

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
obtain t2' where t2'_def: "t2 = ({q \<in> states M . LS M q = LS M (t_source t2')} , t_input t2', t_output t2', {q \<in> states M . LS M q = LS M (t_target t2')})"
                 and          "t2' \<in> transitions M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t2'. \<lbrakk>t2 = ({q \<in> FSM.states M. LS M q = LS M (t_source t2')}, t_input t2', t_output t2', {q \<in> FSM.states M. LS M q = LS M (t_target t2')}); t2' \<in> FSM.transitions M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>t2 \<in> transitions M'\<close> assms(1) \<open>t_input t1 = t_input t2\<close> \<open>t_output t1 = t_output t2\<close>
[PROOF STATE]
proof (prove)
using this:
t2 \<in> FSM.transitions M'
FSM.transitions M' = (\<lambda>t. ({q \<in> FSM.states M. LS M q = LS M (t_source t)}, t_input t, t_output t, {q \<in> FSM.states M. LS M q = LS M (t_target t)})) ` FSM.transitions M
t_input t1 = t_input t2
t_output t1 = t_output t2

goal (1 subgoal):
 1. (\<And>t2'. \<lbrakk>t2 = ({q \<in> FSM.states M. LS M q = LS M (t_source t2')}, t_input t2', t_output t2', {q \<in> FSM.states M. LS M q = LS M (t_target t2')}); t2' \<in> FSM.transitions M\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t2 = ({q \<in> FSM.states M. LS M q = LS M (t_source t2')}, t_input t2', t_output t2', {q \<in> FSM.states M. LS M q = LS M (t_target t2')})
t2' \<in> FSM.transitions M

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
have "{q \<in> FSM.states M. LS M q = LS M (t_source t1')} = {q \<in> FSM.states M. LS M q = LS M (t_source t2')}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q \<in> FSM.states M. LS M q = LS M (t_source t1')} = {q \<in> FSM.states M. LS M q = LS M (t_source t2')}
[PROOF STEP]
using t1'_def t2'_def \<open>t_source t1 = t_source t2\<close>
[PROOF STATE]
proof (prove)
using this:
t1 = ({q \<in> FSM.states M. LS M q = LS M (t_source t1')}, t_input t1', t_output t1', {q \<in> FSM.states M. LS M q = LS M (t_target t1')})
t2 = ({q \<in> FSM.states M. LS M q = LS M (t_source t2')}, t_input t2', t_output t2', {q \<in> FSM.states M. LS M q = LS M (t_target t2')})
t_source t1 = t_source t2

goal (1 subgoal):
 1. {q \<in> FSM.states M. LS M q = LS M (t_source t1')} = {q \<in> FSM.states M. LS M q = LS M (t_source t2')}
[PROOF STEP]
by (metis (no_types, lifting) fst_eqD)
[PROOF STATE]
proof (state)
this:
{q \<in> FSM.states M. LS M q = LS M (t_source t1')} = {q \<in> FSM.states M. LS M q = LS M (t_source t2')}

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{q \<in> FSM.states M. LS M q = LS M (t_source t1')} = {q \<in> FSM.states M. LS M q = LS M (t_source t2')}
[PROOF STEP]
have "LS M (t_source t1') = LS M (t_source t2')"
[PROOF STATE]
proof (prove)
using this:
{q \<in> FSM.states M. LS M q = LS M (t_source t1')} = {q \<in> FSM.states M. LS M q = LS M (t_source t2')}

goal (1 subgoal):
 1. LS M (t_source t1') = LS M (t_source t2')
[PROOF STEP]
using fsm_transition_source[OF \<open>t1' \<in> transitions M\<close>] fsm_transition_source[OF \<open>t2' \<in> transitions M\<close>]
[PROOF STATE]
proof (prove)
using this:
{q \<in> FSM.states M. LS M q = LS M (t_source t1')} = {q \<in> FSM.states M. LS M q = LS M (t_source t2')}
t_source t1' \<in> FSM.states M
t_source t2' \<in> FSM.states M

goal (1 subgoal):
 1. LS M (t_source t1') = LS M (t_source t2')
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
LS M (t_source t1') = LS M (t_source t2')

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LS M (t_source t1') = LS M (t_source t2')
[PROOF STEP]
have "LS M (t_target t1') = LS M (t_target t2')"
[PROOF STATE]
proof (prove)
using this:
LS M (t_source t1') = LS M (t_source t2')

goal (1 subgoal):
 1. LS M (t_target t1') = LS M (t_target t2')
[PROOF STEP]
using observable_transition_target_language_eq[OF _ \<open>t1' \<in> transitions M\<close>  \<open>t2' \<in> transitions M\<close> _ _ \<open>observable M\<close>]
[PROOF STATE]
proof (prove)
using this:
LS M (t_source t1') = LS M (t_source t2')
\<lbrakk>LS M (t_source t1') = LS M (t_source t2'); t_input t1' = t_input t2'; t_output t1' = t_output t2'\<rbrakk> \<Longrightarrow> LS M (t_target t1') = LS M (t_target t2')

goal (1 subgoal):
 1. LS M (t_target t1') = LS M (t_target t2')
[PROOF STEP]
using \<open>t_input t1 = t_input t2\<close> \<open>t_output t1 = t_output t2\<close>
[PROOF STATE]
proof (prove)
using this:
LS M (t_source t1') = LS M (t_source t2')
\<lbrakk>LS M (t_source t1') = LS M (t_source t2'); t_input t1' = t_input t2'; t_output t1' = t_output t2'\<rbrakk> \<Longrightarrow> LS M (t_target t1') = LS M (t_target t2')
t_input t1 = t_input t2
t_output t1 = t_output t2

goal (1 subgoal):
 1. LS M (t_target t1') = LS M (t_target t2')
[PROOF STEP]
unfolding t1'_def t2'_def  fst_conv snd_conv
[PROOF STATE]
proof (prove)
using this:
LS M (t_source t1') = LS M (t_source t2')
\<lbrakk>LS M (t_source t1') = LS M (t_source t2'); t_input t1' = t_input t2'; t_output t1' = t_output t2'\<rbrakk> \<Longrightarrow> LS M (t_target t1') = LS M (t_target t2')
t_input t1' = t_input t2'
t_output t1' = t_output t2'

goal (1 subgoal):
 1. LS M (t_target t1') = LS M (t_target t2')
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
LS M (t_target t1') = LS M (t_target t2')

goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>t1 \<in> FSM.transitions M'; t2 \<in> FSM.transitions M'; t_source t1 = t_source t2; t_input t1 = t_input t2; t_output t1 = t_output t2\<rbrakk> \<Longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LS M (t_target t1') = LS M (t_target t2')
[PROOF STEP]
show "t_target t1 = t_target t2"
[PROOF STATE]
proof (prove)
using this:
LS M (t_target t1') = LS M (t_target t2')

goal (1 subgoal):
 1. t_target t1 = t_target t2
[PROOF STEP]
unfolding t1'_def t2'_def snd_conv
[PROOF STATE]
proof (prove)
using this:
LS M (t_target t1') = LS M (t_target t2')

goal (1 subgoal):
 1. {q \<in> FSM.states M. LS M q = LS M (t_target t1')} = {q \<in> FSM.states M. LS M q = LS M (t_target t2')}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
t_target t1 = t_target t2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?t1.0 \<in> FSM.transitions M'; ?t2.0 \<in> FSM.transitions M'; t_source ?t1.0 = t_source ?t2.0; t_input ?t1.0 = t_input ?t2.0; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> t_target ?t1.0 = t_target ?t2.0

goal (1 subgoal):
 1. observable M'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?t1.0 \<in> FSM.transitions M'; ?t2.0 \<in> FSM.transitions M'; t_source ?t1.0 = t_source ?t2.0; t_input ?t1.0 = t_input ?t2.0; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> t_target ?t1.0 = t_target ?t2.0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t1.0 \<in> FSM.transitions M'; ?t2.0 \<in> FSM.transitions M'; t_source ?t1.0 = t_source ?t2.0; t_input ?t1.0 = t_input ?t2.0; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> t_target ?t1.0 = t_target ?t2.0

goal (1 subgoal):
 1. observable M'
[PROOF STEP]
unfolding observable.simps
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t1.0 \<in> FSM.transitions M'; ?t2.0 \<in> FSM.transitions M'; t_source ?t1.0 = t_source ?t2.0; t_input ?t1.0 = t_input ?t2.0; t_output ?t1.0 = t_output ?t2.0\<rbrakk> \<Longrightarrow> t_target ?t1.0 = t_target ?t2.0

goal (1 subgoal):
 1. \<forall>t1\<in>FSM.transitions M'. \<forall>t2\<in>FSM.transitions M'. t_source t1 = t_source t2 \<and> t_input t1 = t_input t2 \<and> t_output t1 = t_output t2 \<longrightarrow> t_target t1 = t_target t2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
observable M'

goal:
No subgoals!
[PROOF STEP]
qed