[STATEMENT]
lemma divide_option_mpoly_poly:
  fixes p q :: "'a :: idom_divide mpoly poly"
  shows "p div? q =
            (if p = 0 then Some 0
            else if q = 0 then None
            else let dp = Polynomial.degree p; dq = Polynomial.degree q
                 in  if dp < dq then None
                     else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of
                            None \<Rightarrow> None
                          | Some c \<Rightarrow> (
                              case (p - Polynomial.monom c (dp - dq) * q) div? q of
                                None \<Rightarrow> None
                              | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r)))"
  (is "_ = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
proof (cases "p = 0"; cases "q = 0")
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<lbrakk>p = 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<lbrakk>p = 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 3. \<lbrakk>p \<noteq> 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 4. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
assume [simp]: "p \<noteq> 0" "q \<noteq> 0"
[PROOF STATE]
proof (state)
this:
p \<noteq> 0
q \<noteq> 0

goal (4 subgoals):
 1. \<lbrakk>p = 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<lbrakk>p = 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 3. \<lbrakk>p \<noteq> 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 4. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
define dp where "dp = Polynomial.degree p"
[PROOF STATE]
proof (state)
this:
dp = Polynomial.degree p

goal (4 subgoals):
 1. \<lbrakk>p = 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<lbrakk>p = 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 3. \<lbrakk>p \<noteq> 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 4. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
define dq where "dq = Polynomial.degree q"
[PROOF STATE]
proof (state)
this:
dq = Polynomial.degree q

goal (4 subgoals):
 1. \<lbrakk>p = 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<lbrakk>p = 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 3. \<lbrakk>p \<noteq> 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 4. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
define cp where "cp = Polynomial.lead_coeff p"
[PROOF STATE]
proof (state)
this:
cp = Polynomial.lead_coeff p

goal (4 subgoals):
 1. \<lbrakk>p = 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<lbrakk>p = 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 3. \<lbrakk>p \<noteq> 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 4. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
define cq where "cq = Polynomial.lead_coeff q"
[PROOF STATE]
proof (state)
this:
cq = Polynomial.lead_coeff q

goal (4 subgoals):
 1. \<lbrakk>p = 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<lbrakk>p = 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 3. \<lbrakk>p \<noteq> 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 4. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
define mon where "mon = Polynomial.monom (cp div cq) (dp - dq)"
[PROOF STATE]
proof (state)
this:
mon = Polynomial.monom (cp div cq) (dp - dq)

goal (4 subgoals):
 1. \<lbrakk>p = 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<lbrakk>p = 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 3. \<lbrakk>p \<noteq> 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 4. \<lbrakk>p \<noteq> 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
proof (cases "dp < dq")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
dp < dq

goal (2 subgoals):
 1. dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
hence "\<not>q dvd p"
[PROOF STATE]
proof (prove)
using this:
dp < dq

goal (1 subgoal):
 1. \<not> q dvd p
[PROOF STEP]
unfolding dp_def dq_def
[PROOF STATE]
proof (prove)
using this:
Polynomial.degree p < Polynomial.degree q

goal (1 subgoal):
 1. \<not> q dvd p
[PROOF STEP]
by (meson \<open>p \<noteq> 0\<close> divides_degree leD)
[PROOF STATE]
proof (state)
this:
\<not> q dvd p

goal (2 subgoals):
 1. dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> q dvd p

goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
\<not> q dvd p
dp < dq

goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
by (simp add: divide_option_def dp_def dq_def)
[PROOF STATE]
proof (state)
this:
p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))

goal (1 subgoal):
 1. \<not> dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
case deg: False
[PROOF STATE]
proof (state)
this:
\<not> dp < dq

goal (1 subgoal):
 1. \<not> dp < dq \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
proof (cases "cq dvd cp")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> cq dvd cp

goal (2 subgoals):
 1. cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
hence "\<not>q dvd p"
[PROOF STATE]
proof (prove)
using this:
\<not> cq dvd cp

goal (1 subgoal):
 1. \<not> q dvd p
[PROOF STEP]
unfolding cq_def cp_def
[PROOF STATE]
proof (prove)
using this:
\<not> Polynomial.lead_coeff q dvd Polynomial.lead_coeff p

goal (1 subgoal):
 1. \<not> q dvd p
[PROOF STEP]
using poly_lead_coeff_dvd_lead_coeff
[PROOF STATE]
proof (prove)
using this:
\<not> Polynomial.lead_coeff q dvd Polynomial.lead_coeff p
?p dvd ?q \<Longrightarrow> Polynomial.lead_coeff ?p dvd Polynomial.lead_coeff ?q

goal (1 subgoal):
 1. \<not> q dvd p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> q dvd p

goal (2 subgoals):
 1. cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> q dvd p

goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
using deg False
[PROOF STATE]
proof (prove)
using this:
\<not> q dvd p
\<not> dp < dq
\<not> cq dvd cp

goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
by (simp add: dp_def dq_def Let_def divide_option_def cp_def cq_def)
[PROOF STATE]
proof (state)
this:
p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))

goal (1 subgoal):
 1. cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
case dvd1: True
[PROOF STATE]
proof (state)
this:
cq dvd cp

goal (1 subgoal):
 1. cq dvd cp \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
proof (cases "q dvd (p - mon * q)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> q dvd p - mon * q

goal (2 subgoals):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
hence "\<not>q dvd p"
[PROOF STATE]
proof (prove)
using this:
\<not> q dvd p - mon * q

goal (1 subgoal):
 1. \<not> q dvd p
[PROOF STEP]
by (meson dvd_diff dvd_triv_right)
[PROOF STATE]
proof (state)
this:
\<not> q dvd p

goal (2 subgoals):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<not> q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> q dvd p

goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
using deg dvd1 False
[PROOF STATE]
proof (prove)
using this:
\<not> q dvd p
\<not> dp < dq
cq dvd cp
\<not> q dvd p - mon * q

goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
by (simp add: dp_def dq_def Let_def divide_option_def cp_def cq_def mon_def)
[PROOF STATE]
proof (state)
this:
p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))

goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
case dvd2: True
[PROOF STATE]
proof (state)
this:
q dvd p - mon * q

goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
hence "q dvd p"
[PROOF STATE]
proof (prove)
using this:
q dvd p - mon * q

goal (1 subgoal):
 1. q dvd p
[PROOF STEP]
by (metis diff_eq_eq dvd_add dvd_triv_right)
[PROOF STATE]
proof (state)
this:
q dvd p

goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
have "?rhs = Some (mon + (p - mon * q) div q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r)) = Some (mon + (p - mon * q) div q)
[PROOF STEP]
using deg dvd1 dvd2
[PROOF STATE]
proof (prove)
using this:
\<not> dp < dq
cq dvd cp
q dvd p - mon * q

goal (1 subgoal):
 1. (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r)) = Some (mon + (p - mon * q) div q)
[PROOF STEP]
by (simp add: dp_def dq_def Let_def divide_option_def cp_def cq_def mon_def)
[PROOF STATE]
proof (state)
this:
(if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r)) = Some (mon + (p - mon * q) div q)

goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r)) = Some (mon + (p - mon * q) div q)

goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
have "mon + (p - mon * q) div q = p div q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mon + (p - mon * q) div q = p div q
[PROOF STEP]
using dvd2
[PROOF STATE]
proof (prove)
using this:
q dvd p - mon * q

goal (1 subgoal):
 1. mon + (p - mon * q) div q = p div q
[PROOF STEP]
by (elim dvdE) (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
mon + (p - mon * q) div q = p div q

goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mon + (p - mon * q) div q = p div q

goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
have "Some \<dots> = p div? q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Some (p div q) = p div? q
[PROOF STEP]
using \<open>q dvd p\<close>
[PROOF STATE]
proof (prove)
using this:
q dvd p

goal (1 subgoal):
 1. Some (p div q) = p div? q
[PROOF STEP]
by (simp add: divide_option_def)
[PROOF STATE]
proof (state)
this:
Some (p div q) = p div? q

goal (1 subgoal):
 1. q dvd p - mon * q \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r)) = p div? q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r)) = p div? q

goal (1 subgoal):
 1. p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))

goal (3 subgoals):
 1. \<lbrakk>p = 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 2. \<lbrakk>p = 0; q \<noteq> 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
 3. \<lbrakk>p \<noteq> 0; q = 0\<rbrakk> \<Longrightarrow> p div? q = (if p = 0 then Some 0 else if q = 0 then None else let dp = Polynomial.degree p; dq = Polynomial.degree q in if dp < dq then None else case Polynomial.lead_coeff p div? Polynomial.lead_coeff q of None \<Rightarrow> None | Some c \<Rightarrow> case (p - Polynomial.monom c (dp - dq) * q) div? q of None \<Rightarrow> None | Some r \<Rightarrow> Some (Polynomial.monom c (dp - dq) + r))
[PROOF STEP]
qed (auto simp: divide_option_def)


[STATEMENT]
lemma lim_null_mult_left_bounded:
  fixes f :: "'a \<Rightarrow> 'b::real_normed_div_algebra"
  assumes g: "eventually (\<lambda>x. norm(g x) \<le> B) F" and f: "(f \<longlongrightarrow> 0) F"
    shows "((\<lambda>z. g z * f z) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. g z * f z) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>z. g z * f z) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
have "((\<lambda>x. norm (g x) * norm (f x)) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. norm (g x) * norm (f x)) \<longlongrightarrow> 0) F
[PROOF STEP]
proof (rule Lim_null_comparison)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. norm (norm (g x) * norm (f x)) \<le> ?g x
 2. (?g \<longlongrightarrow> 0) F
[PROOF STEP]
show "\<forall>\<^sub>F x in F. norm (norm (g x) * norm (f x)) \<le> B * norm (f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm (norm (g x) * norm (f x)) \<le> B * norm (f x)
[PROOF STEP]
by (simp add: eventually_mono [OF g] mult_right_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. norm (norm (g x) * norm (f x)) \<le> B * norm (f x)

goal (1 subgoal):
 1. ((\<lambda>x. B * norm (f x)) \<longlongrightarrow> 0) F
[PROOF STEP]
show "((\<lambda>x. B * norm (f x)) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. B * norm (f x)) \<longlongrightarrow> 0) F
[PROOF STEP]
by (simp add: f tendsto_mult_right_zero tendsto_norm_zero)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. B * norm (f x)) \<longlongrightarrow> 0) F

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. norm (g x) * norm (f x)) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>z. g z * f z) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. norm (g x) * norm (f x)) \<longlongrightarrow> 0) F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. norm (g x) * norm (f x)) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>z. g z * f z) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
by (subst tendsto_norm_zero_iff [symmetric]) (simp add: norm_mult)
[PROOF STATE]
proof (state)
this:
((\<lambda>z. g z * f z) \<longlongrightarrow> (0::'b)) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inv_fun_plus [simp]:
  "\<lbrakk>inv (f1 :: nat \<Rightarrow> 'a::monoid_add); inv f2\<rbrakk> \<Longrightarrow> inv (fun_plus f1 f2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Abstract_Linear_Poly.inv f1; Abstract_Linear_Poly.inv f2\<rbrakk> \<Longrightarrow> Abstract_Linear_Poly.inv (fun_plus f1 f2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>Abstract_Linear_Poly.inv f1; Abstract_Linear_Poly.inv f2\<rbrakk> \<Longrightarrow> Abstract_Linear_Poly.inv (fun_plus f1 f2)
[PROOF STEP]
have *: "{v. f1 v + f2 v \<noteq> (0 :: 'a)} \<subseteq> {v. f1 v \<noteq> (0 :: 'a)} \<union> {v. f2 v \<noteq> (0 :: 'a)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {v. f1 v + f2 v \<noteq> (0::'a)} \<subseteq> {v. f1 v \<noteq> (0::'a)} \<union> {v. f2 v \<noteq> (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{v. f1 v + f2 v \<noteq> (0::'a)} \<subseteq> {v. f1 v \<noteq> (0::'a)} \<union> {v. f2 v \<noteq> (0::'a)}

goal (1 subgoal):
 1. \<lbrakk>Abstract_Linear_Poly.inv f1; Abstract_Linear_Poly.inv f2\<rbrakk> \<Longrightarrow> Abstract_Linear_Poly.inv (fun_plus f1 f2)
[PROOF STEP]
assume "inv f1" "inv f2"
[PROOF STATE]
proof (state)
this:
Abstract_Linear_Poly.inv f1
Abstract_Linear_Poly.inv f2

goal (1 subgoal):
 1. \<lbrakk>Abstract_Linear_Poly.inv f1; Abstract_Linear_Poly.inv f2\<rbrakk> \<Longrightarrow> Abstract_Linear_Poly.inv (fun_plus f1 f2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Abstract_Linear_Poly.inv f1
Abstract_Linear_Poly.inv f2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Abstract_Linear_Poly.inv f1
Abstract_Linear_Poly.inv f2

goal (1 subgoal):
 1. Abstract_Linear_Poly.inv (fun_plus f1 f2)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
Abstract_Linear_Poly.inv f1
Abstract_Linear_Poly.inv f2
{v. f1 v + f2 v \<noteq> (0::'a)} \<subseteq> {v. f1 v \<noteq> (0::'a)} \<union> {v. f2 v \<noteq> (0::'a)}

goal (1 subgoal):
 1. Abstract_Linear_Poly.inv (fun_plus f1 f2)
[PROOF STEP]
by (auto simp add: finite_subset)
[PROOF STATE]
proof (state)
this:
Abstract_Linear_Poly.inv (fun_plus f1 f2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma evenperm_comp:
  assumes "permutation p" "permutation q"
  shows "evenperm (p \<circ> q) \<longleftrightarrow> evenperm p = evenperm q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evenperm (p \<circ> q) = (evenperm p = evenperm q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. evenperm (p \<circ> q) = (evenperm p = evenperm q)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
permutation p
permutation q
[PROOF STEP]
obtain n m where n: "swapidseq n p" and m: "swapidseq m q"
[PROOF STATE]
proof (prove)
using this:
permutation p
permutation q

goal (1 subgoal):
 1. (\<And>n m. \<lbrakk>swapidseq n p; swapidseq m q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding permutation_def
[PROOF STATE]
proof (prove)
using this:
\<exists>n. swapidseq n p
\<exists>n. swapidseq n q

goal (1 subgoal):
 1. (\<And>n m. \<lbrakk>swapidseq n p; swapidseq m q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
swapidseq n p
swapidseq m q

goal (1 subgoal):
 1. evenperm (p \<circ> q) = (evenperm p = evenperm q)
[PROOF STEP]
have "even (n + m) \<longleftrightarrow> (even n \<longleftrightarrow> even m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (n + m) = (even n = even m)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
even (n + m) = (even n = even m)

goal (1 subgoal):
 1. evenperm (p \<circ> q) = (evenperm p = evenperm q)
[PROOF STEP]
from evenperm_unique[OF n refl] evenperm_unique[OF m refl]
    and evenperm_unique[OF swapidseq_comp_add[OF n m] this]
[PROOF STATE]
proof (chain)
picking this:
evenperm p = even n
evenperm q = even m
evenperm (p \<circ> q) = (even n = even m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
evenperm p = even n
evenperm q = even m
evenperm (p \<circ> q) = (even n = even m)

goal (1 subgoal):
 1. evenperm (p \<circ> q) = (evenperm p = evenperm q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
evenperm (p \<circ> q) = (evenperm p = evenperm q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_connectedin_Un:
   "\<lbrakk>path_connectedin X S; path_connectedin X T; S \<inter> T \<noteq> {}\<rbrakk>
    \<Longrightarrow> path_connectedin X (S \<union> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path_connectedin X S; path_connectedin X T; S \<inter> T \<noteq> {}\<rbrakk> \<Longrightarrow> path_connectedin X (S \<union> T)
[PROOF STEP]
by (blast intro: path_connectedin_Union [of "{S,T}", simplified])


[STATEMENT]
lemma aff_dim_sums_Int_0:
  assumes "affine S"
      and "affine T"
      and "0 \<in> S" "0 \<in> T"
    shows "aff_dim {x + y| x y. x \<in> S \<and> y \<in> T} = (aff_dim S + aff_dim T) - aff_dim(S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim {x + y |x y. x \<in> S \<and> y \<in> T} = aff_dim S + aff_dim T - aff_dim (S \<inter> T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim {x + y |x y. x \<in> S \<and> y \<in> T} = aff_dim S + aff_dim T - aff_dim (S \<inter> T)
[PROOF STEP]
have "0 \<in> {x + y |x y. x \<in> S \<and> y \<in> T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<in> {x + y |x y. x \<in> S \<and> y \<in> T}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
affine S
affine T
(0::'a) \<in> S
(0::'a) \<in> T

goal (1 subgoal):
 1. (0::'a) \<in> {x + y |x y. x \<in> S \<and> y \<in> T}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(0::'a) \<in> {x + y |x y. x \<in> S \<and> y \<in> T}

goal (1 subgoal):
 1. aff_dim {x + y |x y. x \<in> S \<and> y \<in> T} = aff_dim S + aff_dim T - aff_dim (S \<inter> T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<in> {x + y |x y. x \<in> S \<and> y \<in> T}
[PROOF STEP]
have 0: "0 \<in> affine hull {x + y |x y. x \<in> S \<and> y \<in> T}"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<in> {x + y |x y. x \<in> S \<and> y \<in> T}

goal (1 subgoal):
 1. (0::'a) \<in> affine hull {x + y |x y. x \<in> S \<and> y \<in> T}
[PROOF STEP]
by (metis (lifting) hull_inc)
[PROOF STATE]
proof (state)
this:
(0::'a) \<in> affine hull {x + y |x y. x \<in> S \<and> y \<in> T}

goal (1 subgoal):
 1. aff_dim {x + y |x y. x \<in> S \<and> y \<in> T} = aff_dim S + aff_dim T - aff_dim (S \<inter> T)
[PROOF STEP]
have sub: "subspace S"  "subspace T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace S &&& subspace T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
affine S
affine T
(0::'a) \<in> S
(0::'a) \<in> T

goal (1 subgoal):
 1. subspace S &&& subspace T
[PROOF STEP]
by (auto simp: subspace_affine)
[PROOF STATE]
proof (state)
this:
subspace S
subspace T

goal (1 subgoal):
 1. aff_dim {x + y |x y. x \<in> S \<and> y \<in> T} = aff_dim S + aff_dim T - aff_dim (S \<inter> T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim {x + y |x y. x \<in> S \<and> y \<in> T} = aff_dim S + aff_dim T - aff_dim (S \<inter> T)
[PROOF STEP]
using dim_sums_Int [OF sub]
[PROOF STATE]
proof (prove)
using this:
dim {x + y |x y. x \<in> S \<and> y \<in> T} + dim (S \<inter> T) = dim S + dim T

goal (1 subgoal):
 1. aff_dim {x + y |x y. x \<in> S \<and> y \<in> T} = aff_dim S + aff_dim T - aff_dim (S \<inter> T)
[PROOF STEP]
by (simp add: aff_dim_zero assms 0 hull_inc)
[PROOF STATE]
proof (state)
this:
aff_dim {x + y |x y. x \<in> S \<and> y \<in> T} = aff_dim S + aff_dim T - aff_dim (S \<inter> T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_UN_disjoint':
  assumes "disjoint_family_on A I" "\<And>i. i \<in> I \<Longrightarrow> finite (A i)" "finite I"
  shows "card (\<Union>i\<in>I. A i) = (\<Sum>i\<in>I. card (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union> (A ` I)) = (\<Sum>i\<in>I. card (A i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
disjoint_family_on A I
?i \<in> I \<Longrightarrow> finite (A ?i)
finite I

goal (1 subgoal):
 1. card (\<Union> (A ` I)) = (\<Sum>i\<in>I. card (A i))
[PROOF STEP]
by (simp add: card_UN_disjoint disjoint_family_on_def)


[STATEMENT]
lemma floor_log_nat_eq_powr_iff: fixes b n k :: nat
  shows "\<lbrakk> b \<ge> 2; k > 0 \<rbrakk> \<Longrightarrow>
  floor (log b (real k)) = n \<longleftrightarrow> b^n \<le> k \<and> k < b^(n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>2 \<le> b; 0 < k\<rbrakk> \<Longrightarrow> (\<lfloor>log (real b) (real k)\<rfloor> = int n) = (b ^ n \<le> k \<and> k < b ^ (n + 1))
[PROOF STEP]
by (auto simp: floor_log_eq_powr_iff powr_add powr_realpow
               of_nat_power[symmetric] of_nat_mult[symmetric] ac_simps
         simp del: of_nat_power of_nat_mult)


[STATEMENT]
lemma construct_NofI_prop_R:
  fixes p:: "real poly"
  fixes I1:: "real poly list"
  fixes I2:: "real poly list"
  assumes nonzero: "p\<noteq>0"
  shows "construct_NofI_R p I1 I2 =
    rat_of_int (int (card {x. poly p x = 0 \<and> (\<forall>q \<in> set I1. poly q x = 0) \<and> poly (prod_list I2) x > 0}) -
    int (card {x. poly p x = 0  \<and> (\<forall>q \<in> set I1. poly q x = 0) \<and> poly (prod_list I2) x < 0}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. construct_NofI_R p I1 I2 = rat_of_int (int (card {x. poly p x = 0 \<and> (\<forall>q\<in>set I1. poly q x = 0) \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly p x = 0 \<and> (\<forall>q\<in>set I1. poly q x = 0) \<and> poly (prod_list I2) x < 0}))
[PROOF STEP]
unfolding construct_NofI_R_prop_helper[OF nonzero]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0})) = rat_of_int (int (card {x. poly p x = 0 \<and> (\<forall>q\<in>set I1. poly q x = 0) \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly p x = 0 \<and> (\<forall>q\<in>set I1. poly q x = 0) \<and> poly (prod_list I2) x < 0}))
[PROOF STEP]
using zer_iff
[PROOF STATE]
proof (prove)
using this:
(poly (sum_list (map power2 ?ls)) ?x = 0) = (\<forall>i\<in>set ?ls. poly i ?x = 0)

goal (1 subgoal):
 1. rat_of_int (int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly (sum_list (map power2 (p # I1))) x = 0 \<and> poly (prod_list I2) x < 0})) = rat_of_int (int (card {x. poly p x = 0 \<and> (\<forall>q\<in>set I1. poly q x = 0) \<and> 0 < poly (prod_list I2) x}) - int (card {x. poly p x = 0 \<and> (\<forall>q\<in>set I1. poly q x = 0) \<and> poly (prod_list I2) x < 0}))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>ls x. (poly (sum_list (map power2 ls)) x = 0) = (\<forall>i\<in>set ls. poly i x = 0)) \<Longrightarrow> rat_of_nat (card {x. (poly p x)\<^sup>2 + poly (sum_list (map power2 I1)) x = 0 \<and> 0 < poly (prod_list I2) x}) - rat_of_nat (card {x. (poly p x)\<^sup>2 + poly (sum_list (map power2 I1)) x = 0 \<and> poly (prod_list I2) x < 0}) = rat_of_nat (card {x. poly p x = 0 \<and> (\<forall>q\<in>set I1. poly q x = 0) \<and> 0 < poly (prod_list I2) x}) - rat_of_nat (card {x. poly p x = 0 \<and> (\<forall>q\<in>set I1. poly q x = 0) \<and> poly (prod_list I2) x < 0})
[PROOF STEP]
by (smt (verit, del_insts) Collect_cong sum_list_map_power2_poly zero_le_power2 zero_less_power2)


[STATEMENT]
lemma log2_at_1: "log2 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
let ?v = "log2 1"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
have S1: "0 \<le> ?v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> log2 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> log2 1

goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
have S2: "?v = Least(%(z::nat). (1::nat)<2^(z+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log2 1 = (LEAST z. 1 < 2 ^ (z + 1))
[PROOF STEP]
by (simp add: log2_def)
[PROOF STATE]
proof (state)
this:
log2 1 = (LEAST z. 1 < 2 ^ (z + 1))

goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
have S3: "(1::nat)<2^(0+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < 2 ^ (0 + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < 2 ^ (0 + 1)

goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
from S3
[PROOF STATE]
proof (chain)
picking this:
1 < 2 ^ (0 + 1)
[PROOF STEP]
have S4: "Least(%(z::nat). (1::nat)<2^(z+1)) \<le> 0"
[PROOF STATE]
proof (prove)
using this:
1 < 2 ^ (0 + 1)

goal (1 subgoal):
 1. (LEAST z. 1 < 2 ^ (z + 1)) \<le> 0
[PROOF STEP]
by (rule Least_le)
[PROOF STATE]
proof (state)
this:
(LEAST z. 1 < 2 ^ (z + 1)) \<le> 0

goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
from S2 S4
[PROOF STATE]
proof (chain)
picking this:
log2 1 = (LEAST z. 1 < 2 ^ (z + 1))
(LEAST z. 1 < 2 ^ (z + 1)) \<le> 0
[PROOF STEP]
have S5: "?v \<le> 0"
[PROOF STATE]
proof (prove)
using this:
log2 1 = (LEAST z. 1 < 2 ^ (z + 1))
(LEAST z. 1 < 2 ^ (z + 1)) \<le> 0

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

goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
from S1 S5
[PROOF STATE]
proof (chain)
picking this:
0 \<le> log2 1
log2 1 \<le> 0
[PROOF STEP]
have S6: "?v = 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> log2 1
log2 1 \<le> 0

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

goal (1 subgoal):
 1. log2 1 = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
log2 1 = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equal_div_mod:assumes "((j::nat) div a) = (i div a)"
            and "(j mod a) = (i mod a)"
        shows "j = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j = i
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. j = i
[PROOF STEP]
have "j = a*(j div a) + (j mod a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j = a *n j div a + j mod a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j = a *n j div a + j mod a

goal (1 subgoal):
 1. j = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j = a *n j div a + j mod a
[PROOF STEP]
have "j = a*(i div a) + (i mod a)"
[PROOF STATE]
proof (prove)
using this:
j = a *n j div a + j mod a

goal (1 subgoal):
 1. j = a *n i div a + i mod a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j = a *n j div a + j mod a
j div a = i div a
j mod a = i mod a

goal (1 subgoal):
 1. j = a *n i div a + i mod a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j = a *n i div a + i mod a

goal (1 subgoal):
 1. j = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j = a *n i div a + i mod a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
j = a *n i div a + i mod a

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ket_1_norm:
  shows "\<parallel>ket_1\<parallel> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>ket_1\<parallel> = 1
[PROOF STEP]
using unit_cpx_vec_length
[PROOF STATE]
proof (prove)
using this:
?i < ?n \<Longrightarrow> \<parallel>unit_vec ?n ?i\<parallel> = 1

goal (1 subgoal):
 1. \<parallel>ket_1\<parallel> = 1
[PROOF STEP]
unfolding ket_1_def
[PROOF STATE]
proof (prove)
using this:
?i < ?n \<Longrightarrow> \<parallel>unit_vec ?n ?i\<parallel> = 1

goal (1 subgoal):
 1. \<parallel>unit_vec 2 1\<parallel> = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma add_scale_img:
  assumes "a < b" shows "(\<lambda>x::real. a + (b - a) * x) ` {0 .. 1} = {a .. b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. a + (b - a) * x) ` {0..1} = {a..b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. (\<lambda>x. a + (b - a) * x) ` {0..1} = {a..b}
[PROOF STEP]
apply (auto simp: algebra_simps affine_ineq image_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>a < b; 0 \<le> xa; xa \<le> 1\<rbrakk> \<Longrightarrow> xa * a \<le> xa * b
 2. \<And>x. \<lbrakk>a < b; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..1}. x + xa * a = a + xa * b
[PROOF STEP]
using less_eq_real_def
[PROOF STATE]
proof (prove)
using this:
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>a < b; 0 \<le> xa; xa \<le> 1\<rbrakk> \<Longrightarrow> xa * a \<le> xa * b
 2. \<And>x. \<lbrakk>a < b; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..1}. x + xa * a = a + xa * b
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < b; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..1}. x + xa * a = a + xa * b
[PROOF STEP]
apply (rule_tac x="(x-a)/(b-a)" in bexI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>a < b; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> x + (x - a) / (b - a) * a = a + (x - a) / (b - a) * b
 2. \<And>x. \<lbrakk>a < b; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> (x - a) / (b - a) \<in> {0..1}
[PROOF STEP]
apply (auto simp: field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filterlim_at_infinity_times:
  fixes f :: "'a \<Rightarrow> 'b::real_normed_field"
  assumes "filterlim f at_infinity F" "filterlim g at_infinity F"
  shows "filterlim (\<lambda>x. f x * g x) at_infinity F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
have "((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> 0 * 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> (0::'b) * (0::'b)) F
[PROOF STEP]
by (intro tendsto_mult tendsto_inverse assms filterlim_compose[OF tendsto_inverse_0])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> (0::'b) * (0::'b)) F

goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> (0::'b) * (0::'b)) F
[PROOF STEP]
have "filterlim (\<lambda>x. inverse (f x) * inverse (g x)) (at 0) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> (0::'b) * (0::'b)) F

goal (1 subgoal):
 1. LIM x F. inverse (f x) * inverse (g x) :> at (0::'b)
[PROOF STEP]
unfolding filterlim_at
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> (0::'b) * (0::'b)) F

goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. inverse (f x) * inverse (g x) \<in> UNIV \<and> inverse (f x) * inverse (g x) \<noteq> (0::'b)) \<and> ((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> (0::'b) * (0::'b)) F
filterlim f at_infinity F
filterlim g at_infinity F

goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. inverse (f x) * inverse (g x) \<in> UNIV \<and> inverse (f x) * inverse (g x) \<noteq> (0::'b)) \<and> ((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
by (auto intro: filterlim_at_infinity_imp_eventually_ne tendsto_imp_eventually_ne eventually_conj)
[PROOF STATE]
proof (state)
this:
LIM x F. inverse (f x) * inverse (g x) :> at (0::'b)

goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x F. inverse (f x) * inverse (g x) :> at (0::'b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
LIM x F. inverse (f x) * inverse (g x) :> at (0::'b)

goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
by (subst filterlim_inverse_at_iff[symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
LIM x F. f x * g x :> at_infinity

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scaleR_2:
  fixes x :: "'a::real_vector"
  shows "scaleR 2 x = x + x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 *\<^sub>R x = x + x
[PROOF STEP]
unfolding one_add_one [symmetric] scaleR_left_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 *\<^sub>R x + 1 *\<^sub>R x = x + x
[PROOF STEP]
by simp


[STATEMENT]
lemma prime_gt_3_impl_p_minus_one_not_prime:
  fixes p::nat
  assumes "prime p" "p>3"
  shows "\<not> prime (p - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> prime (p - 1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime (p - 1) \<Longrightarrow> False
[PROOF STEP]
assume "prime (p - 1)"
[PROOF STATE]
proof (state)
this:
prime (p - 1)

goal (1 subgoal):
 1. prime (p - 1) \<Longrightarrow> False
[PROOF STEP]
have "\<not> even p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
3 < p

goal (1 subgoal):
 1. odd p
[PROOF STEP]
by (simp add: prime_odd_nat)
[PROOF STATE]
proof (state)
this:
odd p

goal (1 subgoal):
 1. prime (p - 1) \<Longrightarrow> False
[PROOF STEP]
hence "2 dvd (p - 1)"
[PROOF STATE]
proof (prove)
using this:
odd p

goal (1 subgoal):
 1. even (p - 1)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
even (p - 1)

goal (1 subgoal):
 1. prime (p - 1) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even (p - 1)
[PROOF STEP]
obtain q where "p - 1 = 2 * q"
[PROOF STATE]
proof (prove)
using this:
even (p - 1)

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

goal (1 subgoal):
 1. prime (p - 1) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p - 1 = 2 * q
[PROOF STEP]
have "2 \<in> prime_factors (p - 1)"
[PROOF STATE]
proof (prove)
using this:
p - 1 = 2 * q

goal (1 subgoal):
 1. 2 \<in># prime_factorization (p - 1)
[PROOF STEP]
using \<open>p>3\<close>
[PROOF STATE]
proof (prove)
using this:
p - 1 = 2 * q
3 < p

goal (1 subgoal):
 1. 2 \<in># prime_factorization (p - 1)
[PROOF STEP]
by (auto simp: prime_factorization_times_prime)
[PROOF STATE]
proof (state)
this:
2 \<in># prime_factorization (p - 1)

goal (1 subgoal):
 1. prime (p - 1) \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
2 \<in># prime_factorization (p - 1)

goal (1 subgoal):
 1. False
[PROOF STEP]
using prime_factors_of_prime \<open>p>3\<close> \<open>prime (p - 1)\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<in># prime_factorization (p - 1)
prime ?p \<Longrightarrow> prime_factors ?p = {?p}
3 < p
prime (p - 1)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_Pow_card:
  assumes "finite X"
  shows "card (Pow X) = 2 powr (card X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (Pow X)) = 2 powr real (card X)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. real (card (Pow X)) = 2 powr real (card X)
[PROOF STEP]
proof (induct X rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. real (card (Pow {})) = 2 powr real (card {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. real (card (Pow {})) = 2 powr real (card {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (Pow {})) = 2 powr real (card {})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
real (card (Pow {})) = 2 powr real (card {})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
case (insert x X)
[PROOF STATE]
proof (state)
this:
finite X
x \<notin> X
real (card (Pow X)) = 2 powr real (card X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
have "0 \<le> (2 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> 2

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
hence two_powr_one: "(2 :: real) = 2 powr 1"
[PROOF STATE]
proof (prove)
using this:
0 \<le> 2

goal (1 subgoal):
 1. 2 = 2 powr 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
2 = 2 powr 1

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
have "bij_betw (\<lambda> x. fst x \<union> snd x) ({{},{x}} \<times> Pow X) (Pow (insert x X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X) (Pow (insert x X))
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X) \<and> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
fix y z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
assume
        "y \<in> {{}, {x}} \<times> Pow X"
        "z \<in> {{}, {x}} \<times> Pow X"
        "fst y \<union> snd y = fst z \<union> snd z"
        (is "?Uy = ?Uz")
[PROOF STATE]
proof (state)
this:
y \<in> {{}, {x}} \<times> Pow X
z \<in> {{}, {x}} \<times> Pow X
fst y \<union> snd y = fst z \<union> snd z

goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
hence
          "x \<notin> snd y"
          "x \<notin> snd z"
          "fst y = {x} \<or> fst y = {}"
          "fst z = {x} \<or> fst z = {}"
[PROOF STATE]
proof (prove)
using this:
y \<in> {{}, {x}} \<times> Pow X
z \<in> {{}, {x}} \<times> Pow X
fst y \<union> snd y = fst z \<union> snd z

goal (1 subgoal):
 1. (x \<notin> snd y &&& x \<notin> snd z) &&& fst y = {x} \<or> fst y = {} &&& fst z = {x} \<or> fst z = {}
[PROOF STEP]
using insert.hyps(2)
[PROOF STATE]
proof (prove)
using this:
y \<in> {{}, {x}} \<times> Pow X
z \<in> {{}, {x}} \<times> Pow X
fst y \<union> snd y = fst z \<union> snd z
x \<notin> X

goal (1 subgoal):
 1. (x \<notin> snd y &&& x \<notin> snd z) &&& fst y = {x} \<or> fst y = {} &&& fst z = {x} \<or> fst z = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<notin> snd y
x \<notin> snd z
fst y = {x} \<or> fst y = {}
fst z = {x} \<or> fst z = {}

goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
hence
          "x \<in> ?Uy \<longleftrightarrow> fst y = {x}"
          "x \<in> ?Uz \<longleftrightarrow> fst z = {x}"
          "x \<notin> ?Uy \<longleftrightarrow> fst y = {}"
          "x \<notin> ?Uz \<longleftrightarrow> fst z = {}"
          "snd y = ?Uy - {x}"
          "snd z = ?Uz - {x}"
[PROOF STATE]
proof (prove)
using this:
x \<notin> snd y
x \<notin> snd z
fst y = {x} \<or> fst y = {}
fst z = {x} \<or> fst z = {}

goal (1 subgoal):
 1. ((x \<in> fst y \<union> snd y) = (fst y = {x}) &&& (x \<in> fst z \<union> snd z) = (fst z = {x}) &&& (x \<notin> fst y \<union> snd y) = (fst y = {})) &&& (x \<notin> fst z \<union> snd z) = (fst z = {}) &&& snd y = fst y \<union> snd y - {x} &&& snd z = fst z \<union> snd z - {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x \<in> fst y \<union> snd y) = (fst y = {x})
(x \<in> fst z \<union> snd z) = (fst z = {x})
(x \<notin> fst y \<union> snd y) = (fst y = {})
(x \<notin> fst z \<union> snd z) = (fst z = {})
snd y = fst y \<union> snd y - {x}
snd z = fst z \<union> snd z - {x}

goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
hence
          "x \<in> ?Uy \<longleftrightarrow> y = ({x}, ?Uy - {x})"
          "x \<in> ?Uz \<longleftrightarrow> z = ({x}, ?Uz - {x})"
          "x \<notin> ?Uy \<longleftrightarrow> y = ({}, ?Uy - {x})"
          "x \<notin> ?Uz \<longleftrightarrow> z = ({}, ?Uz - {x})"
[PROOF STATE]
proof (prove)
using this:
(x \<in> fst y \<union> snd y) = (fst y = {x})
(x \<in> fst z \<union> snd z) = (fst z = {x})
(x \<notin> fst y \<union> snd y) = (fst y = {})
(x \<notin> fst z \<union> snd z) = (fst z = {})
snd y = fst y \<union> snd y - {x}
snd z = fst z \<union> snd z - {x}

goal (1 subgoal):
 1. ((x \<in> fst y \<union> snd y) = (y = ({x}, fst y \<union> snd y - {x})) &&& (x \<in> fst z \<union> snd z) = (z = ({x}, fst z \<union> snd z - {x}))) &&& (x \<notin> fst y \<union> snd y) = (y = ({}, fst y \<union> snd y - {x})) &&& (x \<notin> fst z \<union> snd z) = (z = ({}, fst z \<union> snd z - {x}))
[PROOF STEP]
by (metis fst_conv prod.collapse)+
[PROOF STATE]
proof (state)
this:
(x \<in> fst y \<union> snd y) = (y = ({x}, fst y \<union> snd y - {x}))
(x \<in> fst z \<union> snd z) = (z = ({x}, fst z \<union> snd z - {x}))
(x \<notin> fst y \<union> snd y) = (y = ({}, fst y \<union> snd y - {x}))
(x \<notin> fst z \<union> snd z) = (z = ({}, fst z \<union> snd z - {x}))

goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
hence "y = z"
[PROOF STATE]
proof (prove)
using this:
(x \<in> fst y \<union> snd y) = (y = ({x}, fst y \<union> snd y - {x}))
(x \<in> fst z \<union> snd z) = (z = ({x}, fst z \<union> snd z - {x}))
(x \<notin> fst y \<union> snd y) = (y = ({}, fst y \<union> snd y - {x}))
(x \<notin> fst z \<union> snd z) = (z = ({}, fst z \<union> snd z - {x}))

goal (1 subgoal):
 1. y = z
[PROOF STEP]
using \<open>?Uy = ?Uz\<close>
[PROOF STATE]
proof (prove)
using this:
(x \<in> fst y \<union> snd y) = (y = ({x}, fst y \<union> snd y - {x}))
(x \<in> fst z \<union> snd z) = (z = ({x}, fst z \<union> snd z - {x}))
(x \<notin> fst y \<union> snd y) = (y = ({}, fst y \<union> snd y - {x}))
(x \<notin> fst z \<union> snd z) = (z = ({}, fst z \<union> snd z - {x}))
fst y \<union> snd y = fst z \<union> snd z

goal (1 subgoal):
 1. y = z
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
y = z

goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y2 \<in> {{}, {x}} \<times> Pow X; ?z2 \<in> {{}, {x}} \<times> Pow X; fst ?y2 \<union> snd ?y2 = fst ?z2 \<union> snd ?z2\<rbrakk> \<Longrightarrow> ?y2 = ?z2

goal (2 subgoals):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
 2. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
thus "inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y2 \<in> {{}, {x}} \<times> Pow X; ?z2 \<in> {{}, {x}} \<times> Pow X; fst ?y2 \<union> snd ?y2 = fst ?z2 \<union> snd ?z2\<rbrakk> \<Longrightarrow> ?y2 = ?z2

goal (1 subgoal):
 1. inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y2 \<in> {{}, {x}} \<times> Pow X; ?z2 \<in> {{}, {x}} \<times> Pow X; fst ?y2 \<union> snd ?y2 = fst ?z2 \<union> snd ?z2\<rbrakk> \<Longrightarrow> ?y2 = ?z2

goal (1 subgoal):
 1. \<forall>xa\<in>{{}, {x}} \<times> Pow X. \<forall>y\<in>{{}, {x}} \<times> Pow X. fst xa \<union> snd xa = fst y \<union> snd y \<longrightarrow> xa = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X)

goal (1 subgoal):
 1. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
show "(\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)
[PROOF STEP]
proof (intro equalityI subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) \<Longrightarrow> xa \<in> Pow (insert x X)
 2. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) \<Longrightarrow> xa \<in> Pow (insert x X)
 2. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
assume "y \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)"
[PROOF STATE]
proof (state)
this:
y \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)

goal (2 subgoals):
 1. \<And>xa. xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) \<Longrightarrow> xa \<in> Pow (insert x X)
 2. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
y \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
obtain z where
         "z \<in> ({{}, {x}} \<times> Pow X)"
         "y = fst z \<union> snd z"
[PROOF STATE]
proof (prove)
using this:
y \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> {{}, {x}} \<times> Pow X; y = fst z \<union> snd z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> {{}, {x}} \<times> Pow X
y = fst z \<union> snd z

goal (2 subgoals):
 1. \<And>xa. xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) \<Longrightarrow> xa \<in> Pow (insert x X)
 2. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
hence
          "snd z \<subseteq> X"
          "fst z \<subseteq> insert x X"
[PROOF STATE]
proof (prove)
using this:
z \<in> {{}, {x}} \<times> Pow X
y = fst z \<union> snd z

goal (1 subgoal):
 1. snd z \<subseteq> X &&& fst z \<subseteq> insert x X
[PROOF STEP]
using SigmaE
[PROOF STATE]
proof (prove)
using this:
z \<in> {{}, {x}} \<times> Pow X
y = fst z \<union> snd z
\<lbrakk>?c \<in> Sigma ?A ?B; \<And>x y. \<lbrakk>x \<in> ?A; y \<in> ?B x; ?c = (x, y)\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. snd z \<subseteq> X &&& fst z \<subseteq> insert x X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
snd z \<subseteq> X
fst z \<subseteq> insert x X

goal (2 subgoals):
 1. \<And>xa. xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) \<Longrightarrow> xa \<in> Pow (insert x X)
 2. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
thus "y \<in> Pow (insert x X)"
[PROOF STATE]
proof (prove)
using this:
snd z \<subseteq> X
fst z \<subseteq> insert x X

goal (1 subgoal):
 1. y \<in> Pow (insert x X)
[PROOF STEP]
using \<open>y = fst z \<union> snd z\<close>
[PROOF STATE]
proof (prove)
using this:
snd z \<subseteq> X
fst z \<subseteq> insert x X
y = fst z \<union> snd z

goal (1 subgoal):
 1. y \<in> Pow (insert x X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> Pow (insert x X)

goal (1 subgoal):
 1. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
assume "y \<in> Pow (insert x X)"
[PROOF STATE]
proof (state)
this:
y \<in> Pow (insert x X)

goal (1 subgoal):
 1. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
let ?z = "(if x \<in> y then {x} else {}, y - {x})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
have "?z \<in> ({{}, {x}} \<times> Pow X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x \<in> y then {x} else {}, y - {x}) \<in> {{}, {x}} \<times> Pow X
[PROOF STEP]
using \<open>y \<in> Pow (insert x X)\<close>
[PROOF STATE]
proof (prove)
using this:
y \<in> Pow (insert x X)

goal (1 subgoal):
 1. (if x \<in> y then {x} else {}, y - {x}) \<in> {{}, {x}} \<times> Pow X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if x \<in> y then {x} else {}, y - {x}) \<in> {{}, {x}} \<times> Pow X

goal (1 subgoal):
 1. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(if x \<in> y then {x} else {}, y - {x}) \<in> {{}, {x}} \<times> Pow X

goal (1 subgoal):
 1. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
have "(\<lambda>x. fst x \<union> snd x) ?z = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (if x \<in> y then {x} else {}, y - {x}) \<union> snd (if x \<in> y then {x} else {}, y - {x}) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst (if x \<in> y then {x} else {}, y - {x}) \<union> snd (if x \<in> y then {x} else {}, y - {x}) = y

goal (1 subgoal):
 1. \<And>xa. xa \<in> Pow (insert x X) \<Longrightarrow> xa \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(if x \<in> y then {x} else {}, y - {x}) \<in> {{}, {x}} \<times> Pow X
fst (if x \<in> y then {x} else {}, y - {x}) \<union> snd (if x \<in> y then {x} else {}, y - {x}) = y
[PROOF STEP]
show "y \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)"
[PROOF STATE]
proof (prove)
using this:
(if x \<in> y then {x} else {}, y - {x}) \<in> {{}, {x}} \<times> Pow X
fst (if x \<in> y then {x} else {}, y - {x}) \<union> snd (if x \<in> y then {x} else {}, y - {x}) = y

goal (1 subgoal):
 1. y \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> (\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. fst x \<union> snd x) ` ({{}, {x}} \<times> Pow X) = Pow (insert x X)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X) (Pow (insert x X))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
hence "card (Pow (insert x X)) = card ({{},{x}} \<times> Pow X)"
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X) (Pow (insert x X))

goal (1 subgoal):
 1. card (Pow (insert x X)) = card ({{}, {x}} \<times> Pow X)
[PROOF STEP]
using bij_betw_same_card
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>x. fst x \<union> snd x) ({{}, {x}} \<times> Pow X) (Pow (insert x X))
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B

goal (1 subgoal):
 1. card (Pow (insert x X)) = card ({{}, {x}} \<times> Pow X)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card (Pow (insert x X)) = card ({{}, {x}} \<times> Pow X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (Pow (insert x X)) = card ({{}, {x}} \<times> Pow X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
have "\<dots> = 2 * card (Pow X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({{}, {x}} \<times> Pow X) = 2 * card (Pow X)
[PROOF STEP]
by (simp add: insert.hyps(1))
[PROOF STATE]
proof (state)
this:
card ({{}, {x}} \<times> Pow X) = 2 * card (Pow X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({{}, {x}} \<times> Pow X) = 2 * card (Pow X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
have "\<dots> = 2 * (2 powr (card X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (2 * card (Pow X)) = 2 * 2 powr real (card X)
[PROOF STEP]
by (simp add: insert.hyps(3))
[PROOF STATE]
proof (state)
this:
real (2 * card (Pow X)) = 2 * 2 powr real (card X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (2 * card (Pow X)) = 2 * 2 powr real (card X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
have "\<dots> = (2 powr 1) * 2 powr (card X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * 2 powr real (card X) = 2 powr 1 * 2 powr real (card X)
[PROOF STEP]
using two_powr_one
[PROOF STATE]
proof (prove)
using this:
2 = 2 powr 1

goal (1 subgoal):
 1. 2 * 2 powr real (card X) = 2 powr 1 * 2 powr real (card X)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
2 * 2 powr real (card X) = 2 powr 1 * 2 powr real (card X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * 2 powr real (card X) = 2 powr 1 * 2 powr real (card X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
have "\<dots> = 2 powr (1 + card X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr 1 * 2 powr real (card X) = 2 powr real (1 + card X)
[PROOF STEP]
by (simp add: powr_add)
[PROOF STATE]
proof (state)
this:
2 powr 1 * 2 powr real (card X) = 2 powr real (1 + card X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr 1 * 2 powr real (card X) = 2 powr real (1 + card X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
have "\<dots> = 2 powr (card (insert x X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr real (1 + card X) = 2 powr real (card (insert x X))
[PROOF STEP]
by (simp add: insert.hyps(1) insert.hyps(2))
[PROOF STATE]
proof (state)
this:
2 powr real (1 + card X) = 2 powr real (card (insert x X))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; real (card (Pow F)) = 2 powr real (card F)\<rbrakk> \<Longrightarrow> real (card (Pow (insert x F))) = 2 powr real (card (insert x F))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (card (Pow (insert x X))) = 2 powr real (card (insert x X))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
real (card (Pow (insert x X))) = 2 powr real (card (insert x X))

goal (1 subgoal):
 1. real (card (Pow (insert x X))) = 2 powr real (card (insert x X))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (card (Pow (insert x X))) = 2 powr real (card (insert x X))

goal:
No subgoals!
[PROOF STEP]
qed