[STATEMENT]
lemma is_projection_on_plus:
  assumes "\<And>x y. x \<in> A \<Longrightarrow> y \<in> B \<Longrightarrow> is_orthogonal x y"
  assumes \<open>closed_csubspace A\<close>
  assumes \<open>closed_csubspace B\<close>
  assumes \<open>is_projection_on \<pi>A A\<close>
  assumes \<open>is_projection_on \<pi>B B\<close>
  shows \<open>is_projection_on (\<lambda>x. \<pi>A x + \<pi>B x) (A +\<^sub>M B)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_projection_on (\<lambda>x. \<pi>A x + \<pi>B x) (A +\<^sub>M B)
[PROOF STEP]
proof (rule is_projection_on_iff_orthog[THEN iffD2, rule_format])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. closed_csubspace (A +\<^sub>M B)
 2. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
show clAB: \<open>closed_csubspace (A +\<^sub>M B)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace (A +\<^sub>M B)
[PROOF STEP]
by (simp add: assms(2) assms(3) closed_subspace_closed_sum)
[PROOF STATE]
proof (state)
this:
closed_csubspace (A +\<^sub>M B)

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
fix h
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
have 1: \<open>\<pi>A h + \<pi>B h \<in> A +\<^sub>M B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
by (meson clAB assms(2) assms(3) assms(4) assms(5) closed_csubspace_def closed_sum_left_subset closed_sum_right_subset complex_vector.subspace_def in_mono is_projection_on_in_image)
[PROOF STATE]
proof (state)
this:
\<pi>A h + \<pi>B h \<in> A +\<^sub>M B

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
have \<open>\<pi>A (\<pi>B h) = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi>A (\<pi>B h) = (0::'a)
[PROOF STEP]
by (smt (verit, del_insts) assms(1) assms(2) assms(4) assms(5) cinner_eq_zero_iff is_cadjoint_def is_projection_on_in_image is_projection_on_is_cadjoint)
[PROOF STATE]
proof (state)
this:
\<pi>A (\<pi>B h) = (0::'a)

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<pi>A (\<pi>B h) = (0::'a)
[PROOF STEP]
have \<open>h - (\<pi>A h + \<pi>B h) = (h - \<pi>B h) - \<pi>A (h - \<pi>B h)\<close>
[PROOF STATE]
proof (prove)
using this:
\<pi>A (\<pi>B h) = (0::'a)

goal (1 subgoal):
 1. h - (\<pi>A h + \<pi>B h) = h - \<pi>B h - \<pi>A (h - \<pi>B h)
[PROOF STEP]
by (smt (verit) add.right_neutral add_diff_cancel_left' assms(2) assms(4) closed_csubspace.subspace complex_vector.subspace_diff diff_add_eq_diff_diff_swap diff_diff_add is_projection_on_iff_orthog orthog_proj_unique orthogonal_complement_closed_subspace)
[PROOF STATE]
proof (state)
this:
h - (\<pi>A h + \<pi>B h) = h - \<pi>B h - \<pi>A (h - \<pi>B h)

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
h - (\<pi>A h + \<pi>B h) = h - \<pi>B h - \<pi>A (h - \<pi>B h)

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
have \<open>\<dots> \<in> orthogonal_complement A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h - \<pi>B h - \<pi>A (h - \<pi>B h) \<in> orthogonal_complement A
[PROOF STEP]
using assms(2) assms(4) is_projection_on_iff_orthog
[PROOF STATE]
proof (prove)
using this:
closed_csubspace A
is_projection_on \<pi>A A
closed_csubspace ?M \<Longrightarrow> is_projection_on ?\<pi> ?M = (\<forall>h. h - ?\<pi> h \<in> orthogonal_complement ?M \<and> ?\<pi> h \<in> ?M)

goal (1 subgoal):
 1. h - \<pi>B h - \<pi>A (h - \<pi>B h) \<in> orthogonal_complement A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
h - \<pi>B h - \<pi>A (h - \<pi>B h) \<in> orthogonal_complement A

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement A
[PROOF STEP]
have orthoA: \<open>h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement A\<close>
[PROOF STATE]
proof (prove)
using this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement A

goal (1 subgoal):
 1. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement A
[PROOF STEP]
by -
[PROOF STATE]
proof (state)
this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement A

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
have \<open>\<pi>B (\<pi>A h) = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi>B (\<pi>A h) = (0::'a)
[PROOF STEP]
by (smt (verit, del_insts) assms(1) assms(3) assms(4) assms(5) cinner_eq_zero_iff is_cadjoint_def is_projection_on_in_image is_projection_on_is_cadjoint)
[PROOF STATE]
proof (state)
this:
\<pi>B (\<pi>A h) = (0::'a)

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<pi>B (\<pi>A h) = (0::'a)
[PROOF STEP]
have \<open>h - (\<pi>A h + \<pi>B h) = (h - \<pi>A h) - \<pi>B (h - \<pi>A h)\<close>
[PROOF STATE]
proof (prove)
using this:
\<pi>B (\<pi>A h) = (0::'a)

goal (1 subgoal):
 1. h - (\<pi>A h + \<pi>B h) = h - \<pi>A h - \<pi>B (h - \<pi>A h)
[PROOF STEP]
by (smt (verit) add.right_neutral add_diff_cancel assms(3) assms(5) closed_csubspace.subspace complex_vector.subspace_diff diff_add_eq_diff_diff_swap diff_diff_add is_projection_on_iff_orthog orthog_proj_unique orthogonal_complement_closed_subspace)
[PROOF STATE]
proof (state)
this:
h - (\<pi>A h + \<pi>B h) = h - \<pi>A h - \<pi>B (h - \<pi>A h)

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
h - (\<pi>A h + \<pi>B h) = h - \<pi>A h - \<pi>B (h - \<pi>A h)

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
have \<open>\<dots> \<in> orthogonal_complement B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h - \<pi>A h - \<pi>B (h - \<pi>A h) \<in> orthogonal_complement B
[PROOF STEP]
using assms(3) assms(5) is_projection_on_iff_orthog
[PROOF STATE]
proof (prove)
using this:
closed_csubspace B
is_projection_on \<pi>B B
closed_csubspace ?M \<Longrightarrow> is_projection_on ?\<pi> ?M = (\<forall>h. h - ?\<pi> h \<in> orthogonal_complement ?M \<and> ?\<pi> h \<in> ?M)

goal (1 subgoal):
 1. h - \<pi>A h - \<pi>B (h - \<pi>A h) \<in> orthogonal_complement B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
h - \<pi>A h - \<pi>B (h - \<pi>A h) \<in> orthogonal_complement B

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement B
[PROOF STEP]
have orthoB: \<open>h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement B\<close>
[PROOF STATE]
proof (prove)
using this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement B

goal (1 subgoal):
 1. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement B
[PROOF STEP]
by -
[PROOF STATE]
proof (state)
this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement B

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
from orthoA orthoB
[PROOF STATE]
proof (chain)
picking this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement A
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement B
[PROOF STEP]
have 2: \<open>h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B)\<close>
[PROOF STATE]
proof (prove)
using this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement A
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement B

goal (1 subgoal):
 1. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B)
[PROOF STEP]
by (metis IntI assms(2) assms(3) closed_csubspace_def complex_vector.subspace_def de_morgan_orthogonal_complement_plus)
[PROOF STATE]
proof (state)
this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B)

goal (1 subgoal):
 1. \<And>h. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
from 1 2
[PROOF STATE]
proof (chain)
picking this:
\<pi>A h + \<pi>B h \<in> A +\<^sub>M B
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B)
[PROOF STEP]
show \<open>h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B\<close>
[PROOF STATE]
proof (prove)
using this:
\<pi>A h + \<pi>B h \<in> A +\<^sub>M B
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B)

goal (1 subgoal):
 1. h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
h - (\<pi>A h + \<pi>B h) \<in> orthogonal_complement (A +\<^sub>M B) \<and> \<pi>A h + \<pi>B h \<in> A +\<^sub>M B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_exp [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. exp (f x))"
  for f :: "_ \<Rightarrow>'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F f \<Longrightarrow> continuous F (\<lambda>x. exp (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F \<Longrightarrow> ((\<lambda>x. exp (f x)) \<longlongrightarrow> exp (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_exp)


[STATEMENT]
lemma fps_dvd_code [code_unfold]:
  "x dvd y \<longleftrightarrow> y = 0 \<or> ((x::'a::field_gcd fps) \<noteq> 0 \<and> subdegree x \<le> subdegree y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x dvd y) = (y = 0 \<or> x \<noteq> 0 \<and> subdegree x \<le> subdegree y)
[PROOF STEP]
using fps_dvd_iff[of x y]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<noteq> 0; y \<noteq> 0\<rbrakk> \<Longrightarrow> (x dvd y) = (subdegree x \<le> subdegree y)

goal (1 subgoal):
 1. (x dvd y) = (y = 0 \<or> x \<noteq> 0 \<and> subdegree x \<le> subdegree y)
[PROOF STEP]
by (cases "x = 0") auto


[STATEMENT]
theorem HFail_valueChosen:
  assumes act: "HFail s s' q"
  and vc: "valueChosen s v"
  and v_input: "v \<in> Inputs"
  shows "valueChosen s' v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
from vc
[PROOF STATE]
proof (chain)
picking this:
valueChosen s v
[PROOF STEP]
obtain b p D where
        asm1: "b \<in> (UN p. Ballot p)"
    and asm2: "D\<in>MajoritySet"
    and asm3: "maxBalInp s b v"
    and asm4: "\<forall>d\<in>D.  b \<le> bal(disk s d p)
                   \<and>(\<forall>q.(   phase s q = 1
                          \<and> b \<le>mbal(dblock s q)
                          \<and> hasRead s q d p
                         ) \<longrightarrow> (\<exists>br\<in>blocksRead s q d. b \<le> bal(block br)))"
[PROOF STATE]
proof (prove)
using this:
valueChosen s v

goal (1 subgoal):
 1. (\<And>b D p. \<lbrakk>b \<in> \<Union> (range Ballot); D \<in> MajoritySet; maxBalInp s b v; \<forall>d\<in>D. b \<le> bal (disk s d p) \<and> (\<forall>q. phase s q = 1 \<and> b \<le> mbal (dblock s q) \<and> hasRead s q d p \<longrightarrow> (\<exists>br\<in>blocksRead s q d. b \<le> bal (block br)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(auto simp add: valueChosen_def)
[PROOF STATE]
proof (state)
this:
b \<in> \<Union> (range Ballot)
D \<in> MajoritySet
maxBalInp s b v
\<forall>d\<in>D. b \<le> bal (disk s d p) \<and> (\<forall>q. phase s q = 1 \<and> b \<le> mbal (dblock s q) \<and> hasRead s q d p \<longrightarrow> (\<exists>br\<in>blocksRead s q d. b \<le> bal (block br)))

goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
from HFail_maxBalInp[OF act asm1 asm3]
[PROOF STATE]
proof (chain)
picking this:
maxBalInp s' b v
[PROOF STEP]
have "maxBalInp s' b v"
[PROOF STATE]
proof (prove)
using this:
maxBalInp s' b v

goal (1 subgoal):
 1. maxBalInp s' b v
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
maxBalInp s' b v

goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
with HFail_valueChosen2[OF act asm4] asm1 asm2
[PROOF STATE]
proof (chain)
picking this:
\<forall>d\<in>D. b \<le> bal (disk s' d p) \<and> (\<forall>q. phase s' q = 1 \<and> b \<le> mbal (dblock s' q) \<and> hasRead s' q d p \<longrightarrow> (\<exists>br\<in>blocksRead s' q d. b \<le> bal (block br)))
b \<in> \<Union> (range Ballot)
D \<in> MajoritySet
maxBalInp s' b v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>d\<in>D. b \<le> bal (disk s' d p) \<and> (\<forall>q. phase s' q = 1 \<and> b \<le> mbal (dblock s' q) \<and> hasRead s' q d p \<longrightarrow> (\<exists>br\<in>blocksRead s' q d. b \<le> bal (block br)))
b \<in> \<Union> (range Ballot)
D \<in> MajoritySet
maxBalInp s' b v

goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
by(auto simp add: valueChosen_def)
[PROOF STATE]
proof (state)
this:
valueChosen s' v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord_form_list_idemp:
  "ord_form_list_aci (ord_form_list_aci q) = ord_form_list_aci q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord_form_list_aci (ord_form_list_aci q) = ord_form_list_aci q
[PROOF STEP]
apply (induct q)
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. ord_form_list_aci (ord_form_list_aci form_list_aci.TT_aci) = ord_form_list_aci form_list_aci.TT_aci
 2. ord_form_list_aci (ord_form_list_aci form_list_aci.FF_aci) = ord_form_list_aci form_list_aci.FF_aci
 3. \<And>x1 x2 x3. ord_form_list_aci (ord_form_list_aci (form_list_aci.Pred_aci x1 x2 x3)) = ord_form_list_aci (form_list_aci.Pred_aci x1 x2 x3)
 4. \<And>x. (\<And>xa. xa \<in> set x \<Longrightarrow> ord_form_list_aci (ord_form_list_aci xa) = ord_form_list_aci xa) \<Longrightarrow> ord_form_list_aci (ord_form_list_aci (form_list_aci.And_aci x)) = ord_form_list_aci (form_list_aci.And_aci x)
 5. \<And>x. (\<And>xa. xa \<in> set x \<Longrightarrow> ord_form_list_aci (ord_form_list_aci xa) = ord_form_list_aci xa) \<Longrightarrow> ord_form_list_aci (ord_form_list_aci (form_list_aci.Or_aci x)) = ord_form_list_aci (form_list_aci.Or_aci x)
 6. \<And>q. ord_form_list_aci (ord_form_list_aci q) = ord_form_list_aci q \<Longrightarrow> ord_form_list_aci (ord_form_list_aci (form_list_aci.Forall_aci q)) = ord_form_list_aci (form_list_aci.Forall_aci q)
 7. \<And>q. ord_form_list_aci (ord_form_list_aci q) = ord_form_list_aci q \<Longrightarrow> ord_form_list_aci (ord_form_list_aci (form_list_aci.Exists_aci q)) = ord_form_list_aci (form_list_aci.Exists_aci q)
[PROOF STEP]
apply (auto simp: list.set_map)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. (\<And>xa. xa \<in> set x \<Longrightarrow> ord_form_list_aci (ord_form_list_aci xa) = ord_form_list_aci xa) \<Longrightarrow> sort (map ord_form_list_aci (sort (map ord_form_list_aci x))) = sort (map ord_form_list_aci x)
 2. \<And>x. (\<And>xa. xa \<in> set x \<Longrightarrow> ord_form_list_aci (ord_form_list_aci xa) = ord_form_list_aci xa) \<Longrightarrow> sort (map ord_form_list_aci (sort (map ord_form_list_aci x))) = sort (map ord_form_list_aci x)
[PROOF STEP]
apply (smt imageE list.set_map map_idI set_sort sorted_sort_id sorted_sort_key)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma omega_sum_unfold: "x\<^sup>\<omega> + x\<^sup>\<star> \<cdot> y \<cdot> (x + y)\<^sup>\<omega> = (x + y)\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<omega> + x\<^sup>\<star> \<cdot> y \<cdot> (x + y)\<^sup>\<omega> = (x + y)\<^sup>\<omega>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^sup>\<omega> + x\<^sup>\<star> \<cdot> y \<cdot> (x + y)\<^sup>\<omega> = (x + y)\<^sup>\<omega>
[PROOF STEP]
have "(x + y)\<^sup>\<omega> = x \<cdot> (x + y)\<^sup>\<omega> + y \<cdot> (x+y)\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y)\<^sup>\<omega> = x \<cdot> (x + y)\<^sup>\<omega> + y \<cdot> (x + y)\<^sup>\<omega>
[PROOF STEP]
by (metis distrib_right omega_unfold_eq)
[PROOF STATE]
proof (state)
this:
(x + y)\<^sup>\<omega> = x \<cdot> (x + y)\<^sup>\<omega> + y \<cdot> (x + y)\<^sup>\<omega>

goal (1 subgoal):
 1. x\<^sup>\<omega> + x\<^sup>\<star> \<cdot> y \<cdot> (x + y)\<^sup>\<omega> = (x + y)\<^sup>\<omega>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(x + y)\<^sup>\<omega> = x \<cdot> (x + y)\<^sup>\<omega> + y \<cdot> (x + y)\<^sup>\<omega>

goal (1 subgoal):
 1. x\<^sup>\<omega> + x\<^sup>\<star> \<cdot> y \<cdot> (x + y)\<^sup>\<omega> = (x + y)\<^sup>\<omega>
[PROOF STEP]
by (metis mult.assoc wagner_3)
[PROOF STATE]
proof (state)
this:
x\<^sup>\<omega> + x\<^sup>\<star> \<cdot> y \<cdot> (x + y)\<^sup>\<omega> = (x + y)\<^sup>\<omega>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reachability_invariant:
  assumes reachable: "(s, x) \<in> (Edges a)\<^sup>*"
      and closed: "\<forall>v\<in>visited. Edges a `` {v} \<subseteq> visited"
      and start: "s \<in> visited"
  shows "x \<in> visited"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> visited
[PROOF STEP]
using reachable start closed
[PROOF STATE]
proof (prove)
using this:
(s, x) \<in> (Edges a)\<^sup>*
s \<in> visited
\<forall>v\<in>visited. Edges a `` {v} \<subseteq> visited

goal (1 subgoal):
 1. x \<in> visited
[PROOF STEP]
by induction auto


[STATEMENT]
lemma to_abs_list_remove_all':
  "\<alpha>\<^sub>0 D n - {s} = \<alpha>\<^sub>0 (filter (\<lambda>d. \<nexists>S. d = (Fun (Val n) [], Fun (Set s) S)) D) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha>\<^sub>0 D n - {s} = \<alpha>\<^sub>0 (filter (\<lambda>d. \<nexists>S. d = (Fun (Val n) [], Fun (Set s) S)) D) n
[PROOF STEP]
using to_abs_alt_def[of D n]
      to_abs_alt_def[of "filter (\<lambda>d. \<nexists>S. d = (Fun (Val n) [], Fun (Set s) S)) D" n]
[PROOF STATE]
proof (prove)
using this:
\<alpha>\<^sub>0 D n = {s. \<exists>S. (Fun (Val n) [], Fun (Set s) S) \<in> set D}
\<alpha>\<^sub>0 (filter (\<lambda>d. \<nexists>S. d = (Fun (Val n) [], Fun (Set s) S)) D) n = {sa. \<exists>S. (Fun (Val n) [], Fun (Set sa) S) \<in> set (filter (\<lambda>d. \<nexists>S. d = (Fun (Val n) [], Fun (Set s) S)) D)}

goal (1 subgoal):
 1. \<alpha>\<^sub>0 D n - {s} = \<alpha>\<^sub>0 (filter (\<lambda>d. \<nexists>S. d = (Fun (Val n) [], Fun (Set s) S)) D) n
[PROOF STEP]
by auto


[STATEMENT]
lemma below_lubmapI[intro]:
  "m k = Some v \<Longrightarrow> (e k v::'a::Join_cpo) \<sqsubseteq> (\<Squnion> k\<mapsto>v\<in>m. e k v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m k = Some v \<Longrightarrow> e k v \<sqsubseteq> lub (mapCollect e m)
[PROOF STEP]
unfolding mapCollect_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m k = Some v \<Longrightarrow> e k v \<sqsubseteq> lub {e k v |k v. m k = Some v}
[PROOF STEP]
by auto


[STATEMENT]
lemma plugInLinear :
  assumes lLength : "length L>var"
  assumes nonzero : "B\<noteq>0"
  assumes hb : "\<forall>v. insertion (nth_default 0 (list_update L var v)) b = B"
  assumes hc : "\<forall>v. insertion (nth_default 0 (list_update L var v)) c = C"
  shows "aEval (Eq(b*Var var + c)) (list_update L var (-C/B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aEval (Eq (b * Var var + c)) (L[var := - C / B])
[PROOF STEP]
by(simp add: lLength insertion_add insertion_mult nonzero hb hc insertion_var)


[STATEMENT]
lemma dim_row_transfer_rule:
  "HMA_M A (A' :: 'a ^ 'nc ^ 'nr) \<Longrightarrow> (=) (dim_row A) (CARD('nr))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HMA_M A A' \<Longrightarrow> dim_row A = CARD('nr)
[PROOF STEP]
unfolding HMA_M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = from_hma\<^sub>m A' \<Longrightarrow> dim_row A = CARD('nr)
[PROOF STEP]
by auto


[STATEMENT]
lemma distinct3_def:
  "distinct [A, B, C] = (A \<noteq> B \<and> A \<noteq> C \<and> B \<noteq> C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct [A, B, C] = (A \<noteq> B \<and> A \<noteq> C \<and> B \<noteq> C)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in \<Z>) vprojection_arrow_is_arr:
  assumes "i \<in>\<^sub>\<circ> I" and "VLambda I A \<in>\<^sub>\<circ> Vset \<alpha>"
  shows "vprojection_arrow I A i : (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i) \<mapsto>\<^bsub>cat_Set \<alpha>\<^esub> A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vprojection_arrow I A i : vproduct I A \<mapsto>\<^bsub>cat_Set \<alpha>\<^esub> A i
[PROOF STEP]
proof(intro cat_Set_is_arrI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. arr_Set \<alpha> (vprojection_arrow I A i)
 2. vprojection_arrow I A i\<lparr>ArrDom\<rparr> = vproduct I A
 3. vprojection_arrow I A i\<lparr>ArrCod\<rparr> = A i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
i \<in>\<^sub>\<circ> I
VLambda I A \<in>\<^sub>\<circ> Vset \<alpha>
[PROOF STEP]
show "arr_Set \<alpha> (vprojection_arrow I A i)"
[PROOF STATE]
proof (prove)
using this:
i \<in>\<^sub>\<circ> I
VLambda I A \<in>\<^sub>\<circ> Vset \<alpha>

goal (1 subgoal):
 1. arr_Set \<alpha> (vprojection_arrow I A i)
[PROOF STEP]
by (rule arr_Set_vprojection_arrow)
[PROOF STATE]
proof (state)
this:
arr_Set \<alpha> (vprojection_arrow I A i)

goal (2 subgoals):
 1. vprojection_arrow I A i\<lparr>ArrDom\<rparr> = vproduct I A
 2. vprojection_arrow I A i\<lparr>ArrCod\<rparr> = A i
[PROOF STEP]
qed (simp_all add: vprojection_arrow_components)


[STATEMENT]
lemma M_to_int_mod_ring: "M (to_int_mod_ring (x :: 'a mod_ring)) = to_int_mod_ring x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M (to_int_mod_ring x) = to_int_mod_ring x
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_int_mod_ring x mod m = to_int_mod_ring x
[PROOF STEP]
unfolding m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_int_mod_ring x mod int CARD('a) = to_int_mod_ring x
[PROOF STEP]
by (transfer, auto)


[STATEMENT]
lemma leadsto_exists: "\<turnstile> ((\<exists>x. F x) \<leadsto> G) = (\<forall>x. (F x \<leadsto> G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> ((\<exists>x. F x) \<leadsto> G) = (\<forall>x. F x \<leadsto> G)
[PROOF STEP]
apply (unfold leadsto_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> (\<box>(Init REx F \<longrightarrow> \<diamond>G)) = (\<forall>x. \<box>(Init F x \<longrightarrow> \<diamond>G))
[PROOF STEP]
apply (auto simp: allT [try_rewrite] Init_simps elim!: STL4E [temp_use])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ivp_solsI:
  assumes "D X = (\<lambda>t. f t (X t)) on U s" and "X t\<^sub>0 = s"
      and "X \<in> U s \<rightarrow> S" and "t\<^sub>0 \<in> U s"
    shows "X \<in> Sols f U S t\<^sub>0 s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<in> Sols f U S t\<^sub>0 s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
 D X = (\<lambda>t. f t (X t)) on U s
X t\<^sub>0 = s
X \<in> U s \<rightarrow> S
t\<^sub>0 \<in> U s

goal (1 subgoal):
 1. X \<in> Sols f U S t\<^sub>0 s
[PROOF STEP]
unfolding ivp_sols_def
[PROOF STATE]
proof (prove)
using this:
 D X = (\<lambda>t. f t (X t)) on U s
X t\<^sub>0 = s
X \<in> U s \<rightarrow> S
t\<^sub>0 \<in> U s

goal (1 subgoal):
 1. X \<in> {X \<in> U s \<rightarrow> S.  D X = (\<lambda>t. f t (X t)) on U s \<and> X t\<^sub>0 = s \<and> t\<^sub>0 \<in> U s}
[PROOF STEP]
by blast


[STATEMENT]
lemma map_vec_map_vec: "map_vec f (map_vec g v) = map_vec (f o g) v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_vec f (map_vec g v) = map_vec (f \<circ> g) v
[PROOF STEP]
by (intro eq_vecI, auto)


[STATEMENT]
lemma index_pref_pow_mod: "w \<le>p r\<^sup>@k \<Longrightarrow> i < \<^bold>|w\<^bold>| \<Longrightarrow>  w!i = r!(i mod \<^bold>|r\<^bold>| )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w \<le>p r \<^sup>@ k; i < \<^bold>|w\<^bold>|\<rbrakk> \<Longrightarrow> w ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
using  index_pow_mod[of i r k] less_le_trans[of i "\<^bold>|w\<^bold>|" "\<^bold>|r\<^sup>@k\<^bold>|"] prefix_length_le[of w "r\<^sup>@k"] pref_index[of w "r\<^sup>@k" i]
[PROOF STATE]
proof (prove)
using this:
i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> (r \<^sup>@ k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
\<lbrakk>i < \<^bold>|w\<^bold>|; \<^bold>|w\<^bold>| \<le> \<^bold>|r \<^sup>@ k\<^bold>|\<rbrakk> \<Longrightarrow> i < \<^bold>|r \<^sup>@ k\<^bold>|
w \<le>p r \<^sup>@ k \<Longrightarrow> \<^bold>|w\<^bold>| \<le> \<^bold>|r \<^sup>@ k\<^bold>|
\<lbrakk>w \<le>p r \<^sup>@ k; i < \<^bold>|w\<^bold>|\<rbrakk> \<Longrightarrow> w ! i = (r \<^sup>@ k) ! i

goal (1 subgoal):
 1. \<lbrakk>w \<le>p r \<^sup>@ k; i < \<^bold>|w\<^bold>|\<rbrakk> \<Longrightarrow> w ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
by argo


[STATEMENT]
lemma set_of_sub_inc_left:
  "set_of (A - B) \<subseteq> set_of (A' - B)"
  if "set_of A \<subseteq> set_of A'"
  for A :: "'a::linordered_ab_group_add interval"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (A - B) \<subseteq> set_of (A' - B)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
set_of A \<subseteq> set_of A'

goal (1 subgoal):
 1. set_of (A - B) \<subseteq> set_of (A' - B)
[PROOF STEP]
unfolding set_of_minus
[PROOF STATE]
proof (prove)
using this:
set_of A \<subseteq> set_of A'

goal (1 subgoal):
 1. {x - y |x y. x \<in>\<^sub>i A \<and> y \<in>\<^sub>i B} \<subseteq> {x - y |x y. x \<in>\<^sub>i A' \<and> y \<in>\<^sub>i B}
[PROOF STEP]
by auto


[STATEMENT]
lemma iso_eq_order: "card \<V> = card \<V>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. source.\<v> = target.\<v>
[PROOF STEP]
using bij bij_betw_same_card
[PROOF STATE]
proof (prove)
using this:
bij_betw \<pi> \<V> \<V>'
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B

goal (1 subgoal):
 1. source.\<v> = target.\<v>
[PROOF STEP]
by auto


[STATEMENT]
lemma inverts_mat_unique:
  fixes A B C :: "'a::field mat"
  assumes dim: "A \<in> carrier_mat n n" "B \<in> carrier_mat n n" "C \<in> carrier_mat n n"
    and AB: "inverts_mat A B" and AC: "inverts_mat A C"
  shows "B = C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B = C
[PROOF STEP]
have AB1: "A * B = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B = 1\<^sub>m n
[PROOF STEP]
using AB dim
[PROOF STATE]
proof (prove)
using this:
inverts_mat A B
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. A * B = 1\<^sub>m n
[PROOF STEP]
unfolding inverts_mat_def
[PROOF STATE]
proof (prove)
using this:
A * B = 1\<^sub>m (dim_row A)
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. A * B = 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * B = 1\<^sub>m n

goal (1 subgoal):
 1. B = C
[PROOF STEP]
have "A * C = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * C = 1\<^sub>m n
[PROOF STEP]
using AC dim
[PROOF STATE]
proof (prove)
using this:
inverts_mat A C
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. A * C = 1\<^sub>m n
[PROOF STEP]
unfolding inverts_mat_def
[PROOF STATE]
proof (prove)
using this:
A * C = 1\<^sub>m (dim_row A)
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. A * C = 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * C = 1\<^sub>m n

goal (1 subgoal):
 1. B = C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A * C = 1\<^sub>m n
[PROOF STEP]
have CA1: "C * A = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
A * C = 1\<^sub>m n

goal (1 subgoal):
 1. C * A = 1\<^sub>m n
[PROOF STEP]
using mat_mult_left_right_inverse[of A n C] dim
[PROOF STATE]
proof (prove)
using this:
A * C = 1\<^sub>m n
\<lbrakk>A \<in> carrier_mat n n; C \<in> carrier_mat n n; A * C = 1\<^sub>m n\<rbrakk> \<Longrightarrow> C * A = 1\<^sub>m n
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. C * A = 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C * A = 1\<^sub>m n

goal (1 subgoal):
 1. B = C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C * A = 1\<^sub>m n
[PROOF STEP]
have "C = C * 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
C * A = 1\<^sub>m n

goal (1 subgoal):
 1. C = C * 1\<^sub>m n
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
C * A = 1\<^sub>m n
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. C = C * 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C = C * 1\<^sub>m n

goal (1 subgoal):
 1. B = C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C = C * 1\<^sub>m n

goal (1 subgoal):
 1. B = C
[PROOF STEP]
have "\<dots> = C * (A * B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C * 1\<^sub>m n = C * (A * B)
[PROOF STEP]
using AB1
[PROOF STATE]
proof (prove)
using this:
A * B = 1\<^sub>m n

goal (1 subgoal):
 1. C * 1\<^sub>m n = C * (A * B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C * 1\<^sub>m n = C * (A * B)

goal (1 subgoal):
 1. B = C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C * 1\<^sub>m n = C * (A * B)

goal (1 subgoal):
 1. B = C
[PROOF STEP]
have "\<dots> = (C * A) * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C * (A * B) = C * A * B
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. C * (A * B) = C * A * B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C * (A * B) = C * A * B

goal (1 subgoal):
 1. B = C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C * (A * B) = C * A * B

goal (1 subgoal):
 1. B = C
[PROOF STEP]
have "\<dots> = 1\<^sub>m n * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C * A * B = 1\<^sub>m n * B
[PROOF STEP]
using CA1
[PROOF STATE]
proof (prove)
using this:
C * A = 1\<^sub>m n

goal (1 subgoal):
 1. C * A * B = 1\<^sub>m n * B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C * A * B = 1\<^sub>m n * B

goal (1 subgoal):
 1. B = C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C * A * B = 1\<^sub>m n * B

goal (1 subgoal):
 1. B = C
[PROOF STEP]
have "\<dots> = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m n * B = B
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. 1\<^sub>m n * B = B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1\<^sub>m n * B = B

goal (1 subgoal):
 1. B = C
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
C = B
[PROOF STEP]
show "B = C"
[PROOF STATE]
proof (prove)
using this:
C = B

goal (1 subgoal):
 1. B = C
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
B = C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_image_join:
  assumes "pathfinish g1 = pathstart g2"
  shows "path_image(g1 +++ g2) = path_image g1 \<union> path_image g2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
have "path_image g1 \<subseteq> path_image (g1 +++ g2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image g1 \<subseteq> path_image (g1 +++ g2)
[PROOF STEP]
proof (clarsimp simp: path_image_def joinpaths_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>g1 xa \<notin> (\<lambda>x. g2 (2 * x - 1)) ` ({0..1} \<inter> {x. \<not> x * 2 \<le> 1}); 0 \<le> xa; xa \<le> 1\<rbrakk> \<Longrightarrow> g1 xa \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})
[PROOF STEP]
fix u::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>g1 xa \<notin> (\<lambda>x. g2 (2 * x - 1)) ` ({0..1} \<inter> {x. \<not> x * 2 \<le> 1}); 0 \<le> xa; xa \<le> 1\<rbrakk> \<Longrightarrow> g1 xa \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})
[PROOF STEP]
assume "0 \<le> u" "u \<le> 1"
[PROOF STATE]
proof (state)
this:
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>g1 xa \<notin> (\<lambda>x. g2 (2 * x - 1)) ` ({0..1} \<inter> {x. \<not> x * 2 \<le> 1}); 0 \<le> xa; xa \<le> 1\<rbrakk> \<Longrightarrow> g1 xa \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> u
u \<le> 1
[PROOF STEP]
show "g1 u \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})"
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. g1 u \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})
[PROOF STEP]
by (rule_tac x="u/2" in image_eqI) auto
[PROOF STATE]
proof (state)
this:
g1 u \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
path_image g1 \<subseteq> path_image (g1 +++ g2)

goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
path_image g1 \<subseteq> path_image (g1 +++ g2)

goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
have \<section>: "g2 u \<in> (\<lambda>x. g2 (2 * x - 1)) ` ({0..1} \<inter> {x. \<not> x * 2 \<le> 1})"
    if "0 < u" "u \<le> 1" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g2 u \<in> (\<lambda>x. g2 (2 * x - 1)) ` ({0..1} \<inter> {x. \<not> x * 2 \<le> 1})
[PROOF STEP]
using that assms
[PROOF STATE]
proof (prove)
using this:
0 < u
u \<le> 1
pathfinish g1 = pathstart g2

goal (1 subgoal):
 1. g2 u \<in> (\<lambda>x. g2 (2 * x - 1)) ` ({0..1} \<inter> {x. \<not> x * 2 \<le> 1})
[PROOF STEP]
by (rule_tac x="(u+1)/2" in image_eqI) (auto simp: field_simps pathfinish_def pathstart_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?u; ?u \<le> 1\<rbrakk> \<Longrightarrow> g2 ?u \<in> (\<lambda>x. g2 (2 * x - 1)) ` ({0..1} \<inter> {x. \<not> x * 2 \<le> 1})

goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
have "g2 0 \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g2 0 \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pathfinish g1 = pathstart g2

goal (1 subgoal):
 1. g2 0 \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})
[PROOF STEP]
by (rule_tac x="1/2" in image_eqI) (auto simp: pathfinish_def pathstart_def)
[PROOF STATE]
proof (state)
this:
g2 0 \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})

goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g2 0 \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})
[PROOF STEP]
have "path_image g2 \<subseteq> path_image (g1 +++ g2)"
[PROOF STATE]
proof (prove)
using this:
g2 0 \<in> (\<lambda>x. g1 (2 * x)) ` ({0..1} \<inter> {x. x * 2 \<le> 1})

goal (1 subgoal):
 1. path_image g2 \<subseteq> path_image (g1 +++ g2)
[PROOF STEP]
by (auto simp: path_image_def joinpaths_def intro!: \<section>)
[PROOF STATE]
proof (state)
this:
path_image g2 \<subseteq> path_image (g1 +++ g2)

goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
path_image g1 \<subseteq> path_image (g1 +++ g2)
path_image g2 \<subseteq> path_image (g1 +++ g2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
path_image g1 \<subseteq> path_image (g1 +++ g2)
path_image g2 \<subseteq> path_image (g1 +++ g2)

goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
using path_image_join_subset
[PROOF STATE]
proof (prove)
using this:
path_image g1 \<subseteq> path_image (g1 +++ g2)
path_image g2 \<subseteq> path_image (g1 +++ g2)
path_image (?g1.0 +++ ?g2.0) \<subseteq> path_image ?g1.0 \<union> path_image ?g2.0

goal (1 subgoal):
 1. path_image (g1 +++ g2) = path_image g1 \<union> path_image g2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
path_image (g1 +++ g2) = path_image g1 \<union> path_image g2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diag_mat_mul_diag_diag:
  fixes A B ::  "complex mat"
  assumes dimA: "A \<in> carrier_mat n n" and dimB: "B \<in> carrier_mat n n"
    and dA: "diagonal_mat A"  and dB: "diagonal_mat B"
  shows "diagonal_mat (A * B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_mat (A * B)
[PROOF STEP]
proof  -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. diagonal_mat (A * B)
[PROOF STEP]
have AB: "A * B = mat n n (\<lambda>(i,j). (if (i = j) then (A$$(i, i)) * (B$$(i, i)) else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
using diag_mat_mult_diag_mat[of A n B] dimA dimB dA dB
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<in> carrier_mat n n; B \<in> carrier_mat n n; diagonal_mat A; diagonal_mat B\<rbrakk> \<Longrightarrow> A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat A
diagonal_mat B

goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)

goal (1 subgoal):
 1. diagonal_mat (A * B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
[PROOF STEP]
have dAB: "\<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A*B) $$ (i,j) = 0"
[PROOF STATE]
proof (prove)
using this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)

goal (1 subgoal):
 1. \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0) \<Longrightarrow> \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0) \<Longrightarrow> \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0) \<Longrightarrow> \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
assume i: "i < n" and j: "j < n" and ij: "i \<noteq> j"
[PROOF STATE]
proof (state)
this:
i < n
j < n
i \<noteq> j

goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0) \<Longrightarrow> \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
have "(A*B) $$ (i,j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * B) $$ (i, j) = 0
[PROOF STEP]
using AB i j ij
[PROOF STATE]
proof (prove)
using this:
A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0)
i < n
j < n
i \<noteq> j

goal (1 subgoal):
 1. (A * B) $$ (i, j) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A * B) $$ (i, j) = 0

goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0) \<Longrightarrow> \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < n; ?j2 < n; ?i2 \<noteq> ?j2\<rbrakk> \<Longrightarrow> (A * B) $$ (?i2, ?j2) = 0

goal (1 subgoal):
 1. A * B = mat n n (\<lambda>(i, j). if i = j then A $$ (i, i) * B $$ (i, i) else 0) \<Longrightarrow> \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?i2 < n; ?j2 < n; ?i2 \<noteq> ?j2\<rbrakk> \<Longrightarrow> (A * B) $$ (?i2, ?j2) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < n; ?j2 < n; ?i2 \<noteq> ?j2\<rbrakk> \<Longrightarrow> (A * B) $$ (?i2, ?j2) = 0

goal (1 subgoal):
 1. \<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0

goal (1 subgoal):
 1. diagonal_mat (A * B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0

goal (1 subgoal):
 1. diagonal_mat (A * B)
[PROOF STEP]
using diagonal_mat_def dAB dimA dimB
[PROOF STATE]
proof (prove)
using this:
\<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
diagonal_mat ?A \<equiv> \<forall>i<dim_row ?A. \<forall>j<dim_col ?A. i \<noteq> j \<longrightarrow> ?A $$ (i, j) = (0::?'a)
\<forall>i<n. \<forall>j<n. i \<noteq> j \<longrightarrow> (A * B) $$ (i, j) = 0
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. diagonal_mat (A * B)
[PROOF STEP]
by (metis carrier_matD(1) carrier_matD(2) index_mult_mat(2) index_mult_mat(3))
[PROOF STATE]
proof (state)
this:
diagonal_mat (A * B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_all2_split:
  assumes major: "list_all2 P xs ys"
  and split: "\<And>x y. P x y \<Longrightarrow> \<exists>z. Q x z \<and> R z y"
  shows "\<exists>zs. list_all2 Q xs zs \<and> list_all2 R zs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>zs. list_all2 Q xs zs \<and> list_all2 R zs ys
[PROOF STEP]
using major
[PROOF STATE]
proof (prove)
using this:
list_all2 P xs ys

goal (1 subgoal):
 1. \<exists>zs. list_all2 Q xs zs \<and> list_all2 R zs ys
[PROOF STEP]
by(induct rule: list_all2_induct)(auto dest: split)


[STATEMENT]
lemma nth_rotate1:
  \<open>rotate1 xs ! n = xs ! (Suc n mod length xs)\<close> if \<open>n < length xs\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rotate1 xs ! n = xs ! (Suc n mod length xs)
[PROOF STEP]
using that nth_rotate [of n xs 1]
[PROOF STATE]
proof (prove)
using this:
n < length xs
n < length xs \<Longrightarrow> rotate 1 xs ! n = xs ! ((1 + n) mod length xs)

goal (1 subgoal):
 1. rotate1 xs ! n = xs ! (Suc n mod length xs)
[PROOF STEP]
by simp


[STATEMENT]
lemma div_gt_0:
  fixes m n :: nat assumes "m \<le> n" "0 < m" shows "0 < n div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n div m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < n div m
[PROOF STEP]
have "0 < m div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m div m
[PROOF STEP]
using \<open>0 < m\<close> div_self
[PROOF STATE]
proof (prove)
using this:
0 < m
?a \<noteq> (0::?'a) \<Longrightarrow> ?a div ?a = (1::?'a)

goal (1 subgoal):
 1. 0 < m div m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < m div m

goal (1 subgoal):
 1. 0 < n div m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 < m div m

goal (1 subgoal):
 1. 0 < n div m
[PROOF STEP]
have "m div m \<le> n div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m div m \<le> n div m
[PROOF STEP]
using \<open>m \<le> n\<close>
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. m div m \<le> n div m
[PROOF STEP]
by (rule div_le_mono)
[PROOF STATE]
proof (state)
this:
m div m \<le> n div m

goal (1 subgoal):
 1. 0 < n div m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < n div m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n div m

goal (1 subgoal):
 1. 0 < n div m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
0 < n div m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_mnm':
  assumes \<open>m < n\<close>
    shows \<open>card {i::nat. i < n \<and> P i}
         = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
have 1:\<open>{i::nat. i < m \<and> P i} \<inter> {i. m \<le> i \<and> i < n \<and> P i} = {}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < m \<and> P i} \<inter> {i. m \<le> i \<and> i < n \<and> P i} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i. i < m \<and> P i} \<inter> {i. m \<le> i \<and> i < n \<and> P i} = {}

goal (1 subgoal):
 1. card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
m < n
[PROOF STEP]
have \<open>\<forall>i::nat. i < n = (i < m) \<or> (m \<le> i \<and> i < n)\<close>
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. \<forall>i. (i < n) = (i < m) \<or> m \<le> i \<and> i < n
[PROOF STEP]
using less_trans
[PROOF STATE]
proof (prove)
using this:
m < n
\<lbrakk>?x < ?y; ?y < ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. \<forall>i. (i < n) = (i < m) \<or> m \<le> i \<and> i < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i. (i < n) = (i < m) \<or> m \<le> i \<and> i < n

goal (1 subgoal):
 1. card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
hence 2:
    \<open>{i::nat. i < n \<and> P i} = {i. i < m \<and> P i} \<union> {i. m \<le> i \<and> i < n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>i. (i < n) = (i < m) \<or> m \<le> i \<and> i < n

goal (1 subgoal):
 1. {i. i < n \<and> P i} = {i. i < m \<and> P i} \<union> {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{i. i < n \<and> P i} = {i. i < m \<and> P i} \<union> {i. m \<le> i \<and> i < n \<and> P i}

goal (1 subgoal):
 1. card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
have 3:\<open>finite {i. i < m \<and> P i}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. i < m \<and> P i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {i. i < m \<and> P i}

goal (1 subgoal):
 1. card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
have 4:\<open>finite {i. m \<le> i \<and> i < n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {i. m \<le> i \<and> i < n \<and> P i}

goal (1 subgoal):
 1. card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
from card_Un_disjoint[OF 3 4 1] 2
[PROOF STATE]
proof (chain)
picking this:
card ({i. i < m \<and> P i} \<union> {i. m \<le> i \<and> i < n \<and> P i}) = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
{i. i < n \<and> P i} = {i. i < m \<and> P i} \<union> {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card ({i. i < m \<and> P i} \<union> {i. m \<le> i \<and> i < n \<and> P i}) = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
{i. i < n \<and> P i} = {i. i < m \<and> P i} \<union> {i. m \<le> i \<and> i < n \<and> P i}

goal (1 subgoal):
 1. card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {i. i < n \<and> P i} = card {i. i < m \<and> P i} + card {i. m \<le> i \<and> i < n \<and> P i}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gen_enumerate_it_to_list[refine_transfer_post_simp]:
      "gen_enumerate (it_to_list it) =
       (\<lambda> upd emp S. snd (foldli (it_to_list it S) (\<lambda> _. True)
      (\<lambda> x s. case s of (k, m) \<Rightarrow> (Suc k, upd x k m)) (0, emp)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_enumerate (it_to_list it) = (\<lambda>upd emp S. snd (foldli (it_to_list it S) (\<lambda>_. True) (\<lambda>x s. case s of (k, m) \<Rightarrow> (Suc k, upd x k m)) (0, emp)))
[PROOF STEP]
unfolding gen_enumerate_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>upd emp S. snd (fold (\<lambda>x (k, m). (Suc k, upd x k m)) (it_to_list it S) (0, emp))) = (\<lambda>upd emp S. snd (foldli (it_to_list it S) (\<lambda>_. True) (\<lambda>x s. case s of (k, m) \<Rightarrow> (Suc k, upd x k m)) (0, emp)))
[PROOF STEP]
unfolding foldl_conv_fold[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>upd emp S. snd (foldl (\<lambda>s x. case s of (k, m) \<Rightarrow> (Suc k, upd x k m)) (0, emp) (it_to_list it S))) = (\<lambda>upd emp S. snd (foldli (it_to_list it S) (\<lambda>_. True) (\<lambda>x s. case s of (k, m) \<Rightarrow> (Suc k, upd x k m)) (0, emp)))
[PROOF STEP]
unfolding foldli_foldl[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>upd emp S. snd (foldli (it_to_list it S) (\<lambda>_. True) (\<lambda>x s. case s of (k, m) \<Rightarrow> (Suc k, upd x k m)) (0, emp))) = (\<lambda>upd emp S. snd (foldli (it_to_list it S) (\<lambda>_. True) (\<lambda>x s. case s of (k, m) \<Rightarrow> (Suc k, upd x k m)) (0, emp)))
[PROOF STEP]
by rule


[STATEMENT]
lemma Subspace_eqdim_imp_equal :
  assumes "Subspace U" "dim U = dim V"
  shows   "U = V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U = V
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U = V
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
Subspace U
[PROOF STEP]
obtain us where us: "basis_for U us"
[PROOF STATE]
proof (prove)
using this:
Subspace U

goal (1 subgoal):
 1. (\<And>us. set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Subspace_is_findim SubspaceD1
          VectorSpace.FinDimVectorSpaceI[of "(\<cdot>)" U]
          FinDimVectorSpace.basis_ex[of "(\<cdot>)" U]
[PROOF STATE]
proof (prove)
using this:
Subspace U
Subspace ?U \<Longrightarrow> \<exists>ms. set ms \<subseteq> ?U \<and> RSpan ms = ?U
Subspace ?U \<Longrightarrow> VectorSpace (\<cdot>) ?U
\<lbrakk>VectorSpace (\<cdot>) U; \<exists>ms. set ms \<subseteq> U \<and> RSpan ms = U\<rbrakk> \<Longrightarrow> FinDimVectorSpace (\<cdot>) U
FinDimVectorSpace (\<cdot>) U \<Longrightarrow> \<exists>vs. set vs \<subseteq> U \<and> U = RSpan vs \<and> R_lin_independent vs

goal (1 subgoal):
 1. (\<And>us. set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us

goal (1 subgoal):
 1. U = V
[PROOF STEP]
with assms(1)
[PROOF STATE]
proof (chain)
picking this:
Subspace U
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
[PROOF STEP]
obtain vs where vs: "basis_for V (vs@us)"
[PROOF STATE]
proof (prove)
using this:
Subspace U
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us

goal (1 subgoal):
 1. (\<And>vs. set (vs @ us) \<subseteq> V \<and> V = RSpan (vs @ us) \<and> R_lin_independent (vs @ us) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using extend_Subspace_basis[of U us]
[PROOF STATE]
proof (prove)
using this:
Subspace U
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
\<lbrakk>U \<subseteq> V; set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us\<rbrakk> \<Longrightarrow> \<exists>vs. set (vs @ us) \<subseteq> V \<and> V = RSpan (vs @ us) \<and> R_lin_independent (vs @ us)

goal (1 subgoal):
 1. (\<And>vs. set (vs @ us) \<subseteq> V \<and> V = RSpan (vs @ us) \<and> R_lin_independent (vs @ us) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
set (vs @ us) \<subseteq> V \<and> V = RSpan (vs @ us) \<and> R_lin_independent (vs @ us)

goal (1 subgoal):
 1. U = V
[PROOF STEP]
from assms us vs
[PROOF STATE]
proof (chain)
picking this:
Subspace U
dim_R U = dim_R V
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
set (vs @ us) \<subseteq> V \<and> V = RSpan (vs @ us) \<and> R_lin_independent (vs @ us)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Subspace U
dim_R U = dim_R V
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
set (vs @ us) \<subseteq> V \<and> V = RSpan (vs @ us) \<and> R_lin_independent (vs @ us)

goal (1 subgoal):
 1. U = V
[PROOF STEP]
using SubspaceD1 VectorSpace.dim_eq_size_basis[of smult U]
          dim_eq_size_basis[of "vs@us"]
[PROOF STATE]
proof (prove)
using this:
Subspace U
dim_R U = dim_R V
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
set (vs @ us) \<subseteq> V \<and> V = RSpan (vs @ us) \<and> R_lin_independent (vs @ us)
Subspace ?U \<Longrightarrow> VectorSpace (\<cdot>) ?U
\<lbrakk>VectorSpace (\<cdot>) U; set ?vs \<subseteq> U \<and> U = RSpan ?vs \<and> R_lin_independent ?vs\<rbrakk> \<Longrightarrow> length ?vs = dim_R U
set (vs @ us) \<subseteq> V \<and> V = RSpan (vs @ us) \<and> R_lin_independent (vs @ us) \<Longrightarrow> length (vs @ us) = dim_R V

goal (1 subgoal):
 1. U = V
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
U = V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gcd_factorial_greatest:
  assumes "\<And>y. y \<in> A \<Longrightarrow> x dvd y"
  shows   "x dvd Gcd_factorial A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x dvd Gcd_factorial A
[PROOF STEP]
proof (cases "A \<subseteq> {0}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
 2. \<not> A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> A \<subseteq> {0::'a}

goal (2 subgoals):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
 2. \<not> A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> A \<subseteq> {0::'a}
[PROOF STEP]
obtain y where "y \<in> A" "y \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> A \<subseteq> {0::'a}

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> A; y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> A
y \<noteq> (0::'a)

goal (2 subgoals):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
 2. \<not> A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
with assms[of y]
[PROOF STATE]
proof (chain)
picking this:
y \<in> A \<Longrightarrow> x dvd y
y \<in> A
y \<noteq> (0::'a)
[PROOF STEP]
have nz: "x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
y \<in> A \<Longrightarrow> x dvd y
y \<in> A
y \<noteq> (0::'a)

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

goal (2 subgoals):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
 2. \<not> A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
from nz assms
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> (0::'a)
?y1 \<in> A \<Longrightarrow> x dvd ?y1
[PROOF STEP]
have "prime_factorization x \<subseteq># prime_factorization y" if "y \<in> A - {0}" for y
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
?y1 \<in> A \<Longrightarrow> x dvd ?y1

goal (1 subgoal):
 1. prime_factorization x \<subseteq># prime_factorization y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
?y1 \<in> A \<Longrightarrow> x dvd ?y1
y \<in> A - {0::'a}

goal (1 subgoal):
 1. prime_factorization x \<subseteq># prime_factorization y
[PROOF STEP]
by (subst prime_factorization_subset_iff_dvd) auto
[PROOF STATE]
proof (state)
this:
?y1 \<in> A - {0::'a} \<Longrightarrow> prime_factorization x \<subseteq># prime_factorization ?y1

goal (2 subgoals):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
 2. \<not> A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> A \<subseteq> {0::'a}
?y1 \<in> A - {0::'a} \<Longrightarrow> prime_factorization x \<subseteq># prime_factorization ?y1
[PROOF STEP]
have "prime_factorization x \<subseteq># Inf (prime_factorization ` (A - {0}))"
[PROOF STATE]
proof (prove)
using this:
\<not> A \<subseteq> {0::'a}
?y1 \<in> A - {0::'a} \<Longrightarrow> prime_factorization x \<subseteq># prime_factorization ?y1

goal (1 subgoal):
 1. prime_factorization x \<subseteq># Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
by (intro subset_mset.cInf_greatest) auto
[PROOF STATE]
proof (state)
this:
prime_factorization x \<subseteq># Inf (prime_factorization ` (A - {0::'a}))

goal (2 subgoals):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
 2. \<not> A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization x \<subseteq># Inf (prime_factorization ` (A - {0::'a}))

goal (2 subgoals):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
 2. \<not> A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> A \<subseteq> {0::'a}
[PROOF STEP]
have "\<dots> = prime_factorization (Gcd_factorial A)"
[PROOF STATE]
proof (prove)
using this:
\<not> A \<subseteq> {0::'a}

goal (1 subgoal):
 1. Inf (prime_factorization ` (A - {0::'a})) = prime_factorization (Gcd_factorial A)
[PROOF STEP]
by (rule prime_factorization_Gcd_factorial [symmetric])
[PROOF STATE]
proof (state)
this:
Inf (prime_factorization ` (A - {0::'a})) = prime_factorization (Gcd_factorial A)

goal (2 subgoals):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
 2. \<not> A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prime_factorization x \<subseteq># prime_factorization (Gcd_factorial A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prime_factorization x \<subseteq># prime_factorization (Gcd_factorial A)

goal (1 subgoal):
 1. x dvd Gcd_factorial A
[PROOF STEP]
by (subst (asm) prime_factorization_subset_iff_dvd)
       (insert nz False, auto simp: Gcd_factorial_eq_0_iff)
[PROOF STATE]
proof (state)
this:
x dvd Gcd_factorial A

goal (1 subgoal):
 1. A \<subseteq> {0::'a} \<Longrightarrow> x dvd Gcd_factorial A
[PROOF STEP]
qed (simp_all add: Gcd_factorial_def)


[STATEMENT]
lemma bv_to_nat_dist_append:
  "bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2
[PROOF STEP]
have "\<forall>l2. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>l2. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2
[PROOF STEP]
proof (induct l1, simp_all)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l1. \<forall>l2. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2 \<Longrightarrow> \<forall>l2. bitval a * 2 ^ (length l1 + length l2) + bv_to_nat l1 * 2 ^ length l2 = (bitval a * 2 ^ length l1 + bv_to_nat l1) * 2 ^ length l2
[PROOF STEP]
fix x xs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l1. \<forall>l2. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2 \<Longrightarrow> \<forall>l2. bitval a * 2 ^ (length l1 + length l2) + bv_to_nat l1 * 2 ^ length l2 = (bitval a * 2 ^ length l1 + bv_to_nat l1) * 2 ^ length l2
[PROOF STEP]
assume ind: "\<forall>l2. bv_to_nat (xs @ l2) = bv_to_nat xs * 2 ^ length l2 + bv_to_nat l2"
[PROOF STATE]
proof (state)
this:
\<forall>l2. bv_to_nat (xs @ l2) = bv_to_nat xs * 2 ^ length l2 + bv_to_nat l2

goal (1 subgoal):
 1. \<And>a l1. \<forall>l2. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2 \<Longrightarrow> \<forall>l2. bitval a * 2 ^ (length l1 + length l2) + bv_to_nat l1 * 2 ^ length l2 = (bitval a * 2 ^ length l1 + bv_to_nat l1) * 2 ^ length l2
[PROOF STEP]
show "\<forall>l2::bit list. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>l2. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l2. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
fix l2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l2. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
show "bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
have "(2::nat) ^ (length xs + length l2) = 2 ^ length xs * 2 ^ length l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (length xs + length l2) = 2 ^ length xs * 2 ^ length l2
[PROOF STEP]
by (induct ("length xs")) simp_all
[PROOF STATE]
proof (state)
this:
2 ^ (length xs + length l2) = 2 ^ length xs * 2 ^ length l2

goal (1 subgoal):
 1. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
hence "bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 =
          bitval x * 2 ^ length xs * 2 ^ length l2 + bv_to_nat xs * 2 ^ length l2"
[PROOF STATE]
proof (prove)
using this:
2 ^ (length xs + length l2) = 2 ^ length xs * 2 ^ length l2

goal (1 subgoal):
 1. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = bitval x * 2 ^ length xs * 2 ^ length l2 + bv_to_nat xs * 2 ^ length l2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = bitval x * 2 ^ length xs * 2 ^ length l2 + bv_to_nat xs * 2 ^ length l2

goal (1 subgoal):
 1. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = bitval x * 2 ^ length xs * 2 ^ length l2 + bv_to_nat xs * 2 ^ length l2

goal (1 subgoal):
 1. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
have "... = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bitval x * 2 ^ length xs * 2 ^ length l2 + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
by (simp add: ring_distribs)
[PROOF STATE]
proof (state)
this:
bitval x * 2 ^ length xs * 2 ^ length l2 + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2

goal (1 subgoal):
 1. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2

goal (1 subgoal):
 1. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>l2. bitval x * 2 ^ (length xs + length l2) + bv_to_nat xs * 2 ^ length l2 = (bitval x * 2 ^ length xs + bv_to_nat xs) * 2 ^ length l2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>l2. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2

goal (1 subgoal):
 1. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>l2. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2

goal (1 subgoal):
 1. bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
bv_to_nat (l1 @ l2) = bv_to_nat l1 * 2 ^ length l2 + bv_to_nat l2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_median_median [simp,intro]: "is_median (median xs) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_median (median xs) xs
[PROOF STEP]
using size_less_than_median[of xs] size_greater_than_median[of xs]
[PROOF STATE]
proof (prove)
using this:
size {#y \<in># mset xs. y < median xs#} \<le> (length xs - 1) div 2
size (filter_mset ((<) (median xs)) (mset xs)) \<le> length xs div 2

goal (1 subgoal):
 1. is_median (median xs) xs
[PROOF STEP]
unfolding is_median_def size_mset [symmetric] mset_filter
[PROOF STATE]
proof (prove)
using this:
size {#y \<in># mset xs. y < median xs#} \<le> (size (mset xs) - 1) div 2
size (filter_mset ((<) (median xs)) (mset xs)) \<le> size (mset xs) div 2

goal (1 subgoal):
 1. size {#y \<in># mset xs. y < median xs#} \<le> size (mset xs) div 2 \<and> size (filter_mset ((<) (median xs)) (mset xs)) \<le> size (mset xs) div 2
[PROOF STEP]
by linarith+


[STATEMENT]
lemma lsum_mono[simp]:
assumes "al \<le> bl"
shows "lsum f al \<le> lsum f bl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lsum f al \<le> lsum f bl
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lsum f al \<le> lsum f bl
[PROOF STEP]
obtain cl where bl: "bl = al @ cl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>cl. bl = al @ cl \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
al \<le> bl

goal (1 subgoal):
 1. (\<And>cl. bl = al @ cl \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding prefix_def less_eq_list_def
[PROOF STATE]
proof (prove)
using this:
\<exists>zs. bl = al @ zs

goal (1 subgoal):
 1. (\<And>cl. bl = al @ cl \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bl = al @ cl

goal (1 subgoal):
 1. lsum f al \<le> lsum f bl
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bl = al @ cl

goal (1 subgoal):
 1. lsum f al \<le> lsum f bl
[PROOF STEP]
unfolding bl lsum_append
[PROOF STATE]
proof (prove)
using this:
al @ cl = al @ cl

goal (1 subgoal):
 1. lsum f al \<le> lsum f al + lsum f cl
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lsum f al \<le> lsum f bl

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prm_set_distributes_union:
  shows "\<pi> {$} (S \<union> T) = (\<pi> {$} S) \<union> (\<pi> {$} T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> {$} (S \<union> T) = \<pi> {$} S \<union> \<pi> {$} T
[PROOF STEP]
unfolding prm_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) \<pi> ` (S \<union> T) = ($) \<pi> ` S \<union> ($) \<pi> ` T
[PROOF STEP]
by auto


[STATEMENT]
lemma combine_map3: assumes "length ys = length xs" "length ys' = length xs'" "length ys'' = length xs''"
  "distinct xs" "distinct xs'" "distinct xs''" "set xs \<inter> set xs' = {}" "set xs \<inter> set xs'' = {}" "set xs' \<inter> set xs'' = {}"
  shows "\<exists>f. ys = map f xs \<and> ys' = map f xs' \<and> ys'' = map f xs''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. ys = map f xs \<and> ys' = map f xs' \<and> ys'' = map f xs''
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. ys = map f xs \<and> ys' = map f xs' \<and> ys'' = map f xs''
[PROOF STEP]
obtain f g h where fgh_def: "ys = map f xs" "ys' = map g xs'" "ys'' = map h xs''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g h. \<lbrakk>ys = map f xs; ys' = map g xs'; ys'' = map h xs''\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms exists_map
[PROOF STATE]
proof (prove)
using this:
length ys = length xs
length ys' = length xs'
length ys'' = length xs''
distinct xs
distinct xs'
distinct xs''
set xs \<inter> set xs' = {}
set xs \<inter> set xs'' = {}
set xs' \<inter> set xs'' = {}
\<lbrakk>length ?xs = length ?ys; distinct ?xs\<rbrakk> \<Longrightarrow> \<exists>f. ?ys = map f ?xs

goal (1 subgoal):
 1. (\<And>f g h. \<lbrakk>ys = map f xs; ys' = map g xs'; ys'' = map h xs''\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
ys = map f xs
ys' = map g xs'
ys'' = map h xs''

goal (1 subgoal):
 1. \<exists>f. ys = map f xs \<and> ys' = map f xs' \<and> ys'' = map f xs''
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. ys = map f xs \<and> ys' = map f xs' \<and> ys'' = map f xs''
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length ys = length xs
length ys' = length xs'
length ys'' = length xs''
distinct xs
distinct xs'
distinct xs''
set xs \<inter> set xs' = {}
set xs \<inter> set xs'' = {}
set xs' \<inter> set xs'' = {}

goal (1 subgoal):
 1. \<exists>f. ys = map f xs \<and> ys' = map f xs' \<and> ys'' = map f xs''
[PROOF STEP]
by (auto simp: fgh_def intro!: exI[of _ "\<lambda>x. if x \<in> set xs then f x else if x \<in> set xs' then g x else h x"])
[PROOF STATE]
proof (state)
this:
\<exists>f. ys = map f xs \<and> ys' = map f xs' \<and> ys'' = map f xs''

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_fresh_gt:
  fixes f :: \<open>'b \<Rightarrow> 'c\<close>
  assumes \<open>\<exists>g :: 'c \<Rightarrow> 'b. surj g\<close> \<open>finite A\<close> \<open>i \<notin> A\<close>
  shows \<open>\<exists>j. j \<notin> f ` A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>j. j \<notin> f ` A
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>j. j \<notin> f ` A \<Longrightarrow> False
[PROOF STEP]
assume \<open>\<nexists>j. j \<notin> f ` A\<close>
[PROOF STATE]
proof (state)
this:
\<nexists>j. j \<notin> f ` A

goal (1 subgoal):
 1. \<nexists>j. j \<notin> f ` A \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<nexists>j. j \<notin> f ` A

goal (1 subgoal):
 1. \<nexists>j. j \<notin> f ` A \<Longrightarrow> False
[PROOF STEP]
obtain g :: \<open>'c \<Rightarrow> 'b\<close> where \<open>surj g\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. surj g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<exists>g. surj g

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

goal (1 subgoal):
 1. \<nexists>j. j \<notin> f ` A \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<nexists>j. j \<notin> f ` A
surj g
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<nexists>j. j \<notin> f ` A
surj g

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(2-3)
[PROOF STATE]
proof (prove)
using this:
\<nexists>j. j \<notin> f ` A
surj g
finite A
i \<notin> A

goal (1 subgoal):
 1. False
[PROOF STEP]
by (metis UNIV_I UNIV_eq_I card_image_le card_seteq finite_imageI image_comp subsetI)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enn2ereal_of_nat[simp]: "enn2ereal (of_nat n) = ereal n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2ereal (of_nat n) = ereal (real n)
[PROOF STEP]
by (induction n) (auto simp: zero_ennreal.rep_eq one_ennreal.rep_eq plus_ennreal.rep_eq)


[STATEMENT]
lemma pderivs_lang_snoc:
  shows "pderivs_lang (PSuf s @@ {[c]}) r = (pderiv_set c (pderivs_lang (PSuf s) r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderivs_lang (PSuf s @@ {[c]}) r = pderiv_set c (pderivs_lang (PSuf s) r)
[PROOF STEP]
unfolding pderivs_lang_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>PSuf s @@ {[c]}. pderivs x r) = pderiv_set c (\<Union>x\<in>PSuf s. pderivs x r)
[PROOF STEP]
by (simp add: PSuf_Union pderivs_snoc)


[STATEMENT]
lemma eventually_nonneg_inverse [eventually_nonzero_simps]:
  "eventually_nonneg F (\<lambda>x. inverse (f x)) \<longleftrightarrow> eventually_nonneg F f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually_nonneg F (\<lambda>x. inverse (f x)) = eventually_nonneg F f
[PROOF STEP]
unfolding eventually_nonneg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. (0::'b) \<le> inverse (f x)) = (\<forall>\<^sub>F x in F. (0::'b) \<le> f x)
[PROOF STEP]
by (intro eventually_subst) (auto)


[STATEMENT]
lemma finite_equiv_implies_finite_carrier:
  assumes "equiv A R"
  assumes "finite (A // R)"
  assumes "\<forall>X \<in> A // R. finite X"
  shows "finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
from \<open>equiv A R\<close>
[PROOF STATE]
proof (chain)
picking this:
equiv A R
[PROOF STEP]
have "A = \<Union>(A // R)"
[PROOF STATE]
proof (prove)
using this:
equiv A R

goal (1 subgoal):
 1. A = \<Union> (A // R)
[PROOF STEP]
by (simp add: Union_quotient)
[PROOF STATE]
proof (state)
this:
A = \<Union> (A // R)

goal (1 subgoal):
 1. finite A
[PROOF STEP]
from this \<open>finite (A // R)\<close> \<open>\<forall>X \<in> A // R. finite X\<close>
[PROOF STATE]
proof (chain)
picking this:
A = \<Union> (A // R)
finite (A // R)
\<forall>X\<in>A // R. finite X
[PROOF STEP]
show "finite A"
[PROOF STATE]
proof (prove)
using this:
A = \<Union> (A // R)
finite (A // R)
\<forall>X\<in>A // R. finite X

goal (1 subgoal):
 1. finite A
[PROOF STEP]
using finite_Union
[PROOF STATE]
proof (prove)
using this:
A = \<Union> (A // R)
finite (A // R)
\<forall>X\<in>A // R. finite X
\<lbrakk>finite ?A; \<And>M. M \<in> ?A \<Longrightarrow> finite M\<rbrakk> \<Longrightarrow> finite (\<Union> ?A)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closedin U S; closedin U T\<rbrakk> \<Longrightarrow> closedin U (S \<inter> T)
[PROOF STEP]
using closedin_Inter[of "{S,T}" U]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{S, T} \<noteq> {}; \<And>Sa. Sa \<in> {S, T} \<Longrightarrow> closedin U Sa\<rbrakk> \<Longrightarrow> closedin U (\<Inter> {S, T})

goal (1 subgoal):
 1. \<lbrakk>closedin U S; closedin U T\<rbrakk> \<Longrightarrow> closedin U (S \<inter> T)
[PROOF STEP]
by auto


[STATEMENT]
lemma map_poly_pCons_hom[hom_distribs]: "map_poly hom (pCons a p) = pCons (hom a) (map_poly hom p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly hom (pCons a p) = pCons (hom a) (map_poly hom p)
[PROOF STEP]
unfolding map_poly_simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if a = (0::'a) \<and> p = 0 then 0 else pCons (hom a) (map_poly hom p)) = pCons (hom a) (map_poly hom p)
[PROOF STEP]
by auto


[STATEMENT]
lemma graph_homo_inv[intro!]:
  assumes "graph G" "inj_on f (vertices G)"
  shows "graph_homomorphism (map_graph_fn G f) G (converse (on_graph G f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph_homomorphism (map_graph_fn G f) G ((on_graph G f)\<inverse>)
[PROOF STEP]
proof(rule graph_homomorphismI)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. vertices (map_graph_fn G f) = Domain ((on_graph G f)\<inverse>)
 2. (on_graph G f)\<inverse> `` vertices (map_graph_fn G f) \<subseteq> vertices G
 3. univalent ((on_graph G f)\<inverse>)
 4. edge_preserving ((on_graph G f)\<inverse>) (edges (map_graph_fn G f)) (edges G)
 5. graph (map_graph_fn G f)
 6. graph G
[PROOF STEP]
show "univalent ((on_graph G f)\<inverse>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univalent ((on_graph G f)\<inverse>)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
inj_on f (vertices G)

goal (1 subgoal):
 1. univalent ((on_graph G f)\<inverse>)
[PROOF STEP]
unfolding univalent_def BNF_Def.Gr_def inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>vertices G. \<forall>y\<in>vertices G. f x = f y \<longrightarrow> x = y

goal (1 subgoal):
 1. \<forall>x y z. (x, y) \<in> {(a, f a) |a. a \<in> vertices G}\<inverse> \<and> (x, z) \<in> {(a, f a) |a. a \<in> vertices G}\<inverse> \<longrightarrow> z = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
univalent ((on_graph G f)\<inverse>)

goal (5 subgoals):
 1. vertices (map_graph_fn G f) = Domain ((on_graph G f)\<inverse>)
 2. (on_graph G f)\<inverse> `` vertices (map_graph_fn G f) \<subseteq> vertices G
 3. edge_preserving ((on_graph G f)\<inverse>) (edges (map_graph_fn G f)) (edges G)
 4. graph (map_graph_fn G f)
 5. graph G
[PROOF STEP]
show "edge_preserving ((on_graph G f)\<inverse>) (edges (map_graph_fn G f)) (edges G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_preserving ((on_graph G f)\<inverse>) (edges (map_graph_fn G f)) (edges G)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
graph G
inj_on f (vertices G)

goal (1 subgoal):
 1. edge_preserving ((on_graph G f)\<inverse>) (edges (map_graph_fn G f)) (edges G)
[PROOF STEP]
unfolding edge_preserving inj_on_def
[PROOF STATE]
proof (prove)
using this:
graph G
\<forall>x\<in>vertices G. \<forall>y\<in>vertices G. f x = f y \<longrightarrow> x = y

goal (1 subgoal):
 1. on_triple ((on_graph G f)\<inverse>) `` edges (map_graph_fn G f) \<subseteq> edges G
[PROOF STEP]
by auto auto
[PROOF STATE]
proof (state)
this:
edge_preserving ((on_graph G f)\<inverse>) (edges (map_graph_fn G f)) (edges G)

goal (4 subgoals):
 1. vertices (map_graph_fn G f) = Domain ((on_graph G f)\<inverse>)
 2. (on_graph G f)\<inverse> `` vertices (map_graph_fn G f) \<subseteq> vertices G
 3. graph (map_graph_fn G f)
 4. graph G
[PROOF STEP]
qed (insert assms(1),auto)


[STATEMENT]
lemma bifunctor_proj_fst_is_functor'[cat_cs_intros]:
  assumes "\<SS> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \
" and "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>" and "\<AA>' = \<AA>"
  shows "\<SS>\<^bsub>\<AA>,\<BB>\<^esub>(-,b)\<^sub>C\<^sub>F : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \
"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<SS>\<^bsub>\<AA>,\<BB>\<^esub>(-,b)\<^sub>C\<^sub>F : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
\<SS> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<SS>\<^bsub>\<AA>,\<BB>\<^esub>(-,b)\<^sub>C\<^sub>F : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

[PROOF STEP]
unfolding assms(3)
[PROOF STATE]
proof (prove)
using this:
\<SS> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<SS>\<^bsub>\<AA>,\<BB>\<^esub>(-,b)\<^sub>C\<^sub>F : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

[PROOF STEP]
by (rule bifunctor_proj_fst_is_functor)


[STATEMENT]
lemma prefix_conc_snd[simp]:
  assumes "n \<ge> length u"
  shows "prefix n (u \<frown> v) = u @ prefix (n - length u) v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix n (u \<frown> v) = u @ prefix (n - length u) v
[PROOF STEP]
proof (intro nth_equalityI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (prefix n (u \<frown> v)) = length (u @ prefix (n - length u) v)
 2. \<And>i. i < length (prefix n (u \<frown> v)) \<Longrightarrow> prefix n (u \<frown> v) ! i = (u @ prefix (n - length u) v) ! i
[PROOF STEP]
show "length (prefix n (u \<frown> v)) = length (u @ prefix (n - length u) v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (prefix n (u \<frown> v)) = length (u @ prefix (n - length u) v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length u \<le> n

goal (1 subgoal):
 1. length (prefix n (u \<frown> v)) = length (u @ prefix (n - length u) v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (prefix n (u \<frown> v)) = length (u @ prefix (n - length u) v)

goal (1 subgoal):
 1. \<And>i. i < length (prefix n (u \<frown> v)) \<Longrightarrow> prefix n (u \<frown> v) ! i = (u @ prefix (n - length u) v) ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length (prefix n (u \<frown> v)) \<Longrightarrow> prefix n (u \<frown> v) ! i = (u @ prefix (n - length u) v) ! i
[PROOF STEP]
assume "i < length (prefix n (u \<frown> v))"
[PROOF STATE]
proof (state)
this:
i < length (prefix n (u \<frown> v))

goal (1 subgoal):
 1. \<And>i. i < length (prefix n (u \<frown> v)) \<Longrightarrow> prefix n (u \<frown> v) ! i = (u @ prefix (n - length u) v) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length (prefix n (u \<frown> v))
[PROOF STEP]
show "prefix n (u \<frown> v) ! i = (u @ prefix (n - length u) v) ! i"
[PROOF STATE]
proof (prove)
using this:
i < length (prefix n (u \<frown> v))

goal (1 subgoal):
 1. prefix n (u \<frown> v) ! i = (u @ prefix (n - length u) v) ! i
[PROOF STEP]
by (cases "i < length u") (auto simp: nth_append)
[PROOF STATE]
proof (state)
this:
prefix n (u \<frown> v) ! i = (u @ prefix (n - length u) v) ! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma carry_bounded: "bin_carry a b k \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_carry a b k \<le> 1
[PROOF STEP]
using bin_carry_bounded not_mod_2_eq_1_eq_0[of "bin_carry a b k"]
[PROOF STATE]
proof (prove)
using this:
bin_carry ?a ?b ?k = bin_carry ?a ?b ?k mod 2
(bin_carry a b k mod 2 \<noteq> 1) = (bin_carry a b k mod 2 = 0)

goal (1 subgoal):
 1. bin_carry a b k \<le> 1
[PROOF STEP]
by auto


[STATEMENT]
lemma p_strict_mono: "x < y \<Longrightarrow> y \<le> t_stop \<Longrightarrow> p x < p y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> t_stop\<rbrakk> \<Longrightarrow> p x < p y
[PROOF STEP]
using decel
[PROOF STATE]
proof (prove)
using this:
a < 0

goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> t_stop\<rbrakk> \<Longrightarrow> p x < p y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> t_stop; a < 0\<rbrakk> \<Longrightarrow> p x < p y
[PROOF STEP]
assume "x < y" and "y \<le> t_stop" and "a < 0"
[PROOF STATE]
proof (state)
this:
x < y
y \<le> t_stop
a < 0

goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> t_stop; a < 0\<rbrakk> \<Longrightarrow> p x < p y
[PROOF STEP]
hence "x + y < - 2 * v / a"
[PROOF STATE]
proof (prove)
using this:
x < y
y \<le> t_stop
a < 0

goal (1 subgoal):
 1. x + y < - 2 * v / a
[PROOF STEP]
unfolding t_stop_def
[PROOF STATE]
proof (prove)
using this:
x < y
y \<le> - v / a
a < 0

goal (1 subgoal):
 1. x + y < - 2 * v / a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x + y < - 2 * v / a

goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> t_stop; a < 0\<rbrakk> \<Longrightarrow> p x < p y
[PROOF STEP]
hence "-1 / 2 * a * (x + y) < v" (is "?lhs0 < ?rhs0")
[PROOF STATE]
proof (prove)
using this:
x + y < - 2 * v / a

goal (1 subgoal):
 1. - 1 / 2 * a * (x + y) < v
[PROOF STEP]
using \<open>a < 0\<close>
[PROOF STATE]
proof (prove)
using this:
x + y < - 2 * v / a
a < 0

goal (1 subgoal):
 1. - 1 / 2 * a * (x + y) < v
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
- 1 / 2 * a * (x + y) < v

goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> t_stop; a < 0\<rbrakk> \<Longrightarrow> p x < p y
[PROOF STEP]
hence "?lhs0 * (x- y) > ?rhs0 * (x - y)"
[PROOF STATE]
proof (prove)
using this:
- 1 / 2 * a * (x + y) < v

goal (1 subgoal):
 1. v * (x - y) < - 1 / 2 * a * (x + y) * (x - y)
[PROOF STEP]
using \<open>x < y\<close>
[PROOF STATE]
proof (prove)
using this:
- 1 / 2 * a * (x + y) < v
x < y

goal (1 subgoal):
 1. v * (x - y) < - 1 / 2 * a * (x + y) * (x - y)
[PROOF STEP]
by sos
[PROOF STATE]
proof (state)
this:
v * (x - y) < - 1 / 2 * a * (x + y) * (x - y)

goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> t_stop; a < 0\<rbrakk> \<Longrightarrow> p x < p y
[PROOF STEP]
hence "v * x + 1 / 2 * a * x\<^sup>2 < v * y + 1 / 2 * a * y\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
v * (x - y) < - 1 / 2 * a * (x + y) * (x - y)

goal (1 subgoal):
 1. v * x + 1 / 2 * a * x\<^sup>2 < v * y + 1 / 2 * a * y\<^sup>2
[PROOF STEP]
by (auto simp add: field_simps power_def)
[PROOF STATE]
proof (state)
this:
v * x + 1 / 2 * a * x\<^sup>2 < v * y + 1 / 2 * a * y\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>x < y; y \<le> t_stop; a < 0\<rbrakk> \<Longrightarrow> p x < p y
[PROOF STEP]
thus " p x < p y"
[PROOF STATE]
proof (prove)
using this:
v * x + 1 / 2 * a * x\<^sup>2 < v * y + 1 / 2 * a * y\<^sup>2

goal (1 subgoal):
 1. p x < p y
[PROOF STEP]
unfolding p_max_def p_def t_stop_def
[PROOF STATE]
proof (prove)
using this:
v * x + 1 / 2 * a * x\<^sup>2 < v * y + 1 / 2 * a * y\<^sup>2

goal (1 subgoal):
 1. s0 + v * x + 1 / 2 * a * x\<^sup>2 < s0 + v * y + 1 / 2 * a * y\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p x < p y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma digit_gen_sum_repr:
  assumes "n < b^c" and "b>1"
  shows "n = (\<Sum>k < c.((nth_digit n k b) * b^k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
have 1: "(c\<le>k \<longrightarrow> n<b^k)" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<le> k \<longrightarrow> n < b ^ k
[PROOF STEP]
using assms less_le_trans
[PROOF STATE]
proof (prove)
using this:
n < b ^ c
1 < b
\<lbrakk>?x < ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. c \<le> k \<longrightarrow> n < b ^ k
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
c \<le> ?k \<longrightarrow> n < b ^ ?k

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
hence nik: "c\<le>k \<longrightarrow> (nth_digit n k b = 0)" for k
[PROOF STATE]
proof (prove)
using this:
c \<le> ?k \<longrightarrow> n < b ^ ?k

goal (1 subgoal):
 1. c \<le> k \<longrightarrow> nth_digit n k b = 0
[PROOF STEP]
by (auto simp add: nth_digit_def)
[PROOF STATE]
proof (state)
this:
c \<le> ?k \<longrightarrow> nth_digit n ?k b = 0

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
have "(\<Sum>r<c.((nth_digit n r b)*b^r))<b^c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c
[PROOF STEP]
apply(induct c, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c. (\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c \<Longrightarrow> (\<Sum>r<c. nth_digit n r b * b ^ r) + nth_digit n c b * b ^ c < b * b ^ c
[PROOF STEP]
subgoal for c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c \<Longrightarrow> (\<Sum>r<c. nth_digit n r b * b ^ r) + nth_digit n c b * b ^ c < b * b ^ c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c \<Longrightarrow> (\<Sum>r<c. nth_digit n r b * b ^ r) + nth_digit n c b * b ^ c < b * b ^ c
[PROOF STEP]
assume IH: "(\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c"
[PROOF STATE]
proof (state)
this:
(\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c

goal (1 subgoal):
 1. (\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c \<Longrightarrow> (\<Sum>r<c. nth_digit n r b * b ^ r) + nth_digit n c b * b ^ c < b * b ^ c
[PROOF STEP]
have bound: "(nth_digit n c b) * b ^ c \<le> (b-1) * b^c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit n c b * b ^ c \<le> (b - 1) * b ^ c
[PROOF STEP]
using nth_digit_bounded \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < ?b \<Longrightarrow> nth_digit ?a ?k ?b \<le> ?b - 1
1 < b

goal (1 subgoal):
 1. nth_digit n c b * b ^ c \<le> (b - 1) * b ^ c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nth_digit n c b * b ^ c \<le> (b - 1) * b ^ c

goal (1 subgoal):
 1. (\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c \<Longrightarrow> (\<Sum>r<c. nth_digit n r b * b ^ r) + nth_digit n c b * b ^ c < b * b ^ c
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
nth_digit n c b * b ^ c \<le> (b - 1) * b ^ c

goal (1 subgoal):
 1. (\<Sum>r<c. nth_digit n r b * b ^ r) + nth_digit n c b * b ^ c < b * b ^ c
[PROOF STEP]
using assms IH
[PROOF STATE]
proof (prove)
using this:
nth_digit n c b * b ^ c \<le> (b - 1) * b ^ c
n < b ^ c
1 < b
(\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c

goal (1 subgoal):
 1. (\<Sum>r<c. nth_digit n r b * b ^ r) + nth_digit n c b * b ^ c < b * b ^ c
[PROOF STEP]
by (metis (no_types, lifting) bound add_mono_thms_linordered_field(1)
            add_mono_thms_linordered_field(5) le_less mult_eq_if not_one_le_zero)
[PROOF STATE]
proof (state)
this:
(\<Sum>r<c. nth_digit n r b * b ^ r) + nth_digit n c b * b ^ c < b * b ^ c

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
hence "k\<ge>c \<longrightarrow> nth_digit (\<Sum>r<c.((nth_digit n r b)*b^r)) k b = 0" for k
[PROOF STATE]
proof (prove)
using this:
(\<Sum>r<c. nth_digit n r b * b ^ r) < b ^ c

goal (1 subgoal):
 1. c \<le> k \<longrightarrow> nth_digit (\<Sum>r<c. nth_digit n r b * b ^ r) k b = 0
[PROOF STEP]
apply(auto simp add: nth_digit_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<Sum>r<c. n div b ^ r mod b * b ^ r) < b ^ c; c \<le> k\<rbrakk> \<Longrightarrow> (\<Sum>r<c. n div b ^ r mod b * b ^ r) div b ^ k mod b = 0
[PROOF STEP]
using less_le_trans assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x < ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x < ?z
1 < b

goal (1 subgoal):
 1. \<lbrakk>(\<Sum>r<c. n div b ^ r mod b * b ^ r) < b ^ c; c \<le> k\<rbrakk> \<Longrightarrow> (\<Sum>r<c. n div b ^ r mod b * b ^ r) div b ^ k mod b = 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
c \<le> ?k \<longrightarrow> nth_digit (\<Sum>r<c. nth_digit n r b * b ^ r) ?k b = 0

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
hence "\<forall>r\<ge>c.(nth_digit n r b
    = nth_digit (\<Sum>k<c.((nth_digit n k b)*b^k)) r b)"
[PROOF STATE]
proof (prove)
using this:
c \<le> ?k \<longrightarrow> nth_digit (\<Sum>r<c. nth_digit n r b * b ^ r) ?k b = 0

goal (1 subgoal):
 1. \<forall>r\<ge>c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b
[PROOF STEP]
by (simp add: nik)
[PROOF STATE]
proof (state)
this:
\<forall>r\<ge>c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>r\<ge>c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
have "\<forall>r<c.(nth_digit n r b
               = nth_digit (\<Sum>k<c.((nth_digit n k b) * b^k)) r b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>r<c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b
[PROOF STEP]
using aux1_digit_gen_sum_repr assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?n < ?b ^ ?c; ?r < ?c; 1 < ?b\<rbrakk> \<Longrightarrow> nth_digit (\<Sum>k<?c. nth_digit ?n k ?b * ?b ^ k) ?r ?b = nth_digit ?n ?r ?b
n < b ^ c
1 < b

goal (1 subgoal):
 1. \<forall>r<c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>r<c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>r\<ge>c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b
\<forall>r<c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b
[PROOF STEP]
have "\<forall>r. nth_digit (\<Sum>k<c.((nth_digit n k b)*b^k)) r b
                    = nth_digit n r b"
[PROOF STATE]
proof (prove)
using this:
\<forall>r\<ge>c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b
\<forall>r<c. nth_digit n r b = nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b

goal (1 subgoal):
 1. \<forall>r. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
by (metis not_less)
[PROOF STATE]
proof (state)
this:
\<forall>r. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>r. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>r. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
using digit_wise_gen_equiv[of "b" "(\<Sum>k<c. nth_digit n k b * b ^ k)" "n"] \<open>b>1\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>r. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) r b = nth_digit n r b
1 < b \<Longrightarrow> ((\<Sum>k<c. nth_digit n k b * b ^ k) = n) = (\<forall>k. nth_digit (\<Sum>k<c. nth_digit n k b * b ^ k) k b = nth_digit n k b)
1 < b

goal (1 subgoal):
 1. n = (\<Sum>k<c. nth_digit n k b * b ^ k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n = (\<Sum>k<c. nth_digit n k b * b ^ k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prv_eqv_trans:
assumes "\<phi> \<in> fmla" and "\<chi> \<in> fmla" and "\<psi> \<in> fmla"
shows "prv (eqv \<phi> \<chi>) \<Longrightarrow> prv (eqv \<chi> \<psi>) \<Longrightarrow> prv (eqv \<phi> \<psi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prv (eqv \<phi> \<chi>); prv (eqv \<chi> \<psi>)\<rbrakk> \<Longrightarrow> prv (eqv \<phi> \<psi>)
[PROOF STEP]
using assms prv_cnjI prv_cnj_imp_monoR2 prv_imp_mp prv_imp_trans1 prv_imp_imp_triv eqv_def
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> fmla
\<chi> \<in> fmla
\<psi> \<in> fmla
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla; prv ?\<phi>; prv ?\<chi>\<rbrakk> \<Longrightarrow> prv (cnj ?\<phi> ?\<chi>)
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla; ?\<psi> \<in> fmla; prv (imp ?\<phi> (imp ?\<chi> ?\<psi>))\<rbrakk> \<Longrightarrow> prv (imp (cnj ?\<phi> ?\<chi>) ?\<psi>)
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla; prv (imp ?\<phi> ?\<chi>); prv ?\<phi>\<rbrakk> \<Longrightarrow> prv ?\<chi>
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla; ?\<psi> \<in> fmla\<rbrakk> \<Longrightarrow> prv (imp (imp ?\<chi> ?\<psi>) (imp (imp ?\<phi> ?\<chi>) (imp ?\<phi> ?\<psi>)))
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla\<rbrakk> \<Longrightarrow> prv (imp ?\<phi> (imp ?\<chi> ?\<phi>))
eqv ?\<phi> ?\<chi> = cnj (imp ?\<phi> ?\<chi>) (imp ?\<chi> ?\<phi>)

goal (1 subgoal):
 1. \<lbrakk>prv (eqv \<phi> \<chi>); prv (eqv \<chi> \<psi>)\<rbrakk> \<Longrightarrow> prv (eqv \<phi> \<psi>)
[PROOF STEP]
by (metis prv_prv_imp_trans prv_imp_cnjL prv_imp_cnjR eqv imp)