[STATEMENT]
lemma refine_using_invariants:
  "\<lbrakk> {R \<inter> I \<times> J} (trans Ta), (trans Tc) {> R};
     {I \<inter> Domain (R \<inter> UNIV \<times> J)} (trans Ta) {> I};
     {J \<inter> Range (R \<inter> I \<times> UNIV)} (trans Tc) {> J};
     init Tc \<subseteq> R``(init Ta);
     init Ta \<subseteq> I; init Tc \<subseteq> J \<rbrakk>
  \<Longrightarrow> PO_refines (R \<inter> I \<times> J) Ta Tc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>{R \<inter> I \<times> J} TS.trans Ta, TS.trans Tc {> R}; {I \<inter> Domain (R \<inter> UNIV \<times> J)} TS.trans Ta {> I}; {J \<inter> Range (R \<inter> I \<times> UNIV)} TS.trans Tc {> J}; init Tc \<subseteq> R `` init Ta; init Ta \<subseteq> I; init Tc \<subseteq> J\<rbrakk> \<Longrightarrow> PO_refines (R \<inter> I \<times> J) Ta Tc
[PROOF STEP]
by (unfold PO_refines_def)
   (intro refine_init_using_invariants refine_trans_using_invariants conjI)


[STATEMENT]
lemma safety_prop_constrains [iff]: "safety_prop (A co B) = (A \<subseteq> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. safety_prop (A co B) = (A \<subseteq> B)
[PROOF STEP]
by (simp add: safety_prop_def constrains_def, blast)


[STATEMENT]
lemma desargues_config_not_col_9:
  assumes "desargues_config A B C A' B' C' M N P R"
  shows "\<not> col B A A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> col B A A'
[PROOF STEP]
using assms desargues_config_not_col_8 desargues_config_rot_CCW
[PROOF STATE]
proof (prove)
using this:
desargues_config A B C A' B' C' M N P R
desargues_config ?A ?B ?C ?A' ?B' ?C' ?M ?N ?P ?R \<Longrightarrow> \<not> col ?A ?C ?C'
desargues_config ?A ?B ?C ?A' ?B' ?C' ?M ?N ?P ?R \<Longrightarrow> desargues_config ?B ?C ?A ?B' ?C' ?A' ?N ?P ?M ?R

goal (1 subgoal):
 1. \<not> col B A A'
[PROOF STEP]
by blast


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


[STATEMENT]
lemma and_xor_dist: fixes x :: int shows
  "x AND (y XOR z) = (x AND y) XOR (x AND z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x AND (y XOR z) = x AND y XOR x AND z
[PROOF STEP]
by (fact bit.conj_xor_distrib)


[STATEMENT]
lemma bigo_iff:
  assumes "g1 \<in> G" "g2 \<in> G" "h1 \<in> H" "h2 \<in> H"
  shows "(\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x) \<longleftrightarrow>
             g1 \<in> o[F](g2) \<or> (g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))" (is "?P \<longleftrightarrow> ?Q")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
proof (rule G.landau_cases[OF assms(1,2)])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. g1 \<in> o[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 3. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
assume "g1 \<in> o[F](g2)"
[PROOF STATE]
proof (state)
this:
g1 \<in> o[F](g2)

goal (3 subgoals):
 1. g1 \<in> o[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 3. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
g1 \<in> o[F](g2)

goal (1 subgoal):
 1. ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
by (auto intro!: gs_dominate assms landau_o.small_imp_big)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))

goal (2 subgoals):
 1. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
assume A: "g2 \<in> o[F](g1)"
[PROOF STATE]
proof (state)
this:
g2 \<in> o[F](g1)

goal (2 subgoals):
 1. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
hence "g1 \<notin> O[F](g2)"
[PROOF STATE]
proof (prove)
using this:
g2 \<in> o[F](g1)

goal (1 subgoal):
 1. g1 \<notin> O[F](g2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g2 \<in> o[F](g1)
g1 \<in> G
g2 \<in> G
h1 \<in> H
h2 \<in> H

goal (1 subgoal):
 1. g1 \<notin> O[F](g2)
[PROOF STEP]
by (auto dest: G.small_big_antisym)
[PROOF STATE]
proof (state)
this:
g1 \<notin> O[F](g2)

goal (2 subgoals):
 1. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g1 \<notin> O[F](g2)

goal (2 subgoals):
 1. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
from gs_dominate[OF assms(2,1,4,3) A]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. g2 x * h2 x) \<in> o[F](\<lambda>x. g1 x * h1 x)
[PROOF STEP]
have "g2*h2 \<in> o[F](g1*h1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. g2 x * h2 x) \<in> o[F](\<lambda>x. g1 x * h1 x)

goal (1 subgoal):
 1. g2 * h2 \<in> o[F](g1 * h1)
[PROOF STEP]
by (simp add: func_times)
[PROOF STATE]
proof (state)
this:
g2 * h2 \<in> o[F](g1 * h1)

goal (2 subgoals):
 1. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
hence "g1*h1 \<notin> O[F](g2*h2)"
[PROOF STATE]
proof (prove)
using this:
g2 * h2 \<in> o[F](g1 * h1)

goal (1 subgoal):
 1. g1 * h1 \<notin> O[F](g2 * h2)
[PROOF STEP]
by (blast intro: GH.small_big_antisym assms)
[PROOF STATE]
proof (state)
this:
g1 * h1 \<notin> O[F](g2 * h2)

goal (2 subgoals):
 1. g2 \<in> o[F](g1) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
 2. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g1 \<notin> O[F](g2)
g1 * h1 \<notin> O[F](g2 * h2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g1 \<notin> O[F](g2)
g1 * h1 \<notin> O[F](g2 * h2)

goal (1 subgoal):
 1. ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
using A assms
[PROOF STATE]
proof (prove)
using this:
g1 \<notin> O[F](g2)
g1 * h1 \<notin> O[F](g2 * h2)
g2 \<in> o[F](g1)
g1 \<in> G
g2 \<in> G
h1 \<in> H
h2 \<in> H

goal (1 subgoal):
 1. ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
by (auto simp: func_times dest: landau_o.small_imp_big)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))

goal (1 subgoal):
 1. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
assume A: "g1 \<in> \<Theta>[F](g2)"
[PROOF STATE]
proof (state)
this:
g1 \<in> \<Theta>[F](g2)

goal (1 subgoal):
 1. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
hence "g1 \<notin> o[F](g2)"
[PROOF STATE]
proof (prove)
using this:
g1 \<in> \<Theta>[F](g2)

goal (1 subgoal):
 1. g1 \<notin> o[F](g2)
[PROOF STEP]
unfolding bigtheta_def
[PROOF STATE]
proof (prove)
using this:
g1 \<in> O[F](g2) \<inter> \<Omega>[F](g2)

goal (1 subgoal):
 1. g1 \<notin> o[F](g2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g1 \<in> O[F](g2) \<inter> \<Omega>[F](g2)
g1 \<in> G
g2 \<in> G
h1 \<in> H
h2 \<in> H

goal (1 subgoal):
 1. g1 \<notin> o[F](g2)
[PROOF STEP]
by (auto dest: G.small_big_antisym simp: bigomega_iff_bigo)
[PROOF STATE]
proof (state)
this:
g1 \<notin> o[F](g2)

goal (1 subgoal):
 1. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g1 \<notin> o[F](g2)

goal (1 subgoal):
 1. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
have "O[F](\<lambda>x. g2 x * h2 x) = O[F](\<lambda>x. g1 x * h2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O[F](\<lambda>x. g2 x * h2 x) = O[F](\<lambda>x. g1 x * h2 x)
[PROOF STEP]
by (subst landau_o.big.cong_bigtheta[OF landau_theta.mult_right[OF A]]) (rule refl)
[PROOF STATE]
proof (state)
this:
O[F](\<lambda>x. g2 x * h2 x) = O[F](\<lambda>x. g1 x * h2 x)

goal (1 subgoal):
 1. g1 \<in> \<Theta>[F](g2) \<Longrightarrow> ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g1 \<notin> o[F](g2)
O[F](\<lambda>x. g2 x * h2 x) = O[F](\<lambda>x. g1 x * h2 x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g1 \<notin> o[F](g2)
O[F](\<lambda>x. g2 x * h2 x) = O[F](\<lambda>x. g1 x * h2 x)

goal (1 subgoal):
 1. ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
using A G.nonzero[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
g1 \<notin> o[F](g2)
O[F](\<lambda>x. g2 x * h2 x) = O[F](\<lambda>x. g1 x * h2 x)
g1 \<in> \<Theta>[F](g2)
\<forall>\<^sub>F x in F. g2 x \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))
[PROOF STEP]
by (auto simp: landau_o.big.mult_cancel_left eventually_nonzero_bigtheta)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g1 x * h1 x) \<in> O[F](\<lambda>x. g2 x * h2 x)) = (g1 \<in> o[F](g2) \<or> g1 \<in> \<Theta>[F](g2) \<and> h1 \<in> O[F](h2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scene_compl_subset_iff:
  assumes "a \<in> scene_space" "b \<in> scene_space"
  shows "- a \<subseteq>\<^sub>S -b \<longleftrightarrow> b \<subseteq>\<^sub>S a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a \<subseteq>\<^sub>S - b = b \<subseteq>\<^sub>S a
[PROOF STEP]
by (metis scene_indep_sym scene_le_iff_indep_inv uminus_scene_twice)


[STATEMENT]
lemma (in encoding_wrt_barbs) indRelLSTPO_impl_SRel_and_TRel_preserve_barbs:
  fixes SRel :: "('procS \<times> 'procS) set"
    and TRel :: "('procT \<times> 'procT) set"
  assumes preservation: "rel_preserves_barbs (indRelLSTPO SRel TRel) (STCalWB SWB TWB)"
  shows "rel_preserves_barbs SRel SWB"
    and "rel_preserves_barbs TRel TWB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB) &&& rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)
 2. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
show "rel_preserves_barbs SRel SWB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)
[PROOF STEP]
using preservation rel_with_source_impl_SRel_preserves_barbs[where
                          Rel="indRelLSTPO SRel TRel" and SRel="SRel"]
[PROOF STATE]
proof (prove)
using this:
rel_preserves_binary_pred (indRelLSTPO SRel TRel) (\<lambda>a. hasBarb a (STCalWB SWB TWB))
rel_preserves_binary_pred (indRelLSTPO SRel TRel) (\<lambda>a. hasBarb a (STCalWB SWB TWB)) \<and> (\<forall>S1 S2. (S1, S2) \<in> SRel \<longrightarrow> SourceTerm S1 \<lesssim>\<lbrakk>\<cdot>\<rbrakk>L<SRel,TRel> SourceTerm S2) \<Longrightarrow> rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)

goal (1 subgoal):
 1. rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)
[PROOF STEP]
by (simp add: indRelLSTPO.source)
[PROOF STATE]
proof (state)
this:
rel_preserves_binary_pred SRel (\<lambda>a. hasBarb a SWB)

goal (1 subgoal):
 1. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
show "rel_preserves_barbs TRel TWB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
using preservation rel_with_target_impl_TRel_preserves_barbs[where
                          Rel="indRelLSTPO SRel TRel" and TRel="TRel"]
[PROOF STATE]
proof (prove)
using this:
rel_preserves_binary_pred (indRelLSTPO SRel TRel) (\<lambda>a. hasBarb a (STCalWB SWB TWB))
rel_preserves_binary_pred (indRelLSTPO SRel TRel) (\<lambda>a. hasBarb a (STCalWB SWB TWB)) \<and> (\<forall>T1 T2. (T1, T2) \<in> TRel \<longrightarrow> TargetTerm T1 \<lesssim>\<lbrakk>\<cdot>\<rbrakk>L<SRel,TRel> TargetTerm T2) \<Longrightarrow> rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)

goal (1 subgoal):
 1. rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)
[PROOF STEP]
by (simp add: indRelLSTPO.target)
[PROOF STATE]
proof (state)
this:
rel_preserves_binary_pred TRel (\<lambda>a. hasBarb a TWB)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_nth_prod:
  assumes "finite A" "A \<noteq> {}" "n > 0"
  shows   "fds_nth (\<Prod>x\<in>A. f x) n =
             (\<Sum>d | d \<in> extensional A \<and> prod d A = n. \<Prod>x\<in>A. fds_nth (f x) (d x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (prod f A) n = (\<Sum>d | d \<in> extensional A \<and> prod d A = n. \<Prod>x\<in>A. fds_nth (f x) (d x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
0 < n

goal (1 subgoal):
 1. fds_nth (prod f A) n = (\<Sum>d | d \<in> extensional A \<and> prod d A = n. \<Prod>x\<in>A. fds_nth (f x) (d x))
[PROOF STEP]
proof (induction arbitrary: n rule: finite_ne_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x n. 0 < n \<Longrightarrow> fds_nth (prod f {x}) n = (\<Sum>d | d \<in> extensional {x} \<and> prod d {x} = n. \<Prod>x\<in>{x}. fds_nth (f x) (d x))
 2. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
case (singleton x n)
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. \<And>x n. 0 < n \<Longrightarrow> fds_nth (prod f {x}) n = (\<Sum>d | d \<in> extensional {x} \<and> prod d {x} = n. \<Prod>x\<in>{x}. fds_nth (f x) (d x))
 2. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
have "{d \<in> extensional {x}. d x = n} = {\<lambda>y. if y = x then n else undefined}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {d \<in> extensional {x}. d x = n} = {\<lambda>y. if y = x then n else undefined}
[PROOF STEP]
by (auto simp: extensional_def)
[PROOF STATE]
proof (state)
this:
{d \<in> extensional {x}. d x = n} = {\<lambda>y. if y = x then n else undefined}

goal (2 subgoals):
 1. \<And>x n. 0 < n \<Longrightarrow> fds_nth (prod f {x}) n = (\<Sum>d | d \<in> extensional {x} \<and> prod d {x} = n. \<Prod>x\<in>{x}. fds_nth (f x) (d x))
 2. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
{d \<in> extensional {x}. d x = n} = {\<lambda>y. if y = x then n else undefined}

goal (1 subgoal):
 1. fds_nth (prod f {x}) n = (\<Sum>d | d \<in> extensional {x} \<and> prod d {x} = n. \<Prod>x\<in>{x}. fds_nth (f x) (d x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fds_nth (prod f {x}) n = (\<Sum>d | d \<in> extensional {x} \<and> prod d {x} = n. \<Prod>x\<in>{x}. fds_nth (f x) (d x))

goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
case (insert x A n)
[PROOF STATE]
proof (state)
this:
finite A
A \<noteq> {}
x \<notin> A
0 < ?n \<Longrightarrow> fds_nth (prod f A) ?n = (\<Sum>d | d \<in> extensional A \<and> prod d A = ?n. \<Prod>x\<in>A. fds_nth (f x) (d x))
0 < n

goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
let ?f = "\<lambda>d. ((d x, n div d x), d(x := undefined))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
let ?g = "\<lambda>(z,d). d(x := fst z)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
from insert
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
x \<notin> A
0 < ?n \<Longrightarrow> fds_nth (prod f A) ?n = (\<Sum>d | d \<in> extensional A \<and> prod d A = ?n. \<Prod>x\<in>A. fds_nth (f x) (d x))
0 < n
[PROOF STEP]
have "fds_nth (\<Prod>x\<in>insert x A. f x) n =
           (\<Sum>z | fst z * snd z = n. \<Sum>d | d \<in> extensional A \<and> prod d A = snd z.
              fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
x \<notin> A
0 < ?n \<Longrightarrow> fds_nth (prod f A) ?n = (\<Sum>d | d \<in> extensional A \<and> prod d A = ?n. \<Prod>x\<in>A. fds_nth (f x) (d x))
0 < n

goal (1 subgoal):
 1. fds_nth (prod f (insert x A)) n = (\<Sum>z | fst z * snd z = n. \<Sum>d | d \<in> extensional A \<and> prod d A = snd z. fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
by (simp add: fds_nth_mult dirichlet_prod_altdef2 sum_distrib_left case_prod_unfold)
[PROOF STATE]
proof (state)
this:
fds_nth (prod f (insert x A)) n = (\<Sum>z | fst z * snd z = n. \<Sum>d | d \<in> extensional A \<and> prod d A = snd z. fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))

goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds_nth (prod f (insert x A)) n = (\<Sum>z | fst z * snd z = n. \<Sum>d | d \<in> extensional A \<and> prod d A = snd z. fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))

goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
have "\<dots> = (\<Sum>(z,d)\<in>(SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}).
                      fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>z | fst z * snd z = n. \<Sum>d | d \<in> extensional A \<and> prod d A = snd z. fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x))) = (\<Sum>(z, d)\<in>(SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}). fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
using finite_divisors_nat'[of n] and insert.hyps and \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> finite {(a, b). a * b = n}
finite A
A \<noteq> {}
x \<notin> A
0 < n

goal (1 subgoal):
 1. (\<Sum>z | fst z * snd z = n. \<Sum>d | d \<in> extensional A \<and> prod d A = snd z. fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x))) = (\<Sum>(z, d)\<in>(SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}). fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
by (intro sum.Sigma finite_extensional_prod_nat ballI)  (auto simp: case_prod_unfold)
[PROOF STATE]
proof (state)
this:
(\<Sum>z | fst z * snd z = n. \<Sum>d | d \<in> extensional A \<and> prod d A = snd z. fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x))) = (\<Sum>(z, d)\<in>(SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}). fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))

goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>z | fst z * snd z = n. \<Sum>d | d \<in> extensional A \<and> prod d A = snd z. fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x))) = (\<Sum>(z, d)\<in>(SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}). fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))

goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
have "\<dots> = (\<Sum>d | d \<in> extensional (insert x A) \<and> prod d (insert x A) = n.
                      (\<Prod>x\<in>insert x A. fds_nth (f x) (d x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(z, d)\<in>(SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}). fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x))) = (\<Sum>d | d \<in> extensional (insert x A) \<and> prod d (insert x A) = n. \<Prod>x\<in>insert x A. fds_nth (f x) (d x))
[PROOF STEP]
proof (rule sum.reindex_bij_witness [of _ ?f ?g], goal_cases)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (((case a of (z, d) \<Rightarrow> d(x := fst z)) x, n div (case a of (z, d) \<Rightarrow> d(x := fst z)) x), (case a of (z, d) \<Rightarrow> d(x := fst z))(x := undefined)) = a
 2. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (case a of (z, d) \<Rightarrow> d(x := fst z)) \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}
 3. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 4. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> ((b x, n div b x), b(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
 5. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
case (1 z)
[PROOF STATE]
proof (state)
this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})

goal (5 subgoals):
 1. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (((case a of (z, d) \<Rightarrow> d(x := fst z)) x, n div (case a of (z, d) \<Rightarrow> d(x := fst z)) x), (case a of (z, d) \<Rightarrow> d(x := fst z))(x := undefined)) = a
 2. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (case a of (z, d) \<Rightarrow> d(x := fst z)) \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}
 3. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 4. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> ((b x, n div b x), b(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
 5. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})

goal (1 subgoal):
 1. (((case z of (z, d) \<Rightarrow> d(x := fst z)) x, n div (case z of (z, d) \<Rightarrow> d(x := fst z)) x), (case z of (z, d) \<Rightarrow> d(x := fst z))(x := undefined)) = z
[PROOF STEP]
using insert.hyps insert.prems
[PROOF STATE]
proof (prove)
using this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
finite A
A \<noteq> {}
x \<notin> A
0 < n

goal (1 subgoal):
 1. (((case z of (z, d) \<Rightarrow> d(x := fst z)) x, n div (case z of (z, d) \<Rightarrow> d(x := fst z)) x), (case z of (z, d) \<Rightarrow> d(x := fst z))(x := undefined)) = z
[PROOF STEP]
by (auto simp: extensional_def)
[PROOF STATE]
proof (state)
this:
(((case z of (z, d) \<Rightarrow> d(x := fst z)) x, n div (case z of (z, d) \<Rightarrow> d(x := fst z)) x), (case z of (z, d) \<Rightarrow> d(x := fst z))(x := undefined)) = z

goal (4 subgoals):
 1. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (case a of (z, d) \<Rightarrow> d(x := fst z)) \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}
 2. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 3. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> ((b x, n div b x), b(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
 4. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (case a of (z, d) \<Rightarrow> d(x := fst z)) \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}
 2. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 3. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> ((b x, n div b x), b(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
 4. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
case (2 z)
[PROOF STATE]
proof (state)
this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})

goal (4 subgoals):
 1. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (case a of (z, d) \<Rightarrow> d(x := fst z)) \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}
 2. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 3. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> ((b x, n div b x), b(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
 4. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})

goal (1 subgoal):
 1. (case z of (z, d) \<Rightarrow> d(x := fst z)) \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}
[PROOF STEP]
using insert.hyps insert.prems
[PROOF STATE]
proof (prove)
using this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
finite A
A \<noteq> {}
x \<notin> A
0 < n

goal (1 subgoal):
 1. (case z of (z, d) \<Rightarrow> d(x := fst z)) \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}
[PROOF STEP]
by (auto simp: extensional_def sum.delta intro!: prod.cong)
[PROOF STATE]
proof (state)
this:
(case z of (z, d) \<Rightarrow> d(x := fst z)) \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}

goal (3 subgoals):
 1. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 2. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> ((b x, n div b x), b(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
 3. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 2. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> ((b x, n div b x), b(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
 3. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
case (4 z)
[PROOF STATE]
proof (state)
this:
z \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}

goal (3 subgoals):
 1. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 2. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> ((b x, n div b x), b(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
 3. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
z \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}

goal (1 subgoal):
 1. ((z x, n div z x), z(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
[PROOF STEP]
using insert.hyps insert.prems
[PROOF STATE]
proof (prove)
using this:
z \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n}
finite A
A \<noteq> {}
x \<notin> A
0 < n

goal (1 subgoal):
 1. ((z x, n div z x), z(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
[PROOF STEP]
by (auto  intro!: prod.cong)
[PROOF STATE]
proof (state)
this:
((z x, n div z x), z(x := undefined)) \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})

goal (2 subgoals):
 1. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 2. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 2. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
case (5 z)
[PROOF STATE]
proof (state)
this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})

goal (2 subgoals):
 1. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 2. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
with insert.hyps insert.prems
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
x \<notin> A
0 < n
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
[PROOF STEP]
have "(\<Prod>xa\<in>A. fds_nth (f xa) (if xa = x then fst (fst z) else snd z xa)) =
              (\<Prod>x\<in>A. fds_nth (f x) (snd z x))"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
x \<notin> A
0 < n
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})

goal (1 subgoal):
 1. (\<Prod>xa\<in>A. fds_nth (f xa) (if xa = x then fst (fst z) else snd z xa)) = (\<Prod>x\<in>A. fds_nth (f x) (snd z x))
[PROOF STEP]
by (intro prod.cong) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>xa\<in>A. fds_nth (f xa) (if xa = x then fst (fst z) else snd z xa)) = (\<Prod>x\<in>A. fds_nth (f x) (snd z x))

goal (2 subgoals):
 1. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
 2. \<And>a. a \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}) \<Longrightarrow> (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case a of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case a of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
with 5 insert.hyps insert.prems
[PROOF STATE]
proof (chain)
picking this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
finite A
A \<noteq> {}
x \<notin> A
0 < n
(\<Prod>xa\<in>A. fds_nth (f xa) (if xa = x then fst (fst z) else snd z xa)) = (\<Prod>x\<in>A. fds_nth (f x) (snd z x))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
z \<in> (SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x})
finite A
A \<noteq> {}
x \<notin> A
0 < n
(\<Prod>xa\<in>A. fds_nth (f xa) (if xa = x then fst (fst z) else snd z xa)) = (\<Prod>x\<in>A. fds_nth (f x) (snd z x))

goal (1 subgoal):
 1. (\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case z of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case z of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))
[PROOF STEP]
by (simp add: case_prod_unfold)
[PROOF STATE]
proof (state)
this:
(\<Prod>xa\<in>insert x A. fds_nth (f xa) ((case z of (z, d) \<Rightarrow> d(x := fst z)) xa)) = (case z of (z, d) \<Rightarrow> fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x)))

goal (1 subgoal):
 1. \<And>b. b \<in> {d \<in> extensional (insert x A). prod d (insert x A) = n} \<Longrightarrow> (case ((b x, n div b x), b(x := undefined)) of (z, d) \<Rightarrow> d(x := fst z)) = b
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(z, d)\<in>(SIGMA x:{z. fst z * snd z = n}. {d \<in> extensional A. prod d A = snd x}). fds_nth (f x) (fst z) * (\<Prod>x\<in>A. fds_nth (f x) (d x))) = (\<Sum>d | d \<in> extensional (insert x A) \<and> prod d (insert x A) = n. \<Prod>x\<in>insert x A. fds_nth (f x) (d x))

goal (1 subgoal):
 1. \<And>x F n. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; \<And>n. 0 < n \<Longrightarrow> fds_nth (prod f F) n = (\<Sum>d | d \<in> extensional F \<and> prod d F = n. \<Prod>x\<in>F. fds_nth (f x) (d x)); 0 < n\<rbrakk> \<Longrightarrow> fds_nth (prod f (insert x F)) n = (\<Sum>d | d \<in> extensional (insert x F) \<and> prod d (insert x F) = n. \<Prod>x\<in>insert x F. fds_nth (f x) (d x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fds_nth (prod f (insert x A)) n = (\<Sum>d | d \<in> extensional (insert x A) \<and> prod d (insert x A) = n. \<Prod>x\<in>insert x A. fds_nth (f x) (d x))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
fds_nth (prod f (insert x A)) n = (\<Sum>d | d \<in> extensional (insert x A) \<and> prod d (insert x A) = n. \<Prod>x\<in>insert x A. fds_nth (f x) (d x))

goal (1 subgoal):
 1. fds_nth (prod f (insert x A)) n = (\<Sum>d | d \<in> extensional (insert x A) \<and> prod d (insert x A) = n. \<Prod>x\<in>insert x A. fds_nth (f x) (d x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fds_nth (prod f (insert x A)) n = (\<Sum>d | d \<in> extensional (insert x A) \<and> prod d (insert x A) = n. \<Prod>x\<in>insert x A. fds_nth (f x) (d x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_measurable_sinc[measurable]: "sinc \<in> borel_measurable borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sinc \<in> borel_measurable borel
[PROOF STEP]
by (intro borel_measurable_continuous_onI continuous_at_imp_continuous_on ballI isCont_sinc)