[STATEMENT]
lemma Cauchy_Binet:
  "det (A*B) = (\<Sum>I\<in>{I. I\<subseteq>{0..<m} \<and> card I=n}. det (submatrix A UNIV I) * det (submatrix B I UNIV))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
let ?f="(\<lambda>I. (\<lambda>i. if i<n then sorted_list_of_set I ! i else i))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
let ?setI = "{I. I \<subseteq> {0..<m} \<and> card I = n}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
have inj_on: "inj_on ?f ?setI"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
proof (rule inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; y \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; (\<lambda>i. if i < n then sorted_list_of_set x ! i else i) = (\<lambda>i. if i < n then sorted_list_of_set y ! i else i)\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix I J
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; y \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; (\<lambda>i. if i < n then sorted_list_of_set x ! i else i) = (\<lambda>i. if i < n then sorted_list_of_set y ! i else i)\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume I: "I \<in> ?setI" and J: "J \<in> ?setI" and fI_fJ: "?f I = ?f J"
[PROOF STATE]
proof (state)
this:
I \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}
J \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}
(\<lambda>i. if i < n then sorted_list_of_set I ! i else i) = (\<lambda>i. if i < n then sorted_list_of_set J ! i else i)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; y \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; (\<lambda>i. if i < n then sorted_list_of_set x ! i else i) = (\<lambda>i. if i < n then sorted_list_of_set y ! i else i)\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "x \<in> J" if x: "x \<in> I" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> J
[PROOF STEP]
by (metis (mono_tags) fI_fJ I J distinct_card in_set_conv_nth mem_Collect_eq
          sorted_list_of_set(1) sorted_list_of_set(3) subset_eq_atLeast0_lessThan_finite x)
[PROOF STATE]
proof (state)
this:
?x \<in> I \<Longrightarrow> ?x \<in> J

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; y \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; (\<lambda>i. if i < n then sorted_list_of_set x ! i else i) = (\<lambda>i. if i < n then sorted_list_of_set y ! i else i)\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> I \<Longrightarrow> ?x \<in> J

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; y \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; (\<lambda>i. if i < n then sorted_list_of_set x ! i else i) = (\<lambda>i. if i < n then sorted_list_of_set y ! i else i)\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "x \<in> I" if x: "x \<in> J" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> I
[PROOF STEP]
by (metis (mono_tags) fI_fJ I J distinct_card in_set_conv_nth mem_Collect_eq
          sorted_list_of_set(1) sorted_list_of_set(3) subset_eq_atLeast0_lessThan_finite x)
[PROOF STATE]
proof (state)
this:
?x \<in> J \<Longrightarrow> ?x \<in> I

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; y \<in> {I. I \<subseteq> {0..<m} \<and> card I = n}; (\<lambda>i. if i < n then sorted_list_of_set x ! i else i) = (\<lambda>i. if i < n then sorted_list_of_set y ! i else i)\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?x \<in> I \<Longrightarrow> ?x \<in> J
?x \<in> J \<Longrightarrow> ?x \<in> I
[PROOF STEP]
show "I = J"
[PROOF STATE]
proof (prove)
using this:
?x \<in> I \<Longrightarrow> ?x \<in> J
?x \<in> J \<Longrightarrow> ?x \<in> I

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) {I. I \<subseteq> {0..<m} \<and> card I = n}

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
have rw: "?f I ` {0..<n} = I" if I: "I \<in> ?setI" for I
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. if i < n then sorted_list_of_set I ! i else i) ` {0..<n} = I
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>i. if i < n then sorted_list_of_set I ! i else i) ` {0..<n} = I
[PROOF STEP]
have "sorted_list_of_set I ! xa \<in> I" if "xa < n" for xa
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set I ! xa \<in> I
[PROOF STEP]
by (metis (mono_tags, lifting) I distinct_card distinct_sorted_list_of_set mem_Collect_eq
          nth_mem set_sorted_list_of_set subset_eq_atLeast0_lessThan_finite that)
[PROOF STATE]
proof (state)
this:
?xa < n \<Longrightarrow> sorted_list_of_set I ! ?xa \<in> I

goal (1 subgoal):
 1. (\<lambda>i. if i < n then sorted_list_of_set I ! i else i) ` {0..<n} = I
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?xa < n \<Longrightarrow> sorted_list_of_set I ! ?xa \<in> I

goal (1 subgoal):
 1. (\<lambda>i. if i < n then sorted_list_of_set I ! i else i) ` {0..<n} = I
[PROOF STEP]
have "\<exists>xa\<in>{0..<n}. x = sorted_list_of_set I ! xa" if x: "x\<in>I" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xa\<in>{0..<n}. x = sorted_list_of_set I ! xa
[PROOF STEP]
by (metis (full_types) x I atLeast0LessThan distinct_card in_set_conv_nth mem_Collect_eq
         lessThan_iff sorted_list_of_set(1) sorted_list_of_set(3) subset_eq_atLeast0_lessThan_finite)
[PROOF STATE]
proof (state)
this:
?x \<in> I \<Longrightarrow> \<exists>xa\<in>{0..<n}. ?x = sorted_list_of_set I ! xa

goal (1 subgoal):
 1. (\<lambda>i. if i < n then sorted_list_of_set I ! i else i) ` {0..<n} = I
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?xa < n \<Longrightarrow> sorted_list_of_set I ! ?xa \<in> I
?x \<in> I \<Longrightarrow> \<exists>xa\<in>{0..<n}. ?x = sorted_list_of_set I ! xa
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?xa < n \<Longrightarrow> sorted_list_of_set I ! ?xa \<in> I
?x \<in> I \<Longrightarrow> \<exists>xa\<in>{0..<n}. ?x = sorted_list_of_set I ! xa

goal (1 subgoal):
 1. (\<lambda>i. if i < n then sorted_list_of_set I ! i else i) ` {0..<n} = I
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
using this:
?xa < n \<Longrightarrow> sorted_list_of_set I ! ?xa \<in> I
?x \<in> I \<Longrightarrow> \<exists>xa\<in>{0..<n}. ?x = sorted_list_of_set I ! xa

goal (1 subgoal):
 1. {y. \<exists>x\<in>{0..<n}. y = (if x < n then sorted_list_of_set I ! x else x)} = I
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. if i < n then sorted_list_of_set I ! i else i) ` {0..<n} = I

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?I \<in> {I. I \<subseteq> {0..<m} \<and> card I = n} \<Longrightarrow> (\<lambda>i. if i < n then sorted_list_of_set ?I ! i else i) ` {0..<n} = ?I

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
have f_setI: "?f` ?setI = F_strict"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict
[PROOF STEP]
have "sorted_list_of_set I ! xa < m" if I: "I \<subseteq> {0..<m}" and "n = card I" and "xa < card I"
        for I xa
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set I ! xa < m
[PROOF STEP]
by (metis I \<open>xa < card I\<close> atLeast0LessThan distinct_card finite_atLeastLessThan lessThan_iff
          pick_in_set_le rev_finite_subset sorted_list_of_set(1)
          sorted_list_of_set(3) sorted_list_of_set_eq_pick subsetCE)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I; ?xa < card ?I\<rbrakk> \<Longrightarrow> sorted_list_of_set ?I ! ?xa < m

goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I; ?xa < card ?I\<rbrakk> \<Longrightarrow> sorted_list_of_set ?I ! ?xa < m

goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict
[PROOF STEP]
have "strict_mono_on {0..<card I} (\<lambda>i. if i < card I then sorted_list_of_set I ! i else i)"
      if "I \<subseteq> {0..<m}" and "n = card I" for I
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono_on {0..<card I} (\<lambda>i. if i < card I then sorted_list_of_set I ! i else i)
[PROOF STEP]
by (smt \<open>I \<subseteq> {0..<m}\<close> atLeastLessThan_iff distinct_card finite_atLeastLessThan pick_mono_le
          rev_finite_subset sorted_list_of_set(1) sorted_list_of_set(3)
          sorted_list_of_set_eq_pick strict_mono_on_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I\<rbrakk> \<Longrightarrow> strict_mono_on {0..<card ?I} (\<lambda>i. if i < card ?I then sorted_list_of_set ?I ! i else i)

goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I\<rbrakk> \<Longrightarrow> strict_mono_on {0..<card ?I} (\<lambda>i. if i < card ?I then sorted_list_of_set ?I ! i else i)

goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict
[PROOF STEP]
have "x \<in> ?f ` {I. I \<subseteq> {0..<m} \<and> card I = n}"
      if x1: "x \<in> {0..<n} \<rightarrow> {0..<m}" and x2: "\<forall>i. \<not> i < n \<longrightarrow> x i = i"
      and s: "strict_mono_on {0..<n} x" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
have inj_x: "inj_on x {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on x {0..<n}
[PROOF STEP]
using s strict_mono_on_imp_inj_on
[PROOF STATE]
proof (prove)
using this:
strict_mono_on {0..<n} x
strict_mono_on ?A ?f \<Longrightarrow> inj_on ?f ?A

goal (1 subgoal):
 1. inj_on x {0..<n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inj_on x {0..<n}

goal (1 subgoal):
 1. x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
hence card_xn: "card (x ` {0..<n}) = n"
[PROOF STATE]
proof (prove)
using this:
inj_on x {0..<n}

goal (1 subgoal):
 1. card (x ` {0..<n}) = n
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
card (x ` {0..<n}) = n

goal (1 subgoal):
 1. x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
have x_eq: "x = (\<lambda>i. if i < n then sorted_list_of_set (x ` {0..<n}) ! i else i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (\<lambda>i. if i < n then sorted_list_of_set (x ` {0..<n}) ! i else i)
[PROOF STEP]
unfolding fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xa. x xa = (if xa < n then sorted_list_of_set (x ` {0..<n}) ! xa else xa)
[PROOF STEP]
using nth_strict_mono_on s
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>strict_mono_on {0..<n} ?f; ?i < n\<rbrakk> \<Longrightarrow> ?f ?i = sorted_list_of_set (?f ` {0..<n}) ! ?i
strict_mono_on {0..<n} x

goal (1 subgoal):
 1. \<forall>xa. x xa = (if xa < n then sorted_list_of_set (x ` {0..<n}) ! xa else xa)
[PROOF STEP]
using x2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>strict_mono_on {0..<n} ?f; ?i < n\<rbrakk> \<Longrightarrow> ?f ?i = sorted_list_of_set (?f ` {0..<n}) ! ?i
strict_mono_on {0..<n} x
\<forall>i. \<not> i < n \<longrightarrow> x i = i

goal (1 subgoal):
 1. \<forall>xa. x xa = (if xa < n then sorted_list_of_set (x ` {0..<n}) ! xa else xa)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = (\<lambda>i. if i < n then sorted_list_of_set (x ` {0..<n}) ! i else i)

goal (1 subgoal):
 1. x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {y. \<exists>x\<in>{I. I \<subseteq> {0..<m} \<and> card I = n}. y = (\<lambda>i. if i < n then sorted_list_of_set x ! i else i)}
[PROOF STEP]
by (auto, rule exI[of _"x`{0..<n}"], insert card_xn x1 x_eq, auto)
[PROOF STATE]
proof (state)
this:
x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> {0..<n} \<rightarrow> {0..<m}; \<forall>i. \<not> i < n \<longrightarrow> ?x i = i; strict_mono_on {0..<n} ?x\<rbrakk> \<Longrightarrow> ?x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}

goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I; ?xa < card ?I\<rbrakk> \<Longrightarrow> sorted_list_of_set ?I ! ?xa < m
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I\<rbrakk> \<Longrightarrow> strict_mono_on {0..<card ?I} (\<lambda>i. if i < card ?I then sorted_list_of_set ?I ! i else i)
\<lbrakk>?x \<in> {0..<n} \<rightarrow> {0..<m}; \<forall>i. \<not> i < n \<longrightarrow> ?x i = i; strict_mono_on {0..<n} ?x\<rbrakk> \<Longrightarrow> ?x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I; ?xa < card ?I\<rbrakk> \<Longrightarrow> sorted_list_of_set ?I ! ?xa < m
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I\<rbrakk> \<Longrightarrow> strict_mono_on {0..<card ?I} (\<lambda>i. if i < card ?I then sorted_list_of_set ?I ! i else i)
\<lbrakk>?x \<in> {0..<n} \<rightarrow> {0..<m}; \<forall>i. \<not> i < n \<longrightarrow> ?x i = i; strict_mono_on {0..<n} ?x\<rbrakk> \<Longrightarrow> ?x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}

goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict
[PROOF STEP]
unfolding F_strict_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I; ?xa < card ?I\<rbrakk> \<Longrightarrow> sorted_list_of_set ?I ! ?xa < m
\<lbrakk>?I \<subseteq> {0..<m}; n = card ?I\<rbrakk> \<Longrightarrow> strict_mono_on {0..<card ?I} (\<lambda>i. if i < card ?I then sorted_list_of_set ?I ! i else i)
\<lbrakk>?x \<in> {0..<n} \<rightarrow> {0..<m}; \<forall>i. \<not> i < n \<longrightarrow> ?x i = i; strict_mono_on {0..<n} ?x\<rbrakk> \<Longrightarrow> ?x \<in> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}

goal (1 subgoal):
 1. (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = {f \<in> {0..<n} \<rightarrow> {0..<m}. (\<forall>i. i \<notin> {0..<n} \<longrightarrow> f i = i) \<and> strict_mono_on {0..<n} f}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n} = F_strict

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
let ?g = "(\<lambda>f. det (submatrix A UNIV (f`{0..<n})) * det(submatrix B (f`{0..<n}) UNIV))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
have "det (A*B) = sum ((\<lambda>f. det (submatrix A UNIV (f ` {0..<n}))
    * det (submatrix B (f ` {0..<n}) UNIV)) \<circ> ?f) {I. I \<subseteq> {0..<m} \<and> card I = n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (A * B) = sum ((\<lambda>f. Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)) \<circ> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i)) {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
unfolding Cauchy_Binet1 f_setI[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>f\<in>(\<lambda>I i. if i < n then sorted_list_of_set I ! i else i) ` {I. I \<subseteq> {0..<m} \<and> card I = n}. Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)) = sum ((\<lambda>f. Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)) \<circ> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i)) {I. I \<subseteq> {0..<m} \<and> card I = n}
[PROOF STEP]
by (rule sum.reindex[OF inj_on])
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = sum ((\<lambda>f. Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)) \<circ> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i)) {I. I \<subseteq> {0..<m} \<and> card I = n}

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = sum ((\<lambda>f. Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)) \<circ> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i)) {I. I \<subseteq> {0..<m} \<and> card I = n}

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
have "... = (\<Sum>I\<in>{I. I\<subseteq>{0..<m} \<and> card I=n}.det(submatrix A UNIV I)*det(submatrix B I UNIV))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>f. Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)) \<circ> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i)) {I. I \<subseteq> {0..<m} \<and> card I = n} = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
by (rule sum.cong, insert rw, auto)
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>f. Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)) \<circ> (\<lambda>I i. if i < n then sorted_list_of_set I ! i else i)) {I. I \<subseteq> {0..<m} \<and> card I = n} = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))

goal (1 subgoal):
 1. Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = (\<Sum>I | I \<subseteq> {0..<m} \<and> card I = n. Determinant.det (submatrix A UNIV I) * Determinant.det (submatrix B I UNIV))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma L1_int_ineq:
  "abs(\<integral>x. f x \<partial>M) \<le> Norm (\<LL> 1 M) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
proof (cases "integrable M f")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable M f \<Longrightarrow> \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
 2. \<not> integrable M f \<Longrightarrow> \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
integrable M f

goal (2 subgoals):
 1. integrable M f \<Longrightarrow> \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
 2. \<not> integrable M f \<Longrightarrow> \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable M f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable M f

goal (1 subgoal):
 1. \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
using L1_I(2)[OF True]
[PROOF STATE]
proof (prove)
using this:
integrable M f
Norm (\<LL> 1 M) f = LINT x|M. \<bar>f x\<bar>

goal (1 subgoal):
 1. \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f

goal (1 subgoal):
 1. \<not> integrable M f \<Longrightarrow> \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> integrable M f \<Longrightarrow> \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> integrable M f

goal (1 subgoal):
 1. \<not> integrable M f \<Longrightarrow> \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> integrable M f
[PROOF STEP]
have "(\<integral>x. f x \<partial>M) = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> integrable M f

goal (1 subgoal):
 1. integral\<^sup>L M f = 0
[PROOF STEP]
by (simp add: not_integrable_integral_eq)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M f = 0

goal (1 subgoal):
 1. \<not> integrable M f \<Longrightarrow> \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L M f = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M f = 0

goal (1 subgoal):
 1. \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
using Norm_nonneg
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M f = 0
0 \<le> Norm ?N ?x

goal (1 subgoal):
 1. \<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>integral\<^sup>L M f\<bar> \<le> Norm (\<LL> 1 M) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l2norm_neg:
   "f square_integrable S \<Longrightarrow> l2norm S (\<lambda>x. - f x) = l2norm S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f square_integrable S \<Longrightarrow> l2norm S (\<lambda>x. - f x) = l2norm S f
[PROOF STEP]
using l2norm_lmult [of f S "-1"]
[PROOF STATE]
proof (prove)
using this:
f square_integrable S \<Longrightarrow> l2norm S (\<lambda>x. - 1 * f x) = \<bar>- 1\<bar> * l2norm S f

goal (1 subgoal):
 1. f square_integrable S \<Longrightarrow> l2norm S (\<lambda>x. - f x) = l2norm S f
[PROOF STEP]
by simp


[STATEMENT]
lemma number_partition_of_functions_of:
  assumes "finite A" "finite B"
  assumes "number_partition (card A) N" "size N \<le> card B"
  shows "number_partition_of A B (functions_of A B N) = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
finite B
number_partition (card A) N
size N \<le> card B
[PROOF STEP]
have "functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
number_partition (card A) N
size N \<le> card B

goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
using functions_of assms
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
number_partition (card A) N
size N \<le> card B
\<lbrakk>finite ?A; finite ?B; number_partition (card ?A) ?N; size ?N \<le> card ?B\<rbrakk> \<Longrightarrow> functions_of ?A ?B ?N \<in> (?A \<rightarrow>\<^sub>E ?B) // domain_and_range_permutation ?A ?B
finite A
finite B
number_partition (card A) N
size N \<le> card B

goal (1 subgoal):
 1. functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B
[PROOF STEP]
obtain f where "f \<in> A \<rightarrow>\<^sub>E B" and "functions_of A B N = domain_and_range_permutation A B `` {f}"
[PROOF STATE]
proof (prove)
using this:
functions_of A B N \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f \<in> A \<rightarrow>\<^sub>E B; functions_of A B N = domain_and_range_permutation A B `` {f}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson quotientE)
[PROOF STATE]
proof (state)
this:
f \<in> A \<rightarrow>\<^sub>E B
functions_of A B N = domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
f \<in> A \<rightarrow>\<^sub>E B
functions_of A B N = domain_and_range_permutation A B `` {f}
[PROOF STEP]
have "f \<in> functions_of A B N"
[PROOF STATE]
proof (prove)
using this:
f \<in> A \<rightarrow>\<^sub>E B
functions_of A B N = domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. f \<in> functions_of A B N
[PROOF STEP]
using equiv_domain_and_range_permutation equiv_class_self
[PROOF STATE]
proof (prove)
using this:
f \<in> A \<rightarrow>\<^sub>E B
functions_of A B N = domain_and_range_permutation A B `` {f}
equiv (?A \<rightarrow>\<^sub>E ?B) (domain_and_range_permutation ?A ?B)
\<lbrakk>equiv ?A ?r; ?a \<in> ?A\<rbrakk> \<Longrightarrow> ?a \<in> ?r `` {?a}

goal (1 subgoal):
 1. f \<in> functions_of A B N
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f \<in> functions_of A B N

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
have "number_partition_of A B (functions_of A B N) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N)
[PROOF STEP]
unfolding number_partition_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
number_partition_of A B (functions_of A B N) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N)

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
number_partition_of A B (functions_of A B N) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N)

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
have "\<dots> = univ (\<lambda>f.  image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f})
[PROOF STEP]
unfolding \<open>functions_of A B N = domain_and_range_permutation A B `` {f}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f}) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f})
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f})

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (functions_of A B N) = univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f})

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
have "\<dots> = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f}) = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))
[PROOF STEP]
using \<open>finite B\<close> \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> equiv_domain_and_range_permutation
      multiset_of_partition_cards_respects_domain_and_range_permutation
[PROOF STATE]
proof (prove)
using this:
finite B
f \<in> A \<rightarrow>\<^sub>E B
equiv (?A \<rightarrow>\<^sub>E ?B) (domain_and_range_permutation ?A ?B)
finite ?B \<Longrightarrow> (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> ?A. f x = b}) ` ?B - {{}}))) respects domain_and_range_permutation ?A ?B

goal (1 subgoal):
 1. univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f}) = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))
[PROOF STEP]
by (subst univ_commute') auto
[PROOF STATE]
proof (state)
this:
univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f}) = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
univ (\<lambda>f. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))) (domain_and_range_permutation A B `` {f}) = image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}))

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
have "image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N
[PROOF STEP]
using \<open>f \<in> functions_of A B N\<close>
[PROOF STATE]
proof (prove)
using this:
f \<in> functions_of A B N

goal (1 subgoal):
 1. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N
[PROOF STEP]
unfolding functions_of_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N}

goal (1 subgoal):
 1. image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
image_mset card (mset_set ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}})) = N

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
number_partition_of A B (functions_of A B N) = N

goal (1 subgoal):
 1. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
number_partition_of A B (functions_of A B N) = N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_option_eq_Some_iff [iff]:
  "zip_option x y = Some (a, b) \<longleftrightarrow> x = Some a \<and> y = Some b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (zip_option x y = Some (a, b)) = (x = Some a \<and> y = Some b)
[PROOF STEP]
by(cases "(x, y)" rule: zip_option.cases) simp_all


[STATEMENT]
lemma NSLIM_isNSCont: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S (f a) \<Longrightarrow> isNSCont f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S f a \<Longrightarrow> isNSCont f a
[PROOF STEP]
by (force simp add: isNSCont_def NSLIM_def)


[STATEMENT]
lemma first_t_fusion [simp]: "last x = first y \<Longrightarrow> first (t_fusion x y) = first x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dioid_Models.last x = first y \<Longrightarrow> first (t_fusion x y) = first x
[PROOF STEP]
by (simp add: first_def t_fusion_def)


[STATEMENT]
lemma valid_UV_lists_nemtpy':
  "\<lbrakk>finite xs; set U \<inter> set V = {}; set U \<subseteq> xs; set V \<subseteq> xs; distinct U; distinct V\<rbrakk>
    \<Longrightarrow> {x. \<exists>as bs cs. as@U@bs@V@cs = x \<and> set x = xs \<and> distinct x} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite xs; set U \<inter> set V = {}; set U \<subseteq> xs; set V \<subseteq> xs; distinct U; distinct V\<rbrakk> \<Longrightarrow> {x. \<exists>as bs cs. as @ U @ bs @ V @ cs = x \<and> set x = xs \<and> distinct x} \<noteq> {}
[PROOF STEP]
using valid_UV_lists_nemtpy[of xs]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite xs; set (?U @ ?V) \<subseteq> xs; distinct (?U @ ?V)\<rbrakk> \<Longrightarrow> {x. \<exists>as bs cs. as @ ?U @ bs @ ?V @ cs = x \<and> set x = xs \<and> distinct x} \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>finite xs; set U \<inter> set V = {}; set U \<subseteq> xs; set V \<subseteq> xs; distinct U; distinct V\<rbrakk> \<Longrightarrow> {x. \<exists>as bs cs. as @ U @ bs @ V @ cs = x \<and> set x = xs \<and> distinct x} \<noteq> {}
[PROOF STEP]
by simp


[STATEMENT]
lemma map_ext:
  "\<lbrakk> \<And> x y. (x, y) \<in>\<^sub>m A \<longleftrightarrow> (x, y) \<in>\<^sub>m B \<rbrakk> \<Longrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. ((x, y) \<in>\<^sub>m A) = ((x, y) \<in>\<^sub>m B)) \<Longrightarrow> A = B
[PROOF STEP]
by (rule ext, auto, metis not_Some_eq)


[STATEMENT]
lemma AE_completion: "(AE x in M. P x) \<Longrightarrow> (AE x in completion M. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_everywhere M P \<Longrightarrow> almost_everywhere (completion M) P
[PROOF STEP]
unfolding eventually_ae_filter
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bex (null_sets M) ((\<subseteq>) {x \<in> space M. \<not> P x}) \<Longrightarrow> Bex (null_sets (completion M)) ((\<subseteq>) {x \<in> space (completion M). \<not> P x})
[PROOF STEP]
by (auto intro: null_sets_completionI)


[STATEMENT]
lemma star_left_induct_mult_equal:
  "x * y = y \<Longrightarrow> x\<^sup>\<star> * y \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y = y \<Longrightarrow> x\<^sup>\<star> * y \<le> y
[PROOF STEP]
by (simp add: star_left_induct_mult)


[STATEMENT]
lemma lucas_lehmer_test_code [code]:
  "lucas_lehmer_test p =
     (2 < p \<and> (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = (push_bit p 1) - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lucas_lehmer_test p = (2 < p \<and> (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1))
[PROOF STEP]
unfolding lucas_lehmer_test_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 < p \<and> 2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (2 < p \<and> (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1))
[PROOF STEP]
proof (rule conj_cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
assume "p > 2"
[PROOF STATE]
proof (state)
this:
2 < p

goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
define x where "x = gen_lucas_lehmer_sequence'' p 4 (p - 2)"
[PROOF STATE]
proof (state)
this:
x = gen_lucas_lehmer_sequence'' p 4 (p - 2)

goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
from \<open>p > 2\<close>
[PROOF STATE]
proof (chain)
picking this:
2 < p
[PROOF STEP]
have "2 ^ 3 \<le> (2 ^ p :: int)"
[PROOF STATE]
proof (prove)
using this:
2 < p

goal (1 subgoal):
 1. 2 ^ 3 \<le> 2 ^ p
[PROOF STEP]
by (intro power_increasing) auto
[PROOF STATE]
proof (state)
this:
2 ^ 3 \<le> 2 ^ p

goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
hence "2 ^ p \<ge> (8 :: int)"
[PROOF STATE]
proof (prove)
using this:
2 ^ 3 \<le> 2 ^ p

goal (1 subgoal):
 1. 8 \<le> 2 ^ p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
8 \<le> 2 ^ p

goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
hence bounds: "x \<in> {0..<2 ^ p + 5}"
[PROOF STATE]
proof (prove)
using this:
8 \<le> 2 ^ p

goal (1 subgoal):
 1. x \<in> {0..<2 ^ p + 5}
[PROOF STEP]
unfolding x_def
[PROOF STATE]
proof (prove)
using this:
8 \<le> 2 ^ p

goal (1 subgoal):
 1. gen_lucas_lehmer_sequence'' p 4 (p - 2) \<in> {0..<2 ^ p + 5}
[PROOF STEP]
using \<open>p > 2\<close>
[PROOF STATE]
proof (prove)
using this:
8 \<le> 2 ^ p
2 < p

goal (1 subgoal):
 1. gen_lucas_lehmer_sequence'' p 4 (p - 2) \<in> {0..<2 ^ p + 5}
[PROOF STEP]
by (intro gen_lucas_lehmer_sequence''_bounds) auto
[PROOF STATE]
proof (state)
this:
x \<in> {0..<2 ^ p + 5}

goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
have "2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2) \<longleftrightarrow> 2 ^ p - 1 dvd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (2 ^ p - 1 dvd x)
[PROOF STEP]
unfolding x_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (2 ^ p - 1 dvd gen_lucas_lehmer_sequence'' p 4 (p - 2))
[PROOF STEP]
by (intro cong_dvd_iff cong_sym[OF gen_lucas_lehmer_sequence''_correct]) auto
[PROOF STATE]
proof (state)
this:
(2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (2 ^ p - 1 dvd x)

goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (2 ^ p - 1 dvd x)

goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> x \<in> {0, 2 ^ p - 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ p - 1 dvd x) = (x \<in> {0, 2 ^ p - 1})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
assume "2 ^ p - 1 dvd x"
[PROOF STATE]
proof (state)
this:
2 ^ p - 1 dvd x

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ p - 1 dvd x
[PROOF STEP]
obtain k where k: "x = (2 ^ p - 1) * k"
[PROOF STATE]
proof (prove)
using this:
2 ^ p - 1 dvd x

goal (1 subgoal):
 1. (\<And>k. x = (2 ^ p - 1) * k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = (2 ^ p - 1) * k

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
have "k \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> k
[PROOF STEP]
using bounds \<open>2 ^ p \<ge> 8\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<2 ^ p + 5}
8 \<le> 2 ^ p

goal (1 subgoal):
 1. 0 \<le> k
[PROOF STEP]
by (auto simp: k zero_le_mult_iff)
[PROOF STATE]
proof (state)
this:
0 \<le> k

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> k

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
0 \<le> k

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
have "x < 2 ^ p + 5"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < 2 ^ p + 5
[PROOF STEP]
using bounds
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<2 ^ p + 5}

goal (1 subgoal):
 1. x < 2 ^ p + 5
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x < 2 ^ p + 5

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x < 2 ^ p + 5

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
have "\<dots> \<le> (2 ^ p - 1) * 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ p + 5 \<le> (2 ^ p - 1) * 2
[PROOF STEP]
using \<open>2 ^ p \<ge> 8\<close>
[PROOF STATE]
proof (prove)
using this:
8 \<le> 2 ^ p

goal (1 subgoal):
 1. 2 ^ p + 5 \<le> (2 ^ p - 1) * 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ p + 5 \<le> (2 ^ p - 1) * 2

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x < (2 ^ p - 1) * 2
[PROOF STEP]
have "(2 ^ p - 1) * k < (2 ^ p - 1) * 2"
[PROOF STATE]
proof (prove)
using this:
x < (2 ^ p - 1) * 2

goal (1 subgoal):
 1. (2 ^ p - 1) * k < (2 ^ p - 1) * 2
[PROOF STEP]
unfolding k
[PROOF STATE]
proof (prove)
using this:
(2 ^ p - 1) * k < (2 ^ p - 1) * 2

goal (1 subgoal):
 1. (2 ^ p - 1) * k < (2 ^ p - 1) * 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(2 ^ p - 1) * k < (2 ^ p - 1) * 2

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
hence "k < 2"
[PROOF STATE]
proof (prove)
using this:
(2 ^ p - 1) * k < (2 ^ p - 1) * 2

goal (1 subgoal):
 1. k < 2
[PROOF STEP]
by (subst (asm) mult_less_cancel_left) auto
[PROOF STATE]
proof (state)
this:
k < 2

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
k < 2

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<le> k
k < 2
[PROOF STEP]
have "k = 0 \<or> k = 1"
[PROOF STATE]
proof (prove)
using this:
0 \<le> k
k < 2

goal (1 subgoal):
 1. k = 0 \<or> k = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k = 0 \<or> k = 1

goal (2 subgoals):
 1. 2 ^ p - 1 dvd x \<Longrightarrow> x \<in> {0, 2 ^ p - 1}
 2. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
thus "x \<in> {0, 2 ^ p - 1}"
[PROOF STATE]
proof (prove)
using this:
k = 0 \<or> k = 1

goal (1 subgoal):
 1. x \<in> {0, 2 ^ p - 1}
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k = 0 \<or> k = 1
x = (2 ^ p - 1) * k

goal (1 subgoal):
 1. x \<in> {0, 2 ^ p - 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {0, 2 ^ p - 1}

goal (1 subgoal):
 1. x \<in> {0, 2 ^ p - 1} \<Longrightarrow> 2 ^ p - 1 dvd x
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(2 ^ p - 1 dvd x) = (x \<in> {0, 2 ^ p - 1})

goal (2 subgoals):
 1. (2 < p) = (2 < p)
 2. 2 < p \<Longrightarrow> (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = gen_lucas_lehmer_sequence'' p 4 (p - 2) in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (x \<in> {0, 2 ^ p - 1})
[PROOF STEP]
show "(2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) =
                ((let x = x in x = 0 \<or> x = (push_bit p 1) - 1))"
[PROOF STATE]
proof (prove)
using this:
(2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (x \<in> {0, 2 ^ p - 1})

goal (1 subgoal):
 1. (2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = x in x = 0 \<or> x = push_bit p 1 - 1)
[PROOF STEP]
by (simp add: Let_def push_bit_eq_mult)
[PROOF STATE]
proof (state)
this:
(2 ^ p - 1 dvd gen_lucas_lehmer_sequence 4 (p - 2)) = (let x = x in x = 0 \<or> x = push_bit p 1 - 1)

goal (1 subgoal):
 1. (2 < p) = (2 < p)
[PROOF STEP]
qed auto


[STATEMENT]
lemma conjugate_one [simp]:
  shows "conjugate 1\<^sub>h = 1\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate 1\<^sub>h = 1\<^sub>h
[PROOF STEP]
by (transfer, transfer, simp add: vec_cnj_def)


[STATEMENT]
lemma gcd_dvd_prod: "gcd a b dvd k * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a b dvd k * b
[PROOF STEP]
using mult_dvd_mono [of 1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(1::'a) dvd ?b; ?c dvd ?d\<rbrakk> \<Longrightarrow> (1::'a) * ?c dvd ?b * ?d

goal (1 subgoal):
 1. gcd a b dvd k * b
[PROOF STEP]
by auto


[STATEMENT]
lemma upper_adjoint_dual [simp]: "upper_adjoint (inv_gorder A) (inv_gorder B) f = lower_adjoint B A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_adjoint (inv_gorder A) (inv_gorder B) f = lower_adjoint B A f
[PROOF STEP]
by (simp add: lower_adjoint_def upper_adjoint_def)


[STATEMENT]
lemma offset_poly_0: "offset_poly 0 h = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. offset_poly 0 h = 0
[PROOF STEP]
by (simp add: offset_poly_def)


[STATEMENT]
lemma gfp_exp_least:
  "\<lbrakk> \<And>P. \<lbrakk> P \<le> t P; unitary P \<rbrakk> \<Longrightarrow> P \<le> Q; unitary Q \<rbrakk> \<Longrightarrow> gfp_exp t \<le> Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>P. \<lbrakk>P \<tturnstile> t P; unitary P\<rbrakk> \<Longrightarrow> P \<tturnstile> Q; unitary Q\<rbrakk> \<Longrightarrow> gfp_exp t \<tturnstile> Q
[PROOF STEP]
unfolding gfp_exp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>P. \<lbrakk>P \<tturnstile> t P; unitary P\<rbrakk> \<Longrightarrow> P \<tturnstile> Q; unitary Q\<rbrakk> \<Longrightarrow> Sup_exp {P. unitary P \<and> P \<tturnstile> t P} \<tturnstile> Q
[PROOF STEP]
by(auto intro:Sup_exp_least)


[STATEMENT]
lemma int_of_uint64_inv: "0 \<le> x \<Longrightarrow> x < 18446744073709551616 \<Longrightarrow> int_of_uint64 (uint64_of_int x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x < 18446744073709551616\<rbrakk> \<Longrightarrow> int_of_uint64 (uint64_of_int x) = x
[PROOF STEP]
by transfer (simp add: take_bit_int_eq_self unsigned_of_int)


[STATEMENT]
lemma (in ring) weak_add_group_morphism:
  assumes "weak_ring_morphism f I R" shows "weak_group_morphism f I (add_monoid R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_group_morphism f I (add_monoid R)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_group_morphism f I (add_monoid R)
[PROOF STEP]
have is_normal: "I \<lhd> (add_monoid R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<lhd> add_monoid R
[PROOF STEP]
using ideal_is_normal[OF  weak_ring_morphism.axioms(1)[OF assms]]
[PROOF STATE]
proof (prove)
using this:
I \<lhd> add_monoid R

goal (1 subgoal):
 1. I \<lhd> add_monoid R
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
I \<lhd> add_monoid R

goal (1 subgoal):
 1. weak_group_morphism f I (add_monoid R)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_group_morphism f I (add_monoid R)
[PROOF STEP]
using weak_group_morphism.intro[OF is_normal]
          weak_ring_morphism.inj_mod_ideal[OF assms]
[PROOF STATE]
proof (prove)
using this:
weak_group_morphism_axioms ?f I (add_monoid R) \<Longrightarrow> weak_group_morphism ?f I (add_monoid R)
\<lbrakk>?a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> (f ?a = f ?b) = (?a \<ominus> ?b \<in> I)

goal (1 subgoal):
 1. weak_group_morphism f I (add_monoid R)
[PROOF STEP]
unfolding weak_group_morphism_axioms_def a_minus_def a_inv_def
[PROOF STATE]
proof (prove)
using this:
\<forall>a b. a \<in> carrier (add_monoid R) \<longrightarrow> b \<in> carrier (add_monoid R) \<longrightarrow> (?f a = ?f b) = (a \<otimes>\<^bsub>add_monoid R\<^esub> inv\<^bsub>add_monoid R\<^esub> b \<in> I) \<Longrightarrow> weak_group_morphism ?f I (add_monoid R)
\<lbrakk>?a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> (f ?a = f ?b) = (?a \<oplus> inv\<^bsub>add_monoid R\<^esub> ?b \<in> I)

goal (1 subgoal):
 1. weak_group_morphism f I (add_monoid R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
weak_group_morphism f I (add_monoid R)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "prefixBeforeElement e t = takeWhile (\<lambda> e'. element e' \<noteq> e) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefixBeforeElement e t = takeWhile (\<lambda>e'. element e' \<noteq> e) t
[PROOF STEP]
by (induct t) auto


[STATEMENT]
lemma lzip_ltransfer [transfer_rule]:
  "(llist_all2 A ===> llist_all2 B ===> llist_all2 (rel_prod A B)) lzip lzip"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (llist_all2 A ===> llist_all2 B ===> llist_all2 (rel_prod A B)) lzip lzip
[PROOF STEP]
by(auto intro: llist_all2_lzipI)


[STATEMENT]
lemma E_of_succ_of_E[simp]: "E_of_succ (succ_of_E E) = E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E_of_succ (succ_of_E E) = E
[PROOF STEP]
unfolding E_of_succ_def succ_of_E_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(u, v). v \<in> {v. (u, v) \<in> E}} = E
[PROOF STEP]
by auto


[STATEMENT]
lemma Bseq_iff: "Bseq X \<longleftrightarrow> (\<exists>N. \<forall>n. norm (X n) \<le> real(Suc N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq X = (\<exists>N. \<forall>n. norm (X n) \<le> real (Suc N))
[PROOF STEP]
by (simp add: Bseq_def) (simp add: lemma_NBseq_def)


[STATEMENT]
lemma substs_Eq[simp]: "length xs = length ys \<Longrightarrow> (Eq x t)[xs \<^bold>\<rightarrow>\<^sup>* ys] = Eq (subst_var xs ys x) (t[xs \<^bold>\<rightarrow>t\<^sup>* ys])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys \<Longrightarrow> fmla.Eq x t[xs \<^bold>\<rightarrow>\<^sup>* ys] = fmla.Eq (subst_var xs ys x) (t[xs \<^bold>\<rightarrow>t\<^sup>* ys])
[PROOF STEP]
by (induct xs ys arbitrary: x t rule: list_induct2) auto


[STATEMENT]
lemma sum_list_closed_prod :
  "set (map (case_prod f) xys) \<subseteq> G \<Longrightarrow> (\<Sum>(x,y)\<leftarrow>xys. f x y) \<in> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>(x, y). f x y) xys) \<subseteq> G \<Longrightarrow> (\<Sum>(x, y)\<leftarrow>xys. f x y) \<in> G
[PROOF STEP]
using sum_list_closed
[PROOF STATE]
proof (prove)
using this:
set (map ?f ?as) \<subseteq> G \<Longrightarrow> sum_list (map ?f ?as) \<in> G

goal (1 subgoal):
 1. set (map (\<lambda>(x, y). f x y) xys) \<subseteq> G \<Longrightarrow> (\<Sum>(x, y)\<leftarrow>xys. f x y) \<in> G
[PROOF STEP]
by fast


[STATEMENT]
lemma fixes pre :: ipv4addr
    shows "ipset_from_cidr pre len = {(pre AND ((mask len) << (32 - len))) .. pre OR (mask (32 - len))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipset_from_cidr pre len = {pre && (mask len << 32 - len)..pre || mask (32 - len)}
[PROOF STEP]
by (simp add: ipset_from_cidr_alt ipset_from_cidr_def)


[STATEMENT]
lemma rel_dist_to_stop': "interpret_floatarith (rel_dist_to_stop_expr 0 1) [v, a] = rel_dist_to_stop v a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interpret_floatarith (rel_dist_to_stop_expr 0 1) [v, a] = rel_dist_to_stop v a
[PROOF STEP]
by (simp add: rel_dist_to_stop_def rel_dist_to_stop_expr_def inverse_eq_divide)


[STATEMENT]
lemma matrix_for_singleton_entry: assumes i: "i < n" and
  j: "j < n"
  and Rdef: "R = mat n n ( \<lambda> ij. if ij = (i,j) then c :: 'a else 0)"
shows "mat n n
   (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A
       else 0) * A = R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
note I = inverse_via_det(3)
[PROOF STATE]
proof (state)
this:
I \<in> carrier_mat n n

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
have R: "R \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<in> carrier_mat n n
[PROOF STEP]
unfolding Rdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat n n (\<lambda>ij. if ij = (i, j) then c else (0::'a)) \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
R \<in> carrier_mat n n

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
have "(R * I) * A = R * (I * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R * I * A = R * (I * A)
[PROOF STEP]
using I A R
[PROOF STATE]
proof (prove)
using this:
I \<in> carrier_mat n n
A \<in> carrier_mat n n
R \<in> carrier_mat n n

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

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
R * I * A = R * (I * A)

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
have "I * A = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I * A = 1\<^sub>m n
[PROOF STEP]
unfolding inverse_via_det(1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m n = 1\<^sub>m n
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
I * A = 1\<^sub>m n

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
I * A = 1\<^sub>m n

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
have "R * \<dots> = R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R * 1\<^sub>m n = R
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
R \<in> carrier_mat n n

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

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
R * 1\<^sub>m n = R

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
have "R * I = mat n n (\<lambda> (i',j'). row R i' \<bullet> col I j')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R * I = mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j')
[PROOF STEP]
using I R
[PROOF STATE]
proof (prove)
using this:
I \<in> carrier_mat n n
R \<in> carrier_mat n n

goal (1 subgoal):
 1. R * I = mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j')
[PROOF STEP]
unfolding times_mat_def
[PROOF STATE]
proof (prove)
using this:
I \<in> carrier_mat n n
R \<in> carrier_mat n n

goal (1 subgoal):
 1. mat (dim_row R) (dim_col I) (\<lambda>(i, j). row R i \<bullet> col I j) = mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
R * I = mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j')

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
R * I = mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j')

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
have "\<dots> = mat n n ( \<lambda> (i',j'). if i' = i then c * I $$ (j, j') else 0)"
    (is "mat n n ?f = mat n n ?g")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
fix i' j'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
assume i': "i' < n" and j': "j' < n"
[PROOF STATE]
proof (state)
this:
i' < n
j' < n

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
have "?f (i',j') = ?g (i',j')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
proof (cases "i' = i")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i' = i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
 2. i' \<noteq> i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
i' \<noteq> i

goal (2 subgoals):
 1. i' = i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
 2. i' \<noteq> i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
hence "row R i' = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
using this:
i' \<noteq> i

goal (1 subgoal):
 1. row R i' = 0\<^sub>v n
[PROOF STEP]
unfolding Rdef
[PROOF STATE]
proof (prove)
using this:
i' \<noteq> i

goal (1 subgoal):
 1. row (mat n n (\<lambda>ij. if ij = (i, j) then c else (0::'a))) i' = 0\<^sub>v n
[PROOF STEP]
using i'
[PROOF STATE]
proof (prove)
using this:
i' \<noteq> i
i' < n

goal (1 subgoal):
 1. row (mat n n (\<lambda>ij. if ij = (i, j) then c else (0::'a))) i' = 0\<^sub>v n
[PROOF STEP]
by (intro eq_vecI, auto simp: Matrix.row_def)
[PROOF STATE]
proof (state)
this:
row R i' = 0\<^sub>v n

goal (2 subgoals):
 1. i' = i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
 2. i' \<noteq> i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
row R i' = 0\<^sub>v n

goal (1 subgoal):
 1. (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
using False i' j' I
[PROOF STATE]
proof (prove)
using this:
row R i' = 0\<^sub>v n
i' \<noteq> i
i' < n
j' < n
I \<in> carrier_mat n n

goal (1 subgoal):
 1. (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))

goal (1 subgoal):
 1. i' = i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i' = i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i' = i

goal (1 subgoal):
 1. i' = i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
hence "row R i' = c \<cdot>\<^sub>v unit_vec n j"
[PROOF STATE]
proof (prove)
using this:
i' = i

goal (1 subgoal):
 1. row R i' = c \<cdot>\<^sub>v unit_vec n j
[PROOF STEP]
unfolding Rdef
[PROOF STATE]
proof (prove)
using this:
i' = i

goal (1 subgoal):
 1. row (mat n n (\<lambda>ij. if ij = (i, j) then c else (0::'a))) i' = c \<cdot>\<^sub>v unit_vec n j
[PROOF STEP]
using i' j' i j
[PROOF STATE]
proof (prove)
using this:
i' = i
i' < n
j' < n
i < n
j < n

goal (1 subgoal):
 1. row (mat n n (\<lambda>ij. if ij = (i, j) then c else (0::'a))) i' = c \<cdot>\<^sub>v unit_vec n j
[PROOF STEP]
by (intro eq_vecI, auto simp: Matrix.row_def)
[PROOF STATE]
proof (state)
this:
row R i' = c \<cdot>\<^sub>v unit_vec n j

goal (1 subgoal):
 1. i' = i \<Longrightarrow> (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
i' = i
row R i' = c \<cdot>\<^sub>v unit_vec n j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i' = i
row R i' = c \<cdot>\<^sub>v unit_vec n j

goal (1 subgoal):
 1. (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
using i' j' I j
[PROOF STATE]
proof (prove)
using this:
i' = i
row R i' = c \<cdot>\<^sub>v unit_vec n j
i' < n
j' < n
I \<in> carrier_mat n n
j < n

goal (1 subgoal):
 1. (case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(case (i', j') of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (i', j') of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i'2 < n; ?j'2 < n\<rbrakk> \<Longrightarrow> (case (?i'2, ?j'2) of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (?i'2, ?j'2) of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i'2 < n; ?j'2 < n\<rbrakk> \<Longrightarrow> (case (?i'2, ?j'2) of (i', j') \<Rightarrow> row R i' \<bullet> col I j') = (case (?i'2, ?j'2) of (i', j') \<Rightarrow> if i' = i then c * I $$ (j, j') else (0::'a))

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat n n (\<lambda>(i', j'). row R i' \<bullet> col I j') = mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a))

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a)) * A = R
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat n n (\<lambda>(i', j'). if i' = i then c * I $$ (j, j') else (0::'a)) * A = R

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
unfolding inverse_via_det(4)
[PROOF STATE]
proof (prove)
using this:
mat n n (\<lambda>(i', j'). if i' = i then c * mat n n (\<lambda>(i, j). det (replace_col A (unit_vec n j) i) / det A) $$ (j, j') else (0::'a)) * A = R

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
mat n n (\<lambda>(i', j'). if i' = i then c * mat n n (\<lambda>(i, j). det (replace_col A (unit_vec n j) i) / det A) $$ (j, j') else (0::'a)) * A = R
j < n

goal (1 subgoal):
 1. mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R
[PROOF STEP]
by (auto intro!: arg_cong[of _ _ "\<lambda> x. x * A"])
[PROOF STATE]
proof (state)
this:
mat n n (\<lambda>(i', j'). if i' = i then c * det (replace_col A (unit_vec n j') j) / det A else (0::'a)) * A = R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_Leq_Rel: "((\<Sum>x\<leftarrow>C. lec_rel (f x)) = Leq_Rel) \<longleftrightarrow> (\<forall> x \<in> set C. lec_rel (f x) = Leq_Rel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>x\<leftarrow>C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set C. lec_rel (f x) = Leq_Rel)
[PROOF STEP]
proof (induct C)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<Sum>x\<leftarrow>[]. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set []. lec_rel (f x) = Leq_Rel)
 2. \<And>a C. ((\<Sum>x\<leftarrow>C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set C. lec_rel (f x) = Leq_Rel) \<Longrightarrow> ((\<Sum>x\<leftarrow>a # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (a # C). lec_rel (f x) = Leq_Rel)
[PROOF STEP]
case (Cons c C)
[PROOF STATE]
proof (state)
this:
((\<Sum>x\<leftarrow>C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set C. lec_rel (f x) = Leq_Rel)

goal (2 subgoals):
 1. ((\<Sum>x\<leftarrow>[]. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set []. lec_rel (f x) = Leq_Rel)
 2. \<And>a C. ((\<Sum>x\<leftarrow>C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set C. lec_rel (f x) = Leq_Rel) \<Longrightarrow> ((\<Sum>x\<leftarrow>a # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (a # C). lec_rel (f x) = Leq_Rel)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)
[PROOF STEP]
proof (cases "lec_rel (f c)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lec_rel (f c) = Leq_Rel \<Longrightarrow> ((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)
 2. lec_rel (f c) = Lt_Rel \<Longrightarrow> ((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)
[PROOF STEP]
case Leq_Rel
[PROOF STATE]
proof (state)
this:
lec_rel (f c) = Leq_Rel

goal (2 subgoals):
 1. lec_rel (f c) = Leq_Rel \<Longrightarrow> ((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)
 2. lec_rel (f c) = Lt_Rel \<Longrightarrow> ((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
((\<Sum>x\<leftarrow>C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set C. lec_rel (f x) = Leq_Rel)

goal (1 subgoal):
 1. ((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)
[PROOF STEP]
by (simp add: Leq_Rel Leq_Rel_0)
[PROOF STATE]
proof (state)
this:
((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)

goal (1 subgoal):
 1. lec_rel (f c) = Lt_Rel \<Longrightarrow> ((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
((\<Sum>x\<leftarrow>c # C. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set (c # C). lec_rel (f x) = Leq_Rel)

goal (1 subgoal):
 1. ((\<Sum>x\<leftarrow>[]. lec_rel (f x)) = Leq_Rel) = (\<forall>x\<in>set []. lec_rel (f x) = Leq_Rel)
[PROOF STEP]
qed (simp add: Leq_Rel_0)


[STATEMENT]
lemma map_ran_append:
  "map_ran f (\<Gamma>@\<Delta>) = map_ran f \<Gamma> @ map_ran f \<Delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_ran f (\<Gamma> @ \<Delta>) = map_ran f \<Gamma> @ map_ran f \<Delta>
[PROOF STEP]
by (induction \<Gamma>)  auto


[STATEMENT]
lemma enc_alt: "wf_interp w I \<Longrightarrow>
  x \<in> enc (w, I) \<longleftrightarrow> x @- sconst ((any, replicate (length I) False)) = stream_enc (w, I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_interp w I \<Longrightarrow> (x \<in> enc (w, I)) = (x @- sconst (any, replicate (length I) False) = stream_enc (w, I))
[PROOF STEP]
unfolding enc.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_interp w I \<Longrightarrow> (x \<in> {x. \<exists>n. x = cut_same (any, replicate (length I) False) (stream_enc (w, I)) @ replicate n (any, replicate (length I) False)}) = (x @- sconst (any, replicate (length I) False) = stream_enc (w, I))
[PROOF STEP]
by (force simp only: shift_append shift_replicate_sconst stream_enc_cut_same[symmetric]
    length_append length_replicate length_cut_same sdrop_shift drop_all diff_self_eq_0
    shift.simps sdrop.simps
    dest: sym[of _ "stream_enc (w, I)"]
    intro: shift_sconst_inj[rotated, of _ "(any, replicate (length I) False)"] Least_le
      exI[of _ "length x - length (cut_same (any, replicate (length I) False) (stream_enc (w, I)))"]
      le_add_diff_inverse[symmetric] )


[STATEMENT]
lemma exponential_eq_stretch:
  assumes "0 < l"
  shows "exponential l = distr (exponential 1) borel (\<lambda>x. (1/l) * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exponential l = distr (exponential 1) borel ((*) (1 / l))
[PROOF STEP]
proof (intro measure_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
assume "A \<in> sets (exponential l)"
[PROOF STATE]
proof (state)
this:
A \<in> sets (exponential l)

goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<in> sets (exponential l)
[PROOF STEP]
have [measurable]: "A \<in> sets borel"
[PROOF STATE]
proof (prove)
using this:
A \<in> sets (exponential l)

goal (1 subgoal):
 1. A \<in> sets borel
[PROOF STEP]
by (simp add: sets_exponential)
[PROOF STATE]
proof (state)
this:
A \<in> sets borel

goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<in> sets borel
[PROOF STEP]
have [measurable]: "(\<lambda>x. x / l) -` A \<in> sets borel"
[PROOF STATE]
proof (prove)
using this:
A \<in> sets borel

goal (1 subgoal):
 1. (\<lambda>x. x / l) -` A \<in> sets borel
[PROOF STEP]
by (rule measurable_sets_borel[rotated]) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x / l) -` A \<in> sets borel

goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
have "emeasure (exponential l) A =
    (\<integral>\<^sup>+x. ennreal l * (indicator (((*) (1/l) -` A) \<inter> {0 ..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (exponential l) A = \<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel
[PROOF STEP]
using \<open>0 < l\<close>
[PROOF STATE]
proof (prove)
using this:
0 < l

goal (1 subgoal):
 1. emeasure (exponential l) A = \<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel
[PROOF STEP]
by (auto simp: ac_simps emeasure_distr exponential_def emeasure_density exponential_density_def
                   ennreal_mult zero_le_mult_iff
             intro!: nn_integral_cong split: split_indicator)
[PROOF STATE]
proof (state)
this:
emeasure (exponential l) A = \<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel

goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (exponential l) A = \<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel

goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+x. indicator (((*) (1/l) -` A) \<inter> {0 ..}) x * ennreal (exp (- x)) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel = \<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel
[PROOF STEP]
using \<open>0<l\<close>
[PROOF STATE]
proof (prove)
using this:
0 < l

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel = \<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel
[PROOF STEP]
apply (subst nn_integral_stretch)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 < l \<Longrightarrow> (\<lambda>a. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) a * ennreal (exp (- a)))) \<in> borel_measurable borel
 2. 0 < l \<Longrightarrow> l \<noteq> 0
 3. 0 < l \<Longrightarrow> ennreal (1 / \<bar>l\<bar>) * \<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x))) \<partial>lborel = \<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel
[PROOF STEP]
apply (auto simp: nn_integral_cmult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < l \<Longrightarrow> ennreal (1 / l) * (ennreal l * \<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel) = \<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel
[PROOF STEP]
apply (simp add: ennreal_mult[symmetric] mult.assoc[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel = \<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel

goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal l * (indicator ((*) (1 / l) -` A \<inter> {0..}) (l * x) * ennreal (exp (- (l * x)))) \<partial>lborel = \<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel

goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
have "\<dots> = emeasure (distr (exponential 1) borel (\<lambda>x. (1/l) * x)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
by (auto simp add: emeasure_distr exponential_def emeasure_density exponential_density_def
        intro!: nn_integral_cong split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. indicator ((*) (1 / l) -` A \<inter> {0..}) x * ennreal (exp (- x)) \<partial>lborel = emeasure (distr (exponential 1) borel ((*) (1 / l))) A

goal (2 subgoals):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
 2. \<And>A. A \<in> sets (exponential l) \<Longrightarrow> emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
show "emeasure (exponential l) A = emeasure (distr (exponential 1) borel (\<lambda>x. (1/l) * x)) A"
[PROOF STATE]
proof (prove)
using this:
emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A

goal (1 subgoal):
 1. emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure (exponential l) A = emeasure (distr (exponential 1) borel ((*) (1 / l))) A

goal (1 subgoal):
 1. sets (exponential l) = sets (distr (exponential 1) borel ((*) (1 / l)))
[PROOF STEP]
qed (simp add: sets_exponential)


[STATEMENT]
lemma VInter_iff[simp]:
  assumes [simp]: "A \<noteq> 0"
  shows "a \<in>\<^sub>\<circ> \<Inter>\<^sub>\<circ> A \<longleftrightarrow> (\<forall>x\<in>\<^sub>\<circ>A. a \<in>\<^sub>\<circ> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in>\<^sub>\<circ> \<Inter>\<^sub>\<circ> A) = (\<forall>x\<in>elts A. a \<in>\<^sub>\<circ> x)
[PROOF STEP]
unfolding VInter_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in>\<^sub>\<circ> (if A = 0 \<Rightarrow> 0 | otherwise \<Rightarrow> set {a. \<forall>x\<in>elts A. a \<in>\<^sub>\<circ> x})) = (\<forall>x\<in>elts A. a \<in>\<^sub>\<circ> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma  discounted_mult:
  shows "\<forall>n w. discounted_value r (\<lambda>m x. X m x * Y m x) n w = X n w * (discounted_value r Y) n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n w. discounted_value r (\<lambda>m x. X m x * Y m x) n w = X n w * discounted_value r Y n w
[PROOF STEP]
by (simp add: discounted_value_def)


[STATEMENT]
lemma SomeE:
  assumes "a = (SOME x. P x)"
  assumes "P c"
  shows "P a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a = (SOME x. P x)
P c

goal (1 subgoal):
 1. P a
[PROOF STEP]
by (meson verit_sko_ex)


[STATEMENT]
lemma nsphere:
   "nsphere n = subtopology (powertop_real UNIV)
                            {x. (\<Sum>i\<le>n. x i ^ 2) = 1 \<and> (\<forall>i>n. x i = 0)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nsphere n = subtopology (powertop_real UNIV) {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}
[PROOF STEP]
by (simp add: nsphere_def Euclidean_space_def subtopology_subtopology Suc_le_eq Collect_conj_eq Int_commute)


[STATEMENT]
lemma vector_diff_chain_at:
  assumes "(f has_vector_derivative f') (at x)"
    and "(g has_vector_derivative g') (at (f x))"
  shows "((g \<circ> f) has_vector_derivative (f' *\<^sub>R g')) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g \<circ> f has_vector_derivative f' *\<^sub>R g') (at x)
[PROOF STEP]
using assms has_vector_derivative_at_within has_vector_derivative_def vector_derivative_diff_chain_within
[PROOF STATE]
proof (prove)
using this:
(f has_vector_derivative f') (at x)
(g has_vector_derivative g') (at (f x))
(?f has_vector_derivative ?f') (at ?x) \<Longrightarrow> (?f has_vector_derivative ?f') (at ?x within ?S)
(?f has_vector_derivative ?f') ?net = (?f has_derivative (\<lambda>x. x *\<^sub>R ?f')) ?net
\<lbrakk>(?f has_vector_derivative ?f') (at ?x within ?S); (?g has_derivative ?g') (at (?f ?x) within ?f ` ?S)\<rbrakk> \<Longrightarrow> (?g \<circ> ?f has_vector_derivative ?g' ?f') (at ?x within ?S)

goal (1 subgoal):
 1. (g \<circ> f has_vector_derivative f' *\<^sub>R g') (at x)
[PROOF STEP]
by blast


[STATEMENT]
lemma dist_\<gamma>[simp]:
    "\<gamma> (inf a b) = inf (\<gamma> a) (\<gamma> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> (inf a b) = inf (\<gamma> a) (\<gamma> b)
[PROOF STEP]
apply (rule order_antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<gamma> (inf a b) \<le> inf (\<gamma> a) (\<gamma> b)
 2. inf (\<gamma> a) (\<gamma> b) \<le> \<gamma> (inf a b)
[PROOF STEP]
apply (rule mono_inf[OF \<gamma>_mono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf (\<gamma> a) (\<gamma> b) \<le> \<gamma> (inf a b)
[PROOF STEP]
apply (simp add: galois)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> (inf (\<gamma> a) (\<gamma> b)) \<le> a \<and> \<alpha> (inf (\<gamma> a) (\<gamma> b)) \<le> b
[PROOF STEP]
apply (simp add: galois[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma comp_swap_lassocr: "(conv1 |\<^sub>= conv2 |\<^sub>= conv3) \<odot> swap_lassocr = swap_lassocr \<odot> (conv2 |\<^sub>= conv1 |\<^sub>= conv3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (conv1 |\<^sub>= conv2 |\<^sub>= conv3) \<odot> swap_lassocr = swap_lassocr \<odot> (conv2 |\<^sub>= conv1 |\<^sub>= conv3)
[PROOF STEP]
unfolding swap_lassocr_def comp_rassocl\<^sub>C' comp_converter_assoc comp_converter_parallel2' comp_swap\<^sub>C' comp_converter_id_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rassocl\<^sub>C \<odot> (swap\<^sub>C \<odot> (conv2 |\<^sub>= conv1) |\<^sub>= conv3) \<odot> lassocr\<^sub>C = rassocl\<^sub>C \<odot> (swap\<^sub>C |\<^sub>= 1\<^sub>C) \<odot> lassocr\<^sub>C \<odot> (conv2 |\<^sub>= conv1 |\<^sub>= conv3)
[PROOF STEP]
by(subst (9) comp_converter_id_left[symmetric], subst comp_converter_parallel2[symmetric])
    (simp add: comp_converter_assoc comp_lassocr\<^sub>C)


[STATEMENT]
lemma lemParallelSym:
    assumes "lineA \<parallel> lineB"
    shows   "lineB \<parallel> lineA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
have case1: "direction lineA = vecZero \<longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. direction lineA = 0 \<longrightarrow> lineB \<parallel>  lineA
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
direction lineA = 0 \<longrightarrow> lineB \<parallel>  lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
have case2: "direction lineB = vecZero \<longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. direction lineB = 0 \<longrightarrow> lineB \<parallel>  lineA
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
direction lineB = 0 \<longrightarrow> lineB \<parallel>  lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
direction lineB = 0 \<longrightarrow> lineB \<parallel>  lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
assume case3: "direction lineA \<noteq> vecZero \<and> direction lineB \<noteq> vecZero"
[PROOF STATE]
proof (state)
this:
direction lineA \<noteq> 0 \<and> direction lineB \<noteq> 0

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
have exists_kab: "\<exists>kab.(kab \<noteq> (0::'a) \<and> direction lineB = kab**direction lineA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>kab. kab \<noteq> (0::'a) \<and> direction lineB = kab ** direction lineA
[PROOF STEP]
by (metis parallel.simps assms(1) case3)
[PROOF STATE]
proof (state)
this:
\<exists>kab. kab \<noteq> (0::'a) \<and> direction lineB = kab ** direction lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
define kab where "kab \<equiv> (SOME kab.(kab \<noteq> (0::'a) \<and> direction lineB = kab**direction lineA))"
[PROOF STATE]
proof (state)
this:
kab \<equiv> SOME kab. kab \<noteq> (0::'a) \<and> direction lineB = kab ** direction lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
have kab_props: "kab \<noteq> 0 \<and> direction lineB = kab**direction lineA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kab \<noteq> (0::'a) \<and> direction lineB = kab ** direction lineA
[PROOF STEP]
using exists_kab kab_def
[PROOF STATE]
proof (prove)
using this:
\<exists>kab. kab \<noteq> (0::'a) \<and> direction lineB = kab ** direction lineA
kab \<equiv> SOME kab. kab \<noteq> (0::'a) \<and> direction lineB = kab ** direction lineA

goal (1 subgoal):
 1. kab \<noteq> (0::'a) \<and> direction lineB = kab ** direction lineA
[PROOF STEP]
by (rule Hilbert_Choice.exE_some)
[PROOF STATE]
proof (state)
this:
kab \<noteq> (0::'a) \<and> direction lineB = kab ** direction lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
define kba where "kba = inverse kab"
[PROOF STATE]
proof (state)
this:
kba = inverse kab

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
have kba_nonzero: "kba \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kba \<noteq> (0::'a)
[PROOF STEP]
by (metis inverse_zero_imp_zero kab_props kba_def)
[PROOF STATE]
proof (state)
this:
kba \<noteq> (0::'a)

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
have "direction lineA = kba**direction lineB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. direction lineA = kba ** direction lineB
[PROOF STEP]
by (metis kba_def lemScaleInverse kab_props)
[PROOF STATE]
proof (state)
this:
direction lineA = kba ** direction lineB

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
hence ?thesis
[PROOF STATE]
proof (prove)
using this:
direction lineA = kba ** direction lineB

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
by (metis kba_nonzero parallel.simps)
[PROOF STATE]
proof (state)
this:
lineB \<parallel>  lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
direction lineA \<noteq> 0 \<and> direction lineB \<noteq> 0 \<Longrightarrow> lineB \<parallel>  lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
direction lineA \<noteq> 0 \<and> direction lineB \<noteq> 0 \<Longrightarrow> lineB \<parallel>  lineA
[PROOF STEP]
have "(direction lineA \<noteq> vecZero \<and> direction lineB \<noteq> vecZero) \<longrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
using this:
direction lineA \<noteq> 0 \<and> direction lineB \<noteq> 0 \<Longrightarrow> lineB \<parallel>  lineA

goal (1 subgoal):
 1. direction lineA \<noteq> 0 \<and> direction lineB \<noteq> 0 \<longrightarrow> lineB \<parallel>  lineA
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
direction lineA \<noteq> 0 \<and> direction lineB \<noteq> 0 \<longrightarrow> lineB \<parallel>  lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
direction lineA \<noteq> 0 \<and> direction lineB \<noteq> 0 \<longrightarrow> lineB \<parallel>  lineA

goal (1 subgoal):
 1. lineB \<parallel>  lineA
[PROOF STEP]
by (metis case1 case2)
[PROOF STATE]
proof (state)
this:
lineB \<parallel>  lineA

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_empty_sup:
  "is_empty (A \<squnion> B) \<longleftrightarrow> is_empty A \<and> is_empty B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_empty (A \<squnion> B) = (is_empty A \<and> is_empty B)
[PROOF STEP]
by (auto simp add: is_empty_def)


[STATEMENT]
lemma clearjunk_compose: "clearjunk (compose xs ys) = compose (clearjunk xs) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clearjunk (compose xs ys) = compose (clearjunk xs) ys
[PROOF STEP]
by (induct xs rule: clearjunk.induct)
    (auto split: option.splits simp add: clearjunk_delete delete_idem compose_delete_twist)


[STATEMENT]
lemma embed_measure_comp:
  assumes [simp]: "inj f" "inj g"
  shows "embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
have [simp]: "inj (\<lambda>x. g (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>x. g (f x))
[PROOF STEP]
by (subst o_def[symmetric]) (auto intro: inj_compose)
[PROOF STATE]
proof (state)
this:
inj (\<lambda>x. g (f x))

goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
note measurable_embed_measure2[measurable]
[PROOF STATE]
proof (state)
this:
inj ?f \<Longrightarrow> ?f \<in> ?M \<rightarrow>\<^sub>M embed_measure ?M ?f

goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
have "embed_measure (embed_measure M f) g =
            distr M (embed_measure (embed_measure M f) g) (g \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = distr M (embed_measure (embed_measure M f) g) (g \<circ> f)
[PROOF STEP]
by (subst (1 2) embed_measure_eq_distr)
         (simp_all add: distr_distr sets_embed_measure cong: distr_cong)
[PROOF STATE]
proof (state)
this:
embed_measure (embed_measure M f) g = distr M (embed_measure (embed_measure M f) g) (g \<circ> f)

goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
embed_measure (embed_measure M f) g = distr M (embed_measure (embed_measure M f) g) (g \<circ> f)

goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
have "... = embed_measure M (g \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr M (embed_measure (embed_measure M f) g) (g \<circ> f) = embed_measure M (g \<circ> f)
[PROOF STEP]
by (subst (3) embed_measure_eq_distr, simp add: o_def, rule distr_cong)
         (auto simp: sets_embed_measure o_def image_image[symmetric]
               intro: inj_compose cong: distr_cong)
[PROOF STATE]
proof (state)
this:
distr M (embed_measure (embed_measure M f) g) (g \<circ> f) = embed_measure M (g \<circ> f)

goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)

goal (1 subgoal):
 1. embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
embed_measure (embed_measure M f) g = embed_measure M (g \<circ> f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma surj_countable_vimage: "surj f \<Longrightarrow> countable (f -` B) \<Longrightarrow> countable B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>surj f; countable (f -` B)\<rbrakk> \<Longrightarrow> countable B
[PROOF STEP]
by (metis countable_vimage top_greatest)


[STATEMENT]
lemma ang_vec_bounded:
  shows "-pi < \<angle> z1 z2 \<and> \<angle> z1 z2 \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi < \<angle> z1 z2 \<and> \<angle> z1 z2 \<le> pi
[PROOF STEP]
by (simp add: canon_ang(1) canon_ang(2))


[STATEMENT]
theorem demonic_bottom:
  "[:R:] (\<bottom>::('a::order_bot)) = {s . (R s) = \<bottom>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [: R :] \<bottom> = {s. R s = \<bottom>}
[PROOF STEP]
apply (unfold demonic_def, safe, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. R x \<sqsubseteq> \<bottom> \<Longrightarrow> R x = \<bottom>
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. R x \<sqsubseteq> \<bottom> \<Longrightarrow> R x \<sqsubseteq> \<bottom>
 2. \<And>x. R x \<sqsubseteq> \<bottom> \<Longrightarrow> \<bottom> \<sqsubseteq> R x
[PROOF STEP]
by auto