[STATEMENT]
lemma cubic_depressed: fixes e :: "'a :: field_char_0"
  assumes yz: "e \<noteq> 0 \<Longrightarrow> z^2 - y * z - e / 3 = 0"
  and u: "e \<noteq> 0 \<Longrightarrow> u = z^3"
  and v: "v = - (e ^ 3 / 27)"
shows "y^3 + e * y + f = 0 \<longleftrightarrow> (if e = 0 then y^3 = -f else u\<^sup>2 + f * u + v = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
let ?yexp = "y^3 + e * y + f"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
proof (cases "e = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
e \<noteq> (0::'a)

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
note yz = yz[OF False]
[PROOF STATE]
proof (state)
this:
z\<^sup>2 - y * z - e / (3::'a) = (0::'a)

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
from yz
[PROOF STATE]
proof (chain)
picking this:
z\<^sup>2 - y * z - e / (3::'a) = (0::'a)
[PROOF STEP]
have eyz: "e = 3 * (z^2 - y * z)"
[PROOF STATE]
proof (prove)
using this:
z\<^sup>2 - y * z - e / (3::'a) = (0::'a)

goal (1 subgoal):
 1. e = (3::'a) * (z\<^sup>2 - y * z)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e = (3::'a) * (z\<^sup>2 - y * z)

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
from yz False
[PROOF STATE]
proof (chain)
picking this:
z\<^sup>2 - y * z - e / (3::'a) = (0::'a)
e \<noteq> (0::'a)
[PROOF STEP]
have z0: "z \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
z\<^sup>2 - y * z - e / (3::'a) = (0::'a)
e \<noteq> (0::'a)

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

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
have "?yexp = 0 \<longleftrightarrow> z^3 * ?yexp = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (z ^ 3 * (y ^ 3 + e * y + f) = (0::'a))
[PROOF STEP]
using z0
[PROOF STATE]
proof (prove)
using this:
z \<noteq> (0::'a)

goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (z ^ 3 * (y ^ 3 + e * y + f) = (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(y ^ 3 + e * y + f = (0::'a)) = (z ^ 3 * (y ^ 3 + e * y + f) = (0::'a))

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(y ^ 3 + e * y + f = (0::'a)) = (z ^ 3 * (y ^ 3 + e * y + f) = (0::'a))

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
have "z^3 * ?yexp = z^6 + f * z^3 - e^3/27"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z ^ 3 * (y ^ 3 + e * y + f) = z ^ 6 + f * z ^ 3 - e ^ 3 / (27::'a)
[PROOF STEP]
unfolding eyz
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z ^ 3 * (y ^ 3 + (3::'a) * (z\<^sup>2 - y * z) * y + f) = z ^ 6 + f * z ^ 3 - ((3::'a) * (z\<^sup>2 - y * z)) ^ 3 / (27::'a)
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
z ^ 3 * (y ^ 3 + e * y + f) = z ^ 6 + f * z ^ 3 - e ^ 3 / (27::'a)

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
z ^ 3 * (y ^ 3 + e * y + f) = z ^ 6 + f * z ^ 3 - e ^ 3 / (27::'a)

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
have "\<dots> = u^2 + f * u + v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z ^ 6 + f * z ^ 3 - e ^ 3 / (27::'a) = u\<^sup>2 + f * u + v
[PROOF STEP]
unfolding u[OF False] v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z ^ 6 + f * z ^ 3 - e ^ 3 / (27::'a) = (z ^ 3)\<^sup>2 + f * z ^ 3 + - (e ^ 3 / (27::'a))
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
z ^ 6 + f * z ^ 3 - e ^ 3 / (27::'a) = u\<^sup>2 + f * u + v

goal (2 subgoals):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
 2. e \<noteq> (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(y ^ 3 + e * y + f = (0::'a)) = (u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(y ^ 3 + e * y + f = (0::'a)) = (u\<^sup>2 + f * u + v = (0::'a))

goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
(y ^ 3 + e * y + f = (0::'a)) = (u\<^sup>2 + f * u + v = (0::'a))
e \<noteq> (0::'a)

goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))

goal (1 subgoal):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
e = (0::'a)

goal (1 subgoal):
 1. e = (0::'a) \<Longrightarrow> (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
unfolding True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y ^ 3 + (0::'a) * y + f = (0::'a)) = (if (0::'a) = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))
[PROOF STEP]
by (auto, algebra)
[PROOF STATE]
proof (state)
this:
(y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(y ^ 3 + e * y + f = (0::'a)) = (if e = (0::'a) then y ^ 3 = - f else u\<^sup>2 + f * u + v = (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma count_size_set_repr: "size {# x \<in># A . x = g#} = count A g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size {#x \<in># A. x = g#} = count A g
[PROOF STEP]
by (simp add: filter_eq_replicate_mset)


[STATEMENT]
lemma hm_it_has_next_rule:
  "<hm_is_it m ht m' it> hm_it_has_next it
    <\<lambda>r. hm_is_it m ht m' it * \<up>(r\<longleftrightarrow>m'\<noteq>Map.empty)>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <hm_is_it m ht m' it> hm_it_has_next it <\<lambda>r. hm_is_it m ht m' it * \<up> (r = (m' \<noteq> Map.empty))>
[PROOF STEP]
unfolding is_hashmap'_def hm_is_it_def hm_is_it'_def hm_it_has_next_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <\<exists>\<^sub>Al l'. is_hashtable l ht * \<up> (let (i, r, ht') = it in ht = ht' \<and> l' = concat (take i l) @ rev r \<and> distinct (map fst l') \<and> i \<le> length l \<and> (r = [] \<longrightarrow> i = 0)) * \<up> (map_of (concat l) = m \<and> map_of l' = m')> return (case it of (0, [], x) \<Rightarrow> False | (0, aa # list, x) \<Rightarrow> True | (Suc nat, b) \<Rightarrow> True) <\<lambda>r. (\<exists>\<^sub>Al l'. is_hashtable l ht * \<up> (let (i, r, ht') = it in ht = ht' \<and> l' = concat (take i l) @ rev r \<and> distinct (map fst l') \<and> i \<le> length l \<and> (r = [] \<longrightarrow> i = 0)) * \<up> (map_of (concat l) = m \<and> map_of l' = m')) * \<up> (r = (m' \<noteq> Map.empty))>
[PROOF STEP]
by (sep_auto split: nat.split list.split)


[STATEMENT]
lemma godel_code'_butlast_last_id' :
  "godel_code' (ys @ [y]) (Suc j) = godel_code' ys (Suc j) *
                                Pi (Suc (length ys + j)) ^ y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. godel_code' (ys @ [y]) (Suc j) = godel_code' ys (Suc j) * Pi (Suc (length ys + j)) ^ y
[PROOF STEP]
proof(induct ys arbitrary: j, simp_all add: godel_code'.simps)
[PROOF STATE]
proof (state)
goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_product_open_eq: "(arbitrary union_of (\<lambda>U. \<exists>S T. U = S \<times> T \<and> open S \<and> open T)) = open"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arbitrary union_of (\<lambda>U. \<exists>S T. U = S \<times> T \<and> open S \<and> open T) = open
[PROOF STEP]
by (force simp: union_of_def arbitrary_def intro: open_product_open open_Times)


[STATEMENT]
lemma ufa_\<alpha>_len_eq:
  assumes "ufa_\<alpha> l = ufa_\<alpha> l'"
  shows "length l = length l'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length l = length l'
[PROOF STEP]
by (metis assms le_antisym less_not_refl linorder_le_less_linear ufa_\<alpha>_refl)


[STATEMENT]
lemma compose_chart_apply_chart[simp]: "apply_chart (compose_chart p p' c) = p o apply_chart c"
  and compose_chart_inv_chart[simp]: "inv_chart (compose_chart p p' c) = inv_chart c o p'"
  and domain_compose_chart[simp]: "domain (compose_chart p p' c) = domain c"
  and codomain_compose_chart[simp]: "codomain (compose_chart p p' c) = p ` codomain c"
  if "homeomorphism UNIV UNIV p p'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (apply_chart (compose_chart p p' c) = p \<circ> apply_chart c &&& inv_chart (compose_chart p p' c) = inv_chart c \<circ> p') &&& domain (compose_chart p p' c) = domain c &&& codomain (compose_chart p p' c) = p ` codomain c
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
homeomorphism UNIV UNIV p p'

goal (1 subgoal):
 1. (apply_chart (compose_chart p p' c) = p \<circ> apply_chart c &&& inv_chart (compose_chart p p' c) = inv_chart c \<circ> p') &&& domain (compose_chart p p' c) = domain c &&& codomain (compose_chart p p' c) = p ` codomain c
[PROOF STEP]
by (transfer, auto)+


[STATEMENT]
lemma sum_Re_le_cmod: "(\<Sum>i\<in>I. Re (z i)) \<le> cmod (\<Sum>i\<in>I. z i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. Re (z i)) \<le> cmod (sum z I)
[PROOF STEP]
by (metis Re_sum complex_Re_le_cmod)


[STATEMENT]
lemma cosh_dist_general:
  assumes "are_endpoints_in_S p q a b"
  shows "cosh_dist a b
  = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
from \<open>are_endpoints_in_S p q a b\<close>
[PROOF STATE]
proof (chain)
picking this:
are_endpoints_in_S p q a b
[PROOF STEP]
have "p \<noteq> q" and "p \<in> S" and "q \<in> S" and "a \<in> hyp2" and "b \<in> hyp2"
    and "proj2_set_Col {p,q,a,b}"
[PROOF STATE]
proof (prove)
using this:
are_endpoints_in_S p q a b

goal (1 subgoal):
 1. (p \<noteq> q &&& p \<in> S &&& q \<in> S) &&& a \<in> hyp2 &&& b \<in> hyp2 &&& proj2_set_Col {p, q, a, b}
[PROOF STEP]
by (unfold are_endpoints_in_S_def) simp_all
[PROOF STATE]
proof (state)
this:
p \<noteq> q
p \<in> S
q \<in> S
a \<in> hyp2
b \<in> hyp2
proj2_set_Col {p, q, a, b}

goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
from \<open>a \<in> hyp2\<close> and \<open>b \<in> hyp2\<close> and \<open>p \<in> S\<close> and \<open>q \<in> S\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in> hyp2
b \<in> hyp2
p \<in> S
q \<in> S
[PROOF STEP]
have "a \<noteq> p" and "a \<noteq> q" and "b \<noteq> p" and "b \<noteq> q"
[PROOF STATE]
proof (prove)
using this:
a \<in> hyp2
b \<in> hyp2
p \<in> S
q \<in> S

goal (1 subgoal):
 1. (a \<noteq> p &&& a \<noteq> q) &&& b \<noteq> p &&& b \<noteq> q
[PROOF STEP]
by (simp_all add: hyp2_S_not_equal)
[PROOF STATE]
proof (state)
this:
a \<noteq> p
a \<noteq> q
b \<noteq> p
b \<noteq> q

goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
show "cosh_dist a b
    = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
assume "a = b"
[PROOF STATE]
proof (state)
this:
a = b

goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
hence "cosh_dist a b = 1"
[PROOF STATE]
proof (prove)
using this:
a = b

goal (1 subgoal):
 1. cosh_dist a b = 1
[PROOF STEP]
by (unfold cosh_dist_def exp_2dist_def) simp
[PROOF STATE]
proof (state)
this:
cosh_dist a b = 1

goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
from \<open>proj2_set_Col {p,q,a,b}\<close>
[PROOF STATE]
proof (chain)
picking this:
proj2_set_Col {p, q, a, b}
[PROOF STEP]
have "proj2_Col p q a"
[PROOF STATE]
proof (prove)
using this:
proj2_set_Col {p, q, a, b}

goal (1 subgoal):
 1. proj2_Col p q a
[PROOF STEP]
by (unfold \<open>a = b\<close>) (simp add: proj2_Col_iff_set_Col)
[PROOF STATE]
proof (state)
this:
proj2_Col p q a

goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
with \<open>p \<noteq> q\<close> and \<open>a \<noteq> p\<close> and \<open>a \<noteq> q\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> q
a \<noteq> p
a \<noteq> q
proj2_Col p q a
[PROOF STEP]
have "cross_ratio p q a b = 1"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> q
a \<noteq> p
a \<noteq> q
proj2_Col p q a

goal (1 subgoal):
 1. cross_ratio p q a b = 1
[PROOF STEP]
by (simp add: \<open>a = b\<close> cross_ratio_equal_1)
[PROOF STATE]
proof (state)
this:
cross_ratio p q a b = 1

goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
hence "(sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
      = 1"
[PROOF STATE]
proof (prove)
using this:
cross_ratio p q a b = 1

goal (1 subgoal):
 1. (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2 = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2 = 1

goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
with \<open>cosh_dist a b = 1\<close>
[PROOF STATE]
proof (chain)
picking this:
cosh_dist a b = 1
(sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2 = 1
[PROOF STEP]
show "cosh_dist a b
      = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2"
[PROOF STATE]
proof (prove)
using this:
cosh_dist a b = 1
(sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2 = 1

goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
assume "a \<noteq> b"
[PROOF STATE]
proof (state)
this:
a \<noteq> b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
let ?r = "endpoint_in_S a b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
let ?s = "endpoint_in_S b a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
from \<open>a \<noteq> b\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> b
[PROOF STEP]
have "exp_2dist a b = cross_ratio ?r ?s a b"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b

goal (1 subgoal):
 1. exp_2dist a b = cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b
[PROOF STEP]
by (unfold exp_2dist_def) simp
[PROOF STATE]
proof (state)
this:
exp_2dist a b = cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
from \<open>a \<noteq> b\<close> and \<open>are_endpoints_in_S p q a b\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> b
are_endpoints_in_S p q a b
[PROOF STEP]
have "(p = ?r \<and> q = ?s) \<or> (q = ?r \<and> p = ?s)"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b
are_endpoints_in_S p q a b

goal (1 subgoal):
 1. p = endpoint_in_S a b \<and> q = endpoint_in_S b a \<or> q = endpoint_in_S a b \<and> p = endpoint_in_S b a
[PROOF STEP]
by (rule are_endpoints_in_S)
[PROOF STATE]
proof (state)
this:
p = endpoint_in_S a b \<and> q = endpoint_in_S b a \<or> q = endpoint_in_S a b \<and> p = endpoint_in_S b a

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
show "cosh_dist a b
      = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
assume "p = ?r \<and> q = ?s"
[PROOF STATE]
proof (state)
this:
p = endpoint_in_S a b \<and> q = endpoint_in_S b a

goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
with \<open>exp_2dist a b = cross_ratio ?r ?s a b\<close>
[PROOF STATE]
proof (chain)
picking this:
exp_2dist a b = cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b
p = endpoint_in_S a b \<and> q = endpoint_in_S b a
[PROOF STEP]
have "exp_2dist a b = cross_ratio p q a b"
[PROOF STATE]
proof (prove)
using this:
exp_2dist a b = cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b
p = endpoint_in_S a b \<and> q = endpoint_in_S b a

goal (1 subgoal):
 1. exp_2dist a b = cross_ratio p q a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp_2dist a b = cross_ratio p q a b

goal (2 subgoals):
 1. ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
 2. \<not> ?P \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
thus "cosh_dist a b
        = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2"
[PROOF STATE]
proof (prove)
using this:
exp_2dist a b = cross_ratio p q a b

goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
by (unfold cosh_dist_def) (simp add: real_sqrt_divide)
[PROOF STATE]
proof (state)
this:
cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2

goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
assume "\<not> (p = ?r \<and> q = ?s)"
[PROOF STATE]
proof (state)
this:
\<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a)

goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
with \<open>(p = ?r \<and> q = ?s) \<or> (q = ?r \<and> p = ?s)\<close>
[PROOF STATE]
proof (chain)
picking this:
p = endpoint_in_S a b \<and> q = endpoint_in_S b a \<or> q = endpoint_in_S a b \<and> p = endpoint_in_S b a
\<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a)
[PROOF STEP]
have "q = ?r" and "p = ?s"
[PROOF STATE]
proof (prove)
using this:
p = endpoint_in_S a b \<and> q = endpoint_in_S b a \<or> q = endpoint_in_S a b \<and> p = endpoint_in_S b a
\<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a)

goal (1 subgoal):
 1. q = endpoint_in_S a b &&& p = endpoint_in_S b a
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
q = endpoint_in_S a b
p = endpoint_in_S b a

goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
with \<open>exp_2dist a b = cross_ratio ?r ?s a b\<close>
[PROOF STATE]
proof (chain)
picking this:
exp_2dist a b = cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b
q = endpoint_in_S a b
p = endpoint_in_S b a
[PROOF STEP]
have "exp_2dist a b = cross_ratio q p a b"
[PROOF STATE]
proof (prove)
using this:
exp_2dist a b = cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b
q = endpoint_in_S a b
p = endpoint_in_S b a

goal (1 subgoal):
 1. exp_2dist a b = cross_ratio q p a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp_2dist a b = cross_ratio q p a b

goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
have "{q,p,a,b} = {p,q,a,b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q, p, a, b} = {p, q, a, b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{q, p, a, b} = {p, q, a, b}

goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
with \<open>proj2_set_Col {p,q,a,b}\<close> and \<open>p \<noteq> q\<close> and \<open>a \<noteq> p\<close> and \<open>b \<noteq> p\<close>
        and \<open>a \<noteq> q\<close> and \<open>b \<noteq> q\<close>
[PROOF STATE]
proof (chain)
picking this:
proj2_set_Col {p, q, a, b}
p \<noteq> q
a \<noteq> p
b \<noteq> p
a \<noteq> q
b \<noteq> q
{q, p, a, b} = {p, q, a, b}
[PROOF STEP]
have "cross_ratio_correct p q a b" and "cross_ratio_correct q p a b"
[PROOF STATE]
proof (prove)
using this:
proj2_set_Col {p, q, a, b}
p \<noteq> q
a \<noteq> p
b \<noteq> p
a \<noteq> q
b \<noteq> q
{q, p, a, b} = {p, q, a, b}

goal (1 subgoal):
 1. cross_ratio_correct p q a b &&& cross_ratio_correct q p a b
[PROOF STEP]
by (unfold cross_ratio_correct_def) simp_all
[PROOF STATE]
proof (state)
this:
cross_ratio_correct p q a b
cross_ratio_correct q p a b

goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
hence "cross_ratio q p a b = 1 / (cross_ratio p q a b)"
[PROOF STATE]
proof (prove)
using this:
cross_ratio_correct p q a b
cross_ratio_correct q p a b

goal (1 subgoal):
 1. cross_ratio q p a b = 1 / cross_ratio p q a b
[PROOF STEP]
by (rule cross_ratio_swap_12)
[PROOF STATE]
proof (state)
this:
cross_ratio q p a b = 1 / cross_ratio p q a b

goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
with \<open>exp_2dist a b = cross_ratio q p a b\<close>
[PROOF STATE]
proof (chain)
picking this:
exp_2dist a b = cross_ratio q p a b
cross_ratio q p a b = 1 / cross_ratio p q a b
[PROOF STEP]
have "exp_2dist a b = 1 / (cross_ratio p q a b)"
[PROOF STATE]
proof (prove)
using this:
exp_2dist a b = cross_ratio q p a b
cross_ratio q p a b = 1 / cross_ratio p q a b

goal (1 subgoal):
 1. exp_2dist a b = 1 / cross_ratio p q a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp_2dist a b = 1 / cross_ratio p q a b

goal (1 subgoal):
 1. \<not> (p = endpoint_in_S a b \<and> q = endpoint_in_S b a) \<Longrightarrow> cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
thus "cosh_dist a b
        = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2"
[PROOF STATE]
proof (prove)
using this:
exp_2dist a b = 1 / cross_ratio p q a b

goal (1 subgoal):
 1. cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2
[PROOF STEP]
by (unfold cosh_dist_def) (simp add: real_sqrt_divide)
[PROOF STATE]
proof (state)
this:
cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cosh_dist a b = (sqrt (cross_ratio p q a b) + 1 / sqrt (cross_ratio p q a b)) / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma radical_sqrt_circle_circle_intersection:
  assumes absA: "(abscissa A) \<in> radical_sqrt" and ordA: "(ordinate A)  \<in> radical_sqrt"
      and absB: "(abscissa B) \<in> radical_sqrt" and ordB: "(ordinate B) \<in> radical_sqrt"
      and absC: "(abscissa C) \<in> radical_sqrt" and ordC: "(ordinate C) \<in> radical_sqrt"
      and absD: "(abscissa D) \<in> radical_sqrt" and ordD: "(ordinate D) \<in> radical_sqrt"
      and absE: "(abscissa E) \<in> radical_sqrt" and ordE: "(ordinate E) \<in> radical_sqrt"
      and absF: "(abscissa F) \<in> radical_sqrt" and ordF: "(ordinate F) \<in> radical_sqrt"
      and eqDist0: "distance A X = distance B C"
      and eqDist1: "distance D X = distance E F"
      and notEqual: "\<not> (A = D & distance B C = distance E F)"
  shows "(abscissa X) \<in> radical_sqrt & (ordinate X) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
have "sqrt ((abscissa X - abscissa A)^2 + (ordinate X - ordinate A) ^2) = sqrt ((abscissa B - abscissa C)^2 + (ordinate B - ordinate C) ^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2) = sqrt ((abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2)
[PROOF STEP]
by (metis (no_types) eqDist0 distance_def minus_diff_eq point_abscissa_diff point_dist_def point_ordinate_diff power2_minus)
[PROOF STATE]
proof (state)
this:
sqrt ((abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2) = sqrt ((abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2)

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence "(sqrt ((abscissa X - abscissa A)^2 + (ordinate X - ordinate A) ^2))^2 = (sqrt ((abscissa B - abscissa C)^2 + (ordinate B - ordinate C)^2)) ^2"
[PROOF STATE]
proof (prove)
using this:
sqrt ((abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2) = sqrt ((abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2)

goal (1 subgoal):
 1. (sqrt ((abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2))\<^sup>2 = (sqrt ((abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2))\<^sup>2
[PROOF STEP]
by (auto simp add: power_def)
[PROOF STATE]
proof (state)
this:
(sqrt ((abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2))\<^sup>2 = (sqrt ((abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2))\<^sup>2

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence l3: "(abscissa X - abscissa A)^2 + (ordinate X - ordinate A) ^2 = (abscissa B - abscissa C)^2 + (ordinate B - ordinate C)^2"
[PROOF STATE]
proof (prove)
using this:
(sqrt ((abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2))\<^sup>2 = (sqrt ((abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2))\<^sup>2

goal (1 subgoal):
 1. (abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2 = (abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2 = (abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
have "sqrt ((abscissa X - abscissa D)^2 + (ordinate X - ordinate D) ^2) = sqrt ((abscissa E - abscissa F)^2 + (ordinate E - ordinate F) ^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((abscissa X - abscissa D)\<^sup>2 + (ordinate X - ordinate D)\<^sup>2) = sqrt ((abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2)
[PROOF STEP]
by (metis (no_types) eqDist1 distance_def minus_diff_eq point_abscissa_diff point_dist_def point_ordinate_diff power2_minus)
[PROOF STATE]
proof (state)
this:
sqrt ((abscissa X - abscissa D)\<^sup>2 + (ordinate X - ordinate D)\<^sup>2) = sqrt ((abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2)

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence l3bis: "(abscissa X - abscissa D)^2 + (ordinate X - ordinate D) ^2 = (abscissa E - abscissa F)^2 + (ordinate E - ordinate F)^2"
[PROOF STATE]
proof (prove)
using this:
sqrt ((abscissa X - abscissa D)\<^sup>2 + (ordinate X - ordinate D)\<^sup>2) = sqrt ((abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2)

goal (1 subgoal):
 1. (abscissa X - abscissa D)\<^sup>2 + (ordinate X - ordinate D)\<^sup>2 = (abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(abscissa X - abscissa D)\<^sup>2 + (ordinate X - ordinate D)\<^sup>2 = (abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
have l4: "\<not> (abscissa A = abscissa D & ordinate A = ordinate D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (abscissa A = abscissa D \<and> ordinate A = ordinate D)
[PROOF STEP]
by (metis point_eq_iff notEqual eqDist0 eqDist1)
[PROOF STATE]
proof (state)
this:
\<not> (abscissa A = abscissa D \<and> ordinate A = ordinate D)

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
have "(abscissa B - abscissa C) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abscissa B - abscissa C \<in> radical_sqrt
[PROOF STEP]
by (metis absB absC radical_sqrt_rule_subtraction)
[PROOF STATE]
proof (state)
this:
abscissa B - abscissa C \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence sl1: "((abscissa B - abscissa C)^2) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
using this:
abscissa B - abscissa C \<in> radical_sqrt

goal (1 subgoal):
 1. (abscissa B - abscissa C)\<^sup>2 \<in> radical_sqrt
[PROOF STEP]
by (auto intro: radical_sqrt.intros simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(abscissa B - abscissa C)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
have "(ordinate B - ordinate C) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinate B - ordinate C \<in> radical_sqrt
[PROOF STEP]
by (metis ordB ordC radical_sqrt_rule_subtraction)
[PROOF STATE]
proof (state)
this:
ordinate B - ordinate C \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence "(ordinate B - ordinate C)^2 \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
using this:
ordinate B - ordinate C \<in> radical_sqrt

goal (1 subgoal):
 1. (ordinate B - ordinate C)\<^sup>2 \<in> radical_sqrt
[PROOF STEP]
by (auto intro: radical_sqrt.intros simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(ordinate B - ordinate C)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence sl3: "((abscissa B - abscissa C)^2 + (ordinate B - ordinate C)^2) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
using this:
(ordinate B - ordinate C)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. (abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2 \<in> radical_sqrt
[PROOF STEP]
by (metis radical_sqrt.intros(4) sl1)
[PROOF STATE]
proof (state)
this:
(abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
have "(abscissa E - abscissa F) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abscissa E - abscissa F \<in> radical_sqrt
[PROOF STEP]
by (metis absE absF radical_sqrt_rule_subtraction)
[PROOF STATE]
proof (state)
this:
abscissa E - abscissa F \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence sl4: "((abscissa E - abscissa F)^2) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
using this:
abscissa E - abscissa F \<in> radical_sqrt

goal (1 subgoal):
 1. (abscissa E - abscissa F)\<^sup>2 \<in> radical_sqrt
[PROOF STEP]
by (auto intro: radical_sqrt.intros simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(abscissa E - abscissa F)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
have "(ordinate E - ordinate F) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinate E - ordinate F \<in> radical_sqrt
[PROOF STEP]
by (metis ordE ordF radical_sqrt_rule_subtraction)
[PROOF STATE]
proof (state)
this:
ordinate E - ordinate F \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence "(ordinate E - ordinate F)^2 \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
using this:
ordinate E - ordinate F \<in> radical_sqrt

goal (1 subgoal):
 1. (ordinate E - ordinate F)\<^sup>2 \<in> radical_sqrt
[PROOF STEP]
by (auto intro: radical_sqrt.intros simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(ordinate E - ordinate F)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
hence "((abscissa E - abscissa F)^2 + (ordinate E - ordinate F)^2) \<in> radical_sqrt"
[PROOF STATE]
proof (prove)
using this:
(ordinate E - ordinate F)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. (abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2 \<in> radical_sqrt
[PROOF STEP]
by (metis radical_sqrt.intros(4) sl4)
[PROOF STATE]
proof (state)
this:
(abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
using radical_sqrt_simultaneous_quadratic_quadratic
            [of "abscissa A" "ordinate A" "(abscissa B - abscissa C)^2 + (ordinate B - ordinate C)^2"
                "abscissa D" "ordinate D" "(abscissa E - abscissa F)^2 + (ordinate E - ordinate F)^2"
                "abscissa X" "ordinate X"]
          absA ordA absD ordD l3 l3bis l4 sl3
[PROOF STATE]
proof (prove)
using this:
(abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2 \<in> radical_sqrt
\<lbrakk>abscissa A \<in> radical_sqrt; ordinate A \<in> radical_sqrt; (abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2 \<in> radical_sqrt; abscissa D \<in> radical_sqrt; ordinate D \<in> radical_sqrt; (abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2 \<in> radical_sqrt; \<not> (abscissa A = abscissa D \<and> ordinate A = ordinate D \<and> (abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2 = (abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2); (abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2 = (abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2; (abscissa X - abscissa D)\<^sup>2 + (ordinate X - ordinate D)\<^sup>2 = (abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2\<rbrakk> \<Longrightarrow> abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
abscissa A \<in> radical_sqrt
ordinate A \<in> radical_sqrt
abscissa D \<in> radical_sqrt
ordinate D \<in> radical_sqrt
(abscissa X - abscissa A)\<^sup>2 + (ordinate X - ordinate A)\<^sup>2 = (abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2
(abscissa X - abscissa D)\<^sup>2 + (ordinate X - ordinate D)\<^sup>2 = (abscissa E - abscissa F)\<^sup>2 + (ordinate E - ordinate F)\<^sup>2
\<not> (abscissa A = abscissa D \<and> ordinate A = ordinate D)
(abscissa B - abscissa C)\<^sup>2 + (ordinate B - ordinate C)\<^sup>2 \<in> radical_sqrt

goal (1 subgoal):
 1. abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
abscissa X \<in> radical_sqrt \<and> ordinate X \<in> radical_sqrt

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_mat_one: "mat_mod (1\<^sub>m n) = (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.mat_mod (1\<^sub>m n) = 1\<^sub>m n
[PROOF STEP]
by (intro eq_matI, simp_all add: mat_mod_def non_triv_m)


[STATEMENT]
lemma scale_left_commute: "a *s (b *s x) = b *s (a *s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a *s b *s x = b *s a *s x
[PROOF STEP]
by (simp add: mult.commute)


[STATEMENT]
lemma count_list_0_iff: "count_list xs x = 0 \<longleftrightarrow> x \<notin> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (count_list xs x = 0) = (x \<notin> set xs)
[PROOF STEP]
by (induction xs) simp_all


[STATEMENT]
lemma mat_mult_plus_distrib_right:
  assumes wf1: "mat nr nc m1"
  and wf2: "mat nc ncc m2"
  and wf3: "mat nc ncc m3"
  shows "mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)" (is "mat_mult nr m1 ?m23 = mat_plus ?m12 ?m13")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)
[PROOF STEP]
note wf = wf1 wf2 wf3
[PROOF STATE]
proof (state)
this:
mat nr nc m1
mat nc ncc m2
mat nc ncc m3

goal (1 subgoal):
 1. mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)
[PROOF STEP]
let ?m1_23 = "mat_mult nr m1 ?m23"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)
[PROOF STEP]
let ?m12_13 = "mat_plus ?m12 ?m13"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)
[PROOF STEP]
from wf
[PROOF STATE]
proof (chain)
picking this:
mat nr nc m1
mat nc ncc m2
mat nc ncc m3
[PROOF STEP]
have
    wf23: "mat nc ncc ?m23" and
    wf12: "mat nr ncc ?m12" and
    wf13: "mat nr ncc ?m13" and
    wf1_23: "mat nr ncc ?m1_23" and
    wf12_13: "mat nr ncc ?m12_13"
[PROOF STATE]
proof (prove)
using this:
mat nr nc m1
mat nc ncc m2
mat nc ncc m3

goal (1 subgoal):
 1. (mat nc ncc (mat_plus m2 m3) &&& mat nr ncc (mat_mult nr m1 m2)) &&& mat nr ncc (mat_mult nr m1 m3) &&& mat nr ncc (mat_mult nr m1 (mat_plus m2 m3)) &&& mat nr ncc (mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat nc ncc (mat_plus m2 m3)
mat nr ncc (mat_mult nr m1 m2)
mat nr ncc (mat_mult nr m1 m3)
mat nr ncc (mat_mult nr m1 (mat_plus m2 m3))
mat nr ncc (mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3))

goal (1 subgoal):
 1. mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)
[PROOF STEP]
proof (rule mat_eqI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. mat ?nr ?nc (mat_mult nr m1 (mat_plus m2 m3))
 2. mat ?nr ?nc (mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3))
 3. \<And>i j. \<lbrakk>i < ?nc; j < ?nr\<rbrakk> \<Longrightarrow> mat_mult nr m1 (mat_plus m2 m3) ! i ! j = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3) ! i ! j
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. mat ?nr ?nc (mat_mult nr m1 (mat_plus m2 m3))
 2. mat ?nr ?nc (mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3))
 3. \<And>i j. \<lbrakk>i < ?nc; j < ?nr\<rbrakk> \<Longrightarrow> mat_mult nr m1 (mat_plus m2 m3) ! i ! j = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3) ! i ! j
[PROOF STEP]
assume i: "i < ncc" and j: "j < nr"
[PROOF STATE]
proof (state)
this:
i < ncc
j < nr

goal (3 subgoals):
 1. mat ?nr ?nc (mat_mult nr m1 (mat_plus m2 m3))
 2. mat ?nr ?nc (mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3))
 3. \<And>i j. \<lbrakk>i < ?nc; j < ?nr\<rbrakk> \<Longrightarrow> mat_mult nr m1 (mat_plus m2 m3) ! i ! j = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3) ! i ! j
[PROOF STEP]
show "?m1_23 ! i ! j = ?m12_13 ! i ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_mult nr m1 (mat_plus m2 m3) ! i ! j = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3) ! i ! j
[PROOF STEP]
by (unfold mat_mult_index[OF wf1 wf23 j i]
           mat_plus_index[OF wf12 wf13 i j]
           mat_mult_index[OF wf1 wf2 j i]
           mat_mult_index[OF wf1 wf3 j i]
           col_mat_plus[OF wf2 wf3 i],
        rule scalar_vec_plus_distrib_right[OF row[OF wf1 j] col[OF wf2 i] col[OF wf3 i]])
[PROOF STATE]
proof (state)
this:
mat_mult nr m1 (mat_plus m2 m3) ! i ! j = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3) ! i ! j

goal (2 subgoals):
 1. mat nr ncc (mat_mult nr m1 (mat_plus m2 m3))
 2. mat nr ncc (mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3))
[PROOF STEP]
qed (insert wf, auto)
[PROOF STATE]
proof (state)
this:
mat_mult nr m1 (mat_plus m2 m3) = mat_plus (mat_mult nr m1 m2) (mat_mult nr m1 m3)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma parts_insert_subset: "insert X (parts H) \<subseteq> parts(insert X H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert X (parts H) \<subseteq> parts (insert X H)
[PROOF STEP]
by (blast intro: parts_mono [THEN [2] rev_subsetD])


[STATEMENT]
lemma SPEC_iff:
  assumes "P \<le> SPEC (\<lambda>s. Q s \<longrightarrow> R s)"
  and "P \<le> SPEC (\<lambda>s. \<not> Q s \<longrightarrow> \<not> R s)"
  shows "P \<le> SPEC (\<lambda>s. Q s \<longleftrightarrow> R s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<le> SPEC (\<lambda>s. Q s = R s)
[PROOF STEP]
using assms[THEN pw_le_iff[THEN iffD1]]
[PROOF STATE]
proof (prove)
using this:
nofail (SPEC (\<lambda>s. Q s \<longrightarrow> R s)) \<longrightarrow> nofail P \<and> (\<forall>x. inres P x \<longrightarrow> inres (SPEC (\<lambda>s. Q s \<longrightarrow> R s)) x)
nofail (SPEC (\<lambda>s. \<not> Q s \<longrightarrow> \<not> R s)) \<longrightarrow> nofail P \<and> (\<forall>x. inres P x \<longrightarrow> inres (SPEC (\<lambda>s. \<not> Q s \<longrightarrow> \<not> R s)) x)

goal (1 subgoal):
 1. P \<le> SPEC (\<lambda>s. Q s = R s)
[PROOF STEP]
by (auto intro!: pw_leI)