[STATEMENT]
lemma induced_union_subgraph:
  assumes "VH1 \<subseteq> S" and "VH2 \<subseteq> T"
  assumes "graph_system VH1 EH1" "graph_system VH2 EH2"
  shows "subgraph VH1 EH1 S (induced_edges S) \<and> subgraph VH2 EH2 T (induced_edges T) \<longleftrightarrow>
    subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subgraph VH1 EH1 S (induced_edges S) \<and> subgraph VH2 EH2 T (induced_edges T)) = subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
[PROOF STEP]
proof (intro iffI conjI, elim conjE)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>subgraph VH1 EH1 S (induced_edges S); subgraph VH2 EH2 T (induced_edges T)\<rbrakk> \<Longrightarrow> subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
 2. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH1 EH1 S (induced_edges S)
 3. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH2 EH2 T (induced_edges T)
[PROOF STEP]
show "subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
      \<Longrightarrow> subgraph VH1 EH1 S (induced_edges S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH1 EH1 S (induced_edges S)
[PROOF STEP]
using induced_edges_union_subgraph_single assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?VH1.0 \<subseteq> ?S; ?VH2.0 \<subseteq> ?T; graph_system ?VH1.0 ?EH1.0; graph_system ?VH2.0 ?EH2.0; subgraph (?VH1.0 \<union> ?VH2.0) (?EH1.0 \<union> ?EH2.0) (?S \<union> ?T) (induced_edges (?S \<union> ?T))\<rbrakk> \<Longrightarrow> subgraph ?VH1.0 ?EH1.0 ?S (induced_edges ?S)
VH1 \<subseteq> S
VH2 \<subseteq> T
graph_system VH1 EH1
graph_system VH2 EH2

goal (1 subgoal):
 1. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH1 EH1 S (induced_edges S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH1 EH1 S (induced_edges S)

goal (2 subgoals):
 1. \<lbrakk>subgraph VH1 EH1 S (induced_edges S); subgraph VH2 EH2 T (induced_edges T)\<rbrakk> \<Longrightarrow> subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
 2. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH2 EH2 T (induced_edges T)
[PROOF STEP]
show "subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
      \<Longrightarrow> subgraph VH2 EH2 T (induced_edges T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH2 EH2 T (induced_edges T)
[PROOF STEP]
using induced_edges_union_subgraph_single assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?VH1.0 \<subseteq> ?S; ?VH2.0 \<subseteq> ?T; graph_system ?VH1.0 ?EH1.0; graph_system ?VH2.0 ?EH2.0; subgraph (?VH1.0 \<union> ?VH2.0) (?EH1.0 \<union> ?EH2.0) (?S \<union> ?T) (induced_edges (?S \<union> ?T))\<rbrakk> \<Longrightarrow> subgraph ?VH1.0 ?EH1.0 ?S (induced_edges ?S)
VH1 \<subseteq> S
VH2 \<subseteq> T
graph_system VH1 EH1
graph_system VH2 EH2

goal (1 subgoal):
 1. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH2 EH2 T (induced_edges T)
[PROOF STEP]
by (simp add: Un_commute)
[PROOF STATE]
proof (state)
this:
subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T)) \<Longrightarrow> subgraph VH2 EH2 T (induced_edges T)

goal (1 subgoal):
 1. \<lbrakk>subgraph VH1 EH1 S (induced_edges S); subgraph VH2 EH2 T (induced_edges T)\<rbrakk> \<Longrightarrow> subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
[PROOF STEP]
assume a1: "subgraph VH1 EH1 S (induced_edges S)" and a2: "subgraph VH2 EH2 T (induced_edges T)"
[PROOF STATE]
proof (state)
this:
subgraph VH1 EH1 S (induced_edges S)
subgraph VH2 EH2 T (induced_edges T)

goal (1 subgoal):
 1. \<lbrakk>subgraph VH1 EH1 S (induced_edges S); subgraph VH2 EH2 T (induced_edges T)\<rbrakk> \<Longrightarrow> subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subgraph VH1 EH1 S (induced_edges S)
subgraph VH2 EH2 T (induced_edges T)
[PROOF STEP]
interpret h1: subgraph VH1 EH1 S "(induced_edges S)"
[PROOF STATE]
proof (prove)
using this:
subgraph VH1 EH1 S (induced_edges S)
subgraph VH2 EH2 T (induced_edges T)

goal (1 subgoal):
 1. subgraph VH1 EH1 S (induced_edges S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>subgraph VH1 EH1 S (induced_edges S); subgraph VH2 EH2 T (induced_edges T)\<rbrakk> \<Longrightarrow> subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
[PROOF STEP]
interpret h2: subgraph VH2 EH2 T "(induced_edges T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgraph VH2 EH2 T (induced_edges T)
[PROOF STEP]
using a2
[PROOF STATE]
proof (prove)
using this:
subgraph VH2 EH2 T (induced_edges T)

goal (1 subgoal):
 1. subgraph VH2 EH2 T (induced_edges T)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>subgraph VH1 EH1 S (induced_edges S); subgraph VH2 EH2 T (induced_edges T)\<rbrakk> \<Longrightarrow> subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
[PROOF STEP]
show "subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
[PROOF STEP]
using h1.H.wellformed h2.H.wellformed h1.verts_ss h2.verts_ss h1.edges_ss h2.edges_ss
[PROOF STATE]
proof (prove)
using this:
?e \<in> EH1 \<Longrightarrow> ?e \<subseteq> VH1
?e \<in> EH2 \<Longrightarrow> ?e \<subseteq> VH2
VH1 \<subseteq> S
VH2 \<subseteq> T
EH1 \<subseteq> induced_edges S
EH2 \<subseteq> induced_edges T

goal (1 subgoal):
 1. subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))
[PROOF STEP]
by (unfold_locales) (auto simp add: induced_edges_def)
[PROOF STATE]
proof (state)
this:
subgraph (VH1 \<union> VH2) (EH1 \<union> EH2) (S \<union> T) (induced_edges (S \<union> T))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inorder_node33: "height m > 0 \<Longrightarrow>
  inorder (treeD (node33 l a m b r')) = inorder l @ a # inorder m @ b # inorder (treeD r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height m \<Longrightarrow> inorder (treeD (node33 l a m b r')) = inorder l @ a # inorder m @ b # inorder (treeD r')
[PROOF STEP]
by(induct l a m b r' rule: node33.induct) auto


[STATEMENT]
lemma exp_less_one_iff [simp]: "exp x < 1 \<longleftrightarrow> x < 0"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp x < 1) = (x < 0)
[PROOF STEP]
using exp_less_cancel_iff [where x = x and y = 0]
[PROOF STATE]
proof (prove)
using this:
(exp x < exp 0) = (x < 0)

goal (1 subgoal):
 1. (exp x < 1) = (x < 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma assoc_mat_mult_vec':
  assumes "A \<in> carrier_mat n n"
  and "B\<in> carrier_mat n n"
  and "C\<in> carrier_mat n n"
and "v\<in> carrier_vec n"
shows "A * B * C *\<^sub>v v = A *\<^sub>v (B *\<^sub>v (C *\<^sub>v v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B * C *\<^sub>v v = A *\<^sub>v (B *\<^sub>v (C *\<^sub>v v))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n
v \<in> carrier_vec n

goal (1 subgoal):
 1. A * B * C *\<^sub>v v = A *\<^sub>v (B *\<^sub>v (C *\<^sub>v v))
[PROOF STEP]
by (smt (z3) assoc_mult_mat_vec mult_carrier_mat mult_mat_vec_carrier)


[STATEMENT]
theorem swap_ex_conj: "(P \<and> (\<exists>x. Q x)) \<longleftrightarrow> (\<exists>x. P \<and> Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<and> (\<exists>x. Q x)) = (\<exists>x. P \<and> Q x)
[PROOF STEP]
by auto


[STATEMENT]
lemma [code]:
  "enum 0 = {}"
  "enum (Suc n) = insert n (enum n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enum 0 = {} &&& enum (Suc n) = insert n (enum n)
[PROOF STEP]
unfolding enum_def lessThan_0 lessThan_Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {} = {} &&& insert n {..<n} = insert n {..<n}
[PROOF STEP]
by rule+


[STATEMENT]
lemma is_top_sorted_cons: "is_top_sorted R (x#l) \<longleftrightarrow> ({x}\<times>set l \<inter> (R\<^sup>*)\<inverse> = {}) \<and> is_top_sorted R l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_top_sorted R (x # l) = ({x} \<times> set l \<inter> (R\<^sup>*)\<inverse> = {} \<and> is_top_sorted R l)
[PROOF STEP]
unfolding is_top_sorted_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (list_before_rel (x # l) \<inter> (R\<^sup>*)\<inverse> = {}) = ({x} \<times> set l \<inter> (R\<^sup>*)\<inverse> = {} \<and> list_before_rel l \<inter> (R\<^sup>*)\<inverse> = {})
[PROOF STEP]
by (auto simp: list_before_rel_cons)


[STATEMENT]
theorem clausal_logic_compact:
  fixes N :: "('a :: wellorder) clause set"
  shows "\<not> satisfiable N \<longleftrightarrow> (\<exists>DD \<subseteq> N. finite DD \<and> \<not> satisfiable DD)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> satisfiable N) = (\<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<not> satisfiable N \<Longrightarrow> \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD
 2. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD \<Longrightarrow> \<not> satisfiable N
[PROOF STEP]
assume "\<not> satisfiable N"
[PROOF STATE]
proof (state)
this:
\<not> satisfiable N

goal (2 subgoals):
 1. \<not> satisfiable N \<Longrightarrow> \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD
 2. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD \<Longrightarrow> \<not> satisfiable N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> satisfiable N
[PROOF STEP]
have "{#} \<in> saturate N"
[PROOF STATE]
proof (prove)
using this:
\<not> satisfiable N

goal (1 subgoal):
 1. {#} \<in> saturate N
[PROOF STEP]
using saturated_complete saturated_saturate saturate.base
[PROOF STATE]
proof (prove)
using this:
\<not> satisfiable N
\<lbrakk>saturated ?N; \<not> satisfiable ?N\<rbrakk> \<Longrightarrow> {#} \<in> ?N
saturated (saturate ?N)
?C \<in> ?CC \<Longrightarrow> ?C \<in> saturate ?CC

goal (1 subgoal):
 1. {#} \<in> saturate N
[PROOF STEP]
unfolding true_clss_def
[PROOF STATE]
proof (prove)
using this:
\<nexists>I. Ball N ((\<Turnstile>) I)
\<lbrakk>saturated ?N; \<nexists>I. Ball ?N ((\<Turnstile>) I)\<rbrakk> \<Longrightarrow> {#} \<in> ?N
saturated (saturate ?N)
?C \<in> ?CC \<Longrightarrow> ?C \<in> saturate ?CC

goal (1 subgoal):
 1. {#} \<in> saturate N
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
{#} \<in> saturate N

goal (2 subgoals):
 1. \<not> satisfiable N \<Longrightarrow> \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD
 2. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD \<Longrightarrow> \<not> satisfiable N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{#} \<in> saturate N
[PROOF STEP]
have "\<exists>DD \<subseteq> N. finite DD \<and> {#} \<in> saturate DD"
[PROOF STATE]
proof (prove)
using this:
{#} \<in> saturate N

goal (1 subgoal):
 1. \<exists>DD\<subseteq>N. finite DD \<and> {#} \<in> saturate DD
[PROOF STEP]
using saturate_finite
[PROOF STATE]
proof (prove)
using this:
{#} \<in> saturate N
?C \<in> saturate ?CC \<Longrightarrow> \<exists>DD\<subseteq>?CC. finite DD \<and> ?C \<in> saturate DD

goal (1 subgoal):
 1. \<exists>DD\<subseteq>N. finite DD \<and> {#} \<in> saturate DD
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>DD\<subseteq>N. finite DD \<and> {#} \<in> saturate DD

goal (2 subgoals):
 1. \<not> satisfiable N \<Longrightarrow> \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD
 2. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD \<Longrightarrow> \<not> satisfiable N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>DD\<subseteq>N. finite DD \<and> {#} \<in> saturate DD
[PROOF STEP]
show "\<exists>DD \<subseteq> N. finite DD \<and> \<not> satisfiable DD"
[PROOF STATE]
proof (prove)
using this:
\<exists>DD\<subseteq>N. finite DD \<and> {#} \<in> saturate DD

goal (1 subgoal):
 1. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD
[PROOF STEP]
using saturate_sound
[PROOF STATE]
proof (prove)
using this:
\<exists>DD\<subseteq>N. finite DD \<and> {#} \<in> saturate DD
\<lbrakk>?C \<in> saturate ?CC; ?I \<Turnstile>s ?CC\<rbrakk> \<Longrightarrow> ?I \<Turnstile> ?C

goal (1 subgoal):
 1. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD

goal (1 subgoal):
 1. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD \<Longrightarrow> \<not> satisfiable N
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD \<Longrightarrow> \<not> satisfiable N
[PROOF STEP]
assume "\<exists>DD \<subseteq> N. finite DD \<and> \<not> satisfiable DD"
[PROOF STATE]
proof (state)
this:
\<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD

goal (1 subgoal):
 1. \<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD \<Longrightarrow> \<not> satisfiable N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD
[PROOF STEP]
show "\<not> satisfiable N"
[PROOF STATE]
proof (prove)
using this:
\<exists>DD\<subseteq>N. finite DD \<and> \<not> satisfiable DD

goal (1 subgoal):
 1. \<not> satisfiable N
[PROOF STEP]
by (blast intro: true_clss_mono)
[PROOF STATE]
proof (state)
this:
\<not> satisfiable N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma CBasis_le_norm: "b \<in> CBasis \<Longrightarrow> cmod (cinner x b) \<le> norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> CBasis \<Longrightarrow> cmod (x \<bullet>\<^sub>C b) \<le> norm x
[PROOF STEP]
by (rule order_trans [OF Cauchy_Schwarz_ineq2]) simp


[STATEMENT]
lemma ltakeWhile_all_conv: "ltakeWhile P xs = xs \<longleftrightarrow> lset xs \<subseteq> {x. P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ltakeWhile P xs = xs) = (lset xs \<subseteq> {x. P x})
[PROOF STEP]
by (metis Int_Collect Int_absorb2 le_infE lset_ltakeWhile_subset ltakeWhile_all)


[STATEMENT]
lemma sin_expansion_lemma: "sin (x + real (Suc m) * pi / 2) = cos (x + real m * pi / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (x + real (Suc m) * pi / 2) = cos (x + real m * pi / 2)
[PROOF STEP]
by (auto simp: cos_add sin_add add_divide_distrib distrib_right)


[STATEMENT]
lemma INF_of_enat_nat_conv1:
  assumes "finite A"
  shows "(INF x \<in> A. enat (f x)) = enat d \<longleftrightarrow> (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have F: "finite (enat`f`A)"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite (enat ` f ` A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (enat ` f ` A)

goal (1 subgoal):
 1. ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
proof (cases "A={}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = {} \<Longrightarrow> ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
 2. A \<noteq> {} \<Longrightarrow> ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
 2. A \<noteq> {} \<Longrightarrow> ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A = {}

goal (1 subgoal):
 1. ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
by (auto simp: top_enat_def)
[PROOF STATE]
proof (state)
this:
((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
note * = Inf_in[OF F, simplified]
[PROOF STATE]
proof (state)
this:
Inf (enat ` f ` A) \<in> enat ` f ` A

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (INF x\<in>A. enat (f x)) = enat d \<Longrightarrow> \<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y)
 2. \<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y) \<Longrightarrow> (INF x\<in>A. enat (f x)) = enat d
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF x\<in>A. enat (f x)) = enat d \<Longrightarrow> \<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y)
[PROOF STEP]
by (smt False Inf_in assms enat.inject enat_ord_simps(1) finite_imageI imageE image_is_empty le_INF_iff order_refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y) \<Longrightarrow> (INF x\<in>A. enat (f x)) = enat d
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y) \<Longrightarrow> (INF x\<in>A. enat (f x)) = enat d
[PROOF STEP]
by clarsimp (meson INF_greatest INF_lower antisym enat_ord_simps(1))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((INF x\<in>A. enat (f x)) = enat d) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma div_right_strict_mono_on: "
  \<lbrakk> 0 < (k::nat); \<forall>x\<in>I. \<forall>y\<in>I. x < y \<longrightarrow> x + k \<le> y \<rbrakk> \<Longrightarrow>
  strict_mono_on (\<lambda>x. x div k) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; \<forall>x\<in>I. \<forall>y\<in>I. x < y \<longrightarrow> x + k \<le> y\<rbrakk> \<Longrightarrow> SetInterval2.strict_mono_on (\<lambda>x. x div k) I
[PROOF STEP]
apply (unfold strict_mono_on_def, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>0 < k; \<forall>x\<in>I. \<forall>y\<in>I. x < y \<longrightarrow> x + k \<le> y; a \<in> I; b \<in> I; a < b\<rbrakk> \<Longrightarrow> a div k < b div k
[PROOF STEP]
apply (fastforce dest: div_le_mono[of _ _ k])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in module) lincomb_del2:
  fixes S a v
  assumes h1: "finite S" and h2: "S\<subseteq> carrier M" and h3: "a\<in>(S\<rightarrow>carrier R)" and h4:"v\<in>S"
  shows "lincomb a S = ((a v) \<odot>\<^bsub>M\<^esub> v) \<oplus>\<^bsub>M\<^esub> lincomb a (S-{v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb a S = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a (S - {v})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lincomb a S = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a (S - {v})
[PROOF STEP]
from h4
[PROOF STATE]
proof (chain)
picking this:
v \<in> S
[PROOF STEP]
have 1: "S={v}\<union>(S-{v})"
[PROOF STATE]
proof (prove)
using this:
v \<in> S

goal (1 subgoal):
 1. S = {v} \<union> (S - {v})
[PROOF STEP]
by (metis insert_Diff insert_is_Un)
[PROOF STATE]
proof (state)
this:
S = {v} \<union> (S - {v})

goal (1 subgoal):
 1. lincomb a S = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a (S - {v})
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite S
S \<subseteq> carrier M
a \<in> S \<rightarrow> carrier R
v \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite S
S \<subseteq> carrier M
a \<in> S \<rightarrow> carrier R
v \<in> S

goal (1 subgoal):
 1. lincomb a S = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a (S - {v})
[PROOF STEP]
apply (subst 1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; S \<subseteq> carrier M; a \<in> S \<rightarrow> carrier R; v \<in> S\<rbrakk> \<Longrightarrow> lincomb a ({v} \<union> (S - {v})) = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a (S - {v})
[PROOF STEP]
apply (subst lincomb_union, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; S \<subseteq> carrier M; a \<in> S \<rightarrow> carrier R; v \<in> S\<rbrakk> \<Longrightarrow> lincomb a {v} \<oplus>\<^bsub>M\<^esub> lincomb a (S - {v}) = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a (S - {v})
[PROOF STEP]
by (unfold lincomb_def, auto simp add: coeff_in_ring)
[PROOF STATE]
proof (state)
this:
lincomb a S = a v \<odot>\<^bsub>M\<^esub> v \<oplus>\<^bsub>M\<^esub> lincomb a (S - {v})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma decompress_compress_no_mod:
  assumes "x\<in>{0..\<lceil>q-(q/(2*2^d))\<rceil>-1}"
          "of_nat d < \<lceil>(log 2 q)::real\<rceil>"
  shows "abs (decompress d (compress d x) - x) \<le>
    round ( real_of_int q / real_of_int (2^(d+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "abs (decompress d (compress d x) - x) =
    abs (real_of_int (decompress d (compress d x)) -
    real_of_int q / real_of_int (2^d) *
    (real_of_int (2^d * x) / real_of_int q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>decompress d (compress d x) - x\<bar> = \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * (real_of_int (2 ^ d * x) / real_of_int q)\<bar>
[PROOF STEP]
using q_gt_zero
[PROOF STATE]
proof (prove)
using this:
0 < q

goal (1 subgoal):
 1. real_of_int \<bar>decompress d (compress d x) - x\<bar> = \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * (real_of_int (2 ^ d * x) / real_of_int q)\<bar>
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> = \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * (real_of_int (2 ^ d * x) / real_of_int q)\<bar>

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> = \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * (real_of_int (2 ^ d * x) / real_of_int q)\<bar>

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "\<dots> \<le> abs (real_of_int (decompress d (compress d x)) -
    real_of_int q / real_of_int (2^d) * real_of_int (compress d x)) +
    abs (real_of_int q / real_of_int (2^d) *
    real_of_int (compress d x) - real_of_int q / real_of_int (2^d) *
    real_of_int (2^d) / real_of_int q * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * (real_of_int (2 ^ d * x) / real_of_int q)\<bar> \<le> \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar>
[PROOF STEP]
using abs_triangle_ineq[of
      "real_of_int (decompress d (compress d x)) -
       real_of_int q / real_of_int (2^d) * real_of_int (compress d x)"
      "real_of_int q / real_of_int (2^d) * real_of_int (compress d x)
       - real_of_int q / real_of_int (2^d) * real_of_int (2^d) /
       real_of_int q * real_of_int x"]
[PROOF STATE]
proof (prove)
using this:
\<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) + (real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar> \<le> \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar>

goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * (real_of_int (2 ^ d * x) / real_of_int q)\<bar> \<le> \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * (real_of_int (2 ^ d * x) / real_of_int q)\<bar> \<le> \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar>

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * (real_of_int (2 ^ d * x) / real_of_int q)\<bar> \<le> \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar>

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "\<dots> \<le> 1/2 + abs (real_of_int q / real_of_int (2^d) *
    (real_of_int (compress d x) -
     real_of_int (2^d) / real_of_int q * real_of_int x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>
[PROOF STEP]
have part_one:
        "abs (real_of_int (decompress d (compress d x)) -
        real_of_int q / real_of_int (2^d) * real_of_int (compress d x))
        \<le> 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> \<le> 1 / 2
[PROOF STEP]
unfolding decompress_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real_of_int (round (real_of_int q * real_of_int (compress d x) / real_of_int 2 ^ d)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> \<le> 1 / 2
[PROOF STEP]
using of_int_round_abs_le[of "real_of_int q *
          real_of_int (compress d x) / real_of_int 2^d"]
[PROOF STATE]
proof (prove)
using this:
\<bar>real_of_int (round (real_of_int q * real_of_int (compress d x) / real_of_int 2 ^ d)) - real_of_int q * real_of_int (compress d x) / real_of_int 2 ^ d\<bar> \<le> 1 / 2

goal (1 subgoal):
 1. \<bar>real_of_int (round (real_of_int q * real_of_int (compress d x) / real_of_int 2 ^ d)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> \<le> 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> \<le> 1 / 2

goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>
[PROOF STEP]
have "real_of_int q * real_of_int (compress d x) / 2^d -
        real_of_int x =
        real_of_int q * (real_of_int (compress d x) -
        2^d * real_of_int x / real_of_int q) / 2^d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int q * real_of_int (compress d x) / 2 ^ d - real_of_int x = real_of_int q * (real_of_int (compress d x) - 2 ^ d * real_of_int x / real_of_int q) / 2 ^ d
[PROOF STEP]
by (smt (verit, best) divide_cancel_right
        nonzero_mult_div_cancel_left of_int_eq_0_iff
        q_nonzero right_diff_distrib times_divide_eq_left
        zero_less_power)
[PROOF STATE]
proof (state)
this:
real_of_int q * real_of_int (compress d x) / 2 ^ d - real_of_int x = real_of_int q * (real_of_int (compress d x) - 2 ^ d * real_of_int x / real_of_int q) / 2 ^ d

goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int q * real_of_int (compress d x) / 2 ^ d - real_of_int x = real_of_int q * (real_of_int (compress d x) - 2 ^ d * real_of_int x / real_of_int q) / 2 ^ d
[PROOF STEP]
have part_two:
        "abs (real_of_int q / real_of_int (2^d) *
        real_of_int (compress d x) -
        real_of_int q / real_of_int (2^d) * real_of_int (2^d) /
        real_of_int q * x) =
        abs (real_of_int q / real_of_int (2^d) *
        (real_of_int (compress d x) - real_of_int (2^d) /
        real_of_int q * x)) "
[PROOF STATE]
proof (prove)
using this:
real_of_int q * real_of_int (compress d x) / 2 ^ d - real_of_int x = real_of_int q * (real_of_int (compress d x) - 2 ^ d * real_of_int x / real_of_int q) / 2 ^ d

goal (1 subgoal):
 1. \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> = \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> = \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>

goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>
[PROOF STEP]
using part_one part_two
[PROOF STATE]
proof (prove)
using this:
\<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> \<le> 1 / 2
\<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> = \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>

goal (1 subgoal):
 1. \<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>real_of_int (decompress d (compress d x)) - real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x)\<bar> + \<bar>real_of_int q / real_of_int (2 ^ d) * real_of_int (compress d x) - real_of_int q / real_of_int (2 ^ d) * real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar>

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "\<dots> = 1/2 + (real_of_int q / real_of_int (2^d)) *
      abs (real_of_int (compress d x) - real_of_int (2^d) /
      real_of_int q * real_of_int x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar> = 1 / 2 + real_of_int q / real_of_int (2 ^ d) * \<bar>real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar>
[PROOF STEP]
by (subst abs_mult) (smt (verit, best) assms(2)
      less_divide_eq_1_pos of_int_add of_int_hom.hom_one
      of_int_power powr_realpow twod_lt_q zero_less_power)
[PROOF STATE]
proof (state)
this:
1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar> = 1 / 2 + real_of_int q / real_of_int (2 ^ d) * \<bar>real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar>

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / 2 + \<bar>real_of_int q / real_of_int (2 ^ d) * (real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x)\<bar> = 1 / 2 + real_of_int q / real_of_int (2 ^ d) * \<bar>real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar>

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "\<dots> \<le> 1/2 + (real_of_int q / real_of_int (2^d)) * (1/2) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 2 + real_of_int q / real_of_int (2 ^ d) * \<bar>real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + real_of_int q / real_of_int (2 ^ d) * (1 / 2)
[PROOF STEP]
using compress_no_mod[OF assms]
[PROOF STATE]
proof (prove)
using this:
compress d x = round (real_of_int (2 ^ d * x) / real_of_int q)

goal (1 subgoal):
 1. 1 / 2 + real_of_int q / real_of_int (2 ^ d) * \<bar>real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + real_of_int q / real_of_int (2 ^ d) * (1 / 2)
[PROOF STEP]
using of_int_round_abs_le[of "real_of_int (2^d) *
      real_of_int x / real_of_int q"]
[PROOF STATE]
proof (prove)
using this:
compress d x = round (real_of_int (2 ^ d * x) / real_of_int q)
\<bar>real_of_int (round (real_of_int (2 ^ d) * real_of_int x / real_of_int q)) - real_of_int (2 ^ d) * real_of_int x / real_of_int q\<bar> \<le> 1 / 2

goal (1 subgoal):
 1. 1 / 2 + real_of_int q / real_of_int (2 ^ d) * \<bar>real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + real_of_int q / real_of_int (2 ^ d) * (1 / 2)
[PROOF STEP]
by (smt (verit, ccfv_SIG) divide_nonneg_nonneg left_diff_distrib
      mult_less_cancel_left_pos of_int_mult of_int_nonneg q_gt_zero
      times_divide_eq_left zero_le_power)
[PROOF STATE]
proof (state)
this:
1 / 2 + real_of_int q / real_of_int (2 ^ d) * \<bar>real_of_int (compress d x) - real_of_int (2 ^ d) / real_of_int q * real_of_int x\<bar> \<le> 1 / 2 + real_of_int q / real_of_int (2 ^ d) * (1 / 2)

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> \<le> 1 / 2 + real_of_int q / real_of_int (2 ^ d) * (1 / 2)
[PROOF STEP]
have "real_of_int (abs (decompress d (compress d x) - x)) \<le>
                real_of_int q / real_of_int (2*2^d) + 1/2"
[PROOF STATE]
proof (prove)
using this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> \<le> 1 / 2 + real_of_int q / real_of_int (2 ^ d) * (1 / 2)

goal (1 subgoal):
 1. real_of_int \<bar>decompress d (compress d x) - x\<bar> \<le> real_of_int q / real_of_int (2 * 2 ^ d) + 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> \<le> real_of_int q / real_of_int (2 * 2 ^ d) + 1 / 2

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> \<le> real_of_int q / real_of_int (2 * 2 ^ d) + 1 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> \<le> real_of_int q / real_of_int (2 * 2 ^ d) + 1 / 2

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
unfolding round_def
[PROOF STATE]
proof (prove)
using this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> \<le> real_of_int q / real_of_int (2 * 2 ^ d) + 1 / 2

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> \<lfloor>real_of_int q / real_of_int (2 ^ (d + 1)) + 1 / 2\<rfloor>
[PROOF STEP]
using le_floor_iff
[PROOF STATE]
proof (prove)
using this:
real_of_int \<bar>decompress d (compress d x) - x\<bar> \<le> real_of_int q / real_of_int (2 * 2 ^ d) + 1 / 2
(?z \<le> \<lfloor>?x\<rfloor>) = (of_int ?z \<le> ?x)

goal (1 subgoal):
 1. \<bar>decompress d (compress d x) - x\<bar> \<le> \<lfloor>real_of_int q / real_of_int (2 ^ (d + 1)) + 1 / 2\<rfloor>
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<bar>decompress d (compress d x) - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_break_down_right:
  shows "{# x \<in># M \<times># N . (fst x) \<in> (snd x)  #} = (\<Sum>n\<in>#N. ({#m \<in># M. m \<in> n#} \<times># {#n#}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#x \<in># M \<times># N. fst x \<in> snd x#} = (\<Sum>n\<in>#N. {#m \<in># M. m \<in> n#} \<times># {#n#})
[PROOF STEP]
by (induction N) (auto simp add: cart_product_add_1_filter_eq_mirror)


[STATEMENT]
lemma [simp]: "set_to_nat (nat_to_set u) = u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_to_nat (nat_to_set u) = u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_to_nat (nat_to_set u) = u
[PROOF STEP]
define D where "D = nat_to_set u"
[PROOF STATE]
proof (state)
this:
D = nat_to_set u

goal (1 subgoal):
 1. set_to_nat (nat_to_set u) = u
[PROOF STEP]
from D_def nat_to_set_is_finite
[PROOF STATE]
proof (chain)
picking this:
D = nat_to_set u
finite (nat_to_set ?u)
[PROOF STEP]
have D_finite: "finite D"
[PROOF STATE]
proof (prove)
using this:
D = nat_to_set u
finite (nat_to_set ?u)

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

goal (1 subgoal):
 1. set_to_nat (nat_to_set u) = u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite D
[PROOF STEP]
have "nat_to_set (set_to_nat D) = D"
[PROOF STATE]
proof (prove)
using this:
finite D

goal (1 subgoal):
 1. nat_to_set (set_to_nat D) = D
[PROOF STEP]
by (rule nat_to_set_srj)
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. set_to_nat (nat_to_set u) = u
[PROOF STEP]
with D_def
[PROOF STATE]
proof (chain)
picking this:
D = nat_to_set u
nat_to_set (set_to_nat D) = D
[PROOF STEP]
have "nat_to_set (set_to_nat D) = nat_to_set u"
[PROOF STATE]
proof (prove)
using this:
D = nat_to_set u
nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. nat_to_set (set_to_nat D) = nat_to_set u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D) = nat_to_set u

goal (1 subgoal):
 1. set_to_nat (nat_to_set u) = u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_to_set (set_to_nat D) = nat_to_set u
[PROOF STEP]
have "set_to_nat D = u"
[PROOF STATE]
proof (prove)
using this:
nat_to_set (set_to_nat D) = nat_to_set u

goal (1 subgoal):
 1. set_to_nat D = u
[PROOF STEP]
by (rule nat_to_set_inj)
[PROOF STATE]
proof (state)
this:
set_to_nat D = u

goal (1 subgoal):
 1. set_to_nat (nat_to_set u) = u
[PROOF STEP]
with D_def
[PROOF STATE]
proof (chain)
picking this:
D = nat_to_set u
set_to_nat D = u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
D = nat_to_set u
set_to_nat D = u

goal (1 subgoal):
 1. set_to_nat (nat_to_set u) = u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_to_nat (nat_to_set u) = u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uncountable_ball:
  fixes a :: "'a::euclidean_space"
  assumes "r > 0"
    shows "uncountable (ball a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncountable (ball a r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uncountable (ball a r)
[PROOF STEP]
have "uncountable (open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncountable (open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)))
[PROOF STEP]
by (metis Basis_zero SOME_Basis add_cancel_right_right assms less_le scale_eq_0_iff uncountable_open_segment)
[PROOF STATE]
proof (state)
this:
uncountable (open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)))

goal (1 subgoal):
 1. uncountable (ball a r)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
uncountable (open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)))

goal (1 subgoal):
 1. uncountable (ball a r)
[PROOF STEP]
have "open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)) \<subseteq> ball a r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)) \<subseteq> ball a r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < r

goal (1 subgoal):
 1. open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)) \<subseteq> ball a r
[PROOF STEP]
by (auto simp: in_segment algebra_simps dist_norm SOME_Basis)
[PROOF STATE]
proof (state)
this:
open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)) \<subseteq> ball a r

goal (1 subgoal):
 1. uncountable (ball a r)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
uncountable (open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)))
open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)) \<subseteq> ball a r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
uncountable (open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)))
open_segment a (a + r *\<^sub>R (SOME i. i \<in> Basis)) \<subseteq> ball a r

goal (1 subgoal):
 1. uncountable (ball a r)
[PROOF STEP]
by (metis countable_subset)
[PROOF STATE]
proof (state)
this:
uncountable (ball a r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma orthogonal_Gram_Schmidt_upt_k:
  assumes s: "k < ncols A"
  shows "pairwise orthogonal ({column i (Gram_Schmidt_upt_k A k) |i. to_nat i\<le>k})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}
[PROOF STEP]
using s
[PROOF STATE]
proof (prove)
using this:
k < ncols A

goal (1 subgoal):
 1. pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A 0) |i. mod_type_class.to_nat i \<le> 0}
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}; Suc k < ncols A\<rbrakk> \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < ncols A

goal (2 subgoals):
 1. 0 < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A 0) |i. mod_type_class.to_nat i \<le> 0}
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}; Suc k < ncols A\<rbrakk> \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}
[PROOF STEP]
have set_rw: "{column i (Gram_Schmidt_upt_k A 0) |i. to_nat i \<le> 0} =  {column 0 (Gram_Schmidt_upt_k A 0)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {column i (Gram_Schmidt_upt_k A 0) |i. mod_type_class.to_nat i \<le> 0} = {column (0::'b) (Gram_Schmidt_upt_k A 0)}
[PROOF STEP]
by (simp add: to_nat_eq_0)
[PROOF STATE]
proof (state)
this:
{column i (Gram_Schmidt_upt_k A 0) |i. mod_type_class.to_nat i \<le> 0} = {column (0::'b) (Gram_Schmidt_upt_k A 0)}

goal (2 subgoals):
 1. 0 < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A 0) |i. mod_type_class.to_nat i \<le> 0}
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}; Suc k < ncols A\<rbrakk> \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal {column i (Gram_Schmidt_upt_k A 0) |i. mod_type_class.to_nat i \<le> 0}
[PROOF STEP]
unfolding set_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal {column (0::'b) (Gram_Schmidt_upt_k A 0)}
[PROOF STEP]
unfolding pairwise_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{column (0::'b) (Gram_Schmidt_upt_k A 0)}. \<forall>y\<in>{column (0::'b) (Gram_Schmidt_upt_k A 0)}. x \<noteq> y \<longrightarrow> orthogonal x y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pairwise orthogonal {column i (Gram_Schmidt_upt_k A 0) |i. mod_type_class.to_nat i \<le> 0}

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}; Suc k < ncols A\<rbrakk> \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}; Suc k < ncols A\<rbrakk> \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}
Suc k < ncols A

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}; Suc k < ncols A\<rbrakk> \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}
[PROOF STEP]
have 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. \<lbrakk>k < ncols A \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}; Suc k < ncols A\<rbrakk> \<Longrightarrow> pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}
[PROOF STEP]
unfolding column_set_Gram_Schmidt_upt_k[OF Suc.prems[unfolded ncols_def], of A]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal ({column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k} \<union> {column (mod_type_class.from_nat (Suc k)) (Gram_Schmidt_upt_k A k) - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}. (x \<bullet> column (mod_type_class.from_nat (Suc k)) (Gram_Schmidt_upt_k A k) / (x \<bullet> x)) *\<^sub>R x)})
[PROOF STEP]
unfolding proj_onto_sum_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise orthogonal ({column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k} \<union> {column (mod_type_class.from_nat (Suc k)) (Gram_Schmidt_upt_k A k) - (\<Sum>x\<in>{column i (Gram_Schmidt_upt_k A k) |i. mod_type_class.to_nat i \<le> k}. (column (mod_type_class.from_nat (Suc k)) (Gram_Schmidt_upt_k A k) \<bullet> x / (x \<bullet> x)) *\<^sub>R x)})
[PROOF STEP]
by (auto simp add: proj_def[symmetric] proj_onto_def[symmetric])
       (rule pairwise_orthogonal_proj_set, auto simp add: Suc.hyps Suc.prems Suc_lessD)
[PROOF STATE]
proof (state)
this:
pairwise orthogonal {column i (Gram_Schmidt_upt_k A (Suc k)) |i. mod_type_class.to_nat i \<le> Suc k}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rotate2_dot [simp]: "(rotate2 u) \<bullet> (rotate2 v) = u \<bullet> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rotate2 u \<bullet> rotate2 v = u \<bullet> v
[PROOF STEP]
unfolding inner_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. rotate2 u $ i \<bullet> rotate2 v $ i) = (\<Sum>i\<in>UNIV. u $ i \<bullet> v $ i)
[PROOF STEP]
by (simp add: sum_2)


[STATEMENT]
lemma pdevs_val_sum_list: "pdevs_val (\<lambda>_. c) X = c *\<^sub>R sum_list (map snd (list_of_pdevs X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdevs_val (\<lambda>_. c) X = c *\<^sub>R sum_list (map snd (list_of_pdevs X))
[PROOF STEP]
by (auto simp: pdevs_val_sum sum_list_list_of_pdevs pdevs_val_const_pdevs_of_list[symmetric]
    pdevs_of_list_dense_list_of_pdevs)


[STATEMENT]
lemma subset_Collect_iff: "B \<subseteq> A \<Longrightarrow> (B \<subseteq> {x \<in> A. P x}) = (\<forall>x \<in> B. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> A \<Longrightarrow> (B \<subseteq> {x \<in> A. P x}) = (\<forall>x\<in>B. P x)
[PROOF STEP]
by blast


[STATEMENT]
lemma geometric_pmf_prob_lessThan:
  assumes "p \<in> {0<..1}"
  shows  "measure_pmf.prob (geometric_pmf p) {..<n} = 1 - (1 - p) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {..<n} = 1 - (1 - p) ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {..<n} = 1 - (1 - p) ^ n
[PROOF STEP]
have "(\<Sum>x<n. (1 - p) ^ x * p) = 1 - (1 - p) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x<n. (1 - p) ^ x * p) = 1 - (1 - p) ^ n
[PROOF STEP]
by (induction n) (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>x<n. (1 - p) ^ x * p) = 1 - (1 - p) ^ n

goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {..<n} = 1 - (1 - p) ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x<n. (1 - p) ^ x * p) = 1 - (1 - p) ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x<n. (1 - p) ^ x * p) = 1 - (1 - p) ^ n

goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {..<n} = 1 - (1 - p) ^ n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x<n. (1 - p) ^ x * p) = 1 - (1 - p) ^ n
p \<in> {0<..1}

goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {..<n} = 1 - (1 - p) ^ n
[PROOF STEP]
by (auto simp add: measure_pmf_conv_infsetsum)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (geometric_pmf p) {..<n} = 1 - (1 - p) ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_subset_finite: "\<lbrakk>finite X; card Y = n; Y \<subseteq> X\<rbrakk> \<Longrightarrow> card X \<ge> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite X; card Y = n; Y \<subseteq> X\<rbrakk> \<Longrightarrow> n \<le> card X
[PROOF STEP]
using card_subset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>card ?Y = ?n; ?Y \<subseteq> ?X\<rbrakk> \<Longrightarrow> ?n \<le> card ?X \<or> infinite ?X

goal (1 subgoal):
 1. \<lbrakk>finite X; card Y = n; Y \<subseteq> X\<rbrakk> \<Longrightarrow> n \<le> card X
[PROOF STEP]
by auto


[STATEMENT]
lemma lm100:
  assumes "x \<notin> set xs" "set (injectionsAlg xs Y) = injections (set xs) (set Y)"
  shows   "set (injectionsAlg (x # xs) Y) = injections ({x} \<union> set xs) (set Y)"
  (is "?l=?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (injectionsAlg (x # xs) Y) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (injectionsAlg (x # xs) Y) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
have "?l = (\<Union> f\<in>injections (set xs) (set Y). {f \<union> {(x,y)} | y . y \<in> (set Y)-Range f})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (injectionsAlg (x # xs) Y) = (\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f})
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
set (injectionsAlg xs Y) = injections (set xs) (set Y)

goal (1 subgoal):
 1. set (injectionsAlg (x # xs) Y) = (\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f})
[PROOF STEP]
by (rule lm097)
[PROOF STATE]
proof (state)
this:
set (injectionsAlg (x # xs) Y) = (\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f})

goal (1 subgoal):
 1. set (injectionsAlg (x # xs) Y) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (injectionsAlg (x # xs) Y) = (\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f})

goal (1 subgoal):
 1. set (injectionsAlg (x # xs) Y) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
have "... = ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f}) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<notin> set xs

goal (1 subgoal):
 1. (\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f}) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
by (rule injectionsUnionCommute)
[PROOF STATE]
proof (state)
this:
(\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f}) = injections ({x} \<union> set xs) (set Y)

goal (1 subgoal):
 1. set (injectionsAlg (x # xs) Y) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (injectionsAlg (x # xs) Y) = (\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f})
(\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f}) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (injectionsAlg (x # xs) Y) = (\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f})
(\<Union>f\<in>injections (set xs) (set Y). {f \<union> {(x, y)} |y. y \<in> set Y - Range f}) = injections ({x} \<union> set xs) (set Y)

goal (1 subgoal):
 1. set (injectionsAlg (x # xs) Y) = injections ({x} \<union> set xs) (set Y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (injectionsAlg (x # xs) Y) = injections ({x} \<union> set xs) (set Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compute_bitlen[code]: "bitlen a = (if a > 0 then log2 a + 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bitlen a = (if 0 < a then log2 a + 1 else 0)
[PROOF STEP]
by (simp add: bitlen_alt_def log2_def)


[STATEMENT]
lemma integral_std_normal_distribution_moment_odd:
  "odd k \<Longrightarrow> integral\<^sup>L std_normal_distribution (\<lambda>x. x^k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd k \<Longrightarrow> LINT x|std_normal_distribution. x ^ k = 0
[PROOF STEP]
using integral_std_normal_moment_odd[of "(k - 1) div 2"]
[PROOF STATE]
proof (prove)
using this:
LBINT x. std_normal_density x * x ^ (2 * ((k - 1) div 2) + 1) = 0

goal (1 subgoal):
 1. odd k \<Longrightarrow> LINT x|std_normal_distribution. x ^ k = 0
[PROOF STEP]
by (auto simp: integral_density normal_density_nonneg elim: oddE)


[STATEMENT]
theorem goedel_first_ex:
assumes "\<omega>consistent"
shows "\<exists> \<phi>. \<phi> \<in> fmla \<and> \<not> prv \<phi> \<and> \<not> prv (neg \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<phi>. \<phi> \<in> fmla \<and> \<not> prv \<phi> \<and> \<not> prv (neg \<phi>)
[PROOF STEP]
using assms goedel_first
[PROOF STATE]
proof (prove)
using this:
\<omega>consistent
\<omega>consistent \<Longrightarrow> \<not> prv \<phi>G \<and> \<not> prv (neg \<phi>G)

goal (1 subgoal):
 1. \<exists>\<phi>. \<phi> \<in> fmla \<and> \<not> prv \<phi> \<and> \<not> prv (neg \<phi>)
[PROOF STEP]
by (intro exI[of _ \<phi>G]) blast


[STATEMENT]
lemma mult_vec_mat_transpose:
  assumes "dim_vec v = dim_row A"
  shows "v \<^sub>v* A = (transpose_mat A) *\<^sub>v (v::'a::comm_semiring_0 vec)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<^sub>v* A = A\<^sup>T *\<^sub>v v
[PROOF STEP]
proof (simp add: mult_vec_mat_def mult_mat_vec_def, rule vec_cong, rule refl, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < dim_col A \<Longrightarrow> v \<bullet> col A i = col A i \<bullet> v
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < dim_col A \<Longrightarrow> v \<bullet> col A i = col A i \<bullet> v
[PROOF STEP]
show "v \<bullet> col A j = col A j \<bullet> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet> col A j = col A j \<bullet> v
[PROOF STEP]
by (rule scalar_prod_comm, simp add: assms)
[PROOF STATE]
proof (state)
this:
v \<bullet> col A j = col A j \<bullet> v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subseteq_set_conv_nth:
  "(\<forall> i < length ss. ss ! i \<in> T) \<longleftrightarrow> set ss \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<length ss. ss ! i \<in> T) = (set ss \<subseteq> T)
[PROOF STEP]
by (metis in_set_conv_nth subset_code(1))


[STATEMENT]
lemma sqrt_lower_bound_2:
  assumes "x \<ge> 0"
    shows "8*x*(x + 1)*(x^2 + 6*x + 1) / (x^4 + 28*x^3 + 70*x^2 + 28*x + 1) \<le> sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 8 * x * (x + 1) * (x\<^sup>2 + 6 * x + 1) / (x ^ 4 + 28 * x ^ 3 + 70 * x\<^sup>2 + 28 * x + 1) \<le> sqrt x
[PROOF STEP]
by (metis assms sqrtl_2_eq gen_sqrt_lower)


[STATEMENT]
lemma orthogonal_complement_orthoI:
  \<open>x \<in> orthogonal_complement M \<Longrightarrow> y \<in> M \<Longrightarrow> x \<bullet>\<^sub>C y = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> orthogonal_complement M; y \<in> M\<rbrakk> \<Longrightarrow> x \<bullet>\<^sub>C y = 0
[PROOF STEP]
unfolding orthogonal_complement_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> {x |x. \<forall>y\<in>M. x \<bullet>\<^sub>C y = 0}; y \<in> M\<rbrakk> \<Longrightarrow> x \<bullet>\<^sub>C y = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma LIMSEQ_power_zero: "f \<longlonglongrightarrow> 0 \<Longrightarrow> 0 < n  \<Longrightarrow> (\<lambda>x. f x ^ n :: real) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<longlonglongrightarrow> 0; 0 < n\<rbrakk> \<Longrightarrow> (\<lambda>x. f x ^ n) \<longlonglongrightarrow> 0
[PROOF STEP]
by (metis power_eq_0_iff tendsto_power)


[STATEMENT]
lemma bigo_plus_idemp [simp]: "O(f) + O(f) = O(f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O(f) + O(f) = O(f)
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. O(f) + O(f) \<subseteq> O(f)
 2. O(f) \<subseteq> O(f) + O(f)
[PROOF STEP]
apply (rule bigo_plus_self_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O(f) \<subseteq> O(f) + O(f)
[PROOF STEP]
apply (rule set_zero_plus2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<in> O(f)
[PROOF STEP]
apply (rule bigo_zero)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma map_eq_zero_iff: "map f p = 0 \<longleftrightarrow> (\<forall>k \<in> keys p. f (lookup p k) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Poly_Mapping.map f p = 0) = (\<forall>k\<in>keys p. f (lookup p k) = (0::'b))
[PROOF STEP]
by transfer(auto simp add: fun_eq_iff when_def)


[STATEMENT]
lemma tranclp_complete_run_right_unique:
  fixes R :: "'a \<Rightarrow> 'a \<Rightarrow> bool" and x y z :: 'a
  assumes "right_unique R"
  shows "R\<^sup>+\<^sup>+ x y \<Longrightarrow> (\<nexists>w. R y w) \<Longrightarrow> R\<^sup>+\<^sup>+ x z \<Longrightarrow> (\<nexists>w. R z w) \<Longrightarrow> y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R\<^sup>+\<^sup>+ x y; \<nexists>w. R y w; R\<^sup>+\<^sup>+ x z; \<nexists>w. R z w\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
using right_uniqueD[OF \<open>right_unique R\<close>, of x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>R x ?y; R x ?z\<rbrakk> \<Longrightarrow> ?y = ?z

goal (1 subgoal):
 1. \<lbrakk>R\<^sup>+\<^sup>+ x y; \<nexists>w. R y w; R\<^sup>+\<^sup>+ x z; \<nexists>w. R z w\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
by (auto dest!: tranclpD intro!: rtranclp_complete_run_right_unique[OF \<open>right_unique R\<close>, of _ y z])


[STATEMENT]
lemma hyperpow_add: "\<And>r n m. (r::'a::monoid_mult star) pow (n + m) = (r pow n) * (r pow m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r n m. r pow (n + m) = r pow n * r pow m
[PROOF STEP]
by transfer (rule power_add)


[STATEMENT]
lemma orthogonalI[intro]:
  "(\<And>i j. i < length vs \<Longrightarrow> j < length vs \<Longrightarrow> (nth vs i \<bullet> nth vs j = 0) = (i \<noteq> j)) \<Longrightarrow>
   orthogonal vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i < length vs; j < length vs\<rbrakk> \<Longrightarrow> (vs ! i \<bullet> vs ! j = (0::'a)) = (i \<noteq> j)) \<Longrightarrow> orthogonal vs
[PROOF STEP]
unfolding orthogonal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i < length vs; j < length vs\<rbrakk> \<Longrightarrow> (vs ! i \<bullet> vs ! j = (0::'a)) = (i \<noteq> j)) \<Longrightarrow> \<forall>i j. i < length vs \<longrightarrow> j < length vs \<longrightarrow> (vs ! i \<bullet> vs ! j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
by auto


[STATEMENT]
lemma card_multisets:
  assumes "finite A"
  shows "card {M. set_mset M \<subseteq> A \<and> size M = k} = (card A + k - 1) choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> A \<and> size M = k} = card A + k - 1 choose k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> A \<and> size M = k} = card A + k - 1 choose k
[PROOF STEP]
proof (induct A k rule: finite_set_and_nat_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. finite A \<Longrightarrow> card {M. set_mset M \<subseteq> A \<and> size M = 0} = card A + 0 - 1 choose 0
 2. \<And>k. card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k
 3. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
case (zero A)
[PROOF STATE]
proof (state)
this:
finite A

goal (3 subgoals):
 1. \<And>A. finite A \<Longrightarrow> card {M. set_mset M \<subseteq> A \<and> size M = 0} = card A + 0 - 1 choose 0
 2. \<And>k. card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k
 3. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
assume "finite (A :: 'a set)"
[PROOF STATE]
proof (state)
this:
finite A

goal (3 subgoals):
 1. \<And>A. finite A \<Longrightarrow> card {M. set_mset M \<subseteq> A \<and> size M = 0} = card A + 0 - 1 choose 0
 2. \<And>k. card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k
 3. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
have "{M. set_mset M \<subseteq> A \<and> size M = 0} = {{#}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {M. set_mset M \<subseteq> A \<and> size M = 0} = {{#}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{M. set_mset M \<subseteq> A \<and> size M = 0} = {{#}}

goal (3 subgoals):
 1. \<And>A. finite A \<Longrightarrow> card {M. set_mset M \<subseteq> A \<and> size M = 0} = card A + 0 - 1 choose 0
 2. \<And>k. card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k
 3. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
{M. set_mset M \<subseteq> A \<and> size M = 0} = {{#}}
[PROOF STEP]
show "card {M. set_mset M \<subseteq> A \<and> size M = 0} = card A + 0 - 1 choose 0"
[PROOF STATE]
proof (prove)
using this:
{M. set_mset M \<subseteq> A \<and> size M = 0} = {{#}}

goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> A \<and> size M = 0} = card A + 0 - 1 choose 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> A \<and> size M = 0} = card A + 0 - 1 choose 0

goal (2 subgoals):
 1. \<And>k. card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k
 2. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>k. card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k
 2. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
case (empty k)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>k. card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k
 2. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
show "card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k
[PROOF STEP]
by (cases k) (auto simp add: binomial_eq_0)
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> {} \<and> size M = k} = card {} + k - 1 choose k

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
case (step A k x)
[PROOF STATE]
proof (state)
this:
finite A
x \<notin> A
card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k
card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
let ?S\<^sub>1 = "{M. set_mset M \<subseteq> A \<and> size M = Suc k}"
  and ?S\<^sub>2 = "{M. set_mset M \<subseteq> insert x A \<and> size M = k}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
assume hyps1: "card ?S\<^sub>1 = card A + Suc k - 1 choose Suc k"
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
assume hyps2: "card ?S\<^sub>2 = card (insert x A) + k - 1 choose k"
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
have finite_sets: "finite ?S\<^sub>1" "finite ((\<lambda>M. M + {#x#}) ` ?S\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {M. set_mset M \<subseteq> A \<and> size M = Suc k} &&& finite ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite {M. set_mset M \<subseteq> A \<and> size M = Suc k} &&& finite ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})
[PROOF STEP]
by (auto simp add: finite_multisets)
[PROOF STATE]
proof (state)
this:
finite {M. set_mset M \<subseteq> A \<and> size M = Suc k}
finite ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
have inj: "inj_on (\<lambda>M. M + {#x#}) ?S\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>M. M + {#x#}) {M. set_mset M \<subseteq> insert x A \<and> size M = k}
[PROOF STEP]
by (rule inj_onI) auto
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>M. M + {#x#}) {M. set_mset M \<subseteq> insert x A \<and> size M = k}

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
have "card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} =
    card (?S\<^sub>1 \<union> (\<lambda>M. M + {#x#}) ` ?S\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card ({M. set_mset M \<subseteq> A \<and> size M = Suc k} \<union> (\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})
[PROOF STEP]
using set_of_multisets_eq \<open>x \<notin> A\<close>
[PROOF STATE]
proof (prove)
using this:
?x \<notin> ?A \<Longrightarrow> {M. set_mset M \<subseteq> insert ?x ?A \<and> size M = Suc ?k} = {M. set_mset M \<subseteq> ?A \<and> size M = Suc ?k} \<union> (\<lambda>M. M + {#?x#}) ` {M. set_mset M \<subseteq> insert ?x ?A \<and> size M = ?k}
x \<notin> A

goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card ({M. set_mset M \<subseteq> A \<and> size M = Suc k} \<union> (\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card ({M. set_mset M \<subseteq> A \<and> size M = Suc k} \<union> (\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card ({M. set_mset M \<subseteq> A \<and> size M = Suc k} \<union> (\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
have "\<dots> = card ?S\<^sub>1 + card ((\<lambda>M. M + {#x#}) ` ?S\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({M. set_mset M \<subseteq> A \<and> size M = Suc k} \<union> (\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k}) = card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})
[PROOF STEP]
using finite_sets \<open>x \<notin> A\<close>
[PROOF STATE]
proof (prove)
using this:
finite {M. set_mset M \<subseteq> A \<and> size M = Suc k}
finite ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})
x \<notin> A

goal (1 subgoal):
 1. card ({M. set_mset M \<subseteq> A \<and> size M = Suc k} \<union> (\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k}) = card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})
[PROOF STEP]
by (subst card_Un_disjoint) auto
[PROOF STATE]
proof (state)
this:
card ({M. set_mset M \<subseteq> A \<and> size M = Suc k} \<union> (\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k}) = card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({M. set_mset M \<subseteq> A \<and> size M = Suc k} \<union> (\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k}) = card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k})

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
have "\<dots> = card ?S\<^sub>1 + card ?S\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k}) = card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card {M. set_mset M \<subseteq> insert x A \<and> size M = k}
[PROOF STEP]
using inj
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>M. M + {#x#}) {M. set_mset M \<subseteq> insert x A \<and> size M = k}

goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k}) = card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card {M. set_mset M \<subseteq> insert x A \<and> size M = k}
[PROOF STEP]
by (auto intro: card_image)
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k}) = card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card {M. set_mset M \<subseteq> insert x A \<and> size M = k}

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card ((\<lambda>M. M + {#x#}) ` {M. set_mset M \<subseteq> insert x A \<and> size M = k}) = card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card {M. set_mset M \<subseteq> insert x A \<and> size M = k}

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
have "\<dots> = card A + Suc k - 1 choose Suc k + (card (insert x A) + k - 1 choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card A + Suc k - 1 choose Suc k + (card (insert x A) + k - 1 choose k)
[PROOF STEP]
using hyps1 hyps2
[PROOF STATE]
proof (prove)
using this:
card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k
card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k

goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card A + Suc k - 1 choose Suc k + (card (insert x A) + k - 1 choose k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card A + Suc k - 1 choose Suc k + (card (insert x A) + k - 1 choose k)

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> A \<and> size M = Suc k} + card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card A + Suc k - 1 choose Suc k + (card (insert x A) + k - 1 choose k)

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
have "\<dots> = card (insert x A) + Suc k - 1 choose Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A + Suc k - 1 choose Suc k + (card (insert x A) + k - 1 choose k) = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
using \<open>x \<notin> A\<close> \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
x \<notin> A
finite A

goal (1 subgoal):
 1. card A + Suc k - 1 choose Suc k + (card (insert x A) + k - 1 choose k) = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card A + Suc k - 1 choose Suc k + (card (insert x A) + k - 1 choose k) = card (insert x A) + Suc k - 1 choose Suc k

goal (1 subgoal):
 1. \<And>A k x. \<lbrakk>finite A; x \<notin> A; card {M. set_mset M \<subseteq> A \<and> size M = Suc k} = card A + Suc k - 1 choose Suc k; card {M. set_mset M \<subseteq> insert x A \<and> size M = k} = card (insert x A) + k - 1 choose k\<rbrakk> \<Longrightarrow> card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k

goal (1 subgoal):
 1. card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {M. set_mset M \<subseteq> insert x A \<and> size M = Suc k} = card (insert x A) + Suc k - 1 choose Suc k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma MOST_SucI: "MOST n. P n \<Longrightarrow> MOST n. P (Suc n)"
  and MOST_SucD: "MOST n. P (Suc n) \<Longrightarrow> MOST n. P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>\<infinity>n. P n \<Longrightarrow> \<forall>\<^sub>\<infinity>n. P (Suc n)) &&& (\<forall>\<^sub>\<infinity>n. P (Suc n) \<Longrightarrow> \<forall>\<^sub>\<infinity>n. P n)
[PROOF STEP]
by (simp_all add: MOST_Suc_iff)


[STATEMENT]
lemma lemma_4_5: "a \<squnion>1 b = a \<squnion>2 b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<squnion>1 b = a \<squnion>2 b
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<squnion>1 b \<le> a \<squnion>2 b
 2. a \<squnion>2 b \<le> a \<squnion>1 b
[PROOF STEP]
by (simp_all add: lemma_4_5_a lemma_4_5_b)


[STATEMENT]
lemma has_fps_expansion_divide [fps_expansion_intros]:
  fixes F G :: "'a :: {banach, real_normed_field} fps"
  assumes "f has_fps_expansion F" and "g has_fps_expansion G" and
          "subdegree G \<le> subdegree F" "G \<noteq> 0"
          "c = fps_nth F (subdegree G) / fps_nth G (subdegree G)"
  shows   "(\<lambda>x. if x = 0 then c else f x / g x) has_fps_expansion (F / G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
define n where "n = subdegree G"
[PROOF STATE]
proof (state)
this:
n = subdegree G

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
define F' and G' where "F' = fps_shift n F" and "G' = fps_shift n G"
[PROOF STATE]
proof (state)
this:
F' = fps_shift n F
G' = fps_shift n G

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
have "F = F' * fps_X ^ n" "G = G' * fps_X ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F = F' * fps_X ^ n &&& G = G' * fps_X ^ n
[PROOF STEP]
unfolding F'_def G'_def n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F = fps_shift (subdegree G) F * fps_X ^ subdegree G &&& G = fps_shift (subdegree G) G * fps_X ^ subdegree G
[PROOF STEP]
by (rule fps_shift_times_fps_X_power [symmetric] le_refl | fact)+
[PROOF STATE]
proof (state)
this:
F = F' * fps_X ^ n
G = G' * fps_X ^ n

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
F = F' * fps_X ^ n
G = G' * fps_X ^ n

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f has_fps_expansion F
g has_fps_expansion G
subdegree G \<le> subdegree F
G \<noteq> 0
c = fps_nth F (subdegree G) / fps_nth G (subdegree G)
[PROOF STEP]
have "fps_nth G' 0 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
f has_fps_expansion F
g has_fps_expansion G
subdegree G \<le> subdegree F
G \<noteq> 0
c = fps_nth F (subdegree G) / fps_nth G (subdegree G)

goal (1 subgoal):
 1. fps_nth G' 0 \<noteq> (0::'a)
[PROOF STEP]
by (simp add: G'_def n_def)
[PROOF STATE]
proof (state)
this:
fps_nth G' 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
F = F' * fps_X ^ n
G = G' * fps_X ^ n
fps_nth G' 0 \<noteq> (0::'a)
[PROOF STEP]
have FG: "F / G = F' * inverse G'"
[PROOF STATE]
proof (prove)
using this:
F = F' * fps_X ^ n
G = G' * fps_X ^ n
fps_nth G' 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. F / G = F' * inverse G'
[PROOF STEP]
by (simp add: fps_divide_unit)
[PROOF STATE]
proof (state)
this:
F / G = F' * inverse G'

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
have "(\<lambda>x. (if x = 0 then fps_nth F n else f x / x ^ n) *
          inverse (if x = 0 then fps_nth G n else g x / x ^ n)) has_fps_expansion F / G"
    (is "?h has_fps_expansion _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (if x = (0::'a) then fps_nth F n else f x / x ^ n) * inverse (if x = (0::'a) then fps_nth G n else g x / x ^ n)) has_fps_expansion F / G
[PROOF STEP]
unfolding FG F'_def G'_def n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (if x = (0::'a) then fps_nth F (subdegree G) else f x / x ^ subdegree G) * inverse (if x = (0::'a) then fps_nth G (subdegree G) else g x / x ^ subdegree G)) has_fps_expansion fps_shift (subdegree G) F * inverse (fps_shift (subdegree G) G)
[PROOF STEP]
using \<open>G \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
G \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>x. (if x = (0::'a) then fps_nth F (subdegree G) else f x / x ^ subdegree G) * inverse (if x = (0::'a) then fps_nth G (subdegree G) else g x / x ^ subdegree G)) has_fps_expansion fps_shift (subdegree G) F * inverse (fps_shift (subdegree G) G)
[PROOF STEP]
by (intro has_fps_expansion_mult has_fps_expansion_inverse
              has_fps_expansion_shift assms) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (if x = (0::'a) then fps_nth F n else f x / x ^ n) * inverse (if x = (0::'a) then fps_nth G n else g x / x ^ n)) has_fps_expansion F / G

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (if x = (0::'a) then fps_nth F n else f x / x ^ n) * inverse (if x = (0::'a) then fps_nth G n else g x / x ^ n)) has_fps_expansion F / G

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
have "?h = (\<lambda>x. if x = 0 then c else f x / g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (if x = (0::'a) then fps_nth F n else f x / x ^ n) * inverse (if x = (0::'a) then fps_nth G n else g x / x ^ n)) = (\<lambda>x. if x = (0::'a) then c else f x / g x)
[PROOF STEP]
using assms(5)
[PROOF STATE]
proof (prove)
using this:
c = fps_nth F (subdegree G) / fps_nth G (subdegree G)

goal (1 subgoal):
 1. (\<lambda>x. (if x = (0::'a) then fps_nth F n else f x / x ^ n) * inverse (if x = (0::'a) then fps_nth G n else g x / x ^ n)) = (\<lambda>x. if x = (0::'a) then c else f x / g x)
[PROOF STEP]
unfolding n_def
[PROOF STATE]
proof (prove)
using this:
c = fps_nth F (subdegree G) / fps_nth G (subdegree G)

goal (1 subgoal):
 1. (\<lambda>x. (if x = (0::'a) then fps_nth F (subdegree G) else f x / x ^ subdegree G) * inverse (if x = (0::'a) then fps_nth G (subdegree G) else g x / x ^ subdegree G)) = (\<lambda>x. if x = (0::'a) then c else f x / g x)
[PROOF STEP]
by (intro ext) (auto split: if_splits simp: field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (if x = (0::'a) then fps_nth F n else f x / x ^ n) * inverse (if x = (0::'a) then fps_nth G n else g x / x ^ n)) = (\<lambda>x. if x = (0::'a) then c else f x / g x)

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G

goal (1 subgoal):
 1. (\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x = (0::'a) then c else f x / g x) has_fps_expansion F / G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma project_at_indices_consecutive_indices':
  assumes "(i::nat) < j"
  assumes "j \<le> n"
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "k < j - i"
  shows "(project_at_indices {i..<j} a) ! k = a! (i + k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths a {i..<j} ! k = a ! (i + k)
[PROOF STEP]
using assms(1) assms(2) assms(3) assms(4) cartesian_power_car_memE project_at_indices_consecutive_indices
[PROOF STATE]
proof (prove)
using this:
i < j
j \<le> n
a \<in> carrier (R\<^bsup>n\<^esup>)
k < j - i
?as \<in> carrier (?R\<^bsup>?n\<^esup>) \<Longrightarrow> length ?as = ?n
\<lbrakk>?i < ?j; ?j \<le> ?n; length ?a = ?n; ?k < ?j - ?i\<rbrakk> \<Longrightarrow> nths ?a {?i..<?j} ! ?k = ?a ! (?i + ?k)

goal (1 subgoal):
 1. nths a {i..<j} ! k = a ! (i + k)
[PROOF STEP]
by blast