[STATEMENT]
lemma r2f_inj_iff: "(\<R> f = \<R> g) = (f = g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<R> f = \<R> g) = (f = g)
[PROOF STEP]
by (simp add: f2r_inj inj_eq)


[STATEMENT]
lemma count_mset_set_leq':
  assumes "finite A"
  shows "count (mset_set A) x \<le> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (mset_set A) x \<le> Suc 0
[PROOF STEP]
using assms count_mset_set_leq
[PROOF STATE]
proof (prove)
using this:
finite A
finite ?A \<Longrightarrow> count (mset_set ?A) ?x \<le> 1

goal (1 subgoal):
 1. count (mset_set A) x \<le> Suc 0
[PROOF STEP]
by fastforce


[STATEMENT]
lemma is_mset_set[simp]: "is_mset_set (mset_set X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct_mset (mset_set X)
[PROOF STEP]
by (fact distinct_mset_mset_set)


[STATEMENT]
lemma permutep_comp': "bij f \<Longrightarrow> bij g \<Longrightarrow> permutep (f \<circ> g) mon = permutep g (permutep f mon)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij f; bij g\<rbrakk> \<Longrightarrow> permutep (f \<circ> g) mon = permutep g (permutep f mon)
[PROOF STEP]
by transfer (auto simp: fun_eq_iff bij_comp)


[STATEMENT]
lemma finite_vars_of_cnf: "finite cnf \<Longrightarrow> finite (vars_of_cnf cnf)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite cnf \<Longrightarrow> finite (vars_of_cnf cnf)
[PROOF STEP]
by(clarsimp simp add: vars_of_cnf_def)


[STATEMENT]
lemma all_pairs_set: "set (all_pairs xs) = set xs \<times> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (all_pairs xs) = set xs \<times> set xs
[PROOF STEP]
by(simp add: all_pairs_list_product)


[STATEMENT]
lemma tl_comp_in_SA:
  assumes "f \<in> carrier (SA n)"
  shows "(\<lambda> a \<in> carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>). f (tl a)) \<in> carrier (SA (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a\<in>carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>). f (tl a)) \<in> carrier (SA (Suc n))
[PROOF STEP]
using assms semialg_map_comp_in_SA[of f _ _  tl] tl_is_semialg_map[of "n"]
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
\<lbrakk>f \<in> carrier (SA ?n); is_semialg_map ?m ?n tl\<rbrakk> \<Longrightarrow> (\<lambda>a\<in>carrier (Q\<^sub>p\<^bsup>?m\<^esup>). f (tl a)) \<in> carrier (SA ?m)
is_semialg_map (Suc n) n tl

goal (1 subgoal):
 1. (\<lambda>a\<in>carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>). f (tl a)) \<in> carrier (SA (Suc n))
[PROOF STEP]
by blast


[STATEMENT]
lemma getFrN_length:
  assumes "set xs \<subseteq> var" "set ts \<subseteq> trm" and "set \<phi>s \<subseteq> fmla"
  shows "length (getFrN xs ts \<phi>s n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (getFrN xs ts \<phi>s n) = n
[PROOF STEP]
using assms getFrN_FvarsT_Fvars
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> var
set ts \<subseteq> trm
set \<phi>s \<subseteq> fmla
\<lbrakk>set ?xs \<subseteq> var; set ?ts \<subseteq> trm; set ?\<phi>s \<subseteq> fmla\<rbrakk> \<Longrightarrow> set (getFrN ?xs ?ts ?\<phi>s ?n) \<subseteq> var \<and> set (getFrN ?xs ?ts ?\<phi>s ?n) \<inter> set ?xs = {} \<and> (?t \<in> set ?ts \<longrightarrow> set (getFrN ?xs ?ts ?\<phi>s ?n) \<inter> FvarsT ?t = {}) \<and> (?\<phi> \<in> set ?\<phi>s \<longrightarrow> set (getFrN ?xs ?ts ?\<phi>s ?n) \<inter> Fvars ?\<phi> = {}) \<and> length (getFrN ?xs ?ts ?\<phi>s ?n) = ?n \<and> distinct (getFrN ?xs ?ts ?\<phi>s ?n)

goal (1 subgoal):
 1. length (getFrN xs ts \<phi>s n) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_list_add_le_fold_eucl_truncate_up:
  fixes z::"'a::executable_euclidean_space"
  shows "sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z
[PROOF STEP]
proof (induct xs arbitrary: z)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>z. sum_list [] + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) [] z
 2. \<And>a xs z. (\<And>z. sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z) \<Longrightarrow> sum_list (a # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (a # xs) z
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
sum_list xs + ?z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs ?z

goal (2 subgoals):
 1. \<And>z. sum_list [] + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) [] z
 2. \<And>a xs z. (\<And>z. sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z) \<Longrightarrow> sum_list (a # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (a # xs) z
[PROOF STEP]
have "sum_list (x # xs) + z = sum_list xs + (z + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (x # xs) + z = sum_list xs + (z + x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (x # xs) + z = sum_list xs + (z + x)

goal (2 subgoals):
 1. \<And>z. sum_list [] + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) [] z
 2. \<And>a xs z. (\<And>z. sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z) \<Longrightarrow> sum_list (a # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (a # xs) z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (x # xs) + z = sum_list xs + (z + x)

goal (2 subgoals):
 1. \<And>z. sum_list [] + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) [] z
 2. \<And>a xs z. (\<And>z. sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z) \<Longrightarrow> sum_list (a # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (a # xs) z
[PROOF STEP]
have "\<dots> \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (z + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list xs + (z + x) \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (z + x)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
sum_list xs + ?z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs ?z

goal (1 subgoal):
 1. sum_list xs + (z + x) \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (z + x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list xs + (z + x) \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (z + x)

goal (2 subgoals):
 1. \<And>z. sum_list [] + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) [] z
 2. \<And>a xs z. (\<And>z. sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z) \<Longrightarrow> sum_list (a # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (a # xs) z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list xs + (z + x) \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (z + x)

goal (2 subgoals):
 1. \<And>z. sum_list [] + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) [] z
 2. \<And>a xs z. (\<And>z. sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z) \<Longrightarrow> sum_list (a # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (a # xs) z
[PROOF STEP]
have "\<dots> \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (eucl_truncate_up p (x + z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (z + x) \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (eucl_truncate_up p (x + z))
[PROOF STEP]
by (auto intro!: add_mono eucl_fold_mono eucl_truncate_up eucl_truncate_up_mono simp: ac_simps)
[PROOF STATE]
proof (state)
this:
fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (z + x) \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (eucl_truncate_up p (x + z))

goal (2 subgoals):
 1. \<And>z. sum_list [] + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) [] z
 2. \<And>a xs z. (\<And>z. sum_list xs + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs z) \<Longrightarrow> sum_list (a # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (a # xs) z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_list (x # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (eucl_truncate_up p (x + z))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sum_list (x # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) xs (eucl_truncate_up p (x + z))

goal (1 subgoal):
 1. sum_list (x # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (x # xs) z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (x # xs) + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) (x # xs) z

goal (1 subgoal):
 1. \<And>z. sum_list [] + z \<le> fold (\<lambda>x y. eucl_truncate_up p (x + y)) [] z
[PROOF STEP]
qed simp


[STATEMENT]
lemma cf_up_ObjMap_vrange:
  assumes "\<And>i. i \<in>\<^sub>\<circ> I \<Longrightarrow> \<phi> i : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<AA> i"
  shows "\<R>\<^sub>\<circ> (cf_up I \<AA> \<CC> \<phi>\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> (\<Prod>\<^sub>Ci\<in>\<^sub>\<circ>I. \<AA> i)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (cf_up I \<AA> \<CC> \<phi>\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> cat_prod I \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
proof
  (
    rule smcf_up_ObjMap_vrange[
      where \<AA>=\<open>\<lambda>i. cat_smc (\<AA> i)\<close>
        and \<phi>=\<open>\<lambda>i. cf_smcf (\<phi> i)\<close>
        and \<CC>=\<open>cat_smc \<CC>\<close>,
      unfolded slicing_simps slicing_commute
      ]
  )
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in>\<^sub>\<circ> I \<Longrightarrow> cf_smcf (\<phi> i) : cat_smc \<CC> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>?\<alpha>\<^esub> cat_smc (\<AA> i)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in>\<^sub>\<circ> I \<Longrightarrow> cf_smcf (\<phi> i) : cat_smc \<CC> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>?\<alpha>\<^esub> cat_smc (\<AA> i)
[PROOF STEP]
assume "i \<in>\<^sub>\<circ> I"
[PROOF STATE]
proof (state)
this:
i \<in>\<^sub>\<circ> I

goal (1 subgoal):
 1. \<And>i. i \<in>\<^sub>\<circ> I \<Longrightarrow> cf_smcf (\<phi> i) : cat_smc \<CC> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>?\<alpha>\<^esub> cat_smc (\<AA> i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in>\<^sub>\<circ> I
[PROOF STEP]
interpret is_functor \<alpha> \<CC> \<open>\<AA> i\<close> \<open>\<phi> i\<close>
[PROOF STATE]
proof (prove)
using this:
i \<in>\<^sub>\<circ> I

goal (1 subgoal):
 1. \<phi> i : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<AA> i
[PROOF STEP]
by (rule assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in>\<^sub>\<circ> I \<Longrightarrow> cf_smcf (\<phi> i) : cat_smc \<CC> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>?\<alpha>\<^esub> cat_smc (\<AA> i)
[PROOF STEP]
show "cf_smcf (\<phi> i) : cat_smc \<CC> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> cat_smc (\<AA> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cf_smcf (\<phi> i) : cat_smc \<CC> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> cat_smc (\<AA> i)
[PROOF STEP]
by (rule cf_is_semifunctor)
[PROOF STATE]
proof (state)
this:
cf_smcf (\<phi> i) : cat_smc \<CC> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> cat_smc (\<AA> i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PosOrd_ex_eq2:
  shows "v1 :\<sqsubset>val v2 \<longleftrightarrow> (v1 :\<sqsubseteq>val v2 \<and> v1 \<noteq> v2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v1 :\<sqsubset>val v2 = (v1 :\<sqsubseteq>val v2 \<and> v1 \<noteq> v2)
[PROOF STEP]
using PosOrd_ordering
[PROOF STATE]
proof (prove)
using this:
ordering PosOrd_ex_eq PosOrd_ex

goal (1 subgoal):
 1. v1 :\<sqsubset>val v2 = (v1 :\<sqsubseteq>val v2 \<and> v1 \<noteq> v2)
[PROOF STEP]
using PosOrd_ex_eq_def PosOrd_irrefl
[PROOF STATE]
proof (prove)
using this:
ordering PosOrd_ex_eq PosOrd_ex
?v1.0 :\<sqsubseteq>val ?v2.0 \<equiv> ?v1.0 :\<sqsubset>val ?v2.0 \<or> ?v1.0 = ?v2.0
?v :\<sqsubset>val ?v \<Longrightarrow> False

goal (1 subgoal):
 1. v1 :\<sqsubset>val v2 = (v1 :\<sqsubseteq>val v2 \<and> v1 \<noteq> v2)
[PROOF STEP]
by blast


[STATEMENT]
theorem halting_problem_undecidable:
  fixes code :: "nat \<Rightarrow> recf"
  assumes "\<And>f. recfn 1 f \<Longrightarrow> \<exists>i. code i = f"
  shows "\<not> decidable {x. eval (code x) [x] \<down>}" (is "\<not> decidable ?K")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> decidable {x. eval (code x) [x] \<down>}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
assume "decidable ?K"
[PROOF STATE]
proof (state)
this:
decidable {x. eval (code x) [x] \<down>}

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
decidable {x. eval (code x) [x] \<down>}
[PROOF STEP]
obtain f where "recfn 1 f" and f: "\<forall>x. eval f [x] \<down>= (if x \<in> ?K then 1 else 0)"
[PROOF STATE]
proof (prove)
using this:
decidable {x. eval (code x) [x] \<down>}

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>recfn 1 f; \<forall>x. eval f [x] \<down>= (if x \<in> {x. eval (code x) [x] \<down>} then 1 else 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using decidable_def
[PROOF STATE]
proof (prove)
using this:
decidable {x. eval (code x) [x] \<down>}
decidable ?X \<equiv> \<exists>f. recfn 1 f \<and> (\<forall>x. eval f [x] \<down>= (if x \<in> ?X then 1 else 0))

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>recfn 1 f; \<forall>x. eval f [x] \<down>= (if x \<in> {x. eval (code x) [x] \<down>} then 1 else 0)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
recfn 1 f
\<forall>x. eval f [x] \<down>= (if x \<in> {x. eval (code x) [x] \<down>} then 1 else 0)

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
define g where "g \<equiv> Cn 1 r_ifeq_else_diverg [f, Z, Z]"
[PROOF STATE]
proof (state)
this:
g \<equiv> Cn 1 r_ifeq_else_diverg [f, Z, Z]

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<equiv> Cn 1 r_ifeq_else_diverg [f, Z, Z]
[PROOF STEP]
have "recfn 1 g"
[PROOF STATE]
proof (prove)
using this:
g \<equiv> Cn 1 r_ifeq_else_diverg [f, Z, Z]

goal (1 subgoal):
 1. recfn 1 g
[PROOF STEP]
using \<open>recfn 1 f\<close> r_ifeq_else_diverg_recfn
[PROOF STATE]
proof (prove)
using this:
g \<equiv> Cn 1 r_ifeq_else_diverg [f, Z, Z]
recfn 1 f
recfn 3 r_ifeq_else_diverg

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

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
recfn 1 ?f \<Longrightarrow> \<exists>i. code i = ?f
recfn 1 g
[PROOF STEP]
obtain i where i: "code i = g"
[PROOF STATE]
proof (prove)
using this:
recfn 1 ?f \<Longrightarrow> \<exists>i. code i = ?f
recfn 1 g

goal (1 subgoal):
 1. (\<And>i. code i = g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
code i = g

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
from g_def
[PROOF STATE]
proof (chain)
picking this:
g \<equiv> Cn 1 r_ifeq_else_diverg [f, Z, Z]
[PROOF STEP]
have "eval g [x] = (if x \<notin> ?K then Some 0 else None)" for x
[PROOF STATE]
proof (prove)
using this:
g \<equiv> Cn 1 r_ifeq_else_diverg [f, Z, Z]

goal (1 subgoal):
 1. eval g [x] = (if x \<notin> {x. eval (code x) [x] \<down>} then Some 0 else None)
[PROOF STEP]
using r_ifeq_else_diverg_recfn \<open>recfn 1 f\<close> f
[PROOF STATE]
proof (prove)
using this:
g \<equiv> Cn 1 r_ifeq_else_diverg [f, Z, Z]
recfn 3 r_ifeq_else_diverg
recfn 1 f
\<forall>x. eval f [x] \<down>= (if x \<in> {x. eval (code x) [x] \<down>} then 1 else 0)

goal (1 subgoal):
 1. eval g [x] = (if x \<notin> {x. eval (code x) [x] \<down>} then Some 0 else None)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval g [?x] = (if ?x \<notin> {x. eval (code x) [x] \<down>} then Some 0 else None)

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval g [?x] = (if ?x \<notin> {x. eval (code x) [x] \<down>} then Some 0 else None)
[PROOF STEP]
have "eval g [i] \<down> \<longleftrightarrow> i \<notin> ?K"
[PROOF STATE]
proof (prove)
using this:
eval g [?x] = (if ?x \<notin> {x. eval (code x) [x] \<down>} then Some 0 else None)

goal (1 subgoal):
 1. (eval g [i] \<down>) = (i \<notin> {x. eval (code x) [x] \<down>})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(eval g [i] \<down>) = (i \<notin> {x. eval (code x) [x] \<down>})

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(eval g [i] \<down>) = (i \<notin> {x. eval (code x) [x] \<down>})

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
have "... \<longleftrightarrow> eval (code i) [i] \<up>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i \<notin> {x. eval (code x) [x] \<down>}) = (eval (code i) [i] \<up>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(i \<notin> {x. eval (code x) [x] \<down>}) = (eval (code i) [i] \<up>)

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(i \<notin> {x. eval (code x) [x] \<down>}) = (eval (code i) [i] \<up>)

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
have "... \<longleftrightarrow> eval g [i] \<up>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eval (code i) [i] \<up>) = (eval g [i] \<up>)
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
code i = g

goal (1 subgoal):
 1. (eval (code i) [i] \<up>) = (eval g [i] \<up>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(eval (code i) [i] \<up>) = (eval g [i] \<up>)

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(eval g [i] \<down>) = (eval g [i] \<up>)
[PROOF STEP]
have "eval g [i] \<down> \<longleftrightarrow> eval g [i] \<up>"
[PROOF STATE]
proof (prove)
using this:
(eval g [i] \<down>) = (eval g [i] \<up>)

goal (1 subgoal):
 1. (eval g [i] \<down>) = (eval g [i] \<up>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(eval g [i] \<down>) = (eval g [i] \<up>)

goal (1 subgoal):
 1. decidable {x. eval (code x) [x] \<down>} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(eval g [i] \<down>) = (eval g [i] \<up>)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
(eval g [i] \<down>) = (eval g [i] \<up>)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_rel_boundaries:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "S homeomorphic T" "rel_interior S = {} \<longleftrightarrow> rel_interior T = {}"
    shows "(S - rel_interior S) homeomorphic (T - rel_interior T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
proof (cases "rel_interior T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel_interior T = {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
 2. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
rel_interior T = {}

goal (2 subgoals):
 1. rel_interior T = {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
 2. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
rel_interior T = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S homeomorphic T
(rel_interior S = {}) = (rel_interior T = {})
rel_interior T = {}

goal (1 subgoal):
 1. S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S - rel_interior S homeomorphic T - rel_interior T

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
rel_interior T \<noteq> {}

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
obtain f g
    where S: "\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x" and T: "\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y"
      and contf: "continuous_on S f" and contg: "continuous_on T g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using  assms [unfolded homeomorphic_minimal]
[PROOF STATE]
proof (prove)
using this:
\<exists>f g. (\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x) \<and> (\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y) \<and> continuous_on S f \<and> continuous_on T g
(rel_interior S = {}) = (rel_interior T = {})

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x; \<forall>y\<in>T. g y \<in> S \<and> f (g y) = y; continuous_on S f; continuous_on T g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>S. f x \<in> T \<and> g (f x) = x
\<forall>y\<in>T. g y \<in> S \<and> f (g y) = y
continuous_on S f
continuous_on T g

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
have "aff_dim (affine hull S) \<le> aff_dim (affine hull T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull S) \<le> aff_dim (affine hull T)
[PROOF STEP]
apply (rule invariance_of_dimension_affine_sets [of _ "rel_interior S" _ f])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
 2. affine (affine hull S)
 3. affine (affine hull T)
 4. continuous_on (rel_interior S) f
 5. f ` rel_interior S \<subseteq> affine hull T
 6. inj_on f (rel_interior S)
 7. rel_interior S \<noteq> {}
[PROOF STEP]
apply (simp_all add: openin_rel_interior False assms)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. continuous_on (rel_interior S) f
 2. f ` rel_interior S \<subseteq> affine hull T
 3. inj_on f (rel_interior S)
[PROOF STEP]
using contf continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (3 subgoals):
 1. continuous_on (rel_interior S) f
 2. f ` rel_interior S \<subseteq> affine hull T
 3. inj_on f (rel_interior S)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f ` rel_interior S \<subseteq> affine hull T
 2. inj_on f (rel_interior S)
[PROOF STEP]
apply (meson S hull_subset image_subsetI rel_interior_subset rev_subsetD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (rel_interior S)
[PROOF STEP]
apply (metis S inj_on_inverseI inj_on_subset rel_interior_subset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
have "aff_dim (affine hull T) \<le> aff_dim (affine hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
apply (rule invariance_of_dimension_affine_sets [of _ "rel_interior T" _ g])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. openin (top_of_set (affine hull T)) (rel_interior T)
 2. affine (affine hull T)
 3. affine (affine hull S)
 4. continuous_on (rel_interior T) g
 5. g ` rel_interior T \<subseteq> affine hull S
 6. inj_on g (rel_interior T)
 7. rel_interior T \<noteq> {}
[PROOF STEP]
apply (simp_all add: openin_rel_interior False assms)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. continuous_on (rel_interior T) g
 2. g ` rel_interior T \<subseteq> affine hull S
 3. inj_on g (rel_interior T)
[PROOF STEP]
using contg continuous_on_subset rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
continuous_on T g
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
rel_interior ?S \<subseteq> ?S

goal (3 subgoals):
 1. continuous_on (rel_interior T) g
 2. g ` rel_interior T \<subseteq> affine hull S
 3. inj_on g (rel_interior T)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g ` rel_interior T \<subseteq> affine hull S
 2. inj_on g (rel_interior T)
[PROOF STEP]
apply (meson T hull_subset image_subsetI rel_interior_subset rev_subsetD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on g (rel_interior T)
[PROOF STEP]
apply (metis T inj_on_inverseI inj_on_subset rel_interior_subset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
aff_dim (affine hull T) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
aff_dim (affine hull T) \<le> aff_dim (affine hull S)
[PROOF STEP]
have "aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
using this:
aff_dim (affine hull S) \<le> aff_dim (affine hull T)
aff_dim (affine hull T) \<le> aff_dim (affine hull S)

goal (1 subgoal):
 1. aff_dim S = aff_dim T
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
aff_dim S = aff_dim T

goal (1 subgoal):
 1. rel_interior T \<noteq> {} \<Longrightarrow> S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim S = aff_dim T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aff_dim S = aff_dim T

goal (1 subgoal):
 1. S - rel_interior S homeomorphic T - rel_interior T
[PROOF STEP]
by (rule homeomorphic_rel_boundaries_same_dimension [OF \<open>S homeomorphic T\<close>])
[PROOF STATE]
proof (state)
this:
S - rel_interior S homeomorphic T - rel_interior T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scaleC_conv_of_complex: "scaleC r x = of_complex r * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r *\<^sub>C x = of_complex r * x
[PROOF STEP]
by (simp add: of_complex_def)


[STATEMENT]
lemma sign_id [simp]: "sign id = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign id = 1
[PROOF STEP]
by (simp add: sign_def)


[STATEMENT]
lemma (in Module) mHom_mId_bijec:"\<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M;
      compose (carrier M) g f = mId\<^bsub>M\<^esub>; compose (carrier N) f g = mId\<^bsub>N\<^esub>\<rbrakk> \<Longrightarrow>
      bijec\<^bsub>M,N\<^esub> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> bijec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (simp add:bijec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> injec\<^bsub>M,N\<^esub> f \<and> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> injec\<^bsub>M,N\<^esub> f
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (simp add:injec_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> f \<in> aHom M N \<and> ker\<^bsub>M,N\<^esub> f = {\<zero>}
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> f \<in> aHom M N
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> ker\<^bsub>M,N\<^esub> f = {\<zero>}
 3. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (simp add:mHom_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> ker\<^bsub>M,N\<^esub> f = {\<zero>}
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (simp add:ker_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> {a \<in> carrier M. f a = \<zero>\<^bsub>N\<^esub>} = {\<zero>}
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> {a \<in> carrier M. f a = \<zero>\<^bsub>N\<^esub>} \<subseteq> {\<zero>}
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> {\<zero>} \<subseteq> {a \<in> carrier M. f a = \<zero>\<^bsub>N\<^esub>}
 3. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (rule subsetI, simp, erule conjE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> ; x \<in> carrier M; f x = \<zero>\<^bsub>N\<^esub>\<rbrakk> \<Longrightarrow> x = \<zero>
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> {\<zero>} \<subseteq> {a \<in> carrier M. f a = \<zero>\<^bsub>N\<^esub>}
 3. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (frule_tac x = "f x" and y = "\<zero>\<^bsub>N\<^esub>" and f = g in eq_elems_eq_val)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> ; x \<in> carrier M; f x = \<zero>\<^bsub>N\<^esub>; g (f x) = g \<zero>\<^bsub>N\<^esub>\<rbrakk> \<Longrightarrow> x = \<zero>
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> {\<zero>} \<subseteq> {a \<in> carrier M. f a = \<zero>\<^bsub>N\<^esub>}
 3. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (frule_tac f = "compose (carrier M) g f" and g = "mId\<^bsub>M\<^esub>" and x = x in
        eq_fun_eq_val, thin_tac "compose (carrier M) g f = mId\<^bsub>M\<^esub>",
        simp add:compose_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; (\<lambda>x\<in>carrier N. f (g x)) = mId\<^bsub>N\<^esub> ; x \<in> carrier M; f x = \<zero>\<^bsub>N\<^esub>; g \<zero>\<^bsub>N\<^esub> = (mId\<^bsub>M\<^esub> ) x\<rbrakk> \<Longrightarrow> x = \<zero>
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> {\<zero>} \<subseteq> {a \<in> carrier M. f a = \<zero>\<^bsub>N\<^esub>}
 3. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (cut_tac Module.mHom_0[of N R M g], simp add:mId_def, assumption,
   rule Module_axioms, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> {\<zero>} \<subseteq> {a \<in> carrier M. f a = \<zero>\<^bsub>N\<^esub>}
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (rule subsetI, simp,
       simp add:ag_inc_zero, simp add:mHom_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surjec\<^bsub>M,N\<^esub> f
[PROOF STEP]
apply (simp add:surjec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> f \<in> aHom M N \<and> surj_to f (carrier M) (carrier N)
[PROOF STEP]
apply (rule conjI, simp add:mHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> surj_to f (carrier M) (carrier N)
[PROOF STEP]
apply (rule surj_to_test)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> f \<in> carrier M \<rightarrow> carrier N
 2. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> \<forall>b\<in>carrier N. \<exists>a\<in>carrier M. f a = b
[PROOF STEP]
apply (simp add:mHom_def aHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> \<rbrakk> \<Longrightarrow> \<forall>b\<in>carrier N. \<exists>a\<in>carrier M. f a = b
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; compose (carrier M) g f = mId\<^bsub>M\<^esub> ; compose (carrier N) f g = mId\<^bsub>N\<^esub> ; b \<in> carrier N\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier M. f a = b
[PROOF STEP]
apply (frule_tac f = "compose (carrier N) f g" and g = "mId\<^bsub>N\<^esub>" and x = b in
        eq_fun_eq_val, thin_tac "compose (carrier M) g f = mId\<^bsub>M\<^esub>",
        thin_tac "compose (carrier N) f g = mId\<^bsub>N\<^esub>",
        simp add:compose_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; b \<in> carrier N; f (g b) = (mId\<^bsub>N\<^esub> ) b\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier M. f a = b
[PROOF STEP]
apply (simp add:mId_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; b \<in> carrier N; f (g b) = b\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier M. f a = b
[PROOF STEP]
apply (frule_tac m = b in Module.mHom_mem [of N R M g], rule Module_axioms, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>R module N; f \<in> mHom R M N; g \<in> mHom R N M; b \<in> carrier N; f (g b) = b; g b \<in> carrier M\<rbrakk> \<Longrightarrow> \<exists>a\<in>carrier M. f a = b
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma U'_neq_zero[simp]: "U' x y \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U' x y \<noteq> 0
[PROOF STEP]
unfolding U'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal_of_enat (eSuc (sfirst (HLD {y}) x)) \<partial>T x \<noteq> 0
[PROOF STEP]
by (simp add: nn_integral_add)


[STATEMENT]
lemma size_cartesian_product: "size (A \<times># B) = size A * size B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (A \<times># B) = size A * size B
[PROOF STEP]
by (induct A) (simp_all add: size_add_elem_step_eq)


[STATEMENT]
lemma IInf_us_inv: "IInf \<circ> us = (id::'a::complete_lattice_with_dual \<Rightarrow> 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IInf \<circ> us = id
[PROOF STEP]
unfolding us_def IInf_def fun_eq_iff id_def comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. \<Sqinter> Rep_upset (Abs_upset (\<up> x)) = x
[PROOF STEP]
by (metis Abs_upset_inverse Sup_Inf_var Sup_atLeastAtMost Sup_dual_upset_var order_refl rangeI)


[STATEMENT]
lemma coeff_Q': "Polynomial.coeff Q' k = (if k > n then 0 else (-1) ^ (n - k) * e' (n - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff Q' k = (if n < k then 0 else (- 1) ^ (n - k) * e' (n - k))
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma ListSum_compl2:
  "(\<Sum>\<^bsub>x \<in>  [x\<leftarrow>xs. P x]\<^esub> f x) + (\<Sum>\<^bsub>x \<in>  [x\<leftarrow>xs. \<not> P x]\<^esub> f x) = (\<Sum>\<^bsub>x \<in> xs\<^esub> (f x::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ListSum (filter P xs) f + ListSum (filter (\<lambda>x. \<not> P x) xs) f = ListSum xs f
[PROOF STEP]
by (induct xs) simp_all


[STATEMENT]
lemma register_comp_pair:
  assumes [simp]: \<open>register F\<close> and [simp]: \<open>compatible G H\<close>
  shows "(F o G; F o H) = F o (G; H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<circ> G;F \<circ> H) = F \<circ> (G;H)
[PROOF STEP]
proof (rule tensor_extensionality)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. clinear (F \<circ> G;F \<circ> H)
 2. clinear (F \<circ> (G;H))
 3. \<And>a b. (F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)
[PROOF STEP]
show \<open>clinear (F \<circ> G;F \<circ> H)\<close> and \<open>clinear (F \<circ> (G;H))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clinear (F \<circ> G;F \<circ> H) &&& clinear (F \<circ> (G;H))
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
clinear (F \<circ> G;F \<circ> H)
clinear (F \<circ> (G;H))

goal (1 subgoal):
 1. \<And>a b. (F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)
[PROOF STEP]
have [simp]: \<open>compatible (F o G) (F o H)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compatible (F \<circ> G) (F \<circ> H)
[PROOF STEP]
apply (rule compatible_comp_inner, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. register F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
compatible (F \<circ> G) (F \<circ> H)

goal (1 subgoal):
 1. \<And>a b. (F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compatible (F \<circ> G) (F \<circ> H)
[PROOF STEP]
have [simp]: \<open>register (F \<circ> G)\<close> \<open>register (F \<circ> H)\<close>
[PROOF STATE]
proof (prove)
using this:
compatible (F \<circ> G) (F \<circ> H)

goal (1 subgoal):
 1. register (F \<circ> G) &&& register (F \<circ> H)
[PROOF STEP]
unfolding compatible_def
[PROOF STATE]
proof (prove)
using this:
register (F \<circ> G) \<and> register (F \<circ> H) \<and> (\<forall>a b. (F \<circ> G) a *\<^sub>u (F \<circ> H) b = (F \<circ> H) b *\<^sub>u (F \<circ> G) a)

goal (1 subgoal):
 1. register (F \<circ> G) &&& register (F \<circ> H)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
register (F \<circ> G)
register (F \<circ> H)

goal (1 subgoal):
 1. \<And>a b. (F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
register F
compatible G H
[PROOF STEP]
have [simp]: \<open>register G\<close> \<open>register H\<close>
[PROOF STATE]
proof (prove)
using this:
register F
compatible G H

goal (1 subgoal):
 1. register G &&& register H
[PROOF STEP]
unfolding compatible_def
[PROOF STATE]
proof (prove)
using this:
register F
register G \<and> register H \<and> (\<forall>a b. G a *\<^sub>u H b = H b *\<^sub>u G a)

goal (1 subgoal):
 1. register G &&& register H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
register G
register H

goal (1 subgoal):
 1. \<And>a b. (F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)
[PROOF STEP]
show \<open>(F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)
[PROOF STEP]
by (auto simp: register_pair_apply register_mult comp_tensor_op)
[PROOF STATE]
proof (state)
this:
(F \<circ> G;F \<circ> H) (a \<otimes>\<^sub>u b) = (F \<circ> (G;H)) (a \<otimes>\<^sub>u b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_sum_ereal:
  fixes f :: "_ \<Rightarrow> _ \<Rightarrow> ereal"
  assumes nonneg: "\<And>i a. a \<in> A \<Longrightarrow> 0 \<le> f i a"
  shows "(\<Sum>i. \<Sum>a\<in>A. f i a) = (\<Sum>a\<in>A. \<Sum>i. f i a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
proof (cases "finite A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite A \<Longrightarrow> (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
 2. infinite A \<Longrightarrow> (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. finite A \<Longrightarrow> (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
 2. infinite A \<Longrightarrow> (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
using nonneg
[PROOF STATE]
proof (prove)
using this:
finite A
?a \<in> A \<Longrightarrow> 0 \<le> f ?i ?a

goal (1 subgoal):
 1. (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
by induct (simp_all add: suminf_add_ereal sum_nonneg)
[PROOF STATE]
proof (state)
this:
(\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)

goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite A

goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. (\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i. sum (f i) A) = (\<Sum>a\<in>A. \<Sum>i. f i a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inter_add_left1: "\<not> x \<in># N \<Longrightarrow> (add_mset x M) \<inter># N = M \<inter># N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin># N \<Longrightarrow> add_mset x M \<inter># N = M \<inter># N
[PROOF STEP]
by (simp add: multiset_eq_iff not_in_iff)


[STATEMENT]
lemma revp_alt: "revp p = rev (map (\<lambda>(u,v). (v,u)) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. revp p = rev (map (\<lambda>(u, v). (v, u)) p)
[PROOF STEP]
by auto


[STATEMENT]
lemma wtPB_UN[simp]: "wtPB (\<Union> i \<in> I. \<Phi> i) \<longleftrightarrow> (\<forall> i \<in> I. wtPB (\<Phi> i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wtPB (\<Union> (\<Phi> ` I)) = (\<forall>i\<in>I. wtPB (\<Phi> i))
[PROOF STEP]
unfolding wtPB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ball (\<Union> (\<Phi> ` I)) wtC = (\<forall>i\<in>I. Ball (\<Phi> i) wtC)
[PROOF STEP]
by auto


[STATEMENT]
lemma In0_UN1: "In0(UN x. f(x)) = (UN x. In0(f(x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. In0 (\<Union> (range f)) = (\<Union>x. In0 (f x))
[PROOF STEP]
by (simp add: In0_def Scons_UN1_y)


[STATEMENT]
lemma powhr_one_eq_one [simp]: "\<And>a. 1 powhr a = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. 1 powhr a = 1
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma alpha_det1:
  assumes "b>2"
  shows "(\<alpha> b (Suc n))^2 - (int b) * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)^2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
proof(cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
 2. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
 2. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
hence "A b n = mat (\<alpha> b (n + 1)) (-(\<alpha> b n)) (\<alpha> b n) (-(\<alpha> b (n - 1)))"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. A b n = mat (\<alpha> b (n + 1)) (- \<alpha> b n) (\<alpha> b n) (- \<alpha> b (n - 1))
[PROOF STEP]
using A.elims neq0_conv
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
\<lbrakk>A ?x ?xa = ?y; \<And>b. \<lbrakk>?x = b; ?xa = 0; ?y = mat 1 0 0 1\<rbrakk> \<Longrightarrow> ?P; \<And>b v. \<lbrakk>?x = b; ?xa = Suc v; ?y = mat (\<alpha> b (Suc v + 1)) (- \<alpha> b (Suc v)) (\<alpha> b (Suc v)) (- \<alpha> b (Suc v - 1))\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
(?n \<noteq> 0) = (0 < ?n)

goal (1 subgoal):
 1. A b n = mat (\<alpha> b (n + 1)) (- \<alpha> b n) (\<alpha> b n) (- \<alpha> b (n - 1))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A b n = mat (\<alpha> b (n + 1)) (- \<alpha> b n) (\<alpha> b n) (- \<alpha> b (n - 1))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
hence "mat_det (A b n)  = (\<alpha> b n)^2 - (\<alpha> b (Suc n)) * \<alpha> b (n-1)"
[PROOF STATE]
proof (prove)
using this:
A b n = mat (\<alpha> b (n + 1)) (- \<alpha> b n) (\<alpha> b n) (- \<alpha> b (n - 1))

goal (1 subgoal):
 1. mat_det (A b n) = (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1)
[PROOF STEP]
apply (auto simp: mat_det.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A b n = mat (\<alpha> b (Suc n)) (- \<alpha> b n) (\<alpha> b n) (- \<alpha> b (n - Suc 0)) \<Longrightarrow> \<alpha> b n * \<alpha> b n = (\<alpha> b n)\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
mat_det (A b n) = (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat_det (A b n) = (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1)

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
hence "... =  (\<alpha> b (Suc n))^2 - b * (\<alpha> b (Suc n)) * \<alpha> b n + (\<alpha> b n)^2"
[PROOF STATE]
proof (prove)
using this:
mat_det (A b n) = (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1)

goal (1 subgoal):
 1. (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1) = (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2
[PROOF STEP]
using False alpha_n[of b "n-1"]
[PROOF STATE]
proof (prove)
using this:
mat_det (A b n) = (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1)
n \<noteq> 0
\<alpha> b (Suc (Suc (n - 1))) = int b * \<alpha> b (Suc (n - 1)) - \<alpha> b (n - 1)

goal (1 subgoal):
 1. (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1) = (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2
[PROOF STEP]
apply(auto simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mat_det (A b n) + \<alpha> b (Suc n) * \<alpha> b (n - Suc 0) = (\<alpha> b n)\<^sup>2; 0 < n; \<alpha> b (Suc n) + \<alpha> b (n - Suc 0) = int b * \<alpha> b n\<rbrakk> \<Longrightarrow> int b * (\<alpha> b n * \<alpha> b (Suc n)) = (\<alpha> b (Suc n))\<^sup>2 + \<alpha> b (Suc n) * \<alpha> b (n - Suc 0)
[PROOF STEP]
by (metis Suc_1 distrib_left mult.commute mult.left_commute power_Suc power_one_right)
[PROOF STATE]
proof (state)
this:
(\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1) = (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat_det (A b n) = (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1)
(\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1) = (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_det (A b n) = (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1)
(\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1) = (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2

goal (1 subgoal):
 1. (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
using A_det assms
[PROOF STATE]
proof (prove)
using this:
mat_det (A b n) = (\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1)
(\<alpha> b n)\<^sup>2 - \<alpha> b (Suc n) * \<alpha> b (n - 1) = (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2
2 < ?b \<Longrightarrow> mat_det (A ?b ?n) = 1
2 < b

goal (1 subgoal):
 1. (\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<alpha> b (Suc n))\<^sup>2 - int b * \<alpha> b (Suc n) * \<alpha> b n + (\<alpha> b n)\<^sup>2 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [autoref_itype]:
  "{} ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "insert ::\<^sub>i I \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "op_set_delete ::\<^sub>i I \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "(\<in>) ::\<^sub>i I \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool"
  "op_set_isEmpty ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool"
  "op_set_isSng ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool"
  "(\<union>) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "(\<inter>) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "((-) :: 'a set \<Rightarrow> 'a set \<Rightarrow> 'a set) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "((=) :: 'a set \<Rightarrow> 'a set \<Rightarrow> bool) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool"
  "(\<subseteq>) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool"
  "op_set_disjoint ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool"
  "Ball ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i (I \<rightarrow>\<^sub>i i_bool) \<rightarrow>\<^sub>i i_bool"
  "Bex ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i (I \<rightarrow>\<^sub>i i_bool) \<rightarrow>\<^sub>i i_bool"
  "op_set_filter ::\<^sub>i (I \<rightarrow>\<^sub>i i_bool) \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "card ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_nat"
  "op_set_size_abort ::\<^sub>i i_nat \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_nat"
  "set ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_list \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "op_set_sel ::\<^sub>i (I \<rightarrow>\<^sub>i i_bool) \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_nres"
  "op_set_pick ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_nres"
  "Sigma ::\<^sub>i \<langle>Ia\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i (Ia \<rightarrow>\<^sub>i \<langle>Ib\<rangle>\<^sub>ii_set) \<rightarrow>\<^sub>i \<langle>\<langle>Ia,Ib\<rangle>\<^sub>ii_prod\<rangle>\<^sub>ii_set"
  "(`) ::\<^sub>i (Ia\<rightarrow>\<^sub>iIb) \<rightarrow>\<^sub>i \<langle>Ia\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>Ib\<rangle>\<^sub>ii_set"
  "op_set_cart ::\<^sub>i \<langle>Ix\<rangle>\<^sub>iIsx \<rightarrow>\<^sub>i \<langle>Iy\<rangle>\<^sub>iIsy \<rightarrow>\<^sub>i \<langle>\<langle>Ix, Iy\<rangle>\<^sub>ii_prod\<rangle>\<^sub>iIsp"
  "Union ::\<^sub>i \<langle>\<langle>I\<rangle>\<^sub>ii_set\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set"
  "atLeastLessThan ::\<^sub>i i_nat \<rightarrow>\<^sub>i i_nat \<rightarrow>\<^sub>i \<langle>i_nat\<rangle>\<^sub>ii_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((({} ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set &&& insert ::\<^sub>i I \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set &&& op_set_delete ::\<^sub>i I \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set) &&& (\<in>) ::\<^sub>i I \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool &&& op_set_isEmpty ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool &&& op_set_isSng ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool) &&& ((\<union>) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set &&& (\<inter>) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set &&& (-) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set) &&& (=) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool &&& (\<subseteq>) ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool &&& op_set_disjoint ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_bool) &&& ((Ball ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i (I \<rightarrow>\<^sub>i i_bool) \<rightarrow>\<^sub>i i_bool &&& Bex ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i (I \<rightarrow>\<^sub>i i_bool) \<rightarrow>\<^sub>i i_bool &&& op_set_filter ::\<^sub>i (I \<rightarrow>\<^sub>i i_bool) \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set) &&& card ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_nat &&& op_set_size_abort ::\<^sub>i i_nat \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i i_nat &&& set ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_list \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set) &&& (op_set_sel ::\<^sub>i (I \<rightarrow>\<^sub>i i_bool) \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_nres &&& op_set_pick ::\<^sub>i \<langle>I\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_nres &&& Sigma ::\<^sub>i \<langle>Ia\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i (Ia \<rightarrow>\<^sub>i \<langle>Ib\<rangle>\<^sub>ii_set) \<rightarrow>\<^sub>i \<langle>\<langle>Ia, Ib\<rangle>\<^sub>ii_prod\<rangle>\<^sub>ii_set) &&& ((`) ::\<^sub>i (Ia \<rightarrow>\<^sub>i Ib) \<rightarrow>\<^sub>i \<langle>Ia\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>Ib\<rangle>\<^sub>ii_set &&& op_set_cart ::\<^sub>i \<langle>Ix\<rangle>\<^sub>iIsx \<rightarrow>\<^sub>i \<langle>Iy\<rangle>\<^sub>iIsy \<rightarrow>\<^sub>i \<langle>\<langle>Ix, Iy\<rangle>\<^sub>ii_prod\<rangle>\<^sub>iIsp) &&& \<Union> ::\<^sub>i \<langle>\<langle>I\<rangle>\<^sub>ii_set\<rangle>\<^sub>ii_set \<rightarrow>\<^sub>i \<langle>I\<rangle>\<^sub>ii_set &&& atLeastLessThan ::\<^sub>i i_nat \<rightarrow>\<^sub>i i_nat \<rightarrow>\<^sub>i \<langle>i_nat\<rangle>\<^sub>ii_set
[PROOF STEP]
by simp_all


[STATEMENT]
lemma (in prob_space) erlang_ith_moment_integrable:
  "0 < l \<Longrightarrow> distributed M lborel X (erlang_density k l) \<Longrightarrow> integrable M (\<lambda>x. X x ^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; distributed M lborel X (\<lambda>x. ennreal (erlang_density k l x))\<rbrakk> \<Longrightarrow> integrable M (\<lambda>x. X x ^ i)
[PROOF STEP]
by rule (rule has_bochner_integral_erlang_ith_moment)


[STATEMENT]
lemma szip_smap_both: "smap f xs ||| smap g ys = smap (map_prod f g) (xs ||| ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smap f xs ||| smap g ys = smap (map_prod f g) (xs ||| ys)
[PROOF STEP]
by (coinduction arbitrary: xs ys) (auto)


[STATEMENT]
lemma Deduction1: "F \<triangleright> (AX1 \<union> \<Gamma> ) \<turnstile>\<^sub>H \<bottom> \<longleftrightarrow> (AX1 \<union> \<Gamma>) \<turnstile>\<^sub>H (F \<^bold>\<rightarrow> \<bottom>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<triangleright> AX1 \<union> \<Gamma> \<turnstile>\<^sub>H \<bottom>) = (AX1 \<union> \<Gamma> \<turnstile>\<^sub>H F \<^bold>\<rightarrow> \<bottom>)
[PROOF STEP]
unfolding AX1_away
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<triangleright> AX0 \<union> (\<Gamma> \<union> AX1) \<turnstile>\<^sub>H \<bottom>) = (AX0 \<union> (\<Gamma> \<union> AX1) \<turnstile>\<^sub>H F \<^bold>\<rightarrow> \<bottom>)
[PROOF STEP]
by (metis Deduction_theorem HC.simps HC_mono Un_commute Un_insert_left insertI1 subset_insertI)


[STATEMENT]
lemma DBM_val_bounded_len'1:
  fixes v
  assumes "DBM_val_bounded v u m n" "0 \<notin> set vs" "v c \<le> n"
          "\<forall> k \<in> set vs. k > 0 \<longrightarrow> k \<le> n \<and> (\<exists> c. v c = k)"
  shows "dbm_entry_val u (Some c) None (len m (v c) 0 vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dbm_entry_val u (Some c) None (len m (v c) 0 vs)
[PROOF STEP]
using DBM_val_bounded_len_1'_aux[OF assms(1,3)] assms(2,4)
[PROOF STATE]
proof (prove)
using this:
\<forall>k\<in>set ?vs. 0 < k \<and> k \<le> n \<and> (\<exists>c. v c = k) \<Longrightarrow> dbm_entry_val u (Some c) None (len m (v c) 0 ?vs)
0 \<notin> set vs
\<forall>k\<in>set vs. 0 < k \<longrightarrow> k \<le> n \<and> (\<exists>c. v c = k)

goal (1 subgoal):
 1. dbm_entry_val u (Some c) None (len m (v c) 0 vs)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma map_ms_aux_MSLCons: "map_ms_aux f (MSLCons (C, e) xs) = MSLCons (f C, e) (map_ms_aux f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_ms_aux f (MSLCons (C, e) xs) = MSLCons (f C, e) (map_ms_aux f xs)
[PROOF STEP]
by (simp add: map_ms_aux_def)


[STATEMENT]
lemma if_same_and: "(If p x y \<and> If p u v) = (if p then x \<and> u else y \<and> v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if p then x else y) \<and> (if p then u else v)) = (if p then x \<and> u else y \<and> v)
[PROOF STEP]
by auto


[STATEMENT]
lemma rotate1_map2:
  "length xs = length ys \<Longrightarrow>
    rotate1 (map2 f xs ys) = map2 f (rotate1 xs) (rotate1 ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys \<Longrightarrow> rotate1 (map2 f xs ys) = map2 f (rotate1 xs) (rotate1 ys)
[PROOF STEP]
by (cases xs; cases ys) auto


[STATEMENT]
lemma strict_subtuple_mono [mono]:
  "(\<And>x y. x \<in> fmran' xm \<Longrightarrow> y \<in> fmran' ym \<Longrightarrow> f x y \<longrightarrow> g x y) \<Longrightarrow>
   strict_subtuple f xm ym \<longrightarrow> strict_subtuple g xm ym"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> fmran' xm; y \<in> fmran' ym\<rbrakk> \<Longrightarrow> f x y \<longrightarrow> g x y) \<Longrightarrow> strict_subtuple f xm ym \<longrightarrow> strict_subtuple g xm ym
[PROOF STEP]
using subtuple_mono
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. \<lbrakk>x \<in> fmran' ?xm; y \<in> fmran' ?ym\<rbrakk> \<Longrightarrow> ?f x y \<longrightarrow> ?g x y) \<Longrightarrow> subtuple ?f ?xm ?ym \<longrightarrow> subtuple ?g ?xm ?ym

goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> fmran' xm; y \<in> fmran' ym\<rbrakk> \<Longrightarrow> f x y \<longrightarrow> g x y) \<Longrightarrow> strict_subtuple f xm ym \<longrightarrow> strict_subtuple g xm ym
[PROOF STEP]
by blast


[STATEMENT]
lemma multiplicity_prime_power [simp]: "prime_elem p \<Longrightarrow> multiplicity p (p ^ n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_elem p \<Longrightarrow> multiplicity p (p ^ n) = n
[PROOF STEP]
by (subst multiplicity_same_power') auto


[STATEMENT]
lemma mconn_equiv: "equiv UNIV (mconn E)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equiv UNIV (mconn E)
[PROOF STEP]
using mconn_refl' mconn_sym' mconn_trans'
[PROOF STATE]
proof (prove)
using this:
refl (mconn ?E)
sym (mconn ?E)
trans (mconn ?E)

goal (1 subgoal):
 1. equiv UNIV (mconn E)
[PROOF STEP]
by (rule equivI)


[STATEMENT]
lemma keysFor_UN [simp]: "keysFor (\<Union>i\<in>A. H i) = (\<Union>i\<in>A. keysFor (H i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keysFor (\<Union> (H ` A)) = (\<Union>i\<in>A. keysFor (H i))
[PROOF STEP]
by (unfold keysFor_def, blast)


[STATEMENT]
lemma subst_dnf_dnf:
  "min_set (subst_dnf (dnf \<phi>) m) = min_dnf (subst \<phi> m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_set (subst_dnf (dnf \<phi>) m) = min_dnf (subst \<phi> m)
[PROOF STEP]
unfolding dnf_min_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_set (subst_dnf (dnf \<phi>) m) = min_set (dnf (subst \<phi> m))
[PROOF STEP]
unfolding list_dnf_to_dnf_list_dnf[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_set (subst_dnf (list_dnf_to_dnf (list_dnf \<phi>)) m) = min_set (list_dnf_to_dnf (list_dnf (subst \<phi> m)))
[PROOF STEP]
unfolding subst_dnf'_list_dnf[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_set (subst_dnf (list_dnf_to_dnf (list_dnf \<phi>)) m) = min_set (list_dnf_to_dnf (subst_dnf' (list_dnf \<phi>) m))
[PROOF STEP]
unfolding min_set_list_dnf_to_dnf_subst_dnf'[OF list_dnf_finite]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_set (subst_dnf (list_dnf_to_dnf (list_dnf \<phi>)) m) = min_set (subst_dnf (list_dnf_to_dnf (list_dnf \<phi>)) m)
[PROOF STEP]
by simp


[STATEMENT]
lemma sorted_wrt_upto[simp]: "sorted_wrt (<) [i..j]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (<) [i..j]
[PROOF STEP]
proof(induct i j rule:upto.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. (i \<le> j \<Longrightarrow> sorted_wrt (<) [i + 1..j]) \<Longrightarrow> sorted_wrt (<) [i..j]
[PROOF STEP]
case (1 i j)
[PROOF STATE]
proof (state)
this:
i \<le> j \<Longrightarrow> sorted_wrt (<) [i + 1..j]

goal (1 subgoal):
 1. \<And>i j. (i \<le> j \<Longrightarrow> sorted_wrt (<) [i + 1..j]) \<Longrightarrow> sorted_wrt (<) [i..j]
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
i \<le> j \<Longrightarrow> sorted_wrt (<) [i + 1..j]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
i \<le> j \<Longrightarrow> sorted_wrt (<) [i + 1..j]

goal (1 subgoal):
 1. sorted_wrt (<) [i..j]
[PROOF STEP]
unfolding upto.simps[of i j]
[PROOF STATE]
proof (prove)
using this:
i \<le> j \<Longrightarrow> sorted_wrt (<) [i + 1..j]

goal (1 subgoal):
 1. sorted_wrt (<) (if i \<le> j then i # [i + 1..j] else [])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sorted_wrt (<) [i..j]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pi_approx':
  fixes n :: nat assumes n: "even n" and "n > 0" and "k \<le> 13*n - 2"
  shows   "\<bar>pi - pi_approx n\<bar> \<le> inverse (2^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ k)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
k \<le> 13 * n - 2

goal (1 subgoal):
 1. \<bar>pi - pi_approx n\<bar> \<le> inverse (2 ^ k)
[PROOF STEP]
by (intro order.trans[OF pi_approx[OF assms(1,2)]]) (simp_all add: field_simps)


[STATEMENT]
lemma holomorphic_closedin_preimage_constant:
  assumes "f holomorphic_on D"
  shows "closedin (top_of_set D) {z\<in>D. f z = a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set D) {z \<in> D. f z = a}
[PROOF STEP]
by (simp add: assms continuous_closedin_preimage_constant holomorphic_on_imp_continuous_on)


[STATEMENT]
lemma Brouwer_degree2_section_map:
  assumes "section_map (nsphere p) (nsphere p) f"
  shows "\<bar>Brouwer_degree2 p f\<bar> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Brouwer_degree2 p f\<bar> = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>Brouwer_degree2 p f\<bar> = 1
[PROOF STEP]
obtain g where g: "retraction_maps (nsphere p) (nsphere p) g f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. retraction_maps (nsphere p) (nsphere p) g f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
section_map (nsphere p) (nsphere p) f

goal (1 subgoal):
 1. (\<And>g. retraction_maps (nsphere p) (nsphere p) g f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: section_map_def)
[PROOF STATE]
proof (state)
this:
retraction_maps (nsphere p) (nsphere p) g f

goal (1 subgoal):
 1. \<bar>Brouwer_degree2 p f\<bar> = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Brouwer_degree2 p f\<bar> = 1
[PROOF STEP]
proof (rule Brouwer_degree2_homotopy_equivalence)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. continuous_map (nsphere ?p) (nsphere ?p) ?f
 2. continuous_map (nsphere ?p) (nsphere ?p) ?g
 3. homotopic_with (\<lambda>x. True) (nsphere ?p) (nsphere ?p) (?f \<circ> ?g) id
 4. \<lbrakk>\<bar>Brouwer_degree2 ?p ?f\<bar> = 1; \<bar>Brouwer_degree2 ?p ?g\<bar> = 1; Brouwer_degree2 ?p ?g = Brouwer_degree2 ?p ?f\<rbrakk> \<Longrightarrow> \<bar>Brouwer_degree2 p f\<bar> = 1
[PROOF STEP]
show "homotopic_with (\<lambda>x. True) (nsphere p) (nsphere p) (g \<circ> f) id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with (\<lambda>x. True) (nsphere p) (nsphere p) (g \<circ> f) id
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
retraction_maps (nsphere p) (nsphere p) g f

goal (1 subgoal):
 1. homotopic_with (\<lambda>x. True) (nsphere p) (nsphere p) (g \<circ> f) id
[PROOF STEP]
apply (auto simp: retraction_maps_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_map (nsphere p) (nsphere p) g; continuous_map (nsphere p) (nsphere p) f; \<forall>x\<in>topspace (nsphere p). g (f x) = x\<rbrakk> \<Longrightarrow> homotopic_with (\<lambda>x. True) (nsphere p) (nsphere p) (g \<circ> f) id
[PROOF STEP]
by (simp add: homotopic_with_equal continuous_map_compose)
[PROOF STATE]
proof (state)
this:
homotopic_with (\<lambda>x. True) (nsphere p) (nsphere p) (g \<circ> f) id

goal (3 subgoals):
 1. continuous_map (nsphere p) (nsphere p) g
 2. continuous_map (nsphere p) (nsphere p) f
 3. \<lbrakk>\<bar>Brouwer_degree2 p g\<bar> = 1; \<bar>Brouwer_degree2 p f\<bar> = 1; Brouwer_degree2 p f = Brouwer_degree2 p g\<rbrakk> \<Longrightarrow> \<bar>Brouwer_degree2 p f\<bar> = 1
[PROOF STEP]
show "continuous_map (nsphere p) (nsphere p) g" "continuous_map (nsphere p) (nsphere p) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (nsphere p) (nsphere p) g &&& continuous_map (nsphere p) (nsphere p) f
[PROOF STEP]
using g retraction_maps_def
[PROOF STATE]
proof (prove)
using this:
retraction_maps (nsphere p) (nsphere p) g f
retraction_maps ?X ?Y ?f ?g \<equiv> continuous_map ?X ?Y ?f \<and> continuous_map ?Y ?X ?g \<and> (\<forall>x\<in>topspace ?Y. ?f (?g x) = x)

goal (1 subgoal):
 1. continuous_map (nsphere p) (nsphere p) g &&& continuous_map (nsphere p) (nsphere p) f
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
continuous_map (nsphere p) (nsphere p) g
continuous_map (nsphere p) (nsphere p) f

goal (1 subgoal):
 1. \<lbrakk>\<bar>Brouwer_degree2 p g\<bar> = 1; \<bar>Brouwer_degree2 p f\<bar> = 1; Brouwer_degree2 p f = Brouwer_degree2 p g\<rbrakk> \<Longrightarrow> \<bar>Brouwer_degree2 p f\<bar> = 1
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>Brouwer_degree2 p f\<bar> = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem nbe_correct: fixes t :: tm
assumes "pure t" and "term (comp_fixed t) \<Rightarrow>* t'" and "pure t'" shows "t \<rightarrow>* t'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
have ML_cl: "closed\<^sub>M\<^sub>L 0 (term (comp_fixed t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed\<^sub>M\<^sub>L 0 (term (comp_fixed t))
[PROOF STEP]
by (simp add: closed_ML_compile[OF \<open>pure t\<close>])
[PROOF STATE]
proof (state)
this:
closed\<^sub>M\<^sub>L 0 (term (comp_fixed t))

goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
have "(term (comp_fixed t))! = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. term (comp_fixed t)! = t
[PROOF STEP]
using kernel_compile[OF \<open>pure t\<close>]
[PROOF STATE]
proof (prove)
using this:
\<forall>i. ?\<sigma> i = V\<^sub>U i [] \<Longrightarrow> compile t ?\<sigma>! = t

goal (1 subgoal):
 1. term (comp_fixed t)! = t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
term (comp_fixed t)! = t

goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
term (comp_fixed t)! = t

goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
have "term (comp_fixed t)! \<rightarrow>* t'!"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. term (comp_fixed t)! \<rightarrow>* t'!
[PROOF STEP]
using kernel_inv[OF assms(2) ML_cl]
[PROOF STATE]
proof (prove)
using this:
term (comp_fixed t)! \<rightarrow>* t'! \<and> closed\<^sub>M\<^sub>L 0 t'

goal (1 subgoal):
 1. term (comp_fixed t)! \<rightarrow>* t'!
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
term (comp_fixed t)! \<rightarrow>* t'!

goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
term (comp_fixed t)! = t
term (comp_fixed t)! \<rightarrow>* t'!
[PROOF STEP]
have "t \<rightarrow>* t'!"
[PROOF STATE]
proof (prove)
using this:
term (comp_fixed t)! = t
term (comp_fixed t)! \<rightarrow>* t'!

goal (1 subgoal):
 1. t \<rightarrow>* t'!
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t \<rightarrow>* t'!

goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<rightarrow>* t'!

goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
using kernel_pure[OF \<open>pure t'\<close>]
[PROOF STATE]
proof (prove)
using this:
t \<rightarrow>* t'!
t'! = t'

goal (1 subgoal):
 1. t \<rightarrow>* t'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t \<rightarrow>* t'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_sum_add:
  fixes f g :: "'a \<Rightarrow> 'b::{topological_comm_monoid_add}"
  assumes \<open>has_sum f A a\<close>
  assumes \<open>has_sum g A b\<close>
  shows \<open>has_sum (\<lambda>x. f x + g x) A (a + b)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum (\<lambda>x. f x + g x) A (a + b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. has_sum (\<lambda>x. f x + g x) A (a + b)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
has_sum f A a
has_sum g A b
[PROOF STEP]
have lim_f: \<open>(sum f \<longlongrightarrow> a)  (finite_subsets_at_top A)\<close>
    and lim_g: \<open>(sum g \<longlongrightarrow> b)  (finite_subsets_at_top A)\<close>
[PROOF STATE]
proof (prove)
using this:
has_sum f A a
has_sum g A b

goal (1 subgoal):
 1. (sum f \<longlongrightarrow> a) (finite_subsets_at_top A) &&& (sum g \<longlongrightarrow> b) (finite_subsets_at_top A)
[PROOF STEP]
by (simp_all add: has_sum_def)
[PROOF STATE]
proof (state)
this:
(sum f \<longlongrightarrow> a) (finite_subsets_at_top A)
(sum g \<longlongrightarrow> b) (finite_subsets_at_top A)

goal (1 subgoal):
 1. has_sum (\<lambda>x. f x + g x) A (a + b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(sum f \<longlongrightarrow> a) (finite_subsets_at_top A)
(sum g \<longlongrightarrow> b) (finite_subsets_at_top A)
[PROOF STEP]
have lim: \<open>(sum (\<lambda>x. f x + g x) \<longlongrightarrow> a + b) (finite_subsets_at_top A)\<close>
[PROOF STATE]
proof (prove)
using this:
(sum f \<longlongrightarrow> a) (finite_subsets_at_top A)
(sum g \<longlongrightarrow> b) (finite_subsets_at_top A)

goal (1 subgoal):
 1. (sum (\<lambda>x. f x + g x) \<longlongrightarrow> a + b) (finite_subsets_at_top A)
[PROOF STEP]
unfolding sum.distrib
[PROOF STATE]
proof (prove)
using this:
(sum f \<longlongrightarrow> a) (finite_subsets_at_top A)
(sum g \<longlongrightarrow> b) (finite_subsets_at_top A)

goal (1 subgoal):
 1. ((\<lambda>A. sum f A + sum g A) \<longlongrightarrow> a + b) (finite_subsets_at_top A)
[PROOF STEP]
by (rule tendsto_add)
[PROOF STATE]
proof (state)
this:
(sum (\<lambda>x. f x + g x) \<longlongrightarrow> a + b) (finite_subsets_at_top A)

goal (1 subgoal):
 1. has_sum (\<lambda>x. f x + g x) A (a + b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(sum (\<lambda>x. f x + g x) \<longlongrightarrow> a + b) (finite_subsets_at_top A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(sum (\<lambda>x. f x + g x) \<longlongrightarrow> a + b) (finite_subsets_at_top A)

goal (1 subgoal):
 1. has_sum (\<lambda>x. f x + g x) A (a + b)
[PROOF STEP]
by (simp_all add: has_sum_def)
[PROOF STATE]
proof (state)
this:
has_sum (\<lambda>x. f x + g x) A (a + b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_deg_map_key_PP: "poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p
[PROOF STEP]
assume "p \<noteq> 0"
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p
[PROOF STEP]
hence "map deg_pp (punit.keys_to_list p) \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. map deg_pp (punit.keys_to_list p) \<noteq> []
[PROOF STEP]
by (simp add: punit.keys_to_list_def punit.pps_to_list_def)
[PROOF STATE]
proof (state)
this:
map deg_pp (punit.keys_to_list p) \<noteq> []

goal (1 subgoal):
 1. poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p
[PROOF STEP]
hence "Max (deg_pp ` keys p) = max_list (map deg_pp (punit.keys_to_list p))"
[PROOF STATE]
proof (prove)
using this:
map deg_pp (punit.keys_to_list p) \<noteq> []

goal (1 subgoal):
 1. Max (deg_pp ` keys p) = max_list (map deg_pp (punit.keys_to_list p))
[PROOF STEP]
by (simp add: max_list_Max punit.set_keys_to_list)
[PROOF STATE]
proof (state)
this:
Max (deg_pp ` keys p) = max_list (map deg_pp (punit.keys_to_list p))

goal (1 subgoal):
 1. poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
p \<noteq> 0 \<Longrightarrow> Max (deg_pp ` keys p) = max_list (map deg_pp (punit.keys_to_list p))

goal (1 subgoal):
 1. poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<Longrightarrow> Max (deg_pp ` keys p) = max_list (map deg_pp (punit.keys_to_list p))

goal (1 subgoal):
 1. poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p
[PROOF STEP]
by (simp add: poly_deg_def poly_deg_pp_def keys_map_key_PP image_image flip: deg_pp.rep_eq)
[PROOF STATE]
proof (state)
this:
poly_deg (Poly_Mapping.map_key PP p) = poly_deg_pp p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integrable_diff:
  "f integrable_on S \<Longrightarrow> g integrable_on S \<Longrightarrow> (\<lambda>x. f x - g x) integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f integrable_on S; g integrable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. f x - g x) integrable_on S
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>y. (f has_integral y) S; \<exists>y. (g has_integral y) S\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. f x - g x) has_integral y) S
[PROOF STEP]
by(auto intro: has_integral_diff)


[STATEMENT]
lemma reachable_states_initial_or_target :
  assumes "q \<in> reachable_states M"
  shows "q = initial M \<or> (\<exists> t \<in> transitions M . t_source t \<in> reachable_states M \<and> t_target t = q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
obtain p where "path M (initial M) p" and "target (initial M) p = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>path M (FSM.initial M) p; target (FSM.initial M) p = q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
q \<in> reachable_states M

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>path M (FSM.initial M) p; target (FSM.initial M) p = q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding reachable_states_def
[PROOF STATE]
proof (prove)
using this:
q \<in> {target (FSM.initial M) p |p. path M (FSM.initial M) p}

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>path M (FSM.initial M) p; target (FSM.initial M) p = q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path M (FSM.initial M) p
target (FSM.initial M) p = q

goal (1 subgoal):
 1. q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
proof (cases p rule: rev_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = [] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
 2. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
p = []

goal (2 subgoals):
 1. p = [] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
 2. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = []
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = []

goal (1 subgoal):
 1. q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
using \<open>path M (initial M) p\<close> \<open>target (initial M) p = q\<close>
[PROOF STATE]
proof (prove)
using this:
p = []
path M (FSM.initial M) p
target (FSM.initial M) p = q

goal (1 subgoal):
 1. q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)

goal (1 subgoal):
 1. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
case (snoc p' t)
[PROOF STATE]
proof (state)
this:
p = p' @ [t]

goal (1 subgoal):
 1. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
have "t \<in> transitions M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> FSM.transitions M
[PROOF STEP]
using \<open>path M (initial M) p\<close>
[PROOF STATE]
proof (prove)
using this:
path M (FSM.initial M) p

goal (1 subgoal):
 1. t \<in> FSM.transitions M
[PROOF STEP]
unfolding snoc
[PROOF STATE]
proof (prove)
using this:
path M (FSM.initial M) (p' @ [t])

goal (1 subgoal):
 1. t \<in> FSM.transitions M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<in> FSM.transitions M

goal (1 subgoal):
 1. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
t \<in> FSM.transitions M

goal (1 subgoal):
 1. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
have "t_target t = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t_target t = q
[PROOF STEP]
using \<open>target (initial M) p = q\<close>
[PROOF STATE]
proof (prove)
using this:
target (FSM.initial M) p = q

goal (1 subgoal):
 1. t_target t = q
[PROOF STEP]
unfolding snoc
[PROOF STATE]
proof (prove)
using this:
target (FSM.initial M) (p' @ [t]) = q

goal (1 subgoal):
 1. t_target t = q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t_target t = q

goal (1 subgoal):
 1. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
t_target t = q

goal (1 subgoal):
 1. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
have "t_source t \<in> reachable_states M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t_source t \<in> reachable_states M
[PROOF STEP]
using \<open>path M (initial M) p\<close>
[PROOF STATE]
proof (prove)
using this:
path M (FSM.initial M) p

goal (1 subgoal):
 1. t_source t \<in> reachable_states M
[PROOF STEP]
unfolding snoc
[PROOF STATE]
proof (prove)
using this:
path M (FSM.initial M) (p' @ [t])

goal (1 subgoal):
 1. t_source t \<in> reachable_states M
[PROOF STEP]
by (metis append_is_Nil_conv last_in_set last_snoc not_Cons_self2 reachable_states_initial reachable_states_path)
[PROOF STATE]
proof (state)
this:
t_source t \<in> reachable_states M

goal (1 subgoal):
 1. \<And>ys y. p = ys @ [y] \<Longrightarrow> q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
t \<in> FSM.transitions M
t_target t = q
t_source t \<in> reachable_states M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<in> FSM.transitions M
t_target t = q
t_source t \<in> reachable_states M

goal (1 subgoal):
 1. q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
q = FSM.initial M \<or> (\<exists>t\<in>FSM.transitions M. t_source t \<in> reachable_states M \<and> t_target t = q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cltn2_compose_left_abs:
  assumes "invertible M"
  shows "cltn2_compose (cltn2_abs M) A = cltn2_abs (M ** cltn2_rep A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cltn2_compose (cltn2_abs M) A = cltn2_abs (M ** cltn2_rep A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cltn2_compose (cltn2_abs M) A = cltn2_abs (M ** cltn2_rep A)
[PROOF STEP]
from \<open>invertible M\<close> and cltn2_rep_invertible and cltn2_compose_abs
[PROOF STATE]
proof (chain)
picking this:
invertible M
invertible (cltn2_rep ?A)
\<lbrakk>invertible ?M; invertible ?N\<rbrakk> \<Longrightarrow> cltn2_compose (cltn2_abs ?M) (cltn2_abs ?N) = cltn2_abs (?M ** ?N)
[PROOF STEP]
have "cltn2_compose (cltn2_abs M) (cltn2_abs (cltn2_rep A))
    = cltn2_abs (M ** cltn2_rep A)"
[PROOF STATE]
proof (prove)
using this:
invertible M
invertible (cltn2_rep ?A)
\<lbrakk>invertible ?M; invertible ?N\<rbrakk> \<Longrightarrow> cltn2_compose (cltn2_abs ?M) (cltn2_abs ?N) = cltn2_abs (?M ** ?N)

goal (1 subgoal):
 1. cltn2_compose (cltn2_abs M) (cltn2_abs (cltn2_rep A)) = cltn2_abs (M ** cltn2_rep A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cltn2_compose (cltn2_abs M) (cltn2_abs (cltn2_rep A)) = cltn2_abs (M ** cltn2_rep A)

goal (1 subgoal):
 1. cltn2_compose (cltn2_abs M) A = cltn2_abs (M ** cltn2_rep A)
[PROOF STEP]
thus "cltn2_compose (cltn2_abs M) A = cltn2_abs (M ** cltn2_rep A)"
[PROOF STATE]
proof (prove)
using this:
cltn2_compose (cltn2_abs M) (cltn2_abs (cltn2_rep A)) = cltn2_abs (M ** cltn2_rep A)

goal (1 subgoal):
 1. cltn2_compose (cltn2_abs M) A = cltn2_abs (M ** cltn2_rep A)
[PROOF STEP]
by (simp add: cltn2_abs_rep)
[PROOF STATE]
proof (state)
this:
cltn2_compose (cltn2_abs M) A = cltn2_abs (M ** cltn2_rep A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_open_vimage:
  "open s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s \<Longrightarrow> continuous_on s f = (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))
[PROOF STEP]
unfolding continuous_on_open_invariant
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s \<Longrightarrow> (\<forall>B. open B \<longrightarrow> (\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> s)) = (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))
[PROOF STEP]
by (metis open_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s])


[STATEMENT]
lemma closedin_Euclidean_space_iff:
  "closedin (Euclidean_space m) S \<longleftrightarrow> closed S \<and> S \<subseteq> topspace (Euclidean_space m)"
  (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (Euclidean_space m) S = (closed S \<and> S \<subseteq> topspace (Euclidean_space m))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. closedin (Euclidean_space m) S \<Longrightarrow> closed S \<and> S \<subseteq> topspace (Euclidean_space m)
 2. closed S \<and> S \<subseteq> topspace (Euclidean_space m) \<Longrightarrow> closedin (Euclidean_space m) S
[PROOF STEP]
show "?lhs \<Longrightarrow> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (Euclidean_space m) S \<Longrightarrow> closed S \<and> S \<subseteq> topspace (Euclidean_space m)
[PROOF STEP]
using closedin_closed_subtopology topspace_Euclidean_space
[PROOF STATE]
proof (prove)
using this:
closedin ?X ?S \<Longrightarrow> closedin (subtopology ?X ?S) ?T = (closedin ?X ?T \<and> ?T \<subseteq> ?S)
topspace (Euclidean_space ?n) = {x. \<forall>i\<ge>?n. x i = 0}

goal (1 subgoal):
 1. closedin (Euclidean_space m) S \<Longrightarrow> closed S \<and> S \<subseteq> topspace (Euclidean_space m)
[PROOF STEP]
by (fastforce simp: topspace_Euclidean_space_alt closedin_Euclidean_imp_closed)
[PROOF STATE]
proof (state)
this:
closedin (Euclidean_space m) S \<Longrightarrow> closed S \<and> S \<subseteq> topspace (Euclidean_space m)

goal (1 subgoal):
 1. closed S \<and> S \<subseteq> topspace (Euclidean_space m) \<Longrightarrow> closedin (Euclidean_space m) S
[PROOF STEP]
show "?rhs \<Longrightarrow> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed S \<and> S \<subseteq> topspace (Euclidean_space m) \<Longrightarrow> closedin (Euclidean_space m) S
[PROOF STEP]
apply (simp add: closedin_subtopology Euclidean_space_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed S \<and> S \<subseteq> {x. \<forall>i\<ge>m. x i = 0} \<Longrightarrow> \<exists>T. closedin (powertop_real UNIV) T \<and> S = T \<inter> {x. \<forall>i\<ge>m. x i = 0}
[PROOF STEP]
by (metis (no_types) closed_closedin euclidean_product_topology inf.orderE)
[PROOF STATE]
proof (state)
this:
closed S \<and> S \<subseteq> topspace (Euclidean_space m) \<Longrightarrow> closedin (Euclidean_space m) S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma meet_comm:
  assumes "meet_in l m P"
  shows "meet_in m l P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. meet_in m l P
[PROOF STEP]
using assms meet_in_def
[PROOF STATE]
proof (prove)
using this:
meet_in l m P
meet_in ?l ?m ?P \<equiv> incid ?P ?l \<and> incid ?P ?m

goal (1 subgoal):
 1. meet_in m l P
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_imp_compactin_eq:
   "finite S \<Longrightarrow> (compactin X S \<longleftrightarrow> S \<subseteq> topspace X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> compactin X S = (S \<subseteq> topspace X)
[PROOF STEP]
using compactin_subset_topspace finite_imp_compactin
[PROOF STATE]
proof (prove)
using this:
compactin ?X ?S \<Longrightarrow> ?S \<subseteq> topspace ?X
\<lbrakk>?S \<subseteq> topspace ?X; finite ?S\<rbrakk> \<Longrightarrow> compactin ?X ?S

goal (1 subgoal):
 1. finite S \<Longrightarrow> compactin X S = (S \<subseteq> topspace X)
[PROOF STEP]
by blast


[STATEMENT]
lemma exp_cf7_pos: "numer_cf7 x > 0 \<Longrightarrow> numer_cf7 (-x) > 0 \<Longrightarrow> exp_cf7 x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < numer_cf7 x; 0 < numer_cf7 (- x)\<rbrakk> \<Longrightarrow> 0 < exp_cf7 x
[PROOF STEP]
by (simp add: exp_cf7_def)


[STATEMENT]
lemma lead_coeff_monom [simp]: "lead_coeff (monom c n) = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (monom c n) = c
[PROOF STEP]
by (cases "c = 0") (simp_all add: degree_monom_eq)