[STATEMENT]
lemma ac_units:
  assumes "x \<in> nonzero Q\<^sub>p"
  assumes "n > 0"
  shows "ac n x \<in> Units (Zp_res_ring n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ac n x \<in> Units (residue_ring (p ^ n))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ac n x \<in> Units (residue_ring (p ^ n))
[PROOF STEP]
obtain y where y_def: "y = inv x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. y = inv x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y = inv x

goal (1 subgoal):
 1. ac n x \<in> Units (residue_ring (p ^ n))
[PROOF STEP]
have y_nz: "y \<in> nonzero Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> nonzero Q\<^sub>p
[PROOF STEP]
using assms(1) nonzero_inverse_Qp y_def
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p
?u \<in> nonzero Q\<^sub>p \<Longrightarrow> inv ?u \<in> nonzero Q\<^sub>p
y = inv x

goal (1 subgoal):
 1. y \<in> nonzero Q\<^sub>p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. ac n x \<in> Units (residue_ring (p ^ n))
[PROOF STEP]
have 0: "ac n (x \<otimes> y) = (ac n x) \<otimes>\<^bsub>Zp_res_ring n\<^esub> (ac n y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ac n (x \<otimes> y) = ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n y
[PROOF STEP]
using ac_mult' assms(1) y_nz
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> nonzero Q\<^sub>p; ?y \<in> nonzero Q\<^sub>p\<rbrakk> \<Longrightarrow> ac ?n (?x \<otimes> ?y) = ac ?n ?x \<otimes>\<^bsub>residue_ring (p ^ ?n)\<^esub> ac ?n ?y
x \<in> nonzero Q\<^sub>p
y \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. ac n (x \<otimes> y) = ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ac n (x \<otimes> y) = ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n y

goal (1 subgoal):
 1. ac n x \<in> Units (residue_ring (p ^ n))
[PROOF STEP]
have 1: "x \<otimes> y = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<otimes> y = \<one>
[PROOF STEP]
by (metis Qp.field_axioms Qp.nonzero_memE Qp.nonzero_memE assms(1) field.field_inv(2) y_def)
[PROOF STATE]
proof (state)
this:
x \<otimes> y = \<one>

goal (1 subgoal):
 1. ac n x \<in> Units (residue_ring (p ^ n))
[PROOF STEP]
have 2: "(ac n x) \<otimes>\<^bsub>Zp_res_ring n\<^esub> (ac n y) = \<one>\<^bsub>Zp_res_ring n\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n y = \<one>\<^bsub>residue_ring (p ^ n)\<^esub>
[PROOF STEP]
using "0" "1" ac_one' assms(2)
[PROOF STATE]
proof (prove)
using this:
ac n (x \<otimes> y) = ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n y
x \<otimes> y = \<one>
0 < ?n \<Longrightarrow> ac ?n \<one> = \<one>\<^bsub>residue_ring (p ^ ?n)\<^esub>
0 < n

goal (1 subgoal):
 1. ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n y = \<one>\<^bsub>residue_ring (p ^ n)\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n y = \<one>\<^bsub>residue_ring (p ^ n)\<^esub>

goal (1 subgoal):
 1. ac n x \<in> Units (residue_ring (p ^ n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ac n x \<in> Units (residue_ring (p ^ n))
[PROOF STEP]
by (metis "2" R_comm_monoid ac_in_res_ring assms(1) assms(2) comm_monoid.UnitsI(1) nonzero_inverse_Qp y_def)
[PROOF STATE]
proof (state)
this:
ac n x \<in> Units (residue_ring (p ^ n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mpoly_sub_conv:
  fixes x :: "'a::comm_ring_1"
  shows "poly p x - poly q x = poly p x + -1 * poly q x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p x - poly q x = poly p x + - (1::'a) * poly q x
[PROOF STEP]
by simp


[STATEMENT]
lemma D_summable:
  assumes x: "x > 0"
  shows   "summable (\<lambda>n. D (real n + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. D (real n + x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>n. D (real n + x))
[PROOF STEP]
have *: "summable (\<lambda>n. 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2))
[PROOF STEP]
by (rule telescope_summable' real_tendsto_divide_at_top tendsto_const
             filterlim_tendsto_pos_mult_at_top filterlim_pow_at_top
             filterlim_tendsto_add_at_top filterlim_real_sequentially | simp)+
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2))

goal (1 subgoal):
 1. summable (\<lambda>n. D (real n + x))
[PROOF STEP]
show "summable (\<lambda>n. D (real n + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. D (real n + x))
[PROOF STEP]
proof (rule summable_comparison_test[OF _ *], rule exI[of _ 2], safe)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 2 \<le> n \<Longrightarrow> norm (D (real n + x)) \<le> 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2)
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 2 \<le> n \<Longrightarrow> norm (D (real n + x)) \<le> 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2)
[PROOF STEP]
assume "n \<ge> 2"
[PROOF STATE]
proof (state)
this:
2 \<le> n

goal (1 subgoal):
 1. \<And>n. 2 \<le> n \<Longrightarrow> norm (D (real n + x)) \<le> 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2)
[PROOF STEP]
show "norm (D (real n + x)) \<le> 1 / (12 * (x + real n)^2) - 1 / (12 * (x + real (Suc n))^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (D (real n + x)) \<le> 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2)
[PROOF STEP]
using stirling_trapezium[of "real n + x"] x
[PROOF STATE]
proof (prove)
using this:
0 < real n + x \<Longrightarrow> D (real n + x) \<in> {0..1 / (12 * (real n + x)\<^sup>2) - 1 / (12 * (real n + x + 1)\<^sup>2)}
0 < x

goal (1 subgoal):
 1. norm (D (real n + x)) \<le> 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2)
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
norm (D (real n + x)) \<le> 1 / (12 * (x + real n)\<^sup>2) - 1 / (12 * (x + real (Suc n))\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. D (real n + x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subgraph_has_max_density:
  assumes "finite_graph G" and "nonempty_graph G" and "uwellformed G"
  shows "\<exists>G'. density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
have "G \<in> nonempty_subgraphs G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<in> nonempty_subgraphs G
[PROOF STEP]
unfolding nonempty_subgraphs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<in> {G'. uwellformed G' \<and> subgraph G' G \<and> nonempty_graph G'}
[PROOF STEP]
using subgraph_refl assms
[PROOF STATE]
proof (prove)
using this:
subgraph ?G ?G
finite_graph G
nonempty_graph G
uwellformed G

goal (1 subgoal):
 1. G \<in> {G'. uwellformed G' \<and> subgraph G' G \<and> nonempty_graph G'}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
G \<in> nonempty_subgraphs G

goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
hence "density G \<in> density ` nonempty_subgraphs G"
[PROOF STATE]
proof (prove)
using this:
G \<in> nonempty_subgraphs G

goal (1 subgoal):
 1. Ugraph_Lemmas.density G \<in> Ugraph_Lemmas.density ` nonempty_subgraphs G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Ugraph_Lemmas.density G \<in> Ugraph_Lemmas.density ` nonempty_subgraphs G

goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
hence "(density ` nonempty_subgraphs G) \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
Ugraph_Lemmas.density G \<in> Ugraph_Lemmas.density ` nonempty_subgraphs G

goal (1 subgoal):
 1. Ugraph_Lemmas.density ` nonempty_subgraphs G \<noteq> {}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
Ugraph_Lemmas.density ` nonempty_subgraphs G \<noteq> {}

goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
hence "max_density G \<in> (density ` nonempty_subgraphs G)"
[PROOF STATE]
proof (prove)
using this:
Ugraph_Lemmas.density ` nonempty_subgraphs G \<noteq> {}

goal (1 subgoal):
 1. max_density G \<in> Ugraph_Lemmas.density ` nonempty_subgraphs G
[PROOF STEP]
unfolding max_density_def
[PROOF STATE]
proof (prove)
using this:
Ugraph_Lemmas.density ` nonempty_subgraphs G \<noteq> {}

goal (1 subgoal):
 1. Max (Ugraph_Lemmas.density ` nonempty_subgraphs G) \<in> Ugraph_Lemmas.density ` nonempty_subgraphs G
[PROOF STEP]
by (auto simp add: nonempty_subgraphs_finite[OF assms(1)] Max.closed)
[PROOF STATE]
proof (state)
this:
max_density G \<in> Ugraph_Lemmas.density ` nonempty_subgraphs G

goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
max_density G \<in> Ugraph_Lemmas.density ` nonempty_subgraphs G

goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
unfolding nonempty_subgraphs_def
[PROOF STATE]
proof (prove)
using this:
max_density G \<in> Ugraph_Lemmas.density ` {G'. uwellformed G' \<and> subgraph G' G \<and> nonempty_graph G'}

goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
using subgraph_finite[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
max_density G \<in> Ugraph_Lemmas.density ` {G'. uwellformed G' \<and> subgraph G' G \<and> nonempty_graph G'}
subgraph ?G' G \<Longrightarrow> finite_graph ?G'

goal (1 subgoal):
 1. \<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>G'. Ugraph_Lemmas.density G' = max_density G \<and> subgraph G' G \<and> nonempty_graph G' \<and> finite_graph G' \<and> uwellformed G'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Inf_inf_closed: "Inf_closed_set (X::'a::complete_lattice set) \<Longrightarrow> inf_closed_set X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_closed_set X \<Longrightarrow> inf_closed_set X
[PROOF STEP]
by (metis Inf_closed_set_def empty_subsetI inf_Inf inf_closed_set_def insert_subset)


[STATEMENT]
lemma funpow_stability: "(f ^^ Suc k) a = (f ^^ k) a \<Longrightarrow> ((f ^^ j) a, (f ^^ k) a) \<in> leq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ Suc k) a = (f ^^ k) a \<Longrightarrow> ((f ^^ j) a, (f ^^ k) a) \<in> leq
[PROOF STEP]
using funpow_prefix funpow_suffix[where j="j - k" and k=k]
[PROOF STATE]
proof (prove)
using this:
?j < ?k \<Longrightarrow> ((f ^^ ?j) a, (f ^^ ?k) a) \<in> leq
(f ^^ Suc k) a = (f ^^ k) a \<Longrightarrow> ((f ^^ (j - k + k)) a, (f ^^ k) a) \<in> leq

goal (1 subgoal):
 1. (f ^^ Suc k) a = (f ^^ k) a \<Longrightarrow> ((f ^^ j) a, (f ^^ k) a) \<in> leq
[PROOF STEP]
by (cases "j < k") simp_all


[STATEMENT]
lemma Carmichael_number_not_prime: "Carmichael_number n \<Longrightarrow> \<not>prime n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael_number n \<Longrightarrow> \<not> prime n
[PROOF STEP]
by (auto simp: Carmichael_number_def)


[STATEMENT]
lemma subsets_smash_property_R:
  fixes subsets1 subsets2 :: "(nat list*nat list) list"
  fixes n:: "nat"
  shows "\<forall> (elem :: nat list*nat list). (List.member (subsets_smash_R n subsets1 subsets2) elem) \<longrightarrow>
    (\<exists> (elem1::nat list*nat list). \<exists> (elem2::nat list*nat list).
      (elem1 \<in> set(subsets1) \<and> elem2 \<in> set(subsets2) \<and> elem = ((fst elem1) @ (map ((+) n) (fst elem2)), (snd elem1) @ (map ((+) n) (snd elem2)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
let ?fst_component2 = "subsets_first_component_list subsets2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
let ?snd_component2 = "subsets_second_component_list subsets2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
let ?new_subsets = "map (\<lambda>I. ((map ((+) n)) (fst I),  (map ((+) n)) (snd I))) subsets2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
(* a slightly unorthodox use of signs_smash, but it closes the proof *)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
have "subsets_smash_R n subsets1 subsets2 = smash_list_list subsets1 ?new_subsets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subsets_smash_R n subsets1 subsets2 = smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)
[PROOF STEP]
unfolding subsets_smash_R_def smash_list_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>l1. map (\<lambda>l2. (fst l1 @ map ((+) n) (fst l2), snd l1 @ map ((+) n) (snd l2))) subsets2) subsets1) = concat (map (\<lambda>l1. map (\<lambda>l2. (fst l1 @ fst l2, snd l1 @ snd l2)) (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)) subsets1)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>l1. map (\<lambda>l2. (fst l1 @ map ((+) n) (fst l2), snd l1 @ map ((+) n) (snd l2))) subsets2) subsets1) = concat (map (\<lambda>l1. map ((\<lambda>l2. (fst l1 @ fst l2, snd l1 @ snd l2)) \<circ> (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I)))) subsets2) subsets1)
[PROOF STEP]
by (simp add: comp_def)
[PROOF STATE]
proof (state)
this:
subsets_smash_R n subsets1 subsets2 = smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)

goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subsets_smash_R n subsets1 subsets2 = smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subsets_smash_R n subsets1 subsets2 = smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)

goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
using smash_list_list_property_set[of subsets1 ?new_subsets]
[PROOF STATE]
proof (prove)
using this:
subsets_smash_R n subsets1 subsets2 = smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)
\<forall>elem. elem \<in> set (smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)) \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2) \<and> elem = (fst elem1 @ fst elem2, snd elem1 @ snd elem2))

goal (1 subgoal):
 1. \<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>subsets_smash_R n subsets1 subsets2 = smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2); \<forall>a b. (a, b) \<in> set (smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)) \<longrightarrow> (\<exists>aa ba. (aa, ba) \<in> set subsets1 \<and> (\<exists>elem2\<in>set subsets2. a = aa @ map ((+) n) (fst elem2) \<and> b = ba @ map ((+) n) (snd elem2))); List.member (smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)) (a, b)\<rbrakk> \<Longrightarrow> \<exists>aa ba. (aa, ba) \<in> set subsets1 \<and> (\<exists>ab bb. (ab, bb) \<in> set subsets2 \<and> a = aa @ map ((+) n) ab \<and> b = ba @ map ((+) n) bb)
[PROOF STEP]
using imageE in_set_member set_map smash_list_list_property_set
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?b \<in> ?f ` ?A; \<And>x. \<lbrakk>?b = ?f x; x \<in> ?A\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
(?x \<in> set ?xs) = List.member ?xs ?x
set (map ?f ?xs) = ?f ` set ?xs
\<forall>elem. elem \<in> set (smash_list_list ?l1.0 ?l2.0) \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set ?l1.0 \<and> elem2 \<in> set ?l2.0 \<and> elem = (fst elem1 @ fst elem2, snd elem1 @ snd elem2))

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>subsets_smash_R n subsets1 subsets2 = smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2); \<forall>a b. (a, b) \<in> set (smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)) \<longrightarrow> (\<exists>aa ba. (aa, ba) \<in> set subsets1 \<and> (\<exists>elem2\<in>set subsets2. a = aa @ map ((+) n) (fst elem2) \<and> b = ba @ map ((+) n) (snd elem2))); List.member (smash_list_list subsets1 (map (\<lambda>I. (map ((+) n) (fst I), map ((+) n) (snd I))) subsets2)) (a, b)\<rbrakk> \<Longrightarrow> \<exists>aa ba. (aa, ba) \<in> set subsets1 \<and> (\<exists>ab bb. (ab, bb) \<in> set subsets2 \<and> a = aa @ map ((+) n) ab \<and> b = ba @ map ((+) n) bb)
[PROOF STEP]
by (smt (z3) prod.exhaust_sel)
[PROOF STATE]
proof (state)
this:
\<forall>elem. List.member (subsets_smash_R n subsets1 subsets2) elem \<longrightarrow> (\<exists>elem1 elem2. elem1 \<in> set subsets1 \<and> elem2 \<in> set subsets2 \<and> elem = (fst elem1 @ map ((+) n) (fst elem2), snd elem1 @ map ((+) n) (snd elem2)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_bernpoly [continuous_intros]:
  "continuous_on A (bernpoly n :: 'a \<Rightarrow> 'a :: real_normed_algebra_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on A (bernpoly n)
[PROOF STEP]
unfolding bernpoly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on A (\<lambda>x. \<Sum>k\<le>n. of_nat (n choose k) * of_real (bernoulli k) * x ^ (n - k))
[PROOF STEP]
by (auto intro!: continuous_intros)


[STATEMENT]
lemma liouville_lambda_power:
  "liouville_lambda (n ^ m) =
     (if n = 0 \<and> m > 0 then 0 else if even m then 1 else liouville_lambda n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liouville_lambda (n ^ m) = (if n = 0 \<and> 0 < m then 0::'a else if even m then 1::'a else liouville_lambda n)
[PROOF STEP]
by (auto simp: liouville_lambda_power_even liouville_lambda_power_odd power_0_left)


[STATEMENT]
lemma set_generate'':
  "set (generate' A B a b) =
  {(x, y). (x, y) \<noteq> (zeroes (length a), zeroes (length b)) \<and> x \<le>\<^sub>v replicate (length a) A \<and> y \<le>\<^sub>v replicate (length b) B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (generate' A B a b) = {(x, y). (x, y) \<noteq> (zeroes (length a), zeroes (length b)) \<and> x \<le>\<^sub>v replicate (length a) A \<and> y \<le>\<^sub>v replicate (length b) B}
[PROOF STEP]
by (simp add: set_generate' set_gen2')


[STATEMENT]
lemma neg_less_minus_divideR_eq [field_simps]:
  "a < - (b /\<^sub>R c) \<longleftrightarrow> - b < c *\<^sub>R a" if "c < 0"
   for a b :: "'a :: ordered_real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a < - (b /\<^sub>R c)) = (- b < c *\<^sub>R a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a < - (b /\<^sub>R c)) = (- b < c *\<^sub>R a)
[PROOF STEP]
have *: "- b = c *\<^sub>R a \<longleftrightarrow> b = - (c *\<^sub>R a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- b = c *\<^sub>R a) = (b = - (c *\<^sub>R a))
[PROOF STEP]
by (metis add.inverse_inverse)
[PROOF STATE]
proof (state)
this:
(- b = c *\<^sub>R a) = (b = - (c *\<^sub>R a))

goal (1 subgoal):
 1. (a < - (b /\<^sub>R c)) = (- b < c *\<^sub>R a)
[PROOF STEP]
from that neg_le_minus_divideR_eq [of c a b]
[PROOF STATE]
proof (chain)
picking this:
c < 0
c < 0 \<Longrightarrow> (a \<le> - (b /\<^sub>R c)) = (- b \<le> c *\<^sub>R a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c < 0
c < 0 \<Longrightarrow> (a \<le> - (b /\<^sub>R c)) = (- b \<le> c *\<^sub>R a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_remove1:
  "length(remove1 x xs) = (if x \<in> set xs then length xs - 1 else length xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (remove1 x xs) = (if x \<in> set xs then length xs - 1 else length xs)
[PROOF STEP]
by (induct xs) (auto dest!:length_pos_if_in_set)


[STATEMENT]
lemma fromCard_toCard:
  "\<lbrakk>|A| \<le>o r; Card_order r; b \<in> A\<rbrakk> \<Longrightarrow> fromCard A r (toCard A r b) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>|A| \<le>o r; Card_order r; b \<in> A\<rbrakk> \<Longrightarrow> fromCard A r (toCard A r b) = b
[PROOF STEP]
unfolding fromCard_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>|A| \<le>o r; Card_order r; b \<in> A\<rbrakk> \<Longrightarrow> (SOME ba. ba \<in> A \<and> toCard A r ba = toCard A r b) = b
[PROOF STEP]
by (rule some_equality) (auto simp add: toCard_inj)


[STATEMENT]
lemma rel_spmf_of_setI:
  assumes card: "\<And>X. X \<subseteq> A \<Longrightarrow> card B * card X \<le> card A * card {y\<in>B. \<exists>x\<in>X. R x y}"
  and eq: "(finite A \<and> A \<noteq> {}) \<longleftrightarrow> (finite B \<and> B \<noteq> {})"
  shows "rel_spmf R (spmf_of_set A) (spmf_of_set B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
finite' A = finite' B

goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
by(clarsimp simp add: spmf_of_set_def card rel_pmf_of_setI simp del: spmf_of_pmf_pmf_of_set cong: conj_cong)


[STATEMENT]
lemma longest_common_prefix_max_prefix:
  "\<lbrakk> prefix ps xs; prefix ps ys \<rbrakk>
   \<Longrightarrow> prefix ps (longest_common_prefix xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prefix ps xs; prefix ps ys\<rbrakk> \<Longrightarrow> prefix ps (longest_common_prefix xs ys)
[PROOF STEP]
by(induction xs ys arbitrary: ps rule: longest_common_prefix.induct)
  (auto simp: prefix_Cons)


[STATEMENT]
lemma Vset_succ_rank_le: "Ord k \<Longrightarrow> a \<^bold>\<in> Vset (succ k) \<Longrightarrow> rank a \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ord k; a \<^bold>\<in> Vset (succ k)\<rbrakk> \<Longrightarrow> rank a \<le> k
[PROOF STEP]
by (unfold rank_def) (rule OrdLeast_le)


[STATEMENT]
lemma path_nret_ex_all_cd: assumes \<open>is_path \<pi>\<close> \<open>\<forall> i. \<pi> i \<noteq> return\<close> shows \<open>\<forall> i. (\<exists> j\<ge>i. (\<forall> k>j. k cd\<^bsup>\<pi>\<^esup>\<rightarrow> j))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. \<exists>j\<ge>i. \<forall>k>j. k cd\<^bsup>\<pi>\<^esup>\<rightarrow> j
[PROOF STEP]
unfolding is_cdi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. \<exists>j\<ge>i. \<forall>k>j. is_path \<pi> \<and> j < k \<and> \<pi> k \<noteq> local.return \<and> (\<forall>ja\<in>{j..k}. \<pi> ja \<noteq> ipd (\<pi> j))
[PROOF STEP]
using assms path_nret_ex_nipd[OF assms]
[PROOF STATE]
proof (prove)
using this:
is_path \<pi>
\<forall>i. \<pi> i \<noteq> local.return
\<forall>i. \<exists>j\<ge>i. \<forall>k>j. \<pi> k \<noteq> ipd (\<pi> j)

goal (1 subgoal):
 1. \<forall>i. \<exists>j\<ge>i. \<forall>k>j. is_path \<pi> \<and> j < k \<and> \<pi> k \<noteq> local.return \<and> (\<forall>ja\<in>{j..k}. \<pi> ja \<noteq> ipd (\<pi> j))
[PROOF STEP]
by (metis atLeastAtMost_iff ipd_not_self linorder_neqE_nat not_le path_nodes)


[STATEMENT]
lemma cong_minus_minus_iff:
  "[- b = - c] (mod a) \<longleftrightarrow> [b = c] (mod a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [- b = - c] (mod a) = [b = c] (mod a)
[PROOF STEP]
using cong_diff_iff_cong_0 [of b c a] cong_diff_iff_cong_0 [of "- b" "- c" a]
[PROOF STATE]
proof (prove)
using this:
[b - c = 0::'a] (mod a) = [b = c] (mod a)
[- b - - c = 0::'a] (mod a) = [- b = - c] (mod a)

goal (1 subgoal):
 1. [- b = - c] (mod a) = [b = c] (mod a)
[PROOF STEP]
by (simp add: cong_0_iff dvd_diff_commute)


[STATEMENT]
lemma derived_set_subset: "S \<subseteq> topspace X \<Longrightarrow> (X derived_set_of S \<subseteq> S \<longleftrightarrow> closedin X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> topspace X \<Longrightarrow> (X derived_set_of S \<subseteq> S) = closedin X S
[PROOF STEP]
by (simp add: closedin_contains_derived_set)


[STATEMENT]
lemma ord_option_trans:
  "\<lbrakk> ord_option ord x y; ord_option ord y z;
    \<And>a b c. \<lbrakk> a \<in> set_option x; b \<in> set_option y; c \<in> set_option z; ord a b; ord b c \<rbrakk> \<Longrightarrow> ord a c \<rbrakk>
  \<Longrightarrow> ord_option ord x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ord_option ord x y; ord_option ord y z; \<And>a b c. \<lbrakk>a \<in> set_option x; b \<in> set_option y; c \<in> set_option z; ord a b; ord b c\<rbrakk> \<Longrightarrow> ord a c\<rbrakk> \<Longrightarrow> ord_option ord x z
[PROOF STEP]
by(auto elim!: ord_option.cases)


[STATEMENT]
lemma primerew: fixes p::nat shows  "\<lbrakk>m dvd p; m~=1; m~=p\<rbrakk> \<Longrightarrow> ~ prime p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m dvd p; m \<noteq> 1; m \<noteq> p\<rbrakk> \<Longrightarrow> \<not> prime p
[PROOF STEP]
by (auto simp add: prime_nat_iff)


[STATEMENT]
lemma (in sigma_finite_measure) borel_measurable_nn_integral[measurable (raw)]:
  "case_prod f \<in> borel_measurable (N \<Otimes>\<^sub>M M) \<Longrightarrow> (\<lambda>x. \<integral>\<^sup>+ y. f x y \<partial>M) \<in> borel_measurable N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f x y) \<in> borel_measurable (N \<Otimes>\<^sub>M M) \<Longrightarrow> (\<lambda>x. integral\<^sup>N M (f x)) \<in> borel_measurable N
[PROOF STEP]
using borel_measurable_nn_integral_fst[of "case_prod f" N]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). f x y) \<in> borel_measurable (N \<Otimes>\<^sub>M M) \<Longrightarrow> (\<lambda>x. \<integral>\<^sup>+ y. (case (x, y) of (x, xa) \<Rightarrow> f x xa) \<partial>M) \<in> borel_measurable N

goal (1 subgoal):
 1. (\<lambda>(x, y). f x y) \<in> borel_measurable (N \<Otimes>\<^sub>M M) \<Longrightarrow> (\<lambda>x. integral\<^sup>N M (f x)) \<in> borel_measurable N
[PROOF STEP]
by simp


[STATEMENT]
lemma D2_ALL:
  shows "(\<forall>d. P d) = (\<forall>d\<in>{D1, D2}. P d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>d. P d) = (\<forall>d\<in>{D1, D2}. P d)
[PROOF STEP]
using D2_UNIV
[PROOF STATE]
proof (prove)
using this:
UNIV = set [D1, D2]

goal (1 subgoal):
 1. (\<forall>d. P d) = (\<forall>d\<in>{D1, D2}. P d)
[PROOF STEP]
by auto


[STATEMENT]
lemma at_least_at_most_Sup: "\<lbrakk> a \<in> carrier L; b \<in> carrier L; a \<sqsubseteq> b \<rbrakk> \<Longrightarrow> \<Squnion> \<lbrace>a..b\<rbrace> .= b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier L; b \<in> carrier L; a \<sqsubseteq> b\<rbrakk> \<Longrightarrow> \<Squnion>\<lbrace>a..b\<rbrace> .= b
[PROOF STEP]
by (rule weak_le_antisym [OF sup_least sup_upper]) (auto simp add: at_least_at_most_closed)


[STATEMENT]
lemma matrix_to_iarray_mat[code_unfold]:
  "matrix_to_iarray (mat k ::'a::{zero}^'n::{mod_type}^'n::{mod_type}) = mat_iarray k CARD('n::{mod_type})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (mat k) = mat_iarray k CARD('n)
[PROOF STEP]
unfolding matrix_to_iarray_def o_def vec_to_iarray_def mat_def mat_iarray_def tabulate2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. (\<chi>i j. if i = j then k else (0::'a)) $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('n)) [0..<CARD('n)]) = IArray.of_fun (\<lambda>i. IArray.of_fun (\<lambda>j. if i = j then k else (0::'a)) CARD('n)) CARD('n)
[PROOF STEP]
using from_nat_eq_imp_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>mod_type_class.from_nat ?x = mod_type_class.from_nat ?xa; ?x < CARD(?'a); ?xa < CARD(?'a)\<rbrakk> \<Longrightarrow> ?x = ?xa

goal (1 subgoal):
 1. IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. (\<chi>i j. if i = j then k else (0::'a)) $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('n)) [0..<CARD('n)]) = IArray.of_fun (\<lambda>i. IArray.of_fun (\<lambda>j. if i = j then k else (0::'a)) CARD('n)) CARD('n)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma assoc_bpp_restrict:"\<lbrakk> A \<subseteq> B; assoc_bpp B f\<rbrakk> \<Longrightarrow> assoc_bpp A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; assoc_bpp B f\<rbrakk> \<Longrightarrow> assoc_bpp A f
[PROOF STEP]
apply (simp add:assoc_bpp_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; \<forall>a\<in>addition_set f B. \<forall>b\<in>addition_set f B. \<forall>c\<in>addition_set f B. a \<^sub>f+ b \<^sub>f+ c = a \<^sub>f+ (b \<^sub>f+ c)\<rbrakk> \<Longrightarrow> \<forall>a\<in>addition_set f A. \<forall>b\<in>addition_set f A. \<forall>c\<in>addition_set f A. a \<^sub>f+ b \<^sub>f+ c = a \<^sub>f+ (b \<^sub>f+ c)
[PROOF STEP]
apply (rule ballI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>A \<subseteq> B; \<forall>a\<in>addition_set f B. \<forall>b\<in>addition_set f B. \<forall>c\<in>addition_set f B. a \<^sub>f+ b \<^sub>f+ c = a \<^sub>f+ (b \<^sub>f+ c); a \<in> addition_set f A; b \<in> addition_set f A; c \<in> addition_set f A\<rbrakk> \<Longrightarrow> a \<^sub>f+ b \<^sub>f+ c = a \<^sub>f+ (b \<^sub>f+ c)
[PROOF STEP]
apply (frule addition_set_mono[of A B f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c. \<lbrakk>A \<subseteq> B; \<forall>a\<in>addition_set f B. \<forall>b\<in>addition_set f B. \<forall>c\<in>addition_set f B. a \<^sub>f+ b \<^sub>f+ c = a \<^sub>f+ (b \<^sub>f+ c); a \<in> addition_set f A; b \<in> addition_set f A; c \<in> addition_set f A; addition_set f A \<subseteq> addition_set f B\<rbrakk> \<Longrightarrow> a \<^sub>f+ b \<^sub>f+ c = a \<^sub>f+ (b \<^sub>f+ c)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Ring) rMulZeroDiv:
     "\<lbrakk> x \<in> carrier R; y \<in> carrier R; x = \<zero> \<or> y = \<zero> \<rbrakk> \<Longrightarrow> x  \<cdot>\<^sub>r  y = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; x = \<zero> \<or> y = \<zero>\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r y = \<zero>
[PROOF STEP]
apply (erule disjE, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<zero> \<in> carrier R; y \<in> carrier R; x = \<zero>\<rbrakk> \<Longrightarrow> \<zero> \<cdot>\<^sub>r y = \<zero>
 2. \<lbrakk>x \<in> carrier R; y \<in> carrier R; y = \<zero>\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r y = \<zero>
[PROOF STEP]
apply (rule ring_times_0_x, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; y = \<zero>\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r y = \<zero>
[PROOF STEP]
apply (simp, rule ring_times_x_0, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma expands_to_exp_0_pull_out2:
  assumes "((\<lambda>x. exp (f x - c * ln (b x))) expands_to MS xs g) (b # basis)"
  assumes "basis_wf (b # basis)"
  shows   "((\<lambda>x. exp (f x)) expands_to MS (shift_ms_aux c xs)
             (\<lambda>x. b x powr c * g x)) (b # basis)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. exp (f x)) expands_to MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) (b # basis)
[PROOF STEP]
proof (rule expands_to.intros)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_expansion (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) (b # basis)
 2. \<forall>\<^sub>F x in at_top. eval (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) x = exp (f x)
[PROOF STEP]
show "is_expansion (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) (b # basis)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_expansion (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) (b # basis)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. exp (f x - c * ln (b x))) expands_to MS xs g) (b # basis)
basis_wf (b # basis)

goal (1 subgoal):
 1. is_expansion (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) (b # basis)
[PROOF STEP]
unfolding expands_to.simps
[PROOF STATE]
proof (prove)
using this:
\<exists>F basisa fa. (\<lambda>x. exp (f x - c * ln (b x))) = fa \<and> MS xs g = F \<and> b # basis = basisa \<and> is_expansion F basisa \<and> (\<forall>\<^sub>F x in at_top. eval F x = fa x)
basis_wf (b # basis)

goal (1 subgoal):
 1. is_expansion (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) (b # basis)
[PROOF STEP]
by (auto intro!: shift_ms_aux)
[PROOF STATE]
proof (state)
this:
is_expansion (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) (b # basis)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. eval (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) x = exp (f x)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. exp (f x - c * ln (b x))) expands_to MS xs g) (b # basis)
basis_wf (b # basis)
[PROOF STEP]
have "eventually (\<lambda>x. b x > 0) at_top"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. exp (f x - c * ln (b x))) expands_to MS xs g) (b # basis)
basis_wf (b # basis)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < b x
[PROOF STEP]
by (simp add: basis_wf_Cons filterlim_at_top_dense)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 0 < b x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. eval (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) x = exp (f x)
[PROOF STEP]
with assms(1)
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. exp (f x - c * ln (b x))) expands_to MS xs g) (b # basis)
\<forall>\<^sub>F x in at_top. 0 < b x
[PROOF STEP]
show "\<forall>\<^sub>F x in at_top. eval (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) x = exp (f x)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. exp (f x - c * ln (b x))) expands_to MS xs g) (b # basis)
\<forall>\<^sub>F x in at_top. 0 < b x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. eval (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) x = exp (f x)
[PROOF STEP]
by (auto simp: expands_to.simps exp_diff powr_def elim: eventually_elim2)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. eval (MS (shift_ms_aux c xs) (\<lambda>x. b x powr c * g x)) x = exp (f x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma if_eq_const_conv: "(if x then y else z) = w \<longleftrightarrow> x \<and> y = w \<or> \<not> x \<and> z = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if x then y else z) = w) = (x \<and> y = w \<or> \<not> x \<and> z = w)
[PROOF STEP]
by simp


[STATEMENT]
lemma inner_Basis_sum2:
  "(\<And>i. i \<in> I \<Longrightarrow> x i \<in> S) \<Longrightarrow> inner_Basis v (\<Sum>i\<in>I. x i) = (\<Sum>i\<in>I. inner_Basis v (x i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> x i \<in> S) \<Longrightarrow> local.inner_Basis v (sum x I) = (\<Sum>i\<in>I. local.inner_Basis v (x i))
[PROOF STEP]
apply (induction I rule: infinite_finite_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>i. i \<in> A \<Longrightarrow> x i \<in> S\<rbrakk> \<Longrightarrow> local.inner_Basis v (sum x A) = (\<Sum>i\<in>A. local.inner_Basis v (x i))
 2. (\<And>i. i \<in> {} \<Longrightarrow> x i \<in> S) \<Longrightarrow> local.inner_Basis v (sum x {}) = (\<Sum>i\<in>{}. local.inner_Basis v (x i))
 3. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> x i \<in> S) \<Longrightarrow> local.inner_Basis v (sum x F) = (\<Sum>i\<in>F. local.inner_Basis v (x i)); \<And>i. i \<in> insert xa F \<Longrightarrow> x i \<in> S\<rbrakk> \<Longrightarrow> local.inner_Basis v (sum x (insert xa F)) = (\<Sum>i\<in>insert xa F. local.inner_Basis v (x i))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; local.inner_Basis v (sum x F) = (\<Sum>i\<in>F. local.inner_Basis v (x i)); \<And>i. i = xa \<or> i \<in> F \<Longrightarrow> x i \<in> S\<rbrakk> \<Longrightarrow> local.inner_Basis v (x xa + sum x F) = local.inner_Basis v (x xa) + (\<Sum>i\<in>F. local.inner_Basis v (x i))
[PROOF STEP]
apply (subst inner_Basis_add2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; local.inner_Basis v (sum x F) = (\<Sum>i\<in>F. local.inner_Basis v (x i)); \<And>i. i = xa \<or> i \<in> F \<Longrightarrow> x i \<in> S\<rbrakk> \<Longrightarrow> x xa \<in> S
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; local.inner_Basis v (sum x F) = (\<Sum>i\<in>F. local.inner_Basis v (x i)); \<And>i. i = xa \<or> i \<in> F \<Longrightarrow> x i \<in> S\<rbrakk> \<Longrightarrow> sum x F \<in> S
 3. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; local.inner_Basis v (sum x F) = (\<Sum>i\<in>F. local.inner_Basis v (x i)); \<And>i. i = xa \<or> i \<in> F \<Longrightarrow> x i \<in> S\<rbrakk> \<Longrightarrow> local.inner_Basis v (x xa) + local.inner_Basis v (sum x F) = local.inner_Basis v (x xa) + (\<Sum>i\<in>F. local.inner_Basis v (x i))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; local.inner_Basis v (sum x F) = (\<Sum>i\<in>F. local.inner_Basis v (x i)); \<And>i. i = xa \<or> i \<in> F \<Longrightarrow> x i \<in> S\<rbrakk> \<Longrightarrow> sum x F \<in> S
[PROOF STEP]
by (metis B(2) subspace_span subspace_sum)


[STATEMENT]
lemma einterpret_scaleR[simp]:
  shows "(einterpret (map (\<lambda>i. fa1 * fa2 i) [0..<DIM('a)]) vs::'a::executable_euclidean_space) =
    interpret_floatarith (fa1) vs *\<^sub>R einterpret (map fa2 [0..<DIM('a)]) vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. einterpret (map (\<lambda>i. fa1 * fa2 i) [0..<DIM('a)]) vs = interpret_floatarith fa1 vs *\<^sub>R einterpret (map fa2 [0..<DIM('a)]) vs
[PROOF STEP]
by (auto intro!: euclidean_eqI[where 'a='a] simp: algebra_simps eucl_of_list_inner)


[STATEMENT]
lemma fls_subdegree_deriv:
  fixes   f :: "'a::{ring_1_no_zero_divisors,ring_char_0} fls"
  assumes "fls_subdegree f \<noteq> 0"
  shows   "fls_subdegree (fls_deriv f) = fls_subdegree f - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_subdegree (fls_deriv f) = fls_subdegree f - 1
[PROOF STEP]
by      (auto intro: fls_subdegree_deriv' simp: assms)


[STATEMENT]
lemma "remdups_on (=) xs = remdups xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. remdups_on (=) xs = remdups xs
[PROOF STEP]
by (induction xs) auto


[STATEMENT]
lemma deriv_compose_linear:
  "f field_differentiable at (c * z) \<Longrightarrow> deriv (\<lambda>w. f (c * w)) z = c * deriv f (c * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f field_differentiable at (c * z) \<Longrightarrow> deriv (\<lambda>w. f (c * w)) z = c * deriv f (c * z)
[PROOF STEP]
apply (rule DERIV_imp_deriv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f field_differentiable at (c * z) \<Longrightarrow> ((\<lambda>w. f (c * w)) has_field_derivative c * deriv f (c * z)) (at z)
[PROOF STEP]
unfolding DERIV_deriv_iff_field_differentiable [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative deriv f (c * z)) (at (c * z)) \<Longrightarrow> ((\<lambda>w. f (c * w)) has_field_derivative c * deriv f (c * z)) (at z)
[PROOF STEP]
by (metis (full_types) DERIV_chain2 DERIV_cmult_Id mult.commute)


[STATEMENT]
lemma arith:
  assumes "d < a"
  assumes "c < b"
  shows "b*d+c < a*(b::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b * d + c < a * b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b * d + c < a * b
[PROOF STEP]
have "b*d+c < b*(d+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b * d + c < b * (d + 1)
[PROOF STEP]
by (simp add: assms(2))
[PROOF STATE]
proof (state)
this:
b * d + c < b * (d + 1)

goal (1 subgoal):
 1. b * d + c < a * b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
b * d + c < b * (d + 1)

goal (1 subgoal):
 1. b * d + c < a * b
[PROOF STEP]
by (metis One_nat_def Suc_leI add.right_neutral add_Suc_right assms(1) less_le_trans mult.commute mult_le_cancel2)
[PROOF STATE]
proof (state)
this:
b * d + c < a * b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fst_Gauss_Jordan_upt_k_PA:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows "fst (Gauss_Jordan_upt_k_PA A k) ** A = snd (Gauss_Jordan_upt_k_PA A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_upt_k_PA A k) ** A = snd (Gauss_Jordan_upt_k_PA A k)
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fst (Gauss_Jordan_upt_k_PA A 0) ** A = snd (Gauss_Jordan_upt_k_PA A 0)
 2. \<And>k. fst (Gauss_Jordan_upt_k_PA A k) ** A = snd (Gauss_Jordan_upt_k_PA A k) \<Longrightarrow> fst (Gauss_Jordan_upt_k_PA A (Suc k)) ** A = snd (Gauss_Jordan_upt_k_PA A (Suc k))
[PROOF STEP]
show "fst (Gauss_Jordan_upt_k_PA A 0) ** A = snd (Gauss_Jordan_upt_k_PA A 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_upt_k_PA A 0) ** A = snd (Gauss_Jordan_upt_k_PA A 0)
[PROOF STEP]
unfolding Gauss_Jordan_upt_k_PA_def Let_def fst_conv snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc 0]) ** A = snd (snd (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc 0]))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) 0) ** A = snd (snd (Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) 0))
[PROOF STEP]
unfolding snd_snd_Gauss_Jordan_column_k_PA_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) 0) ** A = snd (Gauss_Jordan_column_k (0, A) 0)
[PROOF STEP]
by (metis fst_Gauss_Jordan_column_k_PA matrix_mul_lid snd_snd_Gauss_Jordan_column_k_PA_eq)
[PROOF STATE]
proof (state)
this:
fst (Gauss_Jordan_upt_k_PA A 0) ** A = snd (Gauss_Jordan_upt_k_PA A 0)

goal (1 subgoal):
 1. \<And>k. fst (Gauss_Jordan_upt_k_PA A k) ** A = snd (Gauss_Jordan_upt_k_PA A k) \<Longrightarrow> fst (Gauss_Jordan_upt_k_PA A (Suc k)) ** A = snd (Gauss_Jordan_upt_k_PA A (Suc k))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. fst (Gauss_Jordan_upt_k_PA A k) ** A = snd (Gauss_Jordan_upt_k_PA A k) \<Longrightarrow> fst (Gauss_Jordan_upt_k_PA A (Suc k)) ** A = snd (Gauss_Jordan_upt_k_PA A (Suc k))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
fst (Gauss_Jordan_upt_k_PA A k) ** A = snd (Gauss_Jordan_upt_k_PA A k)

goal (1 subgoal):
 1. \<And>k. fst (Gauss_Jordan_upt_k_PA A k) ** A = snd (Gauss_Jordan_upt_k_PA A k) \<Longrightarrow> fst (Gauss_Jordan_upt_k_PA A (Suc k)) ** A = snd (Gauss_Jordan_upt_k_PA A (Suc k))
[PROOF STEP]
have suc_rw: "[0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]

goal (1 subgoal):
 1. \<And>k. fst (Gauss_Jordan_upt_k_PA A k) ** A = snd (Gauss_Jordan_upt_k_PA A k) \<Longrightarrow> fst (Gauss_Jordan_upt_k_PA A (Suc k)) ** A = snd (Gauss_Jordan_upt_k_PA A (Suc k))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_upt_k_PA A (Suc k)) ** A = snd (Gauss_Jordan_upt_k_PA A (Suc k))
[PROOF STEP]
unfolding Gauss_Jordan_upt_k_PA_def Let_def fst_conv snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc (Suc k)]) ** A = snd (snd (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc (Suc k)]))
[PROOF STEP]
unfolding suc_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) ([0..<Suc k] @ [Suc k])) ** A = snd (snd (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) ([0..<Suc k] @ [Suc k])))
[PROOF STEP]
unfolding foldl_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl Gauss_Jordan_column_k_PA (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc k]) [Suc k]) ** A = snd (snd (foldl Gauss_Jordan_column_k_PA (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc k]) [Suc k]))
[PROOF STEP]
unfolding List.foldl.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_PA (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc k]) (Suc k)) ** A = snd (snd (Gauss_Jordan_column_k_PA (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc k]) (Suc k)))
[PROOF STEP]
using Suc.hyps[unfolded Gauss_Jordan_upt_k_PA_def Let_def fst_conv snd_conv]
[PROOF STATE]
proof (prove)
using this:
fst (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc k]) ** A = snd (snd (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc k]))

goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_PA (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc k]) (Suc k)) ** A = snd (snd (Gauss_Jordan_column_k_PA (foldl Gauss_Jordan_column_k_PA (mat (1::'a), 0, A) [0..<Suc k]) (Suc k)))
[PROOF STEP]
by (metis fst_Gauss_Jordan_column_k_PA prod.collapse)
[PROOF STATE]
proof (state)
this:
fst (Gauss_Jordan_upt_k_PA A (Suc k)) ** A = snd (Gauss_Jordan_upt_k_PA A (Suc k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_map_prod_fst:
  "i \<in> I \<Longrightarrow> continuous_map (prod_topology (product_topology (\<lambda>i. Y) I) X) Y (\<lambda>x. fst x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> continuous_map (prod_topology (product_topology (\<lambda>i. Y) I) X) Y (\<lambda>x. fst x i)
[PROOF STEP]
using continuous_map_componentwise_UNIV continuous_map_fst
[PROOF STATE]
proof (prove)
using this:
continuous_map ?X (product_topology ?Y UNIV) ?f = (\<forall>k. continuous_map ?X (?Y k) (\<lambda>x. ?f x k))
continuous_map (prod_topology ?X ?Y) ?X fst

goal (1 subgoal):
 1. i \<in> I \<Longrightarrow> continuous_map (prod_topology (product_topology (\<lambda>i. Y) I) X) Y (\<lambda>x. fst x i)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma eval_merge_primfun:
  "fst f = fst g \<Longrightarrow>
     eval_primfun (merge_primfun f g) x = eval_primfun f x * eval_primfun g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst f = fst g \<Longrightarrow> eval_primfun (merge_primfun f g) x = eval_primfun f x * eval_primfun g x
[PROOF STEP]
by (induction f g rule: merge_primfun.induct) (simp_all add: powr_add)


[STATEMENT]
lemma inc_vec_elems_max_two: "card (set\<^sub>v (inc_vec_of Vs bl)) \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set\<^sub>v (inc_vec_of Vs bl)) \<le> 2
[PROOF STEP]
using card_mono inc_vec_one_zero_elems finite.insertI card_0_eq card_2_iff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B
set\<^sub>v (inc_vec_of ?Vs ?bl) \<subseteq> {0::?'a, 1::?'a}
finite ?A \<Longrightarrow> finite (insert ?a ?A)
finite ?A \<Longrightarrow> (card ?A = 0) = (?A = {})
(card ?S = 2) = (\<exists>x y. ?S = {x, y} \<and> x \<noteq> y)

goal (1 subgoal):
 1. card (set\<^sub>v (inc_vec_of Vs bl)) \<le> 2
[PROOF STEP]
by (smt (verit)  insert_absorb2 linorder_le_cases linordered_nonzero_semiring_class.zero_le_one
      obtain_subset_with_card_n one_add_one subset_singletonD trans_le_add1)


[STATEMENT]
lemma quasi_isometric_empty:
  assumes "X = {}" "quasi_isometric X Y"
  shows "Y = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
X = {}
quasi_isometric X Y

goal (1 subgoal):
 1. Y = {}
[PROOF STEP]
unfolding quasi_isometric_def quasi_isometry_between_def quasi_isometry_on_def
[PROOF STATE]
proof (prove)
using this:
X = {}
\<exists>lambda C f. (1 \<le> lambda \<and> 0 \<le> C \<and> (\<forall>x\<in>X. \<forall>y\<in>X. dist (f x) (f y) \<le> lambda * dist x y + C \<and> 1 / lambda * dist x y - C \<le> dist (f x) (f y))) \<and> f ` X \<subseteq> Y \<and> (\<forall>y\<in>Y. \<exists>x\<in>X. dist (f x) y \<le> C)

goal (1 subgoal):
 1. Y = {}
[PROOF STEP]
by blast


[STATEMENT]
lemma l2product_sym: "l2product S f g = l2product S g f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2product S f g = l2product S g f
[PROOF STEP]
by (simp add: l2product_def mult.commute)


[STATEMENT]
lemma ord0_less_le_trans:
"\<lbrakk>(x::ord0) < y; y \<le> z\<rbrakk> \<Longrightarrow> x < z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> z\<rbrakk> \<Longrightarrow> x < z
[PROOF STEP]
apply (unfold ord0_le_def ord0_less_def, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa ya za. \<lbrakk>(y, z) \<in> ord0_leq; (x, ya) \<in> ord0_leq; (ya, y) \<in> ord0_prec\<^sup>+\<rbrakk> \<Longrightarrow> (x, z) \<in> ord0_leq O ord0_prec\<^sup>+
[PROOF STEP]
apply (drule ord0_leqD, assumption, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa ya za xaa yaa zaa. \<lbrakk>(x, xaa) \<in> ord0_leq; (xaa, y) \<in> ord0_prec\<^sup>+; (xaa, yaa) \<in> ord0_leq; (yaa, z) \<in> ord0_prec\<^sup>+\<rbrakk> \<Longrightarrow> (x, z) \<in> ord0_leq O ord0_prec\<^sup>+
[PROOF STEP]
by (rule relcompI[OF ord0_leq_trans])


[STATEMENT]
lemma list_all_pos_neg_ex: "list_all P D \<Longrightarrow> \<not> (list_all Q D) \<Longrightarrow>
       \<exists> k. k < length D \<and> P(D ! k) \<and> \<not>(Q(D ! k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all P D; \<not> list_all Q D\<rbrakk> \<Longrightarrow> \<exists>k<length D. P (D ! k) \<and> \<not> Q (D ! k)
[PROOF STEP]
using list_all_length
[PROOF STATE]
proof (prove)
using this:
list_all ?P ?xs = (\<forall>n<length ?xs. ?P (?xs ! n))

goal (1 subgoal):
 1. \<lbrakk>list_all P D; \<not> list_all Q D\<rbrakk> \<Longrightarrow> \<exists>k<length D. P (D ! k) \<and> \<not> Q (D ! k)
[PROOF STEP]
by blast


[STATEMENT]
lemma dim_eq_card_independent: "independent B \<Longrightarrow> dim B = card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent B \<Longrightarrow> dim B = card B
[PROOF STEP]
by (rule dim_eq_card[OF refl])


[STATEMENT]
lemma add_mset_commute:
  "add_mset x (add_mset y M) = add_mset y (add_mset x M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset x (add_mset y M) = add_mset y (add_mset x M)
[PROOF STEP]
by (auto simp: multiset_eq_iff)


[STATEMENT]
lemma D_closed_path: "\<lbrakk>path E u q w; u\<in>D\<rbrakk> \<Longrightarrow> set q \<subseteq> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path E u q w; u \<in> D\<rbrakk> \<Longrightarrow> set q \<subseteq> D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>path E u q w; u \<in> D\<rbrakk> \<Longrightarrow> set q \<subseteq> D
[PROOF STEP]
assume a1: "path E u q w"
[PROOF STATE]
proof (state)
this:
path E u q w

goal (1 subgoal):
 1. \<lbrakk>path E u q w; u \<in> D\<rbrakk> \<Longrightarrow> set q \<subseteq> D
[PROOF STEP]
assume "u \<in> D"
[PROOF STATE]
proof (state)
this:
u \<in> D

goal (1 subgoal):
 1. \<lbrakk>path E u q w; u \<in> D\<rbrakk> \<Longrightarrow> set q \<subseteq> D
[PROOF STEP]
hence f1: "{u} \<subseteq> D"
[PROOF STATE]
proof (prove)
using this:
u \<in> D

goal (1 subgoal):
 1. {u} \<subseteq> D
[PROOF STEP]
using bot.extremum
[PROOF STATE]
proof (prove)
using this:
u \<in> D
bot \<le> ?a

goal (1 subgoal):
 1. {u} \<subseteq> D
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{u} \<subseteq> D

goal (1 subgoal):
 1. \<lbrakk>path E u q w; u \<in> D\<rbrakk> \<Longrightarrow> set q \<subseteq> D
[PROOF STEP]
have "set q \<subseteq> E\<^sup>* `` {u}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set q \<subseteq> E\<^sup>* `` {u}
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
path E u q w

goal (1 subgoal):
 1. set q \<subseteq> E\<^sup>* `` {u}
[PROOF STEP]
by (metis insert_subset path_nodes_reachable)
[PROOF STATE]
proof (state)
this:
set q \<subseteq> E\<^sup>* `` {u}

goal (1 subgoal):
 1. \<lbrakk>path E u q w; u \<in> D\<rbrakk> \<Longrightarrow> set q \<subseteq> D
[PROOF STEP]
thus "set q \<subseteq> D"
[PROOF STATE]
proof (prove)
using this:
set q \<subseteq> E\<^sup>* `` {u}

goal (1 subgoal):
 1. set q \<subseteq> D
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
set q \<subseteq> E\<^sup>* `` {u}
{u} \<subseteq> D

goal (1 subgoal):
 1. set q \<subseteq> D
[PROOF STEP]
by (metis D_closed rtrancl_reachable_induct subset_trans)
[PROOF STATE]
proof (state)
this:
set q \<subseteq> D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  PLS_works:
  fixes x s as
  assumes "(x \<in> PLS s as)"
  shows"(\<exists>as'.
      (exec_plan s as = exec_plan s as')
      \<and> (length as' = x)
      \<and> (subseq as' as)
    )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>as'. exec_plan s as = exec_plan s as' \<and> length as' = x \<and> subseq as' as
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> PLS s as

goal (1 subgoal):
 1. \<exists>as'. exec_plan s as = exec_plan s as' \<and> length as' = x \<and> subseq as' as
[PROOF STEP]
unfolding PLS_def
[PROOF STATE]
proof (prove)
using this:
x \<in> length ` {as'. exec_plan s as' = exec_plan s as \<and> subseq as' as}

goal (1 subgoal):
 1. \<exists>as'. exec_plan s as = exec_plan s as' \<and> length as' = x \<and> subseq as' as
[PROOF STEP]
by (smt imageE mem_Collect_eq)

\<comment> \<open>NOTE type of `s` had to be fixed (type mismatch in goal).\<close>


[STATEMENT]
lemma Times_mset_Times: "set_mset (A \<times># B) = set_mset A \<times> set_mset B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset (A \<times># B) = set_mset A \<times> set_mset B
[PROOF STEP]
unfolding Sigma_mset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset (\<Sum>a\<in>#A. image_mset (Pair a) B) = set_mset A \<times> set_mset B
[PROOF STEP]
by auto


[STATEMENT]
lemma linear_orderable_6_implies_3:
  assumes "linear_orderable_6 x"
  shows "linear_orderable_3 (x\<^sup>+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_orderable_3 (x\<^sup>+)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linear_orderable_3 (x\<^sup>+)
[PROOF STEP]
have 1: "transitive (x\<^sup>+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transitive (x\<^sup>+)
[PROOF STEP]
by (simp add: comp_associative mult_isotone star.circ_mult_upper_bound star.left_plus_below_circ)
[PROOF STATE]
proof (state)
this:
transitive (x\<^sup>+)

goal (1 subgoal):
 1. linear_orderable_3 (x\<^sup>+)
[PROOF STEP]
have 2: "asymmetric (x\<^sup>+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. asymmetric (x\<^sup>+)
[PROOF STEP]
by (simp add: assms acyclic_asymmetric star.circ_transitive_equal star.left_plus_circ mult_assoc)
[PROOF STATE]
proof (state)
this:
asymmetric (x\<^sup>+)

goal (1 subgoal):
 1. linear_orderable_3 (x\<^sup>+)
[PROOF STEP]
have 3: "strict_linear (x\<^sup>+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_linear (x\<^sup>+)
[PROOF STEP]
by (smt assms acyclic_star_inf_conv conv_star_commute inf.sup_monoid.add_commute inf_absorb2 maddux_3_13 orientable_11_implies_12 star_left_unfold_equal)
[PROOF STATE]
proof (state)
this:
strict_linear (x\<^sup>+)

goal (1 subgoal):
 1. linear_orderable_3 (x\<^sup>+)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_orderable_3 (x\<^sup>+)
[PROOF STEP]
using 1 2 3
[PROOF STATE]
proof (prove)
using this:
transitive (x\<^sup>+)
asymmetric (x\<^sup>+)
strict_linear (x\<^sup>+)

goal (1 subgoal):
 1. linear_orderable_3 (x\<^sup>+)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
linear_orderable_3 (x\<^sup>+)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus_diff_minus: "- a - - b = - (a - b)"
  for a b :: "'a::ab_group_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a - - b = - (a - b)
[PROOF STEP]
by simp


[STATEMENT]
lemma dims_smult[simp]:"dims (\<alpha> \<cdot> A) = dims A"
and   vec_smult[simp]: "vec  (\<alpha> \<cdot> A) = map ((*) \<alpha>) (vec A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dims (\<alpha> \<cdot> A) = dims A &&& vec (\<alpha> \<cdot> A) = map ((*) \<alpha>) (vec A)
[PROOF STEP]
unfolding smult_def vec_smult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dims (tensor_from_vec (dims A) (map ((*) \<alpha>) (vec A))) = dims A &&& vec (tensor_from_vec (dims A) (map ((*) \<alpha>) (vec A))) = map ((*) \<alpha>) (vec A)
[PROOF STEP]
by (simp add: length_vec)+


[STATEMENT]
lemma changes_itv_smods_congr:
  fixes p q:: "real poly"
  assumes "a<a'" "a'<b'" "b'<b" "poly p a\<noteq>0" "poly p b\<noteq>0"
  assumes no_root:"\<forall>p\<in>set (smods p q). \<forall>x. ((a<x\<and>x\<le>a') \<or> (b'\<le>x \<and> x<b)) \<longrightarrow> poly p x \<noteq>0"
  shows "changes_itv_smods a b p q=changes_itv_smods a' b' p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_itv_smods a b p q = changes_itv_smods a' b' p q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. changes_itv_smods a b p q = changes_itv_smods a' b' p q
[PROOF STEP]
have "changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
[PROOF STEP]
apply (rule changes_smods_congr[OF order.strict_implies_not_eq[OF \<open>a<a'\<close>] \<open>poly p a\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>set (smods p q). \<forall>x. a < x \<and> x \<le> a' \<or> a' \<le> x \<and> x < a \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by (metis assms(1) less_eq_real_def less_irrefl less_trans no_root)
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal (1 subgoal):
 1. changes_itv_smods a b p q = changes_itv_smods a' b' p q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'

goal (1 subgoal):
 1. changes_itv_smods a b p q = changes_itv_smods a' b' p q
[PROOF STEP]
have "changes_poly_at (smods p q) b = changes_poly_at (smods p q) b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes_poly_at (smods p q) b = changes_poly_at (smods p q) b'
[PROOF STEP]
apply (rule changes_smods_congr[OF order.strict_implies_not_eq[OF \<open>b'<b\<close>,
        symmetric] \<open>poly p b\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>set (smods p q). \<forall>x. b < x \<and> x \<le> b' \<or> b' \<le> x \<and> x < b \<longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by (metis assms(3) less_eq_real_def less_trans no_root)
[PROOF STATE]
proof (state)
this:
changes_poly_at (smods p q) b = changes_poly_at (smods p q) b'

goal (1 subgoal):
 1. changes_itv_smods a b p q = changes_itv_smods a' b' p q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
changes_poly_at (smods p q) b = changes_poly_at (smods p q) b'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
changes_poly_at (smods p q) b = changes_poly_at (smods p q) b'

goal (1 subgoal):
 1. changes_itv_smods a b p q = changes_itv_smods a' b' p q
[PROOF STEP]
unfolding changes_itv_smods_def Let_def
[PROOF STATE]
proof (prove)
using this:
changes_poly_at (smods p q) a = changes_poly_at (smods p q) a'
changes_poly_at (smods p q) b = changes_poly_at (smods p q) b'

goal (1 subgoal):
 1. changes_poly_at (smods p q) a - changes_poly_at (smods p q) b = changes_poly_at (smods p q) a' - changes_poly_at (smods p q) b'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
changes_itv_smods a b p q = changes_itv_smods a' b' p q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fstar_Inf_pres:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  shows "Inf_pres f \<Longrightarrow> Inf_pres (fstar f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_pres f \<Longrightarrow> Inf_pres (fstar f)
[PROOF STEP]
by (simp add: fstar_def Inf_pres_Inf fpower_Inf_pres)


[STATEMENT]
lemma poly_shift_times_monom_le:
  "n \<le> m \<Longrightarrow> poly_shift n (monom c m * p) = monom c (m - n) * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> m \<Longrightarrow> poly_shift n (monom c m * p) = monom c (m - n) * p
[PROOF STEP]
by (intro poly_eqI) (auto simp: coeff_monom_mult coeff_poly_shift)


[STATEMENT]
lemma "(y < x + -z) = (y + z < (x::real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y < x + - z) = (y + z < x)
[PROOF STEP]
by arith


[STATEMENT]
lemma homeomorphic_subspaces_eq:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "subspace S" "subspace T"
  shows "S homeomorphic T \<longleftrightarrow> dim S = dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T = (dim S = dim T)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S homeomorphic T \<Longrightarrow> dim S = dim T
 2. dim S = dim T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
assume "S homeomorphic T"
[PROOF STATE]
proof (state)
this:
S homeomorphic T

goal (2 subgoals):
 1. S homeomorphic T \<Longrightarrow> dim S = dim T
 2. dim S = dim T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S homeomorphic T
[PROOF STEP]
obtain f g where hom: "homeomorphism S T f g"
[PROOF STATE]
proof (prove)
using this:
S homeomorphic T

goal (1 subgoal):
 1. (\<And>f g. homeomorphism S T f g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using homeomorphic_def
[PROOF STATE]
proof (prove)
using this:
S homeomorphic T
?s homeomorphic ?t \<equiv> \<exists>f g. homeomorphism ?s ?t f g

goal (1 subgoal):
 1. (\<And>f g. homeomorphism S T f g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
homeomorphism S T f g

goal (2 subgoals):
 1. S homeomorphic T \<Longrightarrow> dim S = dim T
 2. dim S = dim T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
show "dim S = dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim S = dim T
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim S \<le> dim T
 2. dim T \<le> dim S
[PROOF STEP]
show "dim S \<le> dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim S \<le> dim T
[PROOF STEP]
by (metis assms dual_order.refl inj_onI homeomorphism_cont1 [OF hom] homeomorphism_apply1 [OF hom] homeomorphism_image1 [OF hom] continuous_injective_image_subspace_dim_le)
[PROOF STATE]
proof (state)
this:
dim S \<le> dim T

goal (1 subgoal):
 1. dim T \<le> dim S
[PROOF STEP]
show "dim T \<le> dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim T \<le> dim S
[PROOF STEP]
by (metis assms dual_order.refl inj_onI homeomorphism_cont2 [OF hom] homeomorphism_apply2 [OF hom] homeomorphism_image2 [OF hom] continuous_injective_image_subspace_dim_le)
[PROOF STATE]
proof (state)
this:
dim T \<le> dim S

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

goal (1 subgoal):
 1. dim S = dim T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim S = dim T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
assume "dim S = dim T"
[PROOF STATE]
proof (state)
this:
dim S = dim T

goal (1 subgoal):
 1. dim S = dim T \<Longrightarrow> S homeomorphic T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim S = dim T
[PROOF STEP]
show "S homeomorphic T"
[PROOF STATE]
proof (prove)
using this:
dim S = dim T

goal (1 subgoal):
 1. S homeomorphic T
[PROOF STEP]
by (simp add: assms homeomorphic_subspaces)
[PROOF STATE]
proof (state)
this:
S homeomorphic T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma q65_infinite_def: "q65 = (\<lambda>k. k\<^sup>2 mod 65) ` {0..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q65 = (\<lambda>k. k\<^sup>2 mod 65) ` {0..}
[PROOF STEP]
unfolding q65_upto_def image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{..<65}. y = x\<^sup>2 mod 65} = {y. \<exists>x\<in>{0..}. y = x\<^sup>2 mod 65}
[PROOF STEP]
proof (auto, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<exists>x\<in>{..<65}. xa\<^sup>2 mod 65 = x\<^sup>2 mod 65
[PROOF STEP]
case (1 xa)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>xa. \<exists>x\<in>{..<65}. xa\<^sup>2 mod 65 = x\<^sup>2 mod 65
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>{..<65}. xa\<^sup>2 mod 65 = x\<^sup>2 mod 65
[PROOF STEP]
using square_mod_lower[of 65 xa "xa\<^sup>2 mod 65"]
      ex_nat_less_eq[of 65 "\<lambda>x. xa\<^sup>2 mod 65 = x\<^sup>2 mod 65"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 65; xa\<^sup>2 mod 65 = xa\<^sup>2 mod 65\<rbrakk> \<Longrightarrow> \<exists>q'<65. q'\<^sup>2 mod 65 = xa\<^sup>2 mod 65
(\<exists>m<65. xa\<^sup>2 mod 65 = m\<^sup>2 mod 65) = (\<exists>m\<in>{0..<65}. xa\<^sup>2 mod 65 = m\<^sup>2 mod 65)

goal (1 subgoal):
 1. \<exists>x\<in>{..<65}. xa\<^sup>2 mod 65 = x\<^sup>2 mod 65
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>{..<65}. xa\<^sup>2 mod 65 = x\<^sup>2 mod 65

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem fset_induct:
  "P {} \<Longrightarrow> (\<And>x (F::('a::finite)set). x \<notin> F \<Longrightarrow> P F \<Longrightarrow> P (insert x F)) \<Longrightarrow> P F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)\<rbrakk> \<Longrightarrow> P F
[PROOF STEP]
proof (rule_tac P=P and F=F in finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)\<rbrakk> \<Longrightarrow> finite F
 2. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)\<rbrakk> \<Longrightarrow> P {}
 3. \<And>x F. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F); finite F; x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)
[PROOF STEP]
from finite_subset[OF subset_UNIV]
[PROOF STATE]
proof (chain)
picking this:
finite UNIV \<Longrightarrow> finite ?A
[PROOF STEP]
show "finite F"
[PROOF STATE]
proof (prove)
using this:
finite UNIV \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite F

goal (2 subgoals):
 1. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)\<rbrakk> \<Longrightarrow> P {}
 2. \<And>x F. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F); finite F; x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)\<rbrakk> \<Longrightarrow> P {}
 2. \<And>x F. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F); finite F; x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)
[PROOF STEP]
assume "P {}"
[PROOF STATE]
proof (state)
this:
P {}

goal (2 subgoals):
 1. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)\<rbrakk> \<Longrightarrow> P {}
 2. \<And>x F. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F); finite F; x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)
[PROOF STEP]
thus "P {}"
[PROOF STATE]
proof (prove)
using this:
P {}

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

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F); finite F; x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F); finite F; x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)
[PROOF STEP]
fix x F
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F); finite F; x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)
[PROOF STEP]
assume "\<And>x F. \<lbrakk> x \<notin> F; P F \<rbrakk> \<Longrightarrow> P (insert x F)" and "x \<notin> F" and "P F"
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<notin> ?F; P ?F\<rbrakk> \<Longrightarrow> P (insert ?x ?F)
x \<notin> F
P F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>P {}; \<And>x F. \<lbrakk>x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F); finite F; x \<notin> F; P F\<rbrakk> \<Longrightarrow> P (insert x F)
[PROOF STEP]
thus "P (insert x F)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<notin> ?F; P ?F\<rbrakk> \<Longrightarrow> P (insert ?x ?F)
x \<notin> F
P F

goal (1 subgoal):
 1. P (insert x F)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P (insert x F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtrancl_edges_iff_path: "(u,v)\<in>(edges g)\<^sup>* \<longleftrightarrow> (\<exists>p. path g u p v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((u, v) \<in> (edges g)\<^sup>*) = (\<exists>p. path g u p v)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (u, v) \<in> (edges g)\<^sup>* \<Longrightarrow> \<exists>p. path g u p v
 2. \<exists>p. path g u p v \<Longrightarrow> (u, v) \<in> (edges g)\<^sup>*
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u, v) \<in> (edges g)\<^sup>* \<Longrightarrow> \<exists>p. path g u p v
[PROOF STEP]
apply (induction rule: converse_rtrancl_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>p. path g v p v
 2. \<And>y z. \<lbrakk>(y, z) \<in> edges g; (z, v) \<in> (edges g)\<^sup>*; \<exists>p. path g z p v\<rbrakk> \<Longrightarrow> \<exists>p. path g y p v
[PROOF STEP]
by (auto dest: path_transs1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. path g u p v \<Longrightarrow> (u, v) \<in> (edges g)\<^sup>*
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. path g u p v \<Longrightarrow> (u, v) \<in> (edges g)\<^sup>*
[PROOF STEP]
subgoal for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path g u p v \<Longrightarrow> (u, v) \<in> (edges g)\<^sup>*
[PROOF STEP]
by (induction p arbitrary: u; force)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma merge_comm_if_not_equiv: "\<forall>x \<in> set xs. \<forall>y \<in> set ys. compare cmp x y \<noteq> Equiv \<Longrightarrow>
  Sorting_Algorithms.merge cmp xs ys = Sorting_Algorithms.merge cmp ys xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. \<forall>y\<in>set ys. compare cmp x y \<noteq> Equiv \<Longrightarrow> Sorting_Algorithms.merge cmp xs ys = Sorting_Algorithms.merge cmp ys xs
[PROOF STEP]
apply(induction xs ys rule: Sorting_Algorithms.merge.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>ys. \<forall>x\<in>set []. \<forall>y\<in>set ys. compare cmp x y \<noteq> Equiv \<Longrightarrow> Sorting_Algorithms.merge cmp [] ys = Sorting_Algorithms.merge cmp ys []
 2. \<And>xs. \<forall>x\<in>set xs. \<forall>y\<in>set []. compare cmp x y \<noteq> Equiv \<Longrightarrow> Sorting_Algorithms.merge cmp xs [] = Sorting_Algorithms.merge cmp [] xs
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare ?cmp x y = Greater; \<forall>x\<in>set (x # xs). \<forall>y\<in>set ys. compare cmp x y \<noteq> Equiv\<rbrakk> \<Longrightarrow> Sorting_Algorithms.merge cmp (x # xs) ys = Sorting_Algorithms.merge cmp ys (x # xs); \<lbrakk>compare ?cmp x y \<noteq> Greater; \<forall>x\<in>set xs. \<forall>y\<in>set (y # ys). compare cmp x y \<noteq> Equiv\<rbrakk> \<Longrightarrow> Sorting_Algorithms.merge cmp xs (y # ys) = Sorting_Algorithms.merge cmp (y # ys) xs; \<forall>x\<in>set (x # xs). \<forall>y\<in>set (y # ys). compare cmp x y \<noteq> Equiv\<rbrakk> \<Longrightarrow> Sorting_Algorithms.merge cmp (x # xs) (y # ys) = Sorting_Algorithms.merge cmp (y # ys) (x # xs)
[PROOF STEP]
by(auto intro: compare.quasisym_not_greater simp: compare.asym_greater)


[STATEMENT]
lemma mset_subset_size: "A \<subset># B \<Longrightarrow> size A < size B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subset># B \<Longrightarrow> size A < size B
[PROOF STEP]
proof (induct A arbitrary: B)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B. {#} \<subset># B \<Longrightarrow> size {#} < size B
 2. \<And>x A B. \<lbrakk>\<And>B. A \<subset># B \<Longrightarrow> size A < size B; add_mset x A \<subset># B\<rbrakk> \<Longrightarrow> size (add_mset x A) < size B
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
{#} \<subset># B

goal (2 subgoals):
 1. \<And>B. {#} \<subset># B \<Longrightarrow> size {#} < size B
 2. \<And>x A B. \<lbrakk>\<And>B. A \<subset># B \<Longrightarrow> size A < size B; add_mset x A \<subset># B\<rbrakk> \<Longrightarrow> size (add_mset x A) < size B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{#} \<subset># B
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
{#} \<subset># B

goal (1 subgoal):
 1. size {#} < size B
[PROOF STEP]
using nonempty_has_size
[PROOF STATE]
proof (prove)
using this:
{#} \<subset># B
(?S \<noteq> {#}) = (0 < size ?S)

goal (1 subgoal):
 1. size {#} < size B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size {#} < size B

goal (1 subgoal):
 1. \<And>x A B. \<lbrakk>\<And>B. A \<subset># B \<Longrightarrow> size A < size B; add_mset x A \<subset># B\<rbrakk> \<Longrightarrow> size (add_mset x A) < size B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x A B. \<lbrakk>\<And>B. A \<subset># B \<Longrightarrow> size A < size B; add_mset x A \<subset># B\<rbrakk> \<Longrightarrow> size (add_mset x A) < size B
[PROOF STEP]
case (add x A)
[PROOF STATE]
proof (state)
this:
A \<subset># ?B \<Longrightarrow> size A < size ?B
add_mset x A \<subset># B

goal (1 subgoal):
 1. \<And>x A B. \<lbrakk>\<And>B. A \<subset># B \<Longrightarrow> size A < size B; add_mset x A \<subset># B\<rbrakk> \<Longrightarrow> size (add_mset x A) < size B
[PROOF STEP]
have "add_mset x A \<subseteq># B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset x A \<subseteq># B
[PROOF STEP]
by (meson add.prems subset_mset_def)
[PROOF STATE]
proof (state)
this:
add_mset x A \<subseteq># B

goal (1 subgoal):
 1. \<And>x A B. \<lbrakk>\<And>B. A \<subset># B \<Longrightarrow> size A < size B; add_mset x A \<subset># B\<rbrakk> \<Longrightarrow> size (add_mset x A) < size B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
add_mset x A \<subseteq># B
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
add_mset x A \<subseteq># B

goal (1 subgoal):
 1. size (add_mset x A) < size B
[PROOF STEP]
by (metis (no_types) add.prems add.right_neutral add_diff_cancel_left' leD nat_neq_iff
      size_Diff_submset size_eq_0_iff_empty size_mset_mono subset_mset.le_iff_add subset_mset_def)
[PROOF STATE]
proof (state)
this:
size (add_mset x A) < size B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_ereal_semiline:
  fixes a :: ereal
  shows "closed {y. a \<le> ereal y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {y. a \<le> ereal y}
[PROOF STEP]
proof (cases a)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>r. a = ereal r \<Longrightarrow> closed {y. a \<le> ereal y}
 2. a = \<infinity> \<Longrightarrow> closed {y. a \<le> ereal y}
 3. a = - \<infinity> \<Longrightarrow> closed {y. a \<le> ereal y}
[PROOF STEP]
case (real r)
[PROOF STATE]
proof (state)
this:
a = ereal r

goal (3 subgoals):
 1. \<And>r. a = ereal r \<Longrightarrow> closed {y. a \<le> ereal y}
 2. a = \<infinity> \<Longrightarrow> closed {y. a \<le> ereal y}
 3. a = - \<infinity> \<Longrightarrow> closed {y. a \<le> ereal y}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = ereal r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = ereal r

goal (1 subgoal):
 1. closed {y. a \<le> ereal y}
[PROOF STEP]
using closed_real_atLeast
[PROOF STATE]
proof (prove)
using this:
a = ereal r
closed {?a..}

goal (1 subgoal):
 1. closed {y. a \<le> ereal y}
[PROOF STEP]
unfolding atLeast_def
[PROOF STATE]
proof (prove)
using this:
a = ereal r
closed {x. ?a \<le> x}

goal (1 subgoal):
 1. closed {y. a \<le> ereal y}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closed {y. a \<le> ereal y}

goal (2 subgoals):
 1. a = \<infinity> \<Longrightarrow> closed {y. a \<le> ereal y}
 2. a = - \<infinity> \<Longrightarrow> closed {y. a \<le> ereal y}
[PROOF STEP]
qed auto


[STATEMENT]
lemma proj2_incident_iff:
  assumes "p \<noteq> q" and "proj2_incident p l" and "proj2_incident q l"
  shows "proj2_incident r l
  \<longleftrightarrow> r = p \<or> (\<exists> k. r = proj2_abs (k *\<^sub>R proj2_rep p + proj2_rep q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj2_incident r l = (r = p \<or> (\<exists>k. r = proj2_abs (k *\<^sub>R proj2_rep p + proj2_rep q)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proj2_incident r l = (r = p \<or> (\<exists>k. r = proj2_abs (k *\<^sub>R proj2_rep p + proj2_rep q)))
[PROOF STEP]
from \<open>p \<noteq> q\<close> and \<open>proj2_incident p l\<close> and \<open>proj2_incident q l\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> q
proj2_incident p l
proj2_incident q l
[PROOF STEP]
have "proj2_incident r l \<longleftrightarrow> proj2_Col p q r"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> q
proj2_incident p l
proj2_incident q l

goal (1 subgoal):
 1. proj2_incident r l = proj2_Col p q r
[PROOF STEP]
by (rule proj2_incident_iff_Col)
[PROOF STATE]
proof (state)
this:
proj2_incident r l = proj2_Col p q r

goal (1 subgoal):
 1. proj2_incident r l = (r = p \<or> (\<exists>k. r = proj2_abs (k *\<^sub>R proj2_rep p + proj2_rep q)))
[PROOF STEP]
with \<open>p \<noteq> q\<close> and proj2_Col_iff
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> q
?a \<noteq> ?r \<Longrightarrow> proj2_Col ?a ?r ?t = (?t = ?a \<or> (\<exists>i. ?t = proj2_abs (i *\<^sub>R proj2_rep ?a + proj2_rep ?r)))
proj2_incident r l = proj2_Col p q r
[PROOF STEP]
show "proj2_incident r l
    \<longleftrightarrow> r = p \<or> (\<exists> k. r = proj2_abs (k *\<^sub>R proj2_rep p + proj2_rep q))"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> q
?a \<noteq> ?r \<Longrightarrow> proj2_Col ?a ?r ?t = (?t = ?a \<or> (\<exists>i. ?t = proj2_abs (i *\<^sub>R proj2_rep ?a + proj2_rep ?r)))
proj2_incident r l = proj2_Col p q r

goal (1 subgoal):
 1. proj2_incident r l = (r = p \<or> (\<exists>k. r = proj2_abs (k *\<^sub>R proj2_rep p + proj2_rep q)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
proj2_incident r l = (r = p \<or> (\<exists>k. r = proj2_abs (k *\<^sub>R proj2_rep p + proj2_rep q)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma content_pCons[simp]: "content (pCons a p) = gcd a (content p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (pCons a p) = gcd a (content p)
[PROOF STEP]
proof(induct p arbitrary: a)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. content [:a:] = gcd a (content 0)
 2. \<And>a p aa. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; \<And>a. content (pCons a p) = gcd a (content p)\<rbrakk> \<Longrightarrow> content (pCons aa (pCons a p)) = gcd aa (content (pCons a p))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>a. content [:a:] = gcd a (content 0)
 2. \<And>a p aa. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; \<And>a. content (pCons a p) = gcd a (content p)\<rbrakk> \<Longrightarrow> content (pCons aa (pCons a p)) = gcd aa (content (pCons a p))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content [:a:] = gcd a (content 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
content [:a:] = gcd a (content 0)

goal (1 subgoal):
 1. \<And>a p aa. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; \<And>a. content (pCons a p) = gcd a (content p)\<rbrakk> \<Longrightarrow> content (pCons aa (pCons a p)) = gcd aa (content (pCons a p))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p aa. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; \<And>a. content (pCons a p) = gcd a (content p)\<rbrakk> \<Longrightarrow> content (pCons aa (pCons a p)) = gcd aa (content (pCons a p))
[PROOF STEP]
case (pCons c p)
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a) \<or> p \<noteq> 0
content (pCons ?a p) = gcd ?a (content p)

goal (1 subgoal):
 1. \<And>a p aa. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; \<And>a. content (pCons a p) = gcd a (content p)\<rbrakk> \<Longrightarrow> content (pCons aa (pCons a p)) = gcd aa (content (pCons a p))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a) \<or> p \<noteq> 0
content (pCons ?a p) = gcd ?a (content p)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a) \<or> p \<noteq> 0
content (pCons ?a p) = gcd ?a (content p)

goal (1 subgoal):
 1. content (pCons a (pCons c p)) = gcd a (content (pCons c p))
[PROOF STEP]
by (cases "p = 0", auto simp: content_def cCons_def)
[PROOF STATE]
proof (state)
this:
content (pCons a (pCons c p)) = gcd a (content (pCons c p))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_bit_eq_0_iff:
  \<open>take_bit n a = 0 \<longleftrightarrow> 2 ^ n dvd a\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (take_bit n a = (0::'a)) = ((2::'a) ^ n dvd a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. take_bit n a = (0::'a) \<Longrightarrow> (2::'a) ^ n dvd a
 2. (2::'a) ^ n dvd a \<Longrightarrow> take_bit n a = (0::'a)
[PROOF STEP]
assume ?P
[PROOF STATE]
proof (state)
this:
take_bit n a = (0::'a)

goal (2 subgoals):
 1. take_bit n a = (0::'a) \<Longrightarrow> (2::'a) ^ n dvd a
 2. (2::'a) ^ n dvd a \<Longrightarrow> take_bit n a = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
take_bit n a = (0::'a)
[PROOF STEP]
show ?Q
[PROOF STATE]
proof (prove)
using this:
take_bit n a = (0::'a)

goal (1 subgoal):
 1. (2::'a) ^ n dvd a
[PROOF STEP]
by (simp add: take_bit_eq_mod mod_0_imp_dvd)
[PROOF STATE]
proof (state)
this:
(2::'a) ^ n dvd a

goal (1 subgoal):
 1. (2::'a) ^ n dvd a \<Longrightarrow> take_bit n a = (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (2::'a) ^ n dvd a \<Longrightarrow> take_bit n a = (0::'a)
[PROOF STEP]
assume ?Q
[PROOF STATE]
proof (state)
this:
(2::'a) ^ n dvd a

goal (1 subgoal):
 1. (2::'a) ^ n dvd a \<Longrightarrow> take_bit n a = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(2::'a) ^ n dvd a
[PROOF STEP]
obtain b where \<open>a = push_bit n b\<close>
[PROOF STATE]
proof (prove)
using this:
(2::'a) ^ n dvd a

goal (1 subgoal):
 1. (\<And>b. a = push_bit n b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule exp_dvdE)
[PROOF STATE]
proof (state)
this:
a = push_bit n b

goal (1 subgoal):
 1. (2::'a) ^ n dvd a \<Longrightarrow> take_bit n a = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = push_bit n b
[PROOF STEP]
show ?P
[PROOF STATE]
proof (prove)
using this:
a = push_bit n b

goal (1 subgoal):
 1. take_bit n a = (0::'a)
[PROOF STEP]
by (simp add: take_bit_push_bit)
[PROOF STATE]
proof (state)
this:
take_bit n a = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary_unitary_gen [simp]:
  assumes "unitary M"
  shows "unitary_gen M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary_gen M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unitary M

goal (1 subgoal):
 1. unitary_gen M
[PROOF STEP]
unfolding unitary_gen_def unitary_def
[PROOF STATE]
proof (prove)
using this:
mat_adj M *\<^sub>m\<^sub>m M = eye

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> mat_adj M *\<^sub>m\<^sub>m M = k *\<^sub>s\<^sub>m eye
[PROOF STEP]
by auto


[STATEMENT]
lemma set_rel_def[refine_rel_defs]:
  "\<langle>R\<rangle>set_rel \<equiv> {(A,B). (\<forall>x\<in>A. \<exists>y\<in>B. (x,y)\<in>R) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. (x,y)\<in>R)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>R\<rangle>set_rel \<equiv> {(A, B). (\<forall>x\<in>A. \<exists>y\<in>B. (x, y) \<in> R) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. (x, y) \<in> R)}
[PROOF STEP]
by (simp add: set_rel_def_internal relAPP_def)


[STATEMENT]
lemma ones_incidence_mat_block_size:
  assumes "j < \<b>"
  shows "((u\<^sub>v \<v>) \<^sub>v* N) $ j = mat_block_size N j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
have "dim_vec ((u\<^sub>v \<v>) \<^sub>v* N) = \<b>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (u\<^sub>v \<v> \<^sub>v* N) = \<b>
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
dim_vec (u\<^sub>v \<v> \<^sub>v* N) = \<b>

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_vec (u\<^sub>v \<v> \<^sub>v* N) = \<b>
[PROOF STEP]
have "((u\<^sub>v \<v>) \<^sub>v* N) $ j = (u\<^sub>v \<v>) \<bullet> col N j"
[PROOF STATE]
proof (prove)
using this:
dim_vec (u\<^sub>v \<v> \<^sub>v* N) = \<b>

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = u\<^sub>v \<v> \<bullet> col N j
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec (u\<^sub>v \<v> \<^sub>v* N) = \<b>
j < \<b>

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = u\<^sub>v \<v> \<bullet> col N j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u\<^sub>v \<v> \<^sub>v* N) $ j = u\<^sub>v \<v> \<bullet> col N j

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(u\<^sub>v \<v> \<^sub>v* N) $ j = u\<^sub>v \<v> \<bullet> col N j

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< \<v>}. (u\<^sub>v \<v>) $ i * (col N j) $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u\<^sub>v \<v> \<bullet> col N j = (\<Sum>i = 0..<\<v>. u\<^sub>v \<v> $ i * col N j $ i)
[PROOF STEP]
by (simp add: scalar_prod_def)
[PROOF STATE]
proof (state)
this:
u\<^sub>v \<v> \<bullet> col N j = (\<Sum>i = 0..<\<v>. u\<^sub>v \<v> $ i * col N j $ i)

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u\<^sub>v \<v> \<bullet> col N j = (\<Sum>i = 0..<\<v>. u\<^sub>v \<v> $ i * col N j $ i)

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
have "... = sum_vec (col N j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<\<v>. u\<^sub>v \<v> $ i * col N j $ i) = sum_vec (col N j)
[PROOF STEP]
using dim_row_is_v
[PROOF STATE]
proof (prove)
using this:
dim_row N = \<v>

goal (1 subgoal):
 1. (\<Sum>i = 0..<\<v>. u\<^sub>v \<v> $ i * col N j $ i) = sum_vec (col N j)
[PROOF STEP]
by (simp add: sum_vec_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<\<v>. u\<^sub>v \<v> $ i * col N j $ i) = sum_vec (col N j)

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(u\<^sub>v \<v> \<^sub>v* N) $ j = sum_vec (col N j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(u\<^sub>v \<v> \<^sub>v* N) $ j = sum_vec (col N j)

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
using block_size_mat_rep_sum assms
[PROOF STATE]
proof (prove)
using this:
(u\<^sub>v \<v> \<^sub>v* N) $ j = sum_vec (col N j)
?j < \<b> \<Longrightarrow> sum_vec (col N ?j) = int (mat_block_size N ?j)
j < \<b>

goal (1 subgoal):
 1. (u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u\<^sub>v \<v> \<^sub>v* N) $ j = int (mat_block_size N j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cInf_abs_ge:
  fixes S :: "'a::{linordered_idom,conditionally_complete_linorder} set"
  assumes "S \<noteq> {}"
    and bdd: "\<And>x. x\<in>S \<Longrightarrow> \<bar>x\<bar> \<le> a"
  shows "\<bar>Inf S\<bar> \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Inf S\<bar> \<le> a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>Inf S\<bar> \<le> a
[PROOF STEP]
have "Sup (uminus ` S) = - (Inf S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (uminus ` S) = - Inf S
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Sup (uminus ` S) \<le> - Inf S
 2. - Inf S \<le> Sup (uminus ` S)
[PROOF STEP]
show "- (Inf S) \<le> Sup (uminus ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - Inf S \<le> Sup (uminus ` S)
[PROOF STEP]
apply (subst minus_le_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - Sup (uminus ` S) \<le> Inf S
[PROOF STEP]
apply (rule cInf_greatest [OF \<open>S \<noteq> {}\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> - Sup (uminus ` S) \<le> x
[PROOF STEP]
apply (subst minus_le_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> - x \<le> Sup (uminus ` S)
[PROOF STEP]
apply (rule cSup_upper)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> S \<Longrightarrow> - x \<in> uminus ` S
 2. \<And>x. x \<in> S \<Longrightarrow> bdd_above (uminus ` S)
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> bdd_above (uminus ` S)
[PROOF STEP]
using bdd
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<bar>?x\<bar> \<le> a

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> bdd_above (uminus ` S)
[PROOF STEP]
apply (force simp: abs_le_iff bdd_above_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
- Inf S \<le> Sup (uminus ` S)

goal (1 subgoal):
 1. Sup (uminus ` S) \<le> - Inf S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup (uminus ` S) \<le> - Inf S
[PROOF STEP]
have *: "\<And>x. x \<in> S \<Longrightarrow> Inf S \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> Inf S \<le> x
[PROOF STEP]
by (meson abs_le_iff bdd bdd_below_def cInf_lower minus_le_iff)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> Inf S \<le> ?x

goal (1 subgoal):
 1. Sup (uminus ` S) \<le> - Inf S
[PROOF STEP]
show "Sup (uminus ` S) \<le> - Inf S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (uminus ` S) \<le> - Inf S
[PROOF STEP]
using \<open>S \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. Sup (uminus ` S) \<le> - Inf S
[PROOF STEP]
by (force intro: * cSup_least)
[PROOF STATE]
proof (state)
this:
Sup (uminus ` S) \<le> - Inf S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sup (uminus ` S) = - Inf S

goal (1 subgoal):
 1. \<bar>Inf S\<bar> \<le> a
[PROOF STEP]
with cSup_abs_le [of "uminus ` S"] assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>uminus ` S \<noteq> {}; \<And>x. x \<in> uminus ` S \<Longrightarrow> \<bar>x\<bar> \<le> ?a\<rbrakk> \<Longrightarrow> \<bar>Sup (uminus ` S)\<bar> \<le> ?a
S \<noteq> {}
?x \<in> S \<Longrightarrow> \<bar>?x\<bar> \<le> a
Sup (uminus ` S) = - Inf S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>uminus ` S \<noteq> {}; \<And>x. x \<in> uminus ` S \<Longrightarrow> \<bar>x\<bar> \<le> ?a\<rbrakk> \<Longrightarrow> \<bar>Sup (uminus ` S)\<bar> \<le> ?a
S \<noteq> {}
?x \<in> S \<Longrightarrow> \<bar>?x\<bar> \<le> a
Sup (uminus ` S) = - Inf S

goal (1 subgoal):
 1. \<bar>Inf S\<bar> \<le> a
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<bar>Inf S\<bar> \<le> a

goal:
No subgoals!
[PROOF STEP]
qed