[STATEMENT]
theorem uniqueness:
  assumes "finite_field F\<^sub>1"
  assumes "finite_field F\<^sub>2"
  assumes "order F\<^sub>1 = order F\<^sub>2"
  shows "F\<^sub>1 \<simeq> F\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
obtain n where o1: "order F\<^sub>1 = char F\<^sub>1^n" "n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. \<lbrakk>order F\<^sub>1 = char F\<^sub>1 ^ n; 0 < n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_field.finite_field_order[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
\<exists>n. order F\<^sub>1 = char F\<^sub>1 ^ n \<and> 0 < n

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>order F\<^sub>1 = char F\<^sub>1 ^ n; 0 < n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order F\<^sub>1 = char F\<^sub>1 ^ n
0 < n

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
obtain m where o2: "order F\<^sub>2 = char F\<^sub>2^m" "m > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. \<lbrakk>order F\<^sub>2 = char F\<^sub>2 ^ m; 0 < m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_field.finite_field_order[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
\<exists>n. order F\<^sub>2 = char F\<^sub>2 ^ n \<and> 0 < n

goal (1 subgoal):
 1. (\<And>m. \<lbrakk>order F\<^sub>2 = char F\<^sub>2 ^ m; 0 < m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order F\<^sub>2 = char F\<^sub>2 ^ m
0 < m

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
interpret f1: "finite_field" F\<^sub>1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_field F\<^sub>1
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
finite_field F\<^sub>1

goal (1 subgoal):
 1. finite_field F\<^sub>1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
interpret f2: "finite_field" F\<^sub>2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_field F\<^sub>2
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
finite_field F\<^sub>2

goal (1 subgoal):
 1. finite_field F\<^sub>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
have char_pos: "char F\<^sub>1 > 0" "char F\<^sub>2 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < char F\<^sub>1 &&& 0 < char F\<^sub>2
[PROOF STEP]
using f1.finite_carrier f1.finite_carr_imp_char_ge_0
[PROOF STATE]
proof (prove)
using this:
finite (carrier F\<^sub>1)
finite (carrier F\<^sub>1) \<Longrightarrow> 0 < char F\<^sub>1

goal (1 subgoal):
 1. 0 < char F\<^sub>1 &&& 0 < char F\<^sub>2
[PROOF STEP]
using f2.finite_carrier f2.finite_carr_imp_char_ge_0
[PROOF STATE]
proof (prove)
using this:
finite (carrier F\<^sub>1)
finite (carrier F\<^sub>1) \<Longrightarrow> 0 < char F\<^sub>1
finite (carrier F\<^sub>2)
finite (carrier F\<^sub>2) \<Longrightarrow> 0 < char F\<^sub>2

goal (1 subgoal):
 1. 0 < char F\<^sub>1 &&& 0 < char F\<^sub>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < char F\<^sub>1
0 < char F\<^sub>2

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
hence char_prime:
    "Factorial_Ring.prime (char F\<^sub>1)"
    "Factorial_Ring.prime (char F\<^sub>2)"
[PROOF STATE]
proof (prove)
using this:
0 < char F\<^sub>1
0 < char F\<^sub>2

goal (1 subgoal):
 1. normalization_semidom_class.prime (char F\<^sub>1) &&& normalization_semidom_class.prime (char F\<^sub>2)
[PROOF STEP]
using f1.characteristic_is_prime f2.characteristic_is_prime
[PROOF STATE]
proof (prove)
using this:
0 < char F\<^sub>1
0 < char F\<^sub>2
0 < char F\<^sub>1 \<Longrightarrow> normalization_semidom_class.prime (char F\<^sub>1)
0 < char F\<^sub>2 \<Longrightarrow> normalization_semidom_class.prime (char F\<^sub>2)

goal (1 subgoal):
 1. normalization_semidom_class.prime (char F\<^sub>1) &&& normalization_semidom_class.prime (char F\<^sub>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
normalization_semidom_class.prime (char F\<^sub>1)
normalization_semidom_class.prime (char F\<^sub>2)

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
have "char F\<^sub>1^n = char F\<^sub>2^m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char F\<^sub>1 ^ n = char F\<^sub>2 ^ m
[PROOF STEP]
using o1 o2 assms(3)
[PROOF STATE]
proof (prove)
using this:
order F\<^sub>1 = char F\<^sub>1 ^ n
0 < n
order F\<^sub>2 = char F\<^sub>2 ^ m
0 < m
order F\<^sub>1 = order F\<^sub>2

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

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
hence eq: "n = m" "char F\<^sub>1 = char F\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
char F\<^sub>1 ^ n = char F\<^sub>2 ^ m

goal (1 subgoal):
 1. n = m &&& char F\<^sub>1 = char F\<^sub>2
[PROOF STEP]
using char_prime char_pos o1(2) o2(2) prime_power_inj'
[PROOF STATE]
proof (prove)
using this:
char F\<^sub>1 ^ n = char F\<^sub>2 ^ m
normalization_semidom_class.prime (char F\<^sub>1)
normalization_semidom_class.prime (char F\<^sub>2)
0 < char F\<^sub>1
0 < char F\<^sub>2
0 < n
0 < m
\<lbrakk>normalization_semidom_class.prime ?p; normalization_semidom_class.prime ?q; ?p ^ ?m = ?q ^ ?n; 0 < ?m; 0 < ?n\<rbrakk> \<Longrightarrow> ?p = ?q
\<lbrakk>normalization_semidom_class.prime ?p; normalization_semidom_class.prime ?q; ?p ^ ?m = ?q ^ ?n; 0 < ?m; 0 < ?n\<rbrakk> \<Longrightarrow> ?m = ?n

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

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
obtain p where p_def: "p = char F\<^sub>1" "p = char F\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p = char F\<^sub>1; p = char F\<^sub>2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
n = m
char F\<^sub>1 = char F\<^sub>2

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>p = char F\<^sub>1; p = char F\<^sub>2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p = char F\<^sub>1
p = char F\<^sub>2

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
have p_prime: "Factorial_Ring.prime p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalization_semidom_class.prime p
[PROOF STEP]
unfolding p_def(1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalization_semidom_class.prime (char F\<^sub>1)
[PROOF STEP]
using f1.characteristic_is_prime char_pos
[PROOF STATE]
proof (prove)
using this:
0 < char F\<^sub>1 \<Longrightarrow> normalization_semidom_class.prime (char F\<^sub>1)
0 < char F\<^sub>1
0 < char F\<^sub>2

goal (1 subgoal):
 1. normalization_semidom_class.prime (char F\<^sub>1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normalization_semidom_class.prime p

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
interpret zf: finite_field "ZFact (int p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_field (ZFact (int p))
[PROOF STEP]
using zfact_prime_is_finite_field p_prime o1(2)
[PROOF STATE]
proof (prove)
using this:
normalization_semidom_class.prime ?p \<Longrightarrow> finite_field (ZFact (int ?p))
normalization_semidom_class.prime p
0 < n

goal (1 subgoal):
 1. finite_field (ZFact (int p))
[PROOF STEP]
using prime_nat_int_transfer
[PROOF STATE]
proof (prove)
using this:
normalization_semidom_class.prime ?p \<Longrightarrow> finite_field (ZFact (int ?p))
normalization_semidom_class.prime p
0 < n
normalization_semidom_class.prime (int ?n) = normalization_semidom_class.prime ?n

goal (1 subgoal):
 1. finite_field (ZFact (int p))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
interpret zfp: polynomial_ring "ZFact p" "carrier (ZFact p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polynomial_ring (ZFact (int p)) (carrier (ZFact (int p)))
[PROOF STEP]
unfolding polynomial_ring_def polynomial_ring_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. field (ZFact (int p)) \<and> subfield (carrier (ZFact (int p))) (ZFact (int p))
[PROOF STEP]
using zf.field_axioms zf.carrier_is_subfield
[PROOF STATE]
proof (prove)
using this:
field (ZFact (int p))
subfield (carrier (ZFact (int p))) (ZFact (int p))

goal (1 subgoal):
 1. field (ZFact (int p)) \<and> subfield (carrier (ZFact (int p))) (ZFact (int p))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
obtain f where f_def:
    "monic_irreducible_poly (ZFact (int p)) f" "degree f = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>m_i_p (ZFact (int p)) f; Polynomials.degree f = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using zf.exist_irred o1(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?n; \<And>f. \<lbrakk>m_i_p (ZFact (int p)) f; Polynomials.degree f = ?n\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
0 < n

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>m_i_p (ZFact (int p)) f; Polynomials.degree f = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m_i_p (ZFact (int p)) f
Polynomials.degree f = n

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
let ?F\<^sub>0  = "Rupt\<^bsub>(ZFact p)\<^esub> (carrier (ZFact p)) f"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
obtain \<phi>\<^sub>1 where \<phi>\<^sub>1_def: "\<phi>\<^sub>1 \<in> ring_iso ?F\<^sub>0 F\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<phi>\<^sub>1. \<phi>\<^sub>1 \<in> ring_iso (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f) F\<^sub>1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using f1.find_iso_from_zfact f_def o1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>m_i_p (ZFact (int (char F\<^sub>1))) ?f; order F\<^sub>1 = char F\<^sub>1 ^ Polynomials.degree ?f\<rbrakk> \<Longrightarrow> \<exists>\<phi>. \<phi> \<in> ring_iso (Rupt\<^bsub>ZFact (int (char F\<^sub>1))\<^esub> (carrier (ZFact (int (char F\<^sub>1)))) ?f) F\<^sub>1
m_i_p (ZFact (int p)) f
Polynomials.degree f = n
order F\<^sub>1 = char F\<^sub>1 ^ n
0 < n

goal (1 subgoal):
 1. (\<And>\<phi>\<^sub>1. \<phi>\<^sub>1 \<in> ring_iso (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f) F\<^sub>1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding p_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>m_i_p (ZFact (int (char F\<^sub>1))) ?f; order F\<^sub>1 = char F\<^sub>1 ^ Polynomials.degree ?f\<rbrakk> \<Longrightarrow> \<exists>\<phi>. \<phi> \<in> ring_iso (Rupt\<^bsub>ZFact (int (char F\<^sub>1))\<^esub> (carrier (ZFact (int (char F\<^sub>1)))) ?f) F\<^sub>1
m_i_p (ZFact (int (char F\<^sub>1))) f
Polynomials.degree f = n
order F\<^sub>1 = char F\<^sub>1 ^ n
0 < n

goal (1 subgoal):
 1. (\<And>\<phi>\<^sub>1. \<phi>\<^sub>1 \<in> ring_iso (Rupt\<^bsub>ZFact (int (char F\<^sub>1))\<^esub> (carrier (ZFact (int (char F\<^sub>1)))) f) F\<^sub>1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<phi>\<^sub>1 \<in> ring_iso (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f) F\<^sub>1

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
obtain \<phi>\<^sub>2 where \<phi>\<^sub>2_def: "\<phi>\<^sub>2 \<in> ring_iso ?F\<^sub>0 F\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<phi>\<^sub>2. \<phi>\<^sub>2 \<in> ring_iso (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f) F\<^sub>2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using f2.find_iso_from_zfact f_def o2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>m_i_p (ZFact (int (char F\<^sub>2))) ?f; order F\<^sub>2 = char F\<^sub>2 ^ Polynomials.degree ?f\<rbrakk> \<Longrightarrow> \<exists>\<phi>. \<phi> \<in> ring_iso (Rupt\<^bsub>ZFact (int (char F\<^sub>2))\<^esub> (carrier (ZFact (int (char F\<^sub>2)))) ?f) F\<^sub>2
m_i_p (ZFact (int p)) f
Polynomials.degree f = n
order F\<^sub>2 = char F\<^sub>2 ^ m
0 < m

goal (1 subgoal):
 1. (\<And>\<phi>\<^sub>2. \<phi>\<^sub>2 \<in> ring_iso (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f) F\<^sub>2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding p_def(2) eq(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>m_i_p (ZFact (int (char F\<^sub>2))) ?f; order F\<^sub>2 = char F\<^sub>2 ^ Polynomials.degree ?f\<rbrakk> \<Longrightarrow> \<exists>\<phi>. \<phi> \<in> ring_iso (Rupt\<^bsub>ZFact (int (char F\<^sub>2))\<^esub> (carrier (ZFact (int (char F\<^sub>2)))) ?f) F\<^sub>2
m_i_p (ZFact (int (char F\<^sub>2))) f
Polynomials.degree f = m
order F\<^sub>2 = char F\<^sub>2 ^ m
0 < m

goal (1 subgoal):
 1. (\<And>\<phi>\<^sub>2. \<phi>\<^sub>2 \<in> ring_iso (Rupt\<^bsub>ZFact (int (char F\<^sub>2))\<^esub> (carrier (ZFact (int (char F\<^sub>2)))) f) F\<^sub>2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<phi>\<^sub>2 \<in> ring_iso (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f) F\<^sub>2

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
have "?F\<^sub>0 \<simeq> F\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>1
[PROOF STEP]
using \<phi>\<^sub>1_def is_ring_iso_def
[PROOF STATE]
proof (prove)
using this:
\<phi>\<^sub>1 \<in> ring_iso (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f) F\<^sub>1
?R \<simeq> ?S = (ring_iso ?R ?S \<noteq> {})

goal (1 subgoal):
 1. Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>1

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>1

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
have "?F\<^sub>0 \<simeq> F\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>2
[PROOF STEP]
using \<phi>\<^sub>2_def is_ring_iso_def
[PROOF STATE]
proof (prove)
using this:
\<phi>\<^sub>2 \<in> ring_iso (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f) F\<^sub>2
?R \<simeq> ?S = (ring_iso ?R ?S \<noteq> {})

goal (1 subgoal):
 1. Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>2

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>2

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
have "field ?F\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. field (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)
[PROOF STEP]
using f_def(1) zf.monic_poly_carr monic_irreducible_poly_def
[PROOF STATE]
proof (prove)
using this:
m_i_p (ZFact (int p)) f
monic_poly (ZFact (int p)) ?f \<Longrightarrow> ?f \<in> carrier zfp.P
m_i_p ?R ?f = (monic_poly ?R ?f \<and> pirreducible\<^bsub>?R\<^esub> (carrier ?R) ?f)

goal (1 subgoal):
 1. field (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)
[PROOF STEP]
by (subst zfp.rupture_is_field_iff_pirreducible) auto
[PROOF STATE]
proof (state)
this:
field (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
hence "ring ?F\<^sub>0"
[PROOF STATE]
proof (prove)
using this:
field (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)

goal (1 subgoal):
 1. ring (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)
[PROOF STEP]
using field.is_ring
[PROOF STATE]
proof (prove)
using this:
field (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)
field ?R \<Longrightarrow> ring ?R

goal (1 subgoal):
 1. ring (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ring (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>1
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>2
ring (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>1
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>2
ring (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
using ring_iso_trans ring_iso_sym
[PROOF STATE]
proof (prove)
using this:
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>1
Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f \<simeq> F\<^sub>2
ring (Rupt\<^bsub>ZFact (int p)\<^esub> (carrier (ZFact (int p))) f)
\<lbrakk>?R \<simeq> ?S; ?S \<simeq> ?Q\<rbrakk> \<Longrightarrow> ?R \<simeq> ?Q
\<lbrakk>ring ?R; ?R \<simeq> ?S\<rbrakk> \<Longrightarrow> ?S \<simeq> ?R

goal (1 subgoal):
 1. F\<^sub>1 \<simeq> F\<^sub>2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
F\<^sub>1 \<simeq> F\<^sub>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wf_nFAND: "wf idx (nFAND \<phi>s) \<longleftrightarrow> (\<forall>\<phi> \<in> set \<phi>s. wf idx \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.wf idx (nFAND \<phi>s) = (\<forall>\<phi>\<in>set \<phi>s. local.wf idx \<phi>)
[PROOF STEP]
by (induct rule: nFAND.induct) auto


[STATEMENT]
lemma distr_uniform_measure_count_space_inj:
  assumes "inj_on f A'" "A' \<subseteq> A" "f ` A \<subseteq> B" "finite A'"
  shows   "distr (uniform_measure (count_space A) A') (count_space B) f =
             uniform_measure (count_space B) (f ` A')" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (uniform_measure (count_space A) A') (count_space B) f = uniform_measure (count_space B) (f ` A')
[PROOF STEP]
proof (rule measure_eqI, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
case (2 X)
[PROOF STATE]
proof (state)
this:
X \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f)

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
hence X_subset: "X \<subseteq> B"
[PROOF STATE]
proof (prove)
using this:
X \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f)

goal (1 subgoal):
 1. X \<subseteq> B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X \<subseteq> B

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'
[PROOF STEP]
have eq: "f ` A' \<inter> X = f ` (A' \<inter> (f -` X \<inter> A))"
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'

goal (1 subgoal):
 1. f ` A' \<inter> X = f ` (A' \<inter> (f -` X \<inter> A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` A' \<inter> X = f ` (A' \<inter> (f -` X \<inter> A))

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'
[PROOF STEP]
have [measurable]: "f \<in> count_space A \<rightarrow>\<^sub>M count_space B"
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'

goal (1 subgoal):
 1. f \<in> count_space A \<rightarrow>\<^sub>M count_space B
[PROOF STEP]
by (subst measurable_count_space_eq1) auto
[PROOF STATE]
proof (state)
this:
f \<in> count_space A \<rightarrow>\<^sub>M count_space B

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
from X_subset
[PROOF STATE]
proof (chain)
picking this:
X \<subseteq> B
[PROOF STEP]
have "emeasure ?lhs X =
                        emeasure (uniform_measure (count_space A) A') (f -` X \<inter> A)"
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> B

goal (1 subgoal):
 1. emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) X = emeasure (uniform_measure (count_space A) A') (f -` X \<inter> A)
[PROOF STEP]
by (subst emeasure_distr) auto
[PROOF STATE]
proof (state)
this:
emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) X = emeasure (uniform_measure (count_space A) A') (f -` X \<inter> A)

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) X = emeasure (uniform_measure (count_space A) A') (f -` X \<inter> A)

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
from assms X_subset
[PROOF STATE]
proof (chain)
picking this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'
X \<subseteq> B
[PROOF STEP]
have "\<dots> = emeasure (count_space A) (A' \<inter> (f -` X \<inter> A)) / emeasure (count_space A) A'"
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'
X \<subseteq> B

goal (1 subgoal):
 1. emeasure (uniform_measure (count_space A) A') (f -` X \<inter> A) = emeasure (count_space A) (A' \<inter> (f -` X \<inter> A)) / emeasure (count_space A) A'
[PROOF STEP]
by (intro emeasure_uniform_measure) auto
[PROOF STATE]
proof (state)
this:
emeasure (uniform_measure (count_space A) A') (f -` X \<inter> A) = emeasure (count_space A) (A' \<inter> (f -` X \<inter> A)) / emeasure (count_space A) A'

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (uniform_measure (count_space A) A') (f -` X \<inter> A) = emeasure (count_space A) (A' \<inter> (f -` X \<inter> A)) / emeasure (count_space A) A'

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'
[PROOF STEP]
have "\<dots> = of_nat (card (A' \<inter> (f -` X \<inter> A))) / of_nat (card A')"
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'

goal (1 subgoal):
 1. emeasure (count_space A) (A' \<inter> (f -` X \<inter> A)) / emeasure (count_space A) A' = of_nat (card (A' \<inter> (f -` X \<inter> A))) / of_nat (card A')
[PROOF STEP]
by (subst (1 2) emeasure_count_space) auto
[PROOF STATE]
proof (state)
this:
emeasure (count_space A) (A' \<inter> (f -` X \<inter> A)) / emeasure (count_space A) A' = of_nat (card (A' \<inter> (f -` X \<inter> A))) / of_nat (card A')

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (count_space A) (A' \<inter> (f -` X \<inter> A)) / emeasure (count_space A) A' = of_nat (card (A' \<inter> (f -` X \<inter> A))) / of_nat (card A')

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
have "card (A' \<inter> (f -` X \<inter> A)) = card (f ` (A' \<inter> (f -` X \<inter> A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A' \<inter> (f -` X \<inter> A)) = card (f ` (A' \<inter> (f -` X \<inter> A)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'

goal (1 subgoal):
 1. card (A' \<inter> (f -` X \<inter> A)) = card (f ` (A' \<inter> (f -` X \<inter> A)))
[PROOF STEP]
by (intro card_image [symmetric]) (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
card (A' \<inter> (f -` X \<inter> A)) = card (f ` (A' \<inter> (f -` X \<inter> A)))

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (A' \<inter> (f -` X \<inter> A)) = card (f ` (A' \<inter> (f -` X \<inter> A)))

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
have "f ` (A' \<inter> (f -` X \<inter> A)) = f ` A' \<inter> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (A' \<inter> (f -` X \<inter> A)) = f ` A' \<inter> X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'

goal (1 subgoal):
 1. f ` (A' \<inter> (f -` X \<inter> A)) = f ` A' \<inter> X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` (A' \<inter> (f -` X \<inter> A)) = f ` A' \<inter> X

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f ` (A' \<inter> (f -` X \<inter> A)) = f ` A' \<inter> X

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
have "of_nat (card A') = of_nat (card (f ` A'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (card A') = of_nat (card (f ` A'))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'

goal (1 subgoal):
 1. of_nat (card A') = of_nat (card (f ` A'))
[PROOF STEP]
by (subst card_image) auto
[PROOF STATE]
proof (state)
this:
of_nat (card A') = of_nat (card (f ` A'))

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (card A') = of_nat (card (f ` A'))

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
have "of_nat (card (f ` A' \<inter> X)) / \<dots> =
               emeasure (count_space B) (f ` A' \<inter> X) / emeasure (count_space B) (f ` A')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (card (f ` A' \<inter> X)) / of_nat (card (f ` A')) = emeasure (count_space B) (f ` A' \<inter> X) / emeasure (count_space B) (f ` A')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'

goal (1 subgoal):
 1. of_nat (card (f ` A' \<inter> X)) / of_nat (card (f ` A')) = emeasure (count_space B) (f ` A' \<inter> X) / emeasure (count_space B) (f ` A')
[PROOF STEP]
by (subst (1 2) emeasure_count_space) auto
[PROOF STATE]
proof (state)
this:
of_nat (card (f ` A' \<inter> X)) / of_nat (card (f ` A')) = emeasure (count_space B) (f ` A' \<inter> X) / emeasure (count_space B) (f ` A')

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (card (f ` A' \<inter> X)) / of_nat (card (f ` A')) = emeasure (count_space B) (f ` A' \<inter> X) / emeasure (count_space B) (f ` A')

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
from assms X_subset
[PROOF STATE]
proof (chain)
picking this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'
X \<subseteq> B
[PROOF STEP]
have "\<dots> = emeasure ?rhs X"
[PROOF STATE]
proof (prove)
using this:
inj_on f A'
A' \<subseteq> A
f ` A \<subseteq> B
finite A'
X \<subseteq> B

goal (1 subgoal):
 1. emeasure (count_space B) (f ` A' \<inter> X) / emeasure (count_space B) (f ` A') = emeasure (uniform_measure (count_space B) (f ` A')) X
[PROOF STEP]
by (intro emeasure_uniform_measure [symmetric]) auto
[PROOF STATE]
proof (state)
this:
emeasure (count_space B) (f ` A' \<inter> X) / emeasure (count_space B) (f ` A') = emeasure (uniform_measure (count_space B) (f ` A')) X

goal (2 subgoals):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
 2. \<And>Aa. Aa \<in> sets (distr (uniform_measure (count_space A) A') (count_space B) f) \<Longrightarrow> emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) Aa = emeasure (uniform_measure (count_space B) (f ` A')) Aa
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) X = emeasure (uniform_measure (count_space B) (f ` A')) X
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) X = emeasure (uniform_measure (count_space B) (f ` A')) X

goal (1 subgoal):
 1. emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) X = emeasure (uniform_measure (count_space B) (f ` A')) X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure (distr (uniform_measure (count_space A) A') (count_space B) f) X = emeasure (uniform_measure (count_space B) (f ` A')) X

goal (1 subgoal):
 1. sets (distr (uniform_measure (count_space A) A') (count_space B) f) = sets (uniform_measure (count_space B) (f ` A'))
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma HMA_char_poly [transfer_rule]:
  "((HMA_M :: ('a:: comm_ring_1 mat \<Rightarrow> 'a^'n^'n \<Rightarrow> bool)) ===> (=)) char_poly charpoly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
fix A :: "'a mat" and A' :: "'a^'n^'n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
assume [transfer_rule]: "HMA_M A A'"
[PROOF STATE]
proof (state)
this:
HMA_M A A'

goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
hence [simp]: "dim_row A = CARD('n)"
[PROOF STATE]
proof (prove)
using this:
HMA_M A A'

goal (1 subgoal):
 1. dim_row A = CARD('n)
[PROOF STEP]
by (simp add: HMA_M_def)
[PROOF STATE]
proof (state)
this:
dim_row A = CARD('n)

goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
have [simp]: "monom 1 (Suc 0) = [:0, 1 :: 'a :]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (1::'a) (Suc 0) = [:0::'a, 1::'a:]
[PROOF STEP]
by (simp add: monom_Suc)
[PROOF STATE]
proof (state)
this:
monom (1::'a) (Suc 0) = [:0::'a, 1::'a:]

goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
have [simp]: "map_mat uminus (map_mat (\<lambda>a. [:a:]) A) = map_mat (\<lambda>a. [:-a:]) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_mat uminus (map_mat (\<lambda>a. [:a:]) A) = map_mat (\<lambda>a. [:- a:]) A
[PROOF STEP]
by (rule eq_matI, auto)
[PROOF STATE]
proof (state)
this:
map_mat uminus (map_mat (\<lambda>a. [:a:]) A) = map_mat (\<lambda>a. [:- a:]) A

goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
have "char_poly A = charpoly A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A = charpoly A'
[PROOF STEP]
unfolding char_poly_def[abs_def] char_poly_matrix_def charpoly_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det ([:0::'a, 1::'a:] \<cdot>\<^sub>m 1\<^sub>m (dim_row A) + map_mat (\<lambda>a. [:- a:]) A) = det (mat (monom (1::'a) (Suc 0)) - mat2matofpoly A')
[PROOF STEP]
by (transfer, simp)
[PROOF STATE]
proof (state)
this:
char_poly A = charpoly A'

goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
HMA_M ?A2 ?A'2 \<Longrightarrow> char_poly ?A2 = charpoly ?A'2

goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
HMA_M ?A2 ?A'2 \<Longrightarrow> char_poly ?A2 = charpoly ?A'2

goal (1 subgoal):
 1. (HMA_M ===> (=)) char_poly charpoly
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(HMA_M ===> (=)) char_poly charpoly

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in dcharacter) sum_dcharacter_atMost_le:
  assumes "\<chi> \<noteq> principal_dchar n"
  shows   "norm (\<Sum>x\<le>m. \<chi> x) \<le> totient n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (sum \<chi> {..m}) \<le> real (totient n)
[PROOF STEP]
using sum_dcharacter_lessThan_le[OF assms, of "Suc m"]
[PROOF STATE]
proof (prove)
using this:
cmod (sum \<chi> {..<Suc m}) \<le> real (totient n)

goal (1 subgoal):
 1. cmod (sum \<chi> {..m}) \<le> real (totient n)
[PROOF STEP]
by (subst (asm) lessThan_Suc_atMost)


[STATEMENT]
lemma all_relative_to: "(\<forall>S. (P relative_to U) S \<longrightarrow> Q S) \<longleftrightarrow> (\<forall>S. P S \<longrightarrow> Q(U \<inter> S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>S. (P relative_to U) S \<longrightarrow> Q S) = (\<forall>S. P S \<longrightarrow> Q (U \<inter> S))
[PROOF STEP]
by (auto simp: relative_to_def)


[STATEMENT]
lemma [code abstract]: "list_of_oalist (oalist_of_list xs) = sort_oalist_ko xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_of_oalist (oalist_of_list xs) = sort_oalist_ko xs
[PROOF STEP]
by (simp add: list_of_oalist_OAlist oalist_of_list_def)


[STATEMENT]
lemma UNIV_unitary: "UNIV = {a::'a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = {a}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. UNIV = {a}
[PROOF STEP]
have "card(UNIV :: 'a set) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a) = 1
[PROOF STEP]
by (simp add: local.unitary_unit_pres)
[PROOF STATE]
proof (state)
this:
CARD('a) = 1

goal (1 subgoal):
 1. UNIV = {a}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
CARD('a) = 1

goal (1 subgoal):
 1. UNIV = {a}
[PROOF STEP]
by (metis (full_types) UNIV_I card_1_singletonE empty_iff insert_iff)
[PROOF STATE]
proof (state)
this:
UNIV = {a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mono_nn_integral: "mono F \<Longrightarrow> mono (\<lambda>x. integral\<^sup>N M (F x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono F \<Longrightarrow> mono (\<lambda>x. integral\<^sup>N M (F x))
[PROOF STEP]
by (auto simp add: mono_def le_fun_def intro!: nn_integral_mono)


[STATEMENT]
lemma cc_restr_ccApprox_below_iff: "cc_restr S (ccApprox t) \<sqsubseteq> G \<longleftrightarrow> (\<forall> xs \<in> paths t. cc_restr S (ccFromList xs) \<sqsubseteq> G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ccApprox t G|` S \<sqsubseteq> G) = (\<forall>xs\<in>paths t. ccFromList xs G|` S \<sqsubseteq> G)
[PROOF STEP]
unfolding ccApprox_paths cc_restr_lub
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lub (cc_restr S ` ccFromList ` paths t) \<sqsubseteq> G) = (\<forall>xs\<in>paths t. ccFromList xs G|` S \<sqsubseteq> G)
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma norm_of_real_add1 [simp]: "norm (of_real x + 1 :: 'a :: real_normed_div_algebra) = \<bar>x + 1\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_real x + (1::'a)) = \<bar>x + 1\<bar>
[PROOF STEP]
by (metis norm_of_real of_real_1 of_real_add)


[STATEMENT]
lemma list_of_pdevs_perm_filter_nonzero:
  "map snd (list_of_pdevs X) <~~> (filter ((\<noteq>) 0) (dense_list_of_pdevs X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
have zip_map:
    "zip [0..<degree X] (dense_list_of_pdevs X) = map (\<lambda>i. (i, pdevs_apply X i)) [0..<degree X]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip [0..<degree X] (dense_list_of_pdevs X) = map (\<lambda>i. (i, pdevs_apply X i)) [0..<degree X]
[PROOF STEP]
by (auto simp: dense_list_of_pdevs_def intro!: nth_equalityI)
[PROOF STATE]
proof (state)
this:
zip [0..<degree X] (dense_list_of_pdevs X) = map (\<lambda>i. (i, pdevs_apply X i)) [0..<degree X]

goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
have "rev (list_of_pdevs X) <~~>
      filter ((\<noteq>) 0 o snd) (zip [0..<degree X] (dense_list_of_pdevs X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (rev (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X)))
[PROOF STEP]
by (auto simp: list_of_pdevs_eq o_def zip_map)
[PROOF STATE]
proof (state)
this:
mset (rev (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X)))

goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
from map_permI[OF this, of snd]
[PROOF STATE]
proof (chain)
picking this:
mset (map snd (rev (list_of_pdevs X))) = mset (map snd (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))))
[PROOF STEP]
have "map snd (list_of_pdevs X) <~~>
      map snd (filter ((\<noteq>) 0 \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X)))"
[PROOF STATE]
proof (prove)
using this:
mset (map snd (rev (list_of_pdevs X))) = mset (map snd (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))))

goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (map snd (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))))
[PROOF STEP]
by (simp add: rev_map[symmetric] rev_perm)
[PROOF STATE]
proof (state)
this:
mset (map snd (list_of_pdevs X)) = mset (map snd (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))))

goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mset (map snd (list_of_pdevs X)) = mset (map snd (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))))

goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
have "map snd (filter ((\<noteq>) 0 \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))) =
      filter ((\<noteq>) 0) (dense_list_of_pdevs X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map snd (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))) = filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X)
[PROOF STEP]
using map_filter[of snd "(\<noteq>) 0" "(zip [0..<degree X] (dense_list_of_pdevs X))"]
[PROOF STATE]
proof (prove)
using this:
map snd (filter (\<lambda>x. (0::'a) \<noteq> snd x) (zip [0..<degree X] (dense_list_of_pdevs X))) = filter ((\<noteq>) (0::'a)) (map snd (zip [0..<degree X] (dense_list_of_pdevs X)))

goal (1 subgoal):
 1. map snd (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))) = filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X)
[PROOF STEP]
by (simp add: o_def dense_list_of_pdevs_def)
[PROOF STATE]
proof (state)
this:
map snd (filter ((\<noteq>) (0::'a) \<circ> snd) (zip [0..<degree X] (dense_list_of_pdevs X))) = filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X)

goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))

goal (1 subgoal):
 1. mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mset (map snd (list_of_pdevs X)) = mset (filter ((\<noteq>) (0::'a)) (dense_list_of_pdevs X))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fmdom_foldl_add: "fmdom (foldl (++\<^sub>f) m ns) = fmdom m |\<union>| ffUnion (fmdom |`| fset_of_list ns)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmdom (foldl (++\<^sub>f) m ns) = fmdom m |\<union>| ffUnion (fmdom |`| fset_of_list ns)
[PROOF STEP]
by (induction ns arbitrary: m) auto


[STATEMENT]
lemma uint64_finite : "finite (UNIV :: uint64 set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
unfolding uint64_UNIV
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (uint64_of_nat ` {..<2 ^ 64})
[PROOF STEP]
by simp


[STATEMENT]
lemma set_add_def':
  fixes G (structure)
  shows "H <+> K \<equiv> \<Union>h\<in>H. \<Union>k\<in>K. {h \<oplus> k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H <+> K \<equiv> \<Union>h\<in>H. \<Union>k\<in>K. {h \<oplus> k}
[PROOF STEP]
unfolding set_add_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union>h\<in>H. \<Union>k\<in>K. {h \<otimes>\<^bsub>add_monoid G\<^esub> k} \<equiv> \<Union>h\<in>H. \<Union>k\<in>K. {h \<oplus> k}
[PROOF STEP]
by simp


[STATEMENT]
lemma cospoly_Suc: "cospoly (Suc n) = (\<lambda>x. cospoly n x + cos_coeff n * x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cospoly (Suc n) = (\<lambda>x. cospoly n x + cos_coeff n * x ^ n)
[PROOF STEP]
by (simp add: cospoly_def)


[STATEMENT]
lemma is_monomial_setI: "(\<And>p. p \<in> A \<Longrightarrow> is_monomial p) \<Longrightarrow> is_monomial_set A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. p \<in> A \<Longrightarrow> is_monomial p) \<Longrightarrow> is_monomial_set A
[PROOF STEP]
by (simp add: is_monomial_set_def)


[STATEMENT]
lemma some_geodesic_segment_between_exists:
  "\<exists>f. \<forall> x y S. f x S y = f y S x
    \<and> (if (\<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S) then (geodesic_segment_between (f x S y) x y \<and> (f x S y \<subseteq> S))
        else f x S y = {x, y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
define g::"'a \<Rightarrow> 'a set \<Rightarrow> 'a \<Rightarrow> 'a set" where
    "g = (\<lambda>x S y. if (\<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S) then (SOME G. geodesic_segment_between G x y \<and> G \<subseteq> S) else {x, y})"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x S y. if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then SOME G. geodesic_segment_between G x y \<and> G \<subseteq> S else {x, y})

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
have g1: "geodesic_segment_between (g x S y) x y \<and> (g x S y \<subseteq> S)" if "\<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S" for x y S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between (g x S y) x y \<and> g x S y \<subseteq> S
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then SOME G. geodesic_segment_between G x y \<and> G \<subseteq> S else {x, y}) x y \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then SOME G. geodesic_segment_between G x y \<and> G \<subseteq> S else {x, y}) \<subseteq> S
[PROOF STEP]
using someI_ex[OF that]
[PROOF STATE]
proof (prove)
using this:
geodesic_segment_between (SOME xa. geodesic_segment_between xa x y \<and> xa \<subseteq> S) x y \<and> (SOME xa. geodesic_segment_between xa x y \<and> xa \<subseteq> S) \<subseteq> S

goal (1 subgoal):
 1. geodesic_segment_between (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then SOME G. geodesic_segment_between G x y \<and> G \<subseteq> S else {x, y}) x y \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then SOME G. geodesic_segment_between G x y \<and> G \<subseteq> S else {x, y}) \<subseteq> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> geodesic_segment_between (g ?x ?S ?y) ?x ?y \<and> g ?x ?S ?y \<subseteq> ?S

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
have g2: "g x S y = {x, y}" if "\<not>(\<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S)" for x y S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g x S y = {x, y}
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then SOME G. geodesic_segment_between G x y \<and> G \<subseteq> S else {x, y}) = {x, y}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<nexists>G. geodesic_segment_between G x y \<and> G \<subseteq> S

goal (1 subgoal):
 1. (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then SOME G. geodesic_segment_between G x y \<and> G \<subseteq> S else {x, y}) = {x, y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<nexists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> g ?x ?S ?y = {?x, ?y}

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
obtain r::"'a rel" where r: "well_order_on UNIV r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. well_order r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using well_order_on
[PROOF STATE]
proof (prove)
using this:
\<exists>r. well_order_on ?A r

goal (1 subgoal):
 1. (\<And>r. well_order r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
well_order r

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
have A: "x = y" if "(x, y) \<in> r" "(y, x) \<in> r" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using r that
[PROOF STATE]
proof (prove)
using this:
well_order r
(x, y) \<in> r
(y, x) \<in> r

goal (1 subgoal):
 1. x = y
[PROOF STEP]
unfolding well_order_on_def linear_order_on_def partial_order_on_def antisym_def
[PROOF STATE]
proof (prove)
using this:
((preorder_on UNIV r \<and> (\<forall>x y. (x, y) \<in> r \<longrightarrow> (y, x) \<in> r \<longrightarrow> x = y)) \<and> total r) \<and> wf (r - Id)
(x, y) \<in> r
(y, x) \<in> r

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?x, ?y) \<in> r; (?y, ?x) \<in> r\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
have B: "(x, y) \<in> r \<or> (y, x) \<in> r" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) \<in> r \<or> (y, x) \<in> r
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
well_order r

goal (1 subgoal):
 1. (x, y) \<in> r \<or> (y, x) \<in> r
[PROOF STEP]
unfolding well_order_on_def linear_order_on_def total_on_def partial_order_on_def preorder_on_def refl_on_def
[PROOF STATE]
proof (prove)
using this:
((((r \<subseteq> UNIV \<times> UNIV \<and> (\<forall>x\<in>UNIV. (x, x) \<in> r)) \<and> trans r) \<and> antisym r) \<and> (\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. x \<noteq> y \<longrightarrow> (x, y) \<in> r \<or> (y, x) \<in> r)) \<and> wf (r - Id)

goal (1 subgoal):
 1. (x, y) \<in> r \<or> (y, x) \<in> r
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(?x, ?y) \<in> r \<or> (?y, ?x) \<in> r

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
define f where "f = (\<lambda>x S y. if (x, y) \<in> r then g x S y else g y S x)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x S y. if (x, y) \<in> r then g x S y else g y S x)

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
have "f x S y = f y S x" for x y S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x S y = f y S x
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if (x, y) \<in> r then g x S y else g y S x) = (if (y, x) \<in> r then g y S x else g x S y)
[PROOF STEP]
using r A B
[PROOF STATE]
proof (prove)
using this:
well_order r
\<lbrakk>(?x, ?y) \<in> r; (?y, ?x) \<in> r\<rbrakk> \<Longrightarrow> ?x = ?y
(?x, ?y) \<in> r \<or> (?y, ?x) \<in> r

goal (1 subgoal):
 1. (if (x, y) \<in> r then g x S y else g y S x) = (if (y, x) \<in> r then g y S x else g x S y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ?x ?S ?y = f ?y ?S ?x

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f ?x ?S ?y = f ?y ?S ?x

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
have "geodesic_segment_between (f x S y) x y \<and> (f x S y \<subseteq> S)" if "\<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S" for x y S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between (if (x, y) \<in> r then g x S y else g y S x) x y \<and> (if (x, y) \<in> r then g x S y else g y S x) \<subseteq> S
[PROOF STEP]
using g1 geodesic_segment_commute that
[PROOF STATE]
proof (prove)
using this:
\<exists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> geodesic_segment_between (g ?x ?S ?y) ?x ?y \<and> g ?x ?S ?y \<subseteq> ?S
geodesic_segment_between ?G ?x ?y \<Longrightarrow> geodesic_segment_between ?G ?y ?x
\<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S

goal (1 subgoal):
 1. geodesic_segment_between (if (x, y) \<in> r then g x S y else g y S x) x y \<and> (if (x, y) \<in> r then g x S y else g y S x) \<subseteq> S
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
\<exists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> geodesic_segment_between (f ?x ?S ?y) ?x ?y \<and> f ?x ?S ?y \<subseteq> ?S

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> geodesic_segment_between (f ?x ?S ?y) ?x ?y \<and> f ?x ?S ?y \<subseteq> ?S

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
have "f x S y = {x, y}" if "\<not>(\<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S)" for x y S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x S y = {x, y}
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if (x, y) \<in> r then g x S y else g y S x) = {x, y}
[PROOF STEP]
using g2 that geodesic_segment_commute doubleton_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<nexists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> g ?x ?S ?y = {?x, ?y}
\<nexists>G. geodesic_segment_between G x y \<and> G \<subseteq> S
geodesic_segment_between ?G ?x ?y \<Longrightarrow> geodesic_segment_between ?G ?y ?x
({?a, ?b} = {?c, ?d}) = (?a = ?c \<and> ?b = ?d \<or> ?a = ?d \<and> ?b = ?c)

goal (1 subgoal):
 1. (if (x, y) \<in> r then g x S y else g y S x) = {x, y}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<nexists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> f ?x ?S ?y = {?x, ?y}

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f ?x ?S ?y = f ?y ?S ?x
\<exists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> geodesic_segment_between (f ?x ?S ?y) ?x ?y \<and> f ?x ?S ?y \<subseteq> ?S
\<nexists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> f ?x ?S ?y = {?x, ?y}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ?x ?S ?y = f ?y ?S ?x
\<exists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> geodesic_segment_between (f ?x ?S ?y) ?x ?y \<and> f ?x ?S ?y \<subseteq> ?S
\<nexists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> ?S \<Longrightarrow> f ?x ?S ?y = {?x, ?y}

goal (1 subgoal):
 1. \<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>f. \<forall>x y S. f x S y = f y S x \<and> (if \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S then geodesic_segment_between (f x S y) x y \<and> f x S y \<subseteq> S else f x S y = {x, y})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_lt_imp_ex_count_lt: "size M < size N \<Longrightarrow> \<exists>x \<in># N. count M x < count N x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size M < size N \<Longrightarrow> \<exists>x\<in>#N. count M x < count N x
[PROOF STEP]
by (metis count_eq_zero_iff leD not_le_imp_less not_less_zero size_mset_mono subseteq_mset_def)


[STATEMENT]
lemma octo_norm_cnj [simp]: "norm(cnj q) = norm q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (Octonions.cnj q) = norm q
[PROOF STEP]
by (simp add: norm_octo_def)


[STATEMENT]
lemma finite_imp_locally_finite_in:
   "\<lbrakk>finite \<A>; \<Union>\<A> \<subseteq> topspace X\<rbrakk> \<Longrightarrow> locally_finite_in X \<A>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite \<A>; \<Union> \<A> \<subseteq> topspace X\<rbrakk> \<Longrightarrow> locally_finite_in X \<A>
[PROOF STEP]
by (auto simp: locally_finite_in_def)


[STATEMENT]
lemma tendsto_sum [tendsto_intros]:
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::topological_comm_monoid_add"
  shows "(\<And>i. i \<in> I \<Longrightarrow> (f i \<longlongrightarrow> a i) F) \<Longrightarrow> ((\<lambda>x. \<Sum>i\<in>I. f i x) \<longlongrightarrow> (\<Sum>i\<in>I. a i)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> (f i \<longlongrightarrow> a i) F) \<Longrightarrow> ((\<lambda>x. \<Sum>i\<in>I. f i x) \<longlongrightarrow> sum a I) F
[PROOF STEP]
by (induct I rule: infinite_finite_induct) (simp_all add: tendsto_add)


[STATEMENT]
lemma fps_lcm_altdef: "lcm f g =
  (if f = 0 \<or> g = 0 then 0 else fps_X ^ max (subdegree f) (subdegree g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm f g = (if f = 0 \<or> g = 0 then 0 else fps_X ^ max (subdegree f) (subdegree g))
[PROOF STEP]
by (simp add: fps_lcm)


[STATEMENT]
lemma itop_sub_ttop [folded ttop_def itop_def]:
  fixes A and C and S (structure)
  defines "C \<equiv> \<Union>s\<in>A\<^sup>\<star>. {infsuff A s}" and "S \<equiv> topo C"
  fixes B and T (structure)
  defines "B \<equiv> \<Union>s\<in>A\<^sup>\<star>. {suff A s}" and "T \<equiv> topo B"
  shows "subtopology S T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology S T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtopology S T
[PROOF STEP]
interpret itrace_top A C S
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (C \<equiv> \<Union>s\<in>A\<^sup>\<star>. {infsuff A s}) &&& S \<equiv> topo C
[PROOF STEP]
by fact+
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtopology S T
[PROOF STEP]
interpret trace_top A B T
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B \<equiv> \<Union>s\<in>A\<^sup>\<star>. {suff A s}) &&& T \<equiv> topo B
[PROOF STEP]
by fact+
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtopology S T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology S T
[PROOF STEP]
by (auto intro: itop_sub_ttop_base [THEN subtop_lemma] simp: S_def T_def)
[PROOF STATE]
proof (state)
this:
subtopology S T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tree_enum_Leaf: "\<langle>\<rangle> \<in> set (tree_enum n) \<longleftrightarrow> (n = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<langle>\<rangle> \<in> set (tree_enum n)) = (n = 0)
[PROOF STEP]
by(cases n) auto


[STATEMENT]
lemma bitlen_mantissa_Float:
  shows "bitlen \<bar>mantissa (Float m e)\<bar> = (if m = 0 then 0 else bitlen \<bar>m\<bar> + e) - Float.exponent (Float m e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bitlen \<bar>mantissa (Float m e)\<bar> = (if m = 0 then 0 else bitlen \<bar>m\<bar> + e) - Float.exponent (Float m e)
[PROOF STEP]
using bitlen_Float[of m e]
[PROOF STATE]
proof (prove)
using this:
bitlen \<bar>mantissa (Float m e)\<bar> + Float.exponent (Float m e) = (if m = 0 then 0 else bitlen \<bar>m\<bar> + e)

goal (1 subgoal):
 1. bitlen \<bar>mantissa (Float m e)\<bar> = (if m = 0 then 0 else bitlen \<bar>m\<bar> + e) - Float.exponent (Float m e)
[PROOF STEP]
by auto


[STATEMENT]
theorem submonoid_transitive:
  assumes "submonoid K N composition unit"
    and "submonoid N M composition unit"
  shows "submonoid K M composition unit"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. submonoid K M composition unit
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. submonoid K M composition unit
[PROOF STEP]
interpret K: submonoid K N composition unit
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. submonoid K N composition unit
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. submonoid K M composition unit
[PROOF STEP]
interpret M: submonoid N M composition unit
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. submonoid N M composition unit
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. submonoid K M composition unit
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. submonoid K M composition unit
[PROOF STEP]
by unfold_locales auto
[PROOF STATE]
proof (state)
this:
submonoid K M composition unit

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma VWO_iff_Ord_le [simp]: "\<lbrakk>Ord \<alpha>; Ord \<beta>\<rbrakk> \<Longrightarrow> (\<beta>, \<alpha>) \<in> VWO \<longleftrightarrow> \<beta> \<le> \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ord \<alpha>; Ord \<beta>\<rbrakk> \<Longrightarrow> ((\<beta>, \<alpha>) \<in> VWO) = (\<beta> \<le> \<alpha>)
[PROOF STEP]
by (metis VWO_TC_le Ord_TC_less_iff le_TC_def le_TC_imp_VWO le_less)


[STATEMENT]
lemma splitting_permutation_case_2_unique:
  assumes "i \<le> l1"
  assumes "i \<le> y \<and> y < l2 + i"
  assumes "splitting_permutation l1 l2 i j = y"
  shows "j = y + l1 - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j = y + l1 - i
[PROOF STEP]
unfolding splitting_permutation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j = y + l1 - i
[PROOF STEP]
using assms(1) assms(2) assms(3) le_add_diff_inverse2 not_less_iff_gr_or_eq
        splitting_permutation_def trans_less_add2
[PROOF STATE]
proof (prove)
using this:
i \<le> l1
i \<le> y \<and> y < l2 + i
splitting_permutation l1 l2 i j = y
?b \<le> ?a \<Longrightarrow> ?a - ?b + ?b = ?a
(\<not> ?x < ?y) = (?y < ?x \<or> ?x = ?y)
splitting_permutation ?l1.0 ?l2.0 ?i ?j = (if ?j < ?i then ?j else if ?i \<le> ?j \<and> ?j < ?l1.0 then ?l2.0 + ?j else if ?j < ?l1.0 + ?l2.0 then ?j - ?l1.0 + ?i else ?j)
?i < ?j \<Longrightarrow> ?i < ?m + ?j

goal (1 subgoal):
 1. j = y + l1 - i
[PROOF STEP]
by auto


[STATEMENT]
lemma brnL_gt_0[simp]: "\<lbrakk>properL cl; 0 < n\<rbrakk> \<Longrightarrow> 0 < brnL cl n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>properL cl; 0 < n\<rbrakk> \<Longrightarrow> 0 < brnL cl n
[PROOF STEP]
by (metis properL_def brnL_mono brnL_mono2 le_0_eq length_greater_0_conv nat_le_linear neq0_conv)


[STATEMENT]
lemma sum_upto_ind: "sum_upto (ind P) x = of_nat (card {n. n > 0 \<and> real n \<le> x \<and> P n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})
[PROOF STEP]
have "sum_upto (ind P :: nat \<Rightarrow> 'a) x = (\<Sum>n | 0 < n \<and> real n \<le> x \<and> P n. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (ind P) x = (\<Sum>n | 0 < n \<and> real n \<le> x \<and> P n. (1::'a))
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (ind P) {i. 0 < i \<and> real i \<le> x} = (\<Sum>n | 0 < n \<and> real n \<le> x \<and> P n. (1::'a))
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) (auto simp: ind_def)
[PROOF STATE]
proof (state)
this:
sum_upto (ind P) x = (\<Sum>n | 0 < n \<and> real n \<le> x \<and> P n. (1::'a))

goal (1 subgoal):
 1. sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (ind P) x = (\<Sum>n | 0 < n \<and> real n \<le> x \<and> P n. (1::'a))

goal (1 subgoal):
 1. sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})
[PROOF STEP]
have "\<dots> = of_nat (card {n. n > 0 \<and> real n \<le> x \<and> P n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n | 0 < n \<and> real n \<le> x \<and> P n. (1::'a)) = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n | 0 < n \<and> real n \<le> x \<and> P n. (1::'a)) = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})

goal (1 subgoal):
 1. sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})

goal (1 subgoal):
 1. sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_upto (ind P) x = of_nat (card {n. 0 < n \<and> real n \<le> x \<and> P n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma connected_inV_iff: "\<lbrakk>connected u v\<rbrakk> \<Longrightarrow> v\<in>V \<longleftrightarrow> u\<in>V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected u v \<Longrightarrow> (v \<in> V) = (u \<in> V)
[PROOF STEP]
apply (auto simp: connected_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>p. \<lbrakk>isPath u p v; v \<in> V\<rbrakk> \<Longrightarrow> u \<in> V
 2. \<And>p. \<lbrakk>isPath u p v; u \<in> V\<rbrakk> \<Longrightarrow> v \<in> V
[PROOF STEP]
apply (case_tac p; auto simp: V_def) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>isPath u p v; u \<in> V\<rbrakk> \<Longrightarrow> v \<in> V
[PROOF STEP]
apply (case_tac p rule: rev_cases; auto simp: isPath_append V_def) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma T2_axiomsI:
  fixes T (structure)
  shows
  "(\<And>x y. \<lbrakk> x \<in> carrier; y \<in> carrier; x \<noteq> y \<rbrakk> \<Longrightarrow>
           \<exists> u \<in> nhds x. \<exists> v \<in> nhds y. u \<inter> v = {})
   \<Longrightarrow> T2_axioms T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> carrier; y \<in> carrier; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>u\<in>nhds x. \<exists>v\<in>nhds y. u \<inter> v = {}) \<Longrightarrow> T2_axioms T
[PROOF STEP]
by (auto simp: T2_axioms_def)


[STATEMENT]
lemma take_stake: "take n (stake m s) = stake (min n m) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n (stake m s) = stake (min n m) s
[PROOF STEP]
proof (induct m arbitrary: s n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s n. take n (stake 0 s) = stake (min n 0) s
 2. \<And>m s n. (\<And>s n. take n (stake m s) = stake (min n m) s) \<Longrightarrow> take n (stake (Suc m) s) = stake (min n (Suc m)) s
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
take ?n (stake m ?s) = stake (min ?n m) ?s

goal (2 subgoals):
 1. \<And>s n. take n (stake 0 s) = stake (min n 0) s
 2. \<And>m s n. (\<And>s n. take n (stake m s) = stake (min n m) s) \<Longrightarrow> take n (stake (Suc m) s) = stake (min n (Suc m)) s
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
take ?n (stake m ?s) = stake (min ?n m) ?s

goal (1 subgoal):
 1. take n (stake (Suc m) s) = stake (min n (Suc m)) s
[PROOF STEP]
by (cases n) auto
[PROOF STATE]
proof (state)
this:
take n (stake (Suc m) s) = stake (min n (Suc m)) s

goal (1 subgoal):
 1. \<And>s n. take n (stake 0 s) = stake (min n 0) s
[PROOF STEP]
qed simp


[STATEMENT]
lemma Pring_subtract:
  assumes "a \<in> carrier (Pring R I)"
  shows "P_ring_uminus R a \<oplus>\<^bsub>Pring R I\<^esub> a = \<zero>\<^bsub>Pring R I\<^esub>"
        "a \<oplus>\<^bsub>Pring R I\<^esub> P_ring_uminus R a = \<zero>\<^bsub>Pring R I\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_ring_uminus R a \<oplus>\<^bsub>Pring R I\<^esub> a = \<zero>\<^bsub>Pring R I\<^esub> &&& a \<oplus>\<^bsub>Pring R I\<^esub> P_ring_uminus R a = \<zero>\<^bsub>Pring R I\<^esub>
[PROOF STEP]
using assms Pring_add[of I "P_ring_uminus R a " a] Pring_zero[of I]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Pring R I)
P_ring_uminus R a \<oplus>\<^bsub>Pring R I\<^esub> a = P_ring_uminus R a \<Oplus> a
\<zero>\<^bsub>Pring R I\<^esub> = indexed_const \<zero>

goal (1 subgoal):
 1. P_ring_uminus R a \<oplus>\<^bsub>Pring R I\<^esub> a = \<zero>\<^bsub>Pring R I\<^esub> &&& a \<oplus>\<^bsub>Pring R I\<^esub> P_ring_uminus R a = \<zero>\<^bsub>Pring R I\<^esub>
[PROOF STEP]
apply  (simp add: Pring_car local.ring_axioms ring.P_ring_uminus_add)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<oplus>\<^bsub>Pring R I\<^esub> P_ring_uminus R a = \<zero>\<^bsub>Pring R I\<^esub>
[PROOF STEP]
using assms Pring_add[of I "P_ring_uminus R a " a] Pring_zero[of I]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Pring R I)
P_ring_uminus R a \<oplus>\<^bsub>Pring R I\<^esub> a = P_ring_uminus R a \<Oplus> a
\<zero>\<^bsub>Pring R I\<^esub> = indexed_const \<zero>

goal (1 subgoal):
 1. a \<oplus>\<^bsub>Pring R I\<^esub> P_ring_uminus R a = \<zero>\<^bsub>Pring R I\<^esub>
[PROOF STEP]
by (metis P_ring_uminus_add P_ring_uminus_closed Pring_add_comm Pring_car)


[STATEMENT]
lemma eval_Mn_diverg:
  assumes "recfn (length xs) (Mn n f)"
  shows "\<not> (\<exists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>)) \<longleftrightarrow> eval (Mn n f) xs \<up>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>)) = (eval (Mn n f) xs \<up>)
[PROOF STEP]
using assms eval_Mn[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
recfn (length xs) (Mn n f)
eval (Mn n f) xs = (if \<exists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>) then Some (LEAST z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>)) else None)

goal (1 subgoal):
 1. (\<nexists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>)) = (eval (Mn n f) xs \<up>)
[PROOF STEP]
by simp


[STATEMENT]
lemma cball_eq_empty [simp]: "cball x e = {} \<longleftrightarrow> e < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cball x e = {}) = (e < 0)
[PROOF STEP]
apply (simp add: set_eq_iff not_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>xa. e < dist x xa) = (e < 0)
[PROOF STEP]
apply (metis zero_le_dist dist_self order_less_le_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filtermap_ln_at_top: "filtermap (ln :: real \<Rightarrow> real) at_top = at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap ln at_top = at_top
[PROOF STEP]
by (simp add: filter_eq_iff eventually_filtermap eventually_ln_at_top)