[STATEMENT]
lemma normal_poly_general_coeff_mult:
  fixes f::"real poly"
  assumes "normal_poly f" and "h \<le> j"
  shows "coeff f (h+1) * coeff f (j+1) \<ge> coeff f h * coeff f (j+2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
normal_poly f
h \<le> j

goal (1 subgoal):
 1. coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)
[PROOF STEP]
proof (induction j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>normal_poly f; h \<le> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (0 + 2) \<le> coeff f (h + 1) * coeff f (0 + 1)
 2. \<And>j. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
normal_poly f
h \<le> 0

goal (2 subgoals):
 1. \<lbrakk>normal_poly f; h \<le> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (0 + 2) \<le> coeff f (h + 1) * coeff f (0 + 1)
 2. \<And>j. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
normal_poly f
h \<le> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
normal_poly f
h \<le> 0

goal (1 subgoal):
 1. coeff f h * coeff f (0 + 2) \<le> coeff f (h + 1) * coeff f (0 + 1)
[PROOF STEP]
using normal_poly_coeff_mult
[PROOF STATE]
proof (prove)
using this:
normal_poly f
h \<le> 0
normal_poly ?p \<Longrightarrow> coeff ?p ?i * coeff ?p (?i + 2) \<le> (coeff ?p (?i + 1))\<^sup>2

goal (1 subgoal):
 1. coeff f h * coeff f (0 + 2) \<le> coeff f (h + 1) * coeff f (0 + 1)
[PROOF STEP]
by (auto simp: power2_eq_square)[1]
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (0 + 2) \<le> coeff f (h + 1) * coeff f (0 + 1)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
case (Suc j)
[PROOF STATE]
proof (state)
this:
\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)
normal_poly f
h \<le> Suc j

goal (1 subgoal):
 1. \<And>j. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)
normal_poly f
h \<le> Suc j
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)
normal_poly f
h \<le> Suc j

goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
proof (cases "h = Suc j")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j; h = Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j; h \<noteq> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
assume "h = Suc j" "normal_poly f"
[PROOF STATE]
proof (state)
this:
h = Suc j
normal_poly f

goal (2 subgoals):
 1. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j; h = Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j; h \<noteq> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
h = Suc j
normal_poly f

goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
using normal_poly_coeff_mult
[PROOF STATE]
proof (prove)
using this:
h = Suc j
normal_poly f
normal_poly ?p \<Longrightarrow> coeff ?p ?i * coeff ?p (?i + 2) \<le> (coeff ?p (?i + 1))\<^sup>2

goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
by (auto simp: power2_eq_square)
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j; h \<noteq> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j; h \<noteq> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
assume "(normal_poly f \<Longrightarrow>
       h \<le> j \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1))"
      "normal_poly f" and h: "h \<le> Suc j" "h \<noteq> Suc j"
[PROOF STATE]
proof (state)
this:
\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)
normal_poly f
h \<le> Suc j
h \<noteq> Suc j

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j; h \<noteq> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
hence IH: "coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)
normal_poly f
h \<le> Suc j
h \<noteq> Suc j

goal (1 subgoal):
 1. coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1)

goal (1 subgoal):
 1. \<lbrakk>\<lbrakk>normal_poly f; h \<le> j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (j + 2) \<le> coeff f (h + 1) * coeff f (j + 1); normal_poly f; h \<le> Suc j; h \<noteq> Suc j\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
proof (cases "coeff f (Suc j + 1) = 0", cases "coeff f (Suc j + 2) = 0")
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) = 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) \<noteq> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 3. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
show "coeff f (Suc j + 1) = 0 \<Longrightarrow> coeff f (Suc j + 2) = 0 \<Longrightarrow>
        coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) = 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
by (metis assms(1) mult_zero_right normal_coeff_nonneg)
[PROOF STATE]
proof (state)
this:
\<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) = 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)

goal (2 subgoals):
 1. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) \<noteq> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) \<noteq> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
assume 1: "coeff f (Suc j + 1) = 0" "coeff f (Suc j + 2) \<noteq> 0"
[PROOF STATE]
proof (state)
this:
coeff f (Suc j + 1) = 0
coeff f (Suc j + 2) \<noteq> 0

goal (2 subgoals):
 1. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) \<noteq> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
hence "coeff f (Suc j + 2) > 0" "\<not>coeff f (Suc j + 1) > 0"
[PROOF STATE]
proof (prove)
using this:
coeff f (Suc j + 1) = 0
coeff f (Suc j + 2) \<noteq> 0

goal (1 subgoal):
 1. 0 < coeff f (Suc j + 2) &&& \<not> 0 < coeff f (Suc j + 1)
[PROOF STEP]
using normal_coeff_nonneg[of f "Suc j + 2"] assms(1)
[PROOF STATE]
proof (prove)
using this:
coeff f (Suc j + 1) = 0
coeff f (Suc j + 2) \<noteq> 0
normal_poly f \<Longrightarrow> 0 \<le> coeff f (Suc j + 2)
normal_poly f

goal (1 subgoal):
 1. 0 < coeff f (Suc j + 2) &&& \<not> 0 < coeff f (Suc j + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < coeff f (Suc j + 2)
\<not> 0 < coeff f (Suc j + 1)

goal (2 subgoals):
 1. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) \<noteq> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
hence "coeff f h > 0 \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
using this:
0 < coeff f (Suc j + 2)
\<not> 0 < coeff f (Suc j + 1)

goal (1 subgoal):
 1. 0 < coeff f h \<Longrightarrow> False
[PROOF STEP]
using normal_poly_pos_interval[of f h "Suc j + 1" "Suc j + 2"] assms(1) h
[PROOF STATE]
proof (prove)
using this:
0 < coeff f (Suc j + 2)
\<not> 0 < coeff f (Suc j + 1)
\<lbrakk>normal_poly f; h \<le> Suc j + 1; Suc j + 1 \<le> Suc j + 2; 0 < coeff f h; 0 < coeff f (Suc j + 2)\<rbrakk> \<Longrightarrow> 0 < coeff f (Suc j + 1)
normal_poly f
h \<le> Suc j
h \<noteq> Suc j

goal (1 subgoal):
 1. 0 < coeff f h \<Longrightarrow> False
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < coeff f h \<Longrightarrow> False

goal (2 subgoals):
 1. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) \<noteq> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
hence "coeff f h = 0"
[PROOF STATE]
proof (prove)
using this:
0 < coeff f h \<Longrightarrow> False

goal (1 subgoal):
 1. coeff f h = 0
[PROOF STEP]
using normal_coeff_nonneg[OF assms(1)] less_eq_real_def
[PROOF STATE]
proof (prove)
using this:
0 < coeff f h \<Longrightarrow> False
0 \<le> coeff f ?i
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

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

goal (2 subgoals):
 1. \<lbrakk>coeff f (Suc j + 1) = 0; coeff f (Suc j + 2) \<noteq> 0\<rbrakk> \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
thus "coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)"
[PROOF STATE]
proof (prove)
using this:
coeff f h = 0

goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
coeff f h = 0
coeff f (Suc j + 1) = 0
coeff f (Suc j + 2) \<noteq> 0

goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)

goal (1 subgoal):
 1. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
assume 1: "coeff f (Suc j + 1) \<noteq> 0"
[PROOF STATE]
proof (state)
this:
coeff f (Suc j + 1) \<noteq> 0

goal (1 subgoal):
 1. coeff f (Suc j + 1) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
show "coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
proof (cases "coeff f (Suc j) = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. coeff f (Suc j) = 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
assume 2: "coeff f (Suc j) = 0"
[PROOF STATE]
proof (state)
this:
coeff f (Suc j) = 0

goal (2 subgoals):
 1. coeff f (Suc j) = 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
hence "coeff f (Suc j + 1) > 0" "\<not>coeff f (Suc j) > 0"
[PROOF STATE]
proof (prove)
using this:
coeff f (Suc j) = 0

goal (1 subgoal):
 1. 0 < coeff f (Suc j + 1) &&& \<not> 0 < coeff f (Suc j)
[PROOF STEP]
using normal_coeff_nonneg[of f "Suc j + 1"] assms(1) 1
[PROOF STATE]
proof (prove)
using this:
coeff f (Suc j) = 0
normal_poly f \<Longrightarrow> 0 \<le> coeff f (Suc j + 1)
normal_poly f
coeff f (Suc j + 1) \<noteq> 0

goal (1 subgoal):
 1. 0 < coeff f (Suc j + 1) &&& \<not> 0 < coeff f (Suc j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < coeff f (Suc j + 1)
\<not> 0 < coeff f (Suc j)

goal (2 subgoals):
 1. coeff f (Suc j) = 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
hence "coeff f h > 0 \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
using this:
0 < coeff f (Suc j + 1)
\<not> 0 < coeff f (Suc j)

goal (1 subgoal):
 1. 0 < coeff f h \<Longrightarrow> False
[PROOF STEP]
using normal_poly_pos_interval[of f h "Suc j" "Suc j + 1"] assms(1) h
[PROOF STATE]
proof (prove)
using this:
0 < coeff f (Suc j + 1)
\<not> 0 < coeff f (Suc j)
\<lbrakk>normal_poly f; h \<le> Suc j; Suc j \<le> Suc j + 1; 0 < coeff f h; 0 < coeff f (Suc j + 1)\<rbrakk> \<Longrightarrow> 0 < coeff f (Suc j)
normal_poly f
h \<le> Suc j
h \<noteq> Suc j

goal (1 subgoal):
 1. 0 < coeff f h \<Longrightarrow> False
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < coeff f h \<Longrightarrow> False

goal (2 subgoals):
 1. coeff f (Suc j) = 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
hence "coeff f h = 0"
[PROOF STATE]
proof (prove)
using this:
0 < coeff f h \<Longrightarrow> False

goal (1 subgoal):
 1. coeff f h = 0
[PROOF STEP]
using normal_coeff_nonneg[OF assms(1)] less_eq_real_def
[PROOF STATE]
proof (prove)
using this:
0 < coeff f h \<Longrightarrow> False
0 \<le> coeff f ?i
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

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

goal (2 subgoals):
 1. coeff f (Suc j) = 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
 2. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
thus "coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)"
[PROOF STATE]
proof (prove)
using this:
coeff f h = 0

goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
by (simp add: assms(1) normal_coeff_nonneg)
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)

goal (1 subgoal):
 1. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
assume 2: "coeff f (Suc j) \<noteq> 0"
[PROOF STATE]
proof (state)
this:
coeff f (Suc j) \<noteq> 0

goal (1 subgoal):
 1. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
from normal_poly_coeff_mult[OF assms(1), of "Suc j"] normal_coeff_nonneg[OF assms(1), of "Suc j"]
          normal_coeff_nonneg[OF assms(1), of "Suc (Suc j)"] 1 2
[PROOF STATE]
proof (chain)
picking this:
coeff f (Suc j) * coeff f (Suc j + 2) \<le> (coeff f (Suc j + 1))\<^sup>2
0 \<le> coeff f (Suc j)
0 \<le> coeff f (Suc (Suc j))
coeff f (Suc j + 1) \<noteq> 0
coeff f (Suc j) \<noteq> 0
[PROOF STEP]
have 3: "coeff f (Suc j + 1) / coeff f (Suc j) \<ge> coeff f (Suc j + 2) / coeff f (Suc j + 1)"
[PROOF STATE]
proof (prove)
using this:
coeff f (Suc j) * coeff f (Suc j + 2) \<le> (coeff f (Suc j + 1))\<^sup>2
0 \<le> coeff f (Suc j)
0 \<le> coeff f (Suc (Suc j))
coeff f (Suc j + 1) \<noteq> 0
coeff f (Suc j) \<noteq> 0

goal (1 subgoal):
 1. coeff f (Suc j + 2) / coeff f (Suc j + 1) \<le> coeff f (Suc j + 1) / coeff f (Suc j)
[PROOF STEP]
by (auto simp: power2_eq_square divide_simps algebra_simps)
[PROOF STATE]
proof (state)
this:
coeff f (Suc j + 2) / coeff f (Suc j + 1) \<le> coeff f (Suc j + 1) / coeff f (Suc j)

goal (1 subgoal):
 1. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
have "(coeff f h * coeff f (j + 2)) * (coeff f (Suc j + 2) / coeff f (Suc j + 1)) \<le> (coeff f (h + 1) * coeff f (j + 1)) * (coeff f (Suc j + 1) / coeff f (Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff f h * coeff f (j + 2) * (coeff f (Suc j + 2) / coeff f (Suc j + 1)) \<le> coeff f (h + 1) * coeff f (j + 1) * (coeff f (Suc j + 1) / coeff f (Suc j))
[PROOF STEP]
apply (rule mult_mono[OF IH])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. coeff f (Suc j + 2) / coeff f (Suc j + 1) \<le> coeff f (Suc j + 1) / coeff f (Suc j)
 2. 0 \<le> coeff f (h + 1) * coeff f (j + 1)
 3. 0 \<le> coeff f (Suc j + 2) / coeff f (Suc j + 1)
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
coeff f (Suc j + 2) / coeff f (Suc j + 1) \<le> coeff f (Suc j + 1) / coeff f (Suc j)

goal (3 subgoals):
 1. coeff f (Suc j + 2) / coeff f (Suc j + 1) \<le> coeff f (Suc j + 1) / coeff f (Suc j)
 2. 0 \<le> coeff f (h + 1) * coeff f (j + 1)
 3. 0 \<le> coeff f (Suc j + 2) / coeff f (Suc j + 1)
[PROOF STEP]
by (simp_all add: assms(1) normal_coeff_nonneg)
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (j + 2) * (coeff f (Suc j + 2) / coeff f (Suc j + 1)) \<le> coeff f (h + 1) * coeff f (j + 1) * (coeff f (Suc j + 1) / coeff f (Suc j))

goal (1 subgoal):
 1. coeff f (Suc j) \<noteq> 0 \<Longrightarrow> coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
thus "coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)"
[PROOF STATE]
proof (prove)
using this:
coeff f h * coeff f (j + 2) * (coeff f (Suc j + 2) / coeff f (Suc j + 1)) \<le> coeff f (h + 1) * coeff f (j + 1) * (coeff f (Suc j + 1) / coeff f (Suc j))

goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
coeff f h * coeff f (j + 2) * (coeff f (Suc j + 2) / coeff f (Suc j + 1)) \<le> coeff f (h + 1) * coeff f (j + 1) * (coeff f (Suc j + 1) / coeff f (Suc j))
coeff f (Suc j + 1) \<noteq> 0
coeff f (Suc j) \<noteq> 0

goal (1 subgoal):
 1. coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
coeff f h * coeff f (Suc j + 2) \<le> coeff f (h + 1) * coeff f (Suc j + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiset_eqI: "(\<And>x. count A x = count B x) \<Longrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. count A x = count B x) \<Longrightarrow> A = B
[PROOF STEP]
using multiset_eq_iff
[PROOF STATE]
proof (prove)
using this:
(?M = ?N) = (\<forall>a. count ?M a = count ?N a)

goal (1 subgoal):
 1. (\<And>x. count A x = count B x) \<Longrightarrow> A = B
[PROOF STEP]
by auto


[STATEMENT]
lemma cyclic_group_assoc:
  assumes "a \<in> carrier G" "b \<in> carrier G" "c \<in> carrier G"
  shows "(a \<otimes> b) \<otimes> c = a \<otimes> (b \<otimes> c)"
(is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)
[PROOF STEP]
obtain n :: nat where n: "a = \<^bold>g [^] n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. a = \<^bold>g [^] n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using generatorE assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier G; \<And>n. ?x = \<^bold>g [^] n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
a \<in> carrier G
b \<in> carrier G
c \<in> carrier G

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

goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)
[PROOF STEP]
obtain k :: nat where k: "b = \<^bold>g [^] k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. b = \<^bold>g [^] k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using generatorE assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier G; \<And>n. ?x = \<^bold>g [^] n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
a \<in> carrier G
b \<in> carrier G
c \<in> carrier G

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

goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)
[PROOF STEP]
obtain j :: nat where j: "c = \<^bold>g [^] j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. c = \<^bold>g [^] j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using generatorE assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier G; \<And>n. ?x = \<^bold>g [^] n \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
a \<in> carrier G
b \<in> carrier G
c \<in> carrier G

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

goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)
[PROOF STEP]
have "?lhs = (\<^bold>g [^] n \<otimes> \<^bold>g [^] k) \<otimes> \<^bold>g [^] j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = \<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j
[PROOF STEP]
using n k j
[PROOF STATE]
proof (prove)
using this:
a = \<^bold>g [^] n
b = \<^bold>g [^] k
c = \<^bold>g [^] j

goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = \<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<otimes> b \<otimes> c = \<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j

goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<otimes> b \<otimes> c = \<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j
[PROOF STEP]
have "... = \<^bold>g [^] (n + (k + j))"
[PROOF STATE]
proof (prove)
using this:
a \<otimes> b \<otimes> c = \<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j

goal (1 subgoal):
 1. \<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j = \<^bold>g [^] (n + (k + j))
[PROOF STEP]
by(simp add: nat_pow_mult add.assoc)
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j = \<^bold>g [^] (n + (k + j))

goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j = \<^bold>g [^] (n + (k + j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] n \<otimes> \<^bold>g [^] k \<otimes> \<^bold>g [^] j = \<^bold>g [^] (n + (k + j))

goal (1 subgoal):
 1. a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)
[PROOF STEP]
by(simp add: nat_pow_mult n k j)
[PROOF STATE]
proof (state)
this:
a \<otimes> b \<otimes> c = a \<otimes> (b \<otimes> c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma product_path_rev:
  assumes "p_io p1 = p_io p2"
  shows "path (product A B) (q1,q2) (zip_path p1 p2) \<longleftrightarrow> (path A q1 p1 \<and> path B q2 p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)
[PROOF STEP]
have "length p1 = length p2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length p1 = length p2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p_io p1 = p_io p2

goal (1 subgoal):
 1. length p1 = length p2
[PROOF STEP]
using map_eq_imp_length_eq
[PROOF STATE]
proof (prove)
using this:
p_io p1 = p_io p2
map ?f ?xs = map ?g ?ys \<Longrightarrow> length ?xs = length ?ys

goal (1 subgoal):
 1. length p1 = length p2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length p1 = length p2

goal (1 subgoal):
 1. path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length p1 = length p2
[PROOF STEP]
have "(map (\<lambda> t . (fst (t_source t), t_input t, t_output t, fst (t_target t))) (map (\<lambda> t . ((t_source (fst t), t_source (snd t)), t_input (fst t), t_output (fst t), (t_target (fst t), t_target (snd t)))) (zip p1 p2))) = p1"
[PROOF STATE]
proof (prove)
using this:
length p1 = length p2

goal (1 subgoal):
 1. left_path (zip_path p1 p2) = p1
[PROOF STEP]
by (induction p1 p2 arbitrary: q1 q2 rule: list_induct2; auto)
[PROOF STATE]
proof (state)
this:
left_path (zip_path p1 p2) = p1

goal (1 subgoal):
 1. path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
left_path (zip_path p1 p2) = p1

goal (1 subgoal):
 1. path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)
[PROOF STEP]
have "(map (\<lambda> t . (snd (t_source t), t_input t, t_output t, snd (t_target t))) (map (\<lambda> t . ((t_source (fst t), t_source (snd t)), t_input (fst t), t_output (fst t), (t_target (fst t), t_target (snd t)))) (zip p1 p2))) = p2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_path (zip_path p1 p2) = p2
[PROOF STEP]
using \<open>length p1 = length p2\<close> assms
[PROOF STATE]
proof (prove)
using this:
length p1 = length p2
p_io p1 = p_io p2

goal (1 subgoal):
 1. right_path (zip_path p1 p2) = p2
[PROOF STEP]
by (induction p1 p2 arbitrary: q1 q2 rule: list_induct2; auto)
[PROOF STATE]
proof (state)
this:
right_path (zip_path p1 p2) = p2

goal (1 subgoal):
 1. path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
left_path (zip_path p1 p2) = p1
right_path (zip_path p1 p2) = p2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
left_path (zip_path p1 p2) = p1
right_path (zip_path p1 p2) = p2

goal (1 subgoal):
 1. path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)
[PROOF STEP]
using product_path[of A B q1 q2 "(map (\<lambda> t . ((t_source (fst t), t_source (snd t)), t_input (fst t), t_output (fst t), (t_target (fst t), t_target (snd t)))) (zip p1 p2))"]
[PROOF STATE]
proof (prove)
using this:
left_path (zip_path p1 p2) = p1
right_path (zip_path p1 p2) = p2
path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 (left_path (zip_path p1 p2)) \<and> path B q2 (right_path (zip_path p1 p2)))

goal (1 subgoal):
 1. path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path (Product_FSM.product A B) (q1, q2) (zip_path p1 p2) = (path A q1 p1 \<and> path B q2 p2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bpp_closed:"\<lbrakk>assoc_bpp A f; x \<in> addition_set f A; y \<in> addition_set f A\<rbrakk>
             \<Longrightarrow>  x \<^sub>f+ y \<in> addition_set f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>assoc_bpp A f; x \<in> addition_set f A; y \<in> addition_set f A\<rbrakk> \<Longrightarrow> x \<^sub>f+ y \<in> addition_set f A
[PROOF STEP]
apply (simp add:addition_set_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>assoc_bpp A f; \<exists>xa. (\<exists>n. xa = add_set f A n) \<and> x \<in> xa; \<exists>x. (\<exists>n. x = add_set f A n) \<and> y \<in> x\<rbrakk> \<Longrightarrow> \<exists>xa. (\<exists>n. xa = add_set f A n) \<and> x \<^sub>f+ y \<in> xa
[PROOF STEP]
apply ((erule exE)+, (erule conjE)+, (erule exE)+, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa xaa n na. \<lbrakk>assoc_bpp A f; x \<in> add_set f A n; y \<in> add_set f A na; xa = add_set f A n; xaa = add_set f A na\<rbrakk> \<Longrightarrow> \<exists>xa. (\<exists>n. xa = add_set f A n) \<and> x \<^sub>f+ y \<in> xa
[PROOF STEP]
apply (frule_tac x = x and n = n and y = y and m = na in bpp_closed1,
        assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa xaa n na. \<lbrakk>assoc_bpp A f; x \<in> add_set f A n; y \<in> add_set f A na; xa = add_set f A n; xaa = add_set f A na; x \<^sub>f+ y \<in> add_set f A (n + na + Suc 0)\<rbrakk> \<Longrightarrow> \<exists>xa. (\<exists>n. xa = add_set f A n) \<and> x \<^sub>f+ y \<in> xa
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vcompD[dest!]:
  assumes "\<langle>a, c\<rangle> \<in>\<^sub>\<circ> r \<circ>\<^sub>\<circ> s"
  shows "\<exists>b. \<langle>b, c\<rangle> \<in>\<^sub>\<circ> r \<and> \<langle>a, b\<rangle> \<in>\<^sub>\<circ> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b. \<langle>b, c\<rangle> \<in>\<^sub>\<circ> r \<and> \<langle>a, b\<rangle> \<in>\<^sub>\<circ> s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<langle>a, c\<rangle> \<in>\<^sub>\<circ> r \<circ>\<^sub>\<circ> s

goal (1 subgoal):
 1. \<exists>b. \<langle>b, c\<rangle> \<in>\<^sub>\<circ> r \<and> \<langle>a, b\<rangle> \<in>\<^sub>\<circ> s
[PROOF STEP]
unfolding vcomp_def
[PROOF STATE]
proof (prove)
using this:
\<langle>a, c\<rangle> \<in>\<^sub>\<circ> set {\<langle>a, c\<rangle> |a c. \<exists>b. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> s \<and> \<langle>b, c\<rangle> \<in>\<^sub>\<circ> r}

goal (1 subgoal):
 1. \<exists>b. \<langle>b, c\<rangle> \<in>\<^sub>\<circ> r \<and> \<langle>a, b\<rangle> \<in>\<^sub>\<circ> s
[PROOF STEP]
by auto


[STATEMENT]
lemma subcocycle_lim_cmult:
  assumes "subcocycle u" "subcocycle_avg_ereal u > -\<infinity>" "c\<ge>(0::real)"
  shows "subcocycle_avg_ereal (\<lambda>n x. c * u n x) > - \<infinity>"
        "AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<infinity> < subcocycle_avg_ereal (\<lambda>n x. c * u n x) &&& AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - \<infinity> < subcocycle_avg_ereal (\<lambda>n x. c * u n x)
 2. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
show *: "subcocycle_avg_ereal (\<lambda>n x. c * u n x) > - \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<infinity> < subcocycle_avg_ereal (\<lambda>n x. c * u n x)
[PROOF STEP]
using subcocycle_avg_cmult[OF assms(1) assms(3)] assms(2) assms(3)
[PROOF STATE]
proof (prove)
using this:
- \<infinity> < subcocycle_avg_ereal u \<Longrightarrow> - \<infinity> < subcocycle_avg_ereal (\<lambda>n x. c * u n x)
- \<infinity> < subcocycle_avg_ereal u \<Longrightarrow> subcocycle_avg (\<lambda>n x. c * u n x) = c * subcocycle_avg u
- \<infinity> < subcocycle_avg_ereal u
0 \<le> c

goal (1 subgoal):
 1. - \<infinity> < subcocycle_avg_ereal (\<lambda>n x. c * u n x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- \<infinity> < subcocycle_avg_ereal (\<lambda>n x. c * u n x)

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
have "AE x in M. (\<lambda>n. (c * u n x)/n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. (\<lambda>n. c * u n x / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x
[PROOF STEP]
by (rule kingman_theorem_nonergodic(1)[OF subcocycle_cmult[OF assms(1) assms(3)] *])
[PROOF STATE]
proof (state)
this:
AE x in M. (\<lambda>n. c * u n x / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in M. (\<lambda>n. c * u n x / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
have "AE x in M. (\<lambda>n. u n x / n) \<longlonglongrightarrow> subcocycle_lim u x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. (\<lambda>n. u n x / real n) \<longlonglongrightarrow> subcocycle_lim u x
[PROOF STEP]
by (rule kingman_theorem_nonergodic(1)[OF assms(1) assms(2)])
[PROOF STATE]
proof (state)
this:
AE x in M. (\<lambda>n. u n x / real n) \<longlonglongrightarrow> subcocycle_lim u x

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in M. (\<lambda>n. u n x / real n) \<longlonglongrightarrow> subcocycle_lim u x

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
AE x in M. (\<lambda>n. u n x / real n) \<longlonglongrightarrow> subcocycle_lim u x

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
assume H: "(\<lambda>n. (c * u n x)/n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x"
                    "(\<lambda>n. u n x / n) \<longlonglongrightarrow> subcocycle_lim u x"
[PROOF STATE]
proof (state)
this:
(\<lambda>n. c * u n x / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x
(\<lambda>n. u n x / real n) \<longlonglongrightarrow> subcocycle_lim u x

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
have "(\<lambda>n. c * (u n x / n)) \<longlonglongrightarrow> c * subcocycle_lim u x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. c * (u n x / real n)) \<longlonglongrightarrow> c * subcocycle_lim u x
[PROOF STEP]
by (rule tendsto_mult[OF _ H(2)], auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. c * (u n x / real n)) \<longlonglongrightarrow> c * subcocycle_lim u x

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. c * (u n x / real n)) \<longlonglongrightarrow> c * subcocycle_lim u x
[PROOF STEP]
have "subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. c * (u n x / real n)) \<longlonglongrightarrow> c * subcocycle_lim u x

goal (1 subgoal):
 1. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
using H(1)
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. c * (u n x / real n)) \<longlonglongrightarrow> c * subcocycle_lim u x
(\<lambda>n. c * u n x / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x

goal (1 subgoal):
 1. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
by (simp add: LIMSEQ_unique)
[PROOF STATE]
proof (state)
this:
subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>(\<lambda>n. c * u n ?x5 / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) ?x5; (\<lambda>n. u n ?x5 / real n) \<longlonglongrightarrow> subcocycle_lim u ?x5\<rbrakk> \<Longrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) ?x5 = c * subcocycle_lim u ?x5

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE x in M. (\<lambda>n. c * u n x / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x
AE x in M. (\<lambda>n. u n x / real n) \<longlonglongrightarrow> subcocycle_lim u x
\<lbrakk>(\<lambda>n. c * u n ?x5 / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) ?x5; (\<lambda>n. u n ?x5 / real n) \<longlonglongrightarrow> subcocycle_lim u ?x5\<rbrakk> \<Longrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) ?x5 = c * subcocycle_lim u ?x5
[PROOF STEP]
show "AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x"
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>n. c * u n x / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) x
AE x in M. (\<lambda>n. u n x / real n) \<longlonglongrightarrow> subcocycle_lim u x
\<lbrakk>(\<lambda>n. c * u n ?x5 / real n) \<longlonglongrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) ?x5; (\<lambda>n. u n ?x5 / real n) \<longlonglongrightarrow> subcocycle_lim u ?x5\<rbrakk> \<Longrightarrow> subcocycle_lim (\<lambda>n x. c * u n x) ?x5 = c * subcocycle_lim u ?x5

goal (1 subgoal):
 1. AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. subcocycle_lim (\<lambda>n x. c * u n x) x = c * subcocycle_lim u x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hequiv_trans_rel: \<open>Hintikka B A \<Longrightarrow> trans (hequiv_rel B A)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hintikka B A \<Longrightarrow> trans (hequiv_rel B A)
[PROOF STEP]
unfolding trans_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hintikka B A \<Longrightarrow> \<forall>x y z. (x, y) \<in> hequiv_rel B A \<longrightarrow> (y, z) \<in> hequiv_rel B A \<longrightarrow> (x, z) \<in> hequiv_rel B A
[PROOF STEP]
using hequiv_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Hintikka ?A ?H; ?i \<in> ?A; ?k \<in> ?A; hequiv ?H ?i ?j; hequiv ?H ?j ?k\<rbrakk> \<Longrightarrow> hequiv ?H ?i ?k

goal (1 subgoal):
 1. Hintikka B A \<Longrightarrow> \<forall>x y z. (x, y) \<in> hequiv_rel B A \<longrightarrow> (y, z) \<in> hequiv_rel B A \<longrightarrow> (x, z) \<in> hequiv_rel B A
[PROOF STEP]
by fast


[STATEMENT]
lemma "(\<exists>x. P(x) \<and> \<not>Q(x)) \<and>
              (\<forall>x. P(x) \<longrightarrow> R(x)) \<and>
              (\<forall>x. M(x) \<and> L(x) \<longrightarrow> P(x)) \<and>
              ((\<exists>x. R(x) \<and> \<not> Q(x)) \<longrightarrow> (\<forall>x. L(x) \<longrightarrow> \<not> R(x)))
          \<longrightarrow> (\<forall>x. M(x) \<longrightarrow> \<not>L(x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x \<and> \<not> Q x) \<and> (\<forall>x. P x \<longrightarrow> R x) \<and> (\<forall>x. M x \<and> L x \<longrightarrow> P x) \<and> ((\<exists>x. R x \<and> \<not> Q x) \<longrightarrow> (\<forall>x. L x \<longrightarrow> \<not> R x)) \<longrightarrow> (\<forall>x. M x \<longrightarrow> \<not> L x)
[PROOF STEP]
by blast


[STATEMENT]
lemma lemma_2:
  assumes "desargues_config A B C A' B' C' M N P R" and "incid A (line B' C') \<or> incid C' (line A B)"
    and "incid C (line A' B') \<or> incid B' (line A C)" and "incid B (line A' C') \<or> incid A' (line B C)"
  shows "col M N P \<or> triangle_circumscribes_triangle A B C A' B' C' \<or> triangle_circumscribes_triangle A' B' C' A B C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col M N P \<or> triangle_circumscribes_triangle A B C A' B' C' \<or> triangle_circumscribes_triangle A' B' C' A B C
[PROOF STEP]
by (smt assms ax_uniqueness col_def desargues_config_not_col_1
      desargues_config_not_col_11 desargues_config_not_col_12 desargues_config_not_col_2
      desargues_config_not_col_3 desargues_config_not_col_9 incidA_lAB incidB_lAB
      triangle_circumscribes_triangle_def)


[STATEMENT]
lemma invar_2Nodes:"invar (Node l (x,lv) (Node rl (rx, rlv) rr)) =
     (invar l \<and> invar \<langle>rl, (rx, rlv), rr\<rangle> \<and> lv = Suc (lvl l) \<and>
     (lv = Suc rlv \<or> rlv = lv \<and> lv = Suc (lvl rr)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar \<langle>l, (x, lv), \<langle>rl, (rx, rlv), rr\<rangle>\<rangle> = (invar l \<and> invar \<langle>rl, (rx, rlv), rr\<rangle> \<and> lv = Suc (lvl l) \<and> (lv = Suc rlv \<or> rlv = lv \<and> lv = Suc (lvl rr)))
[PROOF STEP]
by simp


[STATEMENT]
lemma Gauss_Jordan_iarrays_PA_mult:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows "snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i matrix_to_iarray A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i matrix_to_iarray A
[PROOF STEP]
have "snd (Gauss_Jordan_PA A) = fst (Gauss_Jordan_PA A) ** A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (Gauss_Jordan_PA A) = fst (Gauss_Jordan_PA A) ** A
[PROOF STEP]
using fst_Gauss_Jordan_PA[of A]
[PROOF STATE]
proof (prove)
using this:
fst (Gauss_Jordan_PA A) ** A = snd (Gauss_Jordan_PA A)

goal (1 subgoal):
 1. snd (Gauss_Jordan_PA A) = fst (Gauss_Jordan_PA A) ** A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
snd (Gauss_Jordan_PA A) = fst (Gauss_Jordan_PA A) ** A

goal (1 subgoal):
 1. snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i matrix_to_iarray A
[PROOF STEP]
hence "matrix_to_iarray (snd (Gauss_Jordan_PA A)) = matrix_to_iarray (fst (Gauss_Jordan_PA A) ** A)"
[PROOF STATE]
proof (prove)
using this:
snd (Gauss_Jordan_PA A) = fst (Gauss_Jordan_PA A) ** A

goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_PA A)) = matrix_to_iarray (fst (Gauss_Jordan_PA A) ** A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (snd (Gauss_Jordan_PA A)) = matrix_to_iarray (fst (Gauss_Jordan_PA A) ** A)

goal (1 subgoal):
 1. snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i matrix_to_iarray A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (snd (Gauss_Jordan_PA A)) = matrix_to_iarray (fst (Gauss_Jordan_PA A) ** A)

goal (1 subgoal):
 1. snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i matrix_to_iarray A
[PROOF STEP]
unfolding matrix_to_iarray_snd_Gauss_Jordan_PA matrix_to_iarray_matrix_matrix_mult matrix_to_iarray_fst_Gauss_Jordan_PA
[PROOF STATE]
proof (prove)
using this:
snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i matrix_to_iarray A

goal (1 subgoal):
 1. snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i matrix_to_iarray A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) = fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) **i matrix_to_iarray A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma retract_of_connected:
    "\<lbrakk>connected T; S retract_of T\<rbrakk> \<Longrightarrow> connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connected T; S retract_of T\<rbrakk> \<Longrightarrow> connected S
[PROOF STEP]
by (metis Topological_Spaces.connected_continuous_image retract_of_def retraction)


[STATEMENT]
lemma mset_remove1: "t \<in> set q \<Longrightarrow>
  queue_to_multiset (remove1 t q) =
  queue_to_multiset q - tree_to_multiset t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> set q \<Longrightarrow> queue_to_multiset (remove1 t q) = queue_to_multiset q - tree_to_multiset t
[PROOF STEP]
by (induct q) (auto simp: in_set_subset)


[STATEMENT]
lemma atLeastatMost_empty[simp]:
  assumes "b <\<^sub>a a"
  shows "{a\<le>\<^sub>a..\<le>\<^sub>ab} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a\<le>\<^sub>a..\<le>\<^sub>ab} = {}
[PROOF STEP]
unfolding interval_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a\<le>\<^sub>a..} \<inter> {..\<le>\<^sub>ab} = {}
[PROOF STEP]
using less_le_not_le assms
[PROOF STATE]
proof (prove)
using this:
(?x <\<^sub>a ?y) = (?x \<le>\<^sub>a ?y \<and> \<not> ?y \<le>\<^sub>a ?x)
b <\<^sub>a a

goal (1 subgoal):
 1. {a\<le>\<^sub>a..} \<inter> {..\<le>\<^sub>ab} = {}
[PROOF STEP]
by (metis Int_emptyI ord.lessThan_iff atLeast_iff order_trans)


[STATEMENT]
lemma odd_even_cases [case_names 0 odd even]:
  assumes "P 0" and odd: "\<And>n. P(Suc (2 * n))" and even: "\<And>n. P(2 * n + 2)"
  shows "P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P n
[PROOF STEP]
by (metis nat_induct2 One_nat_def Suc_1 add_Suc_right assms(1) dvdE even odd oddE)


[STATEMENT]
lemma Infinitesimal_interval:
  "e \<in> Infinitesimal \<Longrightarrow> e' \<in> Infinitesimal \<Longrightarrow> e' < x \<Longrightarrow> x < e \<Longrightarrow> x \<in> Infinitesimal"
  for x :: hypreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>e \<in> Infinitesimal; e' \<in> Infinitesimal; e' < x; x < e\<rbrakk> \<Longrightarrow> x \<in> Infinitesimal
[PROOF STEP]
by (auto simp add: Infinitesimal_def abs_less_iff)


[STATEMENT]
lemma SUP_Pair: "(SUP x\<in>A. (f x, g x)) = (SUP x\<in>A. f x, SUP x\<in>A. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP x\<in>A. (f x, g x)) = (Sup (f ` A), Sup (g ` A))
[PROOF STEP]
by (simp add: Sup_prod_def image_image)


[STATEMENT]
lemma eventually_ln_not_equal: "eventually (\<lambda>x::real. ln x \<noteq> a) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ln x \<noteq> a
[PROOF STEP]
by (subst eventually_ln_at_top) (rule eventually_not_equal)


[STATEMENT]
lemma floor_le_neg_numeral [simp]: "\<lfloor>x\<rfloor> \<le> - numeral v \<longleftrightarrow> x < - numeral v + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> \<le> - numeral v) = (x < - numeral v + (1::'a))
[PROOF STEP]
by (simp add: floor_le_iff)


[STATEMENT]
lemma approx_add: "a \<approx> b \<Longrightarrow> c \<approx> d \<Longrightarrow> a + c \<approx> b + d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<approx> b; c \<approx> d\<rbrakk> \<Longrightarrow> a + c \<approx> b + d
[PROOF STEP]
proof (unfold approx_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>a - b \<in> Infinitesimal; c - d \<in> Infinitesimal\<rbrakk> \<Longrightarrow> a + c - (b + d) \<in> Infinitesimal
[PROOF STEP]
assume inf: "a - b \<in> Infinitesimal" "c - d \<in> Infinitesimal"
[PROOF STATE]
proof (state)
this:
a - b \<in> Infinitesimal
c - d \<in> Infinitesimal

goal (1 subgoal):
 1. \<lbrakk>a - b \<in> Infinitesimal; c - d \<in> Infinitesimal\<rbrakk> \<Longrightarrow> a + c - (b + d) \<in> Infinitesimal
[PROOF STEP]
have "a + c - (b + d) = (a - b) + (c - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + c - (b + d) = a - b + (c - d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a + c - (b + d) = a - b + (c - d)

goal (1 subgoal):
 1. \<lbrakk>a - b \<in> Infinitesimal; c - d \<in> Infinitesimal\<rbrakk> \<Longrightarrow> a + c - (b + d) \<in> Infinitesimal
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a + c - (b + d) = a - b + (c - d)

goal (1 subgoal):
 1. \<lbrakk>a - b \<in> Infinitesimal; c - d \<in> Infinitesimal\<rbrakk> \<Longrightarrow> a + c - (b + d) \<in> Infinitesimal
[PROOF STEP]
have "... \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - b + (c - d) \<in> Infinitesimal
[PROOF STEP]
using inf
[PROOF STATE]
proof (prove)
using this:
a - b \<in> Infinitesimal
c - d \<in> Infinitesimal

goal (1 subgoal):
 1. a - b + (c - d) \<in> Infinitesimal
[PROOF STEP]
by (rule Infinitesimal_add)
[PROOF STATE]
proof (state)
this:
a - b + (c - d) \<in> Infinitesimal

goal (1 subgoal):
 1. \<lbrakk>a - b \<in> Infinitesimal; c - d \<in> Infinitesimal\<rbrakk> \<Longrightarrow> a + c - (b + d) \<in> Infinitesimal
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a + c - (b + d) \<in> Infinitesimal
[PROOF STEP]
show "a + c - (b + d) \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
using this:
a + c - (b + d) \<in> Infinitesimal

goal (1 subgoal):
 1. a + c - (b + d) \<in> Infinitesimal
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
a + c - (b + d) \<in> Infinitesimal

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma C_card_eq_D_plus_E: "card C = card D + card E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card C = card D + card E
[PROOF STEP]
by (auto simp add: C_eq card_Un_disjoint D_E_disj finite_D finite_E)


[STATEMENT]
lemma fact_prod_Suc: "fact n = of_nat (prod Suc {0..<n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact n = of_nat (prod Suc {0..<n})
[PROOF STEP]
unfolding fact_prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (\<Prod>{1..n}) = of_nat (prod Suc {0..<n})
[PROOF STEP]
using atLeast0LessThan prod.atLeast1_atMost_eq
[PROOF STATE]
proof (prove)
using this:
{0..<?n} = {..<?n}
prod ?g {Suc 0..?n} = (\<Prod>k<?n. ?g (Suc k))

goal (1 subgoal):
 1. of_nat (\<Prod>{1..n}) = of_nat (prod Suc {0..<n})
[PROOF STEP]
by auto


[STATEMENT]
lemma cGDERIV_inverse:
  "\<lbrakk>cGDERIV f x :> df; f x \<noteq> 0\<rbrakk>
     \<Longrightarrow> cGDERIV (\<lambda>x. inverse (f x)) x :> - cnj ((inverse (f x))\<^sup>2) *\<^sub>C df"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cGDERIV f x :> df; f x \<noteq> 0\<rbrakk> \<Longrightarrow> cGDERIV (\<lambda>x. inverse (f x)) x :> - cnj ((inverse (f x))\<^sup>2) *\<^sub>C df
[PROOF STEP]
by (metis DERIV_inverse cGDERIV_DERIV_compose complex_cnj_cnj complex_cnj_minus numerals(2))


[STATEMENT]
lemma nth_first_ind:
  "\<lbrakk> distinct xs; x \<in> set(xs) \<rbrakk> \<Longrightarrow> xs ! (first_ind xs x i - i) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> xs ! (first_ind xs x i - i) = x
[PROOF STEP]
apply (induct xs arbitrary: i)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. \<lbrakk>distinct []; x \<in> set []\<rbrakk> \<Longrightarrow> [] ! (first_ind [] x i - i) = x
 2. \<And>a xs i. \<lbrakk>\<And>i. \<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> xs ! (first_ind xs x i - i) = x; distinct (a # xs); x \<in> set (a # xs)\<rbrakk> \<Longrightarrow> (a # xs) ! (first_ind (a # xs) x i - i) = x
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs i. \<lbrakk>\<And>i. xs ! (first_ind xs x i - i) = x; a \<notin> set xs; distinct xs; a \<noteq> x; x \<in> set xs\<rbrakk> \<Longrightarrow> (a # xs) ! (first_ind xs x (Suc i) - i) = x
[PROOF STEP]
apply (metis One_nat_def add.right_neutral add_Suc_right add_diff_cancel_left' diff_diff_left empty_iff first_ind.simps(2) list.set(1) nat.simps(3) neq_Nil_conv nth_Cons' zero_diff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ennreal_SUP_const_minus:
  fixes f :: "'a \<Rightarrow> ennreal"
  shows "I \<noteq> {} \<Longrightarrow> c < top \<Longrightarrow> (INF x\<in>I. c - f x) = c - (SUP x\<in>I. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; c < top\<rbrakk> \<Longrightarrow> (INF x\<in>I. c - f x) = c - Sup (f ` I)
[PROOF STEP]
apply (transfer fixing: I)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c f. \<lbrakk>I \<noteq> {}; 0 \<le> c; c < top; pred_fun top ((\<le>) 0) f\<rbrakk> \<Longrightarrow> (INF x\<in>I. max 0 (c - f x)) = max 0 (c - (sup 0 \<circ> Sup) (f ` I))
[PROOF STEP]
unfolding ex_in_conv[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c f. \<lbrakk>\<exists>x. x \<in> I; 0 \<le> c; c < top; pred_fun top ((\<le>) 0) f\<rbrakk> \<Longrightarrow> (INF x\<in>I. max 0 (c - f x)) = max 0 (c - (sup 0 \<circ> Sup) (f ` I))
[PROOF STEP]
apply (auto simp add: SUP_upper2 sup_absorb2 simp flip: sup_ereal_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c f x. \<lbrakk>0 \<le> c; c < top; \<forall>x. 0 \<le> f x; x \<in> I\<rbrakk> \<Longrightarrow> (INF x\<in>I. sup 0 (c - f x)) = sup 0 (c - Sup (f ` I))
[PROOF STEP]
apply (subst INF_ereal_minus_right[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>c f x. \<lbrakk>0 \<le> c; c < top; \<forall>x. 0 \<le> f x; x \<in> I\<rbrakk> \<Longrightarrow> I \<noteq> {}
 2. \<And>c f x. \<lbrakk>0 \<le> c; c < top; \<forall>x. 0 \<le> f x; x \<in> I\<rbrakk> \<Longrightarrow> \<bar>c\<bar> \<noteq> \<infinity>
 3. \<And>c f x. \<lbrakk>0 \<le> c; c < top; \<forall>x. 0 \<le> f x; x \<in> I\<rbrakk> \<Longrightarrow> (INF x\<in>I. sup 0 (c - f x)) = sup 0 (INF i\<in>I. c - f i)
[PROOF STEP]
apply (auto simp del: sup_ereal_def simp add: sup_INF)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem wf_dbtm_iff_is_tm: "wf_dbtm x \<longleftrightarrow> (\<exists>t::tm. x = trans_tm [] t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dbtm x = (\<exists>t. x = trans_tm [] t)
[PROOF STEP]
by (metis wf_dbtm_imp_is_tm wf_dbtm_trans_tm)


[STATEMENT]
theorem main_lemma:
  fixes PROB :: "'a problem" and as s
  assumes "finite PROB" "(s \<in> valid_states PROB)" "(as \<in> valid_plans PROB)"
  shows "(\<exists>as'.
    (exec_plan s as = exec_plan s as')
    \<and> (subseq as' as)
    \<and> (length  as' \<le> (2 ^ (card (prob_dom PROB))) - 1)
  )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
proof (cases "length as \<le> (2 ^ (card (prob_dom PROB))) - 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
 2. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
length as \<le> 2 ^ card (prob_dom PROB) - 1

goal (2 subgoals):
 1. length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
 2. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length as \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
have "exec_plan s as = exec_plan s as"
[PROOF STATE]
proof (prove)
using this:
length as \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. exec_plan s as = exec_plan s as
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exec_plan s as = exec_plan s as

goal (2 subgoals):
 1. length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
 2. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exec_plan s as = exec_plan s as
[PROOF STEP]
have "subseq as as"
[PROOF STATE]
proof (prove)
using this:
exec_plan s as = exec_plan s as

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

goal (2 subgoals):
 1. length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
 2. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subseq as as
[PROOF STEP]
have "length as \<le> (2^(card (prob_dom PROB)) - 1)"
[PROOF STATE]
proof (prove)
using this:
subseq as as

goal (1 subgoal):
 1. length as \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
subseq as as
length as \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. length as \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length as \<le> 2 ^ card (prob_dom PROB) - 1

goal (2 subgoals):
 1. length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
 2. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length as \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length as \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> length as \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> length as \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
have "length as > (2 ^ (card (prob_dom PROB))) - 1"
[PROOF STATE]
proof (prove)
using this:
\<not> length as \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. 2 ^ card (prob_dom PROB) - 1 < length as
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> length as \<le> 2 ^ card (prob_dom PROB) - 1
\<not> length as \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. 2 ^ card (prob_dom PROB) - 1 < length as
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ card (prob_dom PROB) - 1 < length as

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ card (prob_dom PROB) - 1 < length as
[PROOF STEP]
obtain as' where 1:
    "exec_plan s as = exec_plan s as'" "length as' < length as" "subseq as' as"
[PROOF STATE]
proof (prove)
using this:
2 ^ card (prob_dom PROB) - 1 < length as

goal (1 subgoal):
 1. (\<And>as'. \<lbrakk>exec_plan s as = exec_plan s as'; length as' < length as; subseq as' as\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms lemma_3
[PROOF STATE]
proof (prove)
using this:
2 ^ card (prob_dom PROB) - 1 < length as
finite PROB
s \<in> valid_states PROB
as \<in> valid_plans PROB
\<lbrakk>finite ?PROB; ?s \<in> valid_states ?PROB; ?as \<in> valid_plans ?PROB; 2 ^ card (prob_dom ?PROB) - 1 < length ?as\<rbrakk> \<Longrightarrow> \<exists>as'. exec_plan ?s ?as = exec_plan ?s as' \<and> length as' < length ?as \<and> subseq as' ?as

goal (1 subgoal):
 1. (\<And>as'. \<lbrakk>exec_plan s as = exec_plan s as'; length as' < length as; subseq as' as\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
exec_plan s as = exec_plan s as'
length as' < length as
subseq as' as

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
exec_plan s as = exec_plan s as'
length as' < length as
subseq as' as

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
assume "exec_plan s as = exec_plan s p" "subseq p as"
      "2 ^ card (prob_dom PROB) - 1 < length p"
[PROOF STATE]
proof (state)
this:
exec_plan s as = exec_plan s p
subseq p as
2 ^ card (prob_dom PROB) - 1 < length p

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exec_plan s as = exec_plan s p
subseq p as
2 ^ card (prob_dom PROB) - 1 < length p
[PROOF STEP]
have "(\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length p)"
[PROOF STATE]
proof (prove)
using this:
exec_plan s as = exec_plan s p
subseq p as
2 ^ card (prob_dom PROB) - 1 < length p

goal (1 subgoal):
 1. \<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length p
[PROOF STEP]
using assms(1, 2, 3) lemma_3 sublist_valid_is_valid
[PROOF STATE]
proof (prove)
using this:
exec_plan s as = exec_plan s p
subseq p as
2 ^ card (prob_dom PROB) - 1 < length p
finite PROB
s \<in> valid_states PROB
as \<in> valid_plans PROB
\<lbrakk>finite ?PROB; ?s \<in> valid_states ?PROB; ?as \<in> valid_plans ?PROB; 2 ^ card (prob_dom ?PROB) - 1 < length ?as\<rbrakk> \<Longrightarrow> \<exists>as'. exec_plan ?s ?as = exec_plan ?s as' \<and> length as' < length ?as \<and> subseq as' ?as
\<lbrakk>?as \<in> valid_plans ?PROB; subseq ?as' ?as\<rbrakk> \<Longrightarrow> ?as' \<in> valid_plans ?PROB

goal (1 subgoal):
 1. \<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length p
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length p

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>exec_plan s as = exec_plan s ?p2; subseq ?p2 as; 2 ^ card (prob_dom PROB) - 1 < length ?p2\<rbrakk> \<Longrightarrow> \<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length ?p2

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>exec_plan s as = exec_plan s ?p2; subseq ?p2 as; 2 ^ card (prob_dom PROB) - 1 < length ?p2\<rbrakk> \<Longrightarrow> \<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length ?p2
[PROOF STEP]
have "\<forall>p. exec_plan s as = exec_plan s p \<and> subseq p as \<longrightarrow>
      (\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as)
      \<and> length p' \<le> 2 ^ card (prob_dom PROB) - 1)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>exec_plan s as = exec_plan s ?p2; subseq ?p2 as; 2 ^ card (prob_dom PROB) - 1 < length ?p2\<rbrakk> \<Longrightarrow> \<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length ?p2

goal (1 subgoal):
 1. \<forall>p. exec_plan s as = exec_plan s p \<and> subseq p as \<longrightarrow> (\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' \<le> 2 ^ card (prob_dom PROB) - 1)
[PROOF STEP]
using general_theorem[where
        P = "\<lambda>(as'' :: 'a action list). (exec_plan s as = exec_plan s as'') \<and> subseq as'' as"
        and l = "(2 ^ (card (prob_dom (PROB ::'a problem)))) - 1" and f = length]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>exec_plan s as = exec_plan s ?p2; subseq ?p2 as; 2 ^ card (prob_dom PROB) - 1 < length ?p2\<rbrakk> \<Longrightarrow> \<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length ?p2
\<forall>p. (exec_plan s as = exec_plan s p \<and> subseq p as) \<and> 2 ^ card (prob_dom PROB) - 1 < length p \<longrightarrow> (\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' < length p) \<Longrightarrow> \<forall>p. exec_plan s as = exec_plan s p \<and> subseq p as \<longrightarrow> (\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' \<le> 2 ^ card (prob_dom PROB) - 1)

goal (1 subgoal):
 1. \<forall>p. exec_plan s as = exec_plan s p \<and> subseq p as \<longrightarrow> (\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' \<le> 2 ^ card (prob_dom PROB) - 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>p. exec_plan s as = exec_plan s p \<and> subseq p as \<longrightarrow> (\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' \<le> 2 ^ card (prob_dom PROB) - 1)

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>p. exec_plan s as = exec_plan s p \<and> subseq p as \<longrightarrow> (\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' \<le> 2 ^ card (prob_dom PROB) - 1)
[PROOF STEP]
obtain p' where
    "exec_plan s as = exec_plan s p'" "subseq p' as" "length p' \<le> 2 ^ card (prob_dom PROB) - 1"
[PROOF STATE]
proof (prove)
using this:
\<forall>p. exec_plan s as = exec_plan s p \<and> subseq p as \<longrightarrow> (\<exists>p'. (exec_plan s as = exec_plan s p' \<and> subseq p' as) \<and> length p' \<le> 2 ^ card (prob_dom PROB) - 1)

goal (1 subgoal):
 1. (\<And>p'. \<lbrakk>exec_plan s as = exec_plan s p'; subseq p' as; length p' \<le> 2 ^ card (prob_dom PROB) - 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
exec_plan s as = exec_plan s p'
subseq p' as
length p' \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. \<not> length as \<le> 2 ^ card (prob_dom PROB) - 1 \<Longrightarrow> \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exec_plan s as = exec_plan s p'
subseq p' as
length p' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
exec_plan s as = exec_plan s p'
subseq p' as
length p' \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
using sublist_refl
[PROOF STATE]
proof (prove)
using this:
exec_plan s as = exec_plan s p'
subseq p' as
length p' \<le> 2 ^ card (prob_dom PROB) - 1
subseq ?l ?l

goal (1 subgoal):
 1. \<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>as'. exec_plan s as = exec_plan s as' \<and> subseq as' as \<and> length as' \<le> 2 ^ card (prob_dom PROB) - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l8_14_2_1b_bis:
  assumes "A B Perp C D" and
    "Col X A B" and
    "Col X C D"
  shows "X PerpAt A B C D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X PerpAt A B C D
[PROOF STEP]
using Perp_def assms(1) assms(2) assms(3) l8_14_2_1b
[PROOF STATE]
proof (prove)
using this:
?A ?B Perp ?C ?D \<equiv> \<exists>X. X PerpAt ?A ?B ?C ?D
A B Perp C D
Col X A B
Col X C D
\<lbrakk>?X PerpAt ?A ?B ?C ?D ; Col ?Y ?A ?B; Col ?Y ?C ?D\<rbrakk> \<Longrightarrow> ?X = ?Y

goal (1 subgoal):
 1. X PerpAt A B C D
[PROOF STEP]
by blast


[STATEMENT]
lemma sparse_row_vector_smult: "sparse_row_vector (smult_spvec y a) = scalar_mult y (sparse_row_vector a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sparse_row_vector (smult_spvec y a) = scalar_mult y (sparse_row_vector a)
[PROOF STEP]
apply (induct a)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. sparse_row_vector (smult_spvec y []) = scalar_mult y (sparse_row_vector [])
 2. \<And>a1 a2. sparse_row_vector (smult_spvec y a2) = scalar_mult y (sparse_row_vector a2) \<Longrightarrow> sparse_row_vector (smult_spvec y (a1 # a2)) = scalar_mult y (sparse_row_vector (a1 # a2))
[PROOF STEP]
apply (simp_all add: smult_spvec_cons scalar_mult_add)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma norm_octo_squared:
  "norm x ^ 2 = Ree x ^ 2 + Im1 x ^ 2 + Im2 x ^ 2 + Im3 x ^ 2 +
     Im4 x ^ 2 + Im5 x ^ 2 + Im6 x ^ 2 + Im7 x ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x)\<^sup>2 = (Ree x)\<^sup>2 + (Im1 x)\<^sup>2 + (Im2 x)\<^sup>2 + (Im3 x)\<^sup>2 + (Im4 x)\<^sup>2 + (Im5 x)\<^sup>2 + (Im6 x)\<^sup>2 + (Im7 x)\<^sup>2
[PROOF STEP]
by (simp add: norm_octo_def)


[STATEMENT]
lemma gcd_code_integer [code]: "gcd k l = \<bar>if l = (0::integer) then k else gcd l (\<bar>k\<bar> mod \<bar>l\<bar>)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd k l = \<bar>if l = 0 then k else gcd l (\<bar>k\<bar> mod \<bar>l\<bar>)\<bar>
[PROOF STEP]
by transfer (fact gcd_code_int)


[STATEMENT]
lemma extreme_point_of_stillconvex:
   "convex S \<Longrightarrow> (x extreme_point_of S \<longleftrightarrow> x \<in> S \<and> convex(S - {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex S \<Longrightarrow> (x extreme_point_of S) = (x \<in> S \<and> convex (S - {x}))
[PROOF STEP]
by (fastforce simp add: convex_contains_segment extreme_point_of_def open_segment_def)


[STATEMENT]
lemma flow_in_ivp_sols_ex_ivl:
  assumes "s \<in> S"
  shows "flow t\<^sub>0 s \<in> Sols f (\<lambda>s. ex_ivl s) S t\<^sub>0 s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. flow t\<^sub>0 s \<in> Sols f ex_ivl S t\<^sub>0 s
[PROOF STEP]
using flow_has_vderiv_on_ex_ivl[OF assms]
[PROOF STATE]
proof (prove)
using this:
 D flow t\<^sub>0 s = (\<lambda>t. f t (flow t\<^sub>0 s t)) on ex_ivl s

goal (1 subgoal):
 1. flow t\<^sub>0 s \<in> Sols f ex_ivl S t\<^sub>0 s
[PROOF STEP]
apply(rule ivp_solsI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. flow t\<^sub>0 s t\<^sub>0 = s
 2. flow t\<^sub>0 s \<in> ex_ivl s \<rightarrow> S
 3. t\<^sub>0 \<in> ex_ivl s
[PROOF STEP]
apply(simp_all add: init_time assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. flow t\<^sub>0 s \<in> ex_ivl s \<rightarrow> S
[PROOF STEP]
by (rule flow_funcset_ex_ivl[OF assms])


[STATEMENT]
lemma unit_imp_det_non_zero: assumes "A \<in> Units (ring_mat TYPE('a :: comm_ring_1) n b)"
   shows "det A \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A \<noteq> (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A \<noteq> (0::'a)
[PROOF STEP]
from assms[unfolded Units_def ring_mat_def]
[PROOF STATE]
proof (chain)
picking this:
A \<in> {y \<in> carrier \<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>. \<exists>x\<in>carrier \<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>. x \<otimes>\<^bsub>\<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>\<^esub> y = \<one>\<^bsub>\<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>\<^esub> \<and> y \<otimes>\<^bsub>\<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>\<^esub> x = \<one>\<^bsub>\<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>\<^esub>}
[PROOF STEP]
obtain B where A: "A \<in> carrier_mat n n" and B: "B \<in> carrier_mat n n" and BA: "B * A = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
A \<in> {y \<in> carrier \<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>. \<exists>x\<in>carrier \<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>. x \<otimes>\<^bsub>\<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>\<^esub> y = \<one>\<^bsub>\<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>\<^esub> \<and> y \<otimes>\<^bsub>\<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>\<^esub> x = \<one>\<^bsub>\<lparr>carrier = carrier_mat n n, monoid.mult = (*), one = 1\<^sub>m n, zero = 0\<^sub>m n n, add = (+), \<dots> = b\<rparr>\<^esub>}

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>A \<in> carrier_mat n n; B \<in> carrier_mat n n; B * A = 1\<^sub>m n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
B * A = 1\<^sub>m n

goal (1 subgoal):
 1. det A \<noteq> (0::'a)
[PROOF STEP]
from arg_cong[OF BA, of det, unfolded det_mult[OF B A] det_one]
[PROOF STATE]
proof (chain)
picking this:
det B * det A = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det B * det A = (1::'a)

goal (1 subgoal):
 1. det A \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det A \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma divide_eq_inf:
  assumes "z :\<^sub>h w = \<infinity>\<^sub>h"
  shows "z = \<infinity>\<^sub>h \<or> w = 0\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = 0\<^sub>h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z :\<^sub>h w = \<infinity>\<^sub>h

goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = 0\<^sub>h
[PROOF STEP]
using reciprocal_inf_iff[of w] mult_eq_inf
[PROOF STATE]
proof (prove)
using this:
z :\<^sub>h w = \<infinity>\<^sub>h
(reciprocal w = \<infinity>\<^sub>h) = (w = 0\<^sub>h)
?z *\<^sub>h ?w = \<infinity>\<^sub>h \<Longrightarrow> ?z = \<infinity>\<^sub>h \<or> ?w = \<infinity>\<^sub>h

goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = 0\<^sub>h
[PROOF STEP]
unfolding divide_def
[PROOF STATE]
proof (prove)
using this:
z *\<^sub>h reciprocal w = \<infinity>\<^sub>h
(reciprocal w = \<infinity>\<^sub>h) = (w = 0\<^sub>h)
?z *\<^sub>h ?w = \<infinity>\<^sub>h \<Longrightarrow> ?z = \<infinity>\<^sub>h \<or> ?w = \<infinity>\<^sub>h

goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = 0\<^sub>h
[PROOF STEP]
by auto


[STATEMENT]
lemma hermitian_decomp_dim_carrier:
  assumes "hermitian_decomp A B U"
  shows "B \<in> carrier_mat (dim_row A) (dim_col A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat (dim_row A) (dim_col A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitian_decomp A B U

goal (1 subgoal):
 1. B \<in> carrier_mat (dim_row A) (dim_col A)
[PROOF STEP]
unfolding hermitian_decomp_def similar_mat_wit_def
[PROOF STATE]
proof (prove)
using this:
(let n = dim_row A in {A, B, U, Complex_Matrix.adjoint U} \<subseteq> carrier_mat n n \<and> U * Complex_Matrix.adjoint U = 1\<^sub>m n \<and> Complex_Matrix.adjoint U * U = 1\<^sub>m n \<and> A = U * B * Complex_Matrix.adjoint U) \<and> diagonal_mat B \<and> diag_mat B = eigvals A \<and> Complex_Matrix.unitary U \<and> (\<forall>i<dim_row B. B $$ (i, i) \<in> \<real>)

goal (1 subgoal):
 1. B \<in> carrier_mat (dim_row A) (dim_col A)
[PROOF STEP]
by (metis (full_types) index_mult_mat(3) index_one_mat(3) insert_subset)


[STATEMENT]
lemma nth_repl: "m<length xs \<Longrightarrow> n <length xs \<Longrightarrow> m\<noteq> n \<Longrightarrow>(take n xs @ [x] @ drop (n+1) xs) ! m = xs ! m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m < length xs; n < length xs; m \<noteq> n\<rbrakk> \<Longrightarrow> (take n xs @ [x] @ drop (n + 1) xs) ! m = xs ! m
[PROOF STEP]
by (metis Suc_eq_plus1 append_Cons append_Nil nth_list_update_neq upd_conv_take_nth_drop)


[STATEMENT]
lemma gen_boolean_algebra_idempotent:
  assumes "S = \<Union> Xs"
  shows "gen_boolean_algebra S (gen_boolean_algebra S Xs) = (gen_boolean_algebra S Xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_boolean_algebra S (gen_boolean_algebra S Xs) = gen_boolean_algebra S Xs
[PROOF STEP]
apply(rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. gen_boolean_algebra S (gen_boolean_algebra S Xs) \<subseteq> gen_boolean_algebra S Xs
 2. gen_boolean_algebra S Xs \<subseteq> gen_boolean_algebra S (gen_boolean_algebra S Xs)
[PROOF STEP]
apply(rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> gen_boolean_algebra S (gen_boolean_algebra S Xs) \<Longrightarrow> x \<in> gen_boolean_algebra S Xs
 2. gen_boolean_algebra S Xs \<subseteq> gen_boolean_algebra S (gen_boolean_algebra S Xs)
[PROOF STEP]
apply (meson equalityD2 gen_boolean_algebra_subalgebra in_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_boolean_algebra S Xs \<subseteq> gen_boolean_algebra S (gen_boolean_algebra S Xs)
[PROOF STEP]
apply(rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> gen_boolean_algebra S Xs \<Longrightarrow> x \<in> gen_boolean_algebra S (gen_boolean_algebra S Xs)
[PROOF STEP]
by (metis gen_boolean_algebra.simps gen_boolean_algebra_subset inf.absorb1)


[STATEMENT]
lemma size_length: "size t = length (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size t = length (Tree2.inorder t)
[PROOF STEP]
by (induction t rule: inorder.induct) auto


[STATEMENT]
lemma DERIV_deriv_iff_real_differentiable:
  fixes x :: real
  shows "DERIV f x :> deriv f x \<longleftrightarrow> f differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_real_derivative deriv f x) (at x) = (f differentiable at x)
[PROOF STEP]
unfolding differentiable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_real_derivative deriv f x) (at x) = (\<exists>D. (f has_derivative D) (at x))
[PROOF STEP]
by (metis DERIV_imp_deriv has_real_derivative_iff)


[STATEMENT]
lemma poly_shift_1: "poly_shift n 1 = (if n = 0 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_shift n 1 = (if n = 0 then 1 else 0)
[PROOF STEP]
by (simp add: poly_eq_iff coeff_poly_shift)


[STATEMENT]
lemma discrete_topology: "topology (discrete_top X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topology (discrete_top X)
[PROOF STEP]
by (auto intro!: topologyI simp: is_open_def discrete_top_def)
   blast


[STATEMENT]
lemma hmsetmset_diff: "hmsetmset (M - N) = hmsetmset M - hmsetmset N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hmsetmset (M - N) = hmsetmset M - hmsetmset N
[PROOF STEP]
by (simp add: minus_hmultiset_def)


[STATEMENT]
lemma fps_left_inverse':
  fixes   f :: "'a::ring_1 fps"
  assumes "x * f$0 = 1" "f$0 * y = 1"
  \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close>
  shows   "fps_right_inverse f y * f = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_right_inverse f y * f = 1
[PROOF STEP]
using   assms fps_left_inverse_eq_fps_right_inverse[of x f y] fps_left_inverse[of x f]
[PROOF STATE]
proof (prove)
using this:
x * f $ 0 = (1::'a)
f $ 0 * y = (1::'a)
\<lbrakk>x * f $ 0 = (1::'a); f $ 0 * y = (1::'a)\<rbrakk> \<Longrightarrow> fps_left_inverse f x = fps_right_inverse f y
x * f $ 0 = (1::'a) \<Longrightarrow> fps_left_inverse f x * f = 1

goal (1 subgoal):
 1. fps_right_inverse f y * f = 1
[PROOF STEP]
by      simp


[STATEMENT]
theorem suffix_length_le: "suffix xs ys \<Longrightarrow> length xs \<le> length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. suffix xs ys \<Longrightarrow> length xs \<le> length ys
[PROOF STEP]
by (auto simp add: suffix_def)


[STATEMENT]
lemma aform_val_scaleR_aform[simp]:
  shows "aform_val e (aform_scaleR X y) = aform_val e X *\<^sub>R y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aform_val e (aform_scaleR X y) = aform_val e X *\<^sub>R y
[PROOF STEP]
by (auto simp: aform_scaleR_def aform_val_def scaleR_left_distrib)


[STATEMENT]
lemma Frct_le: "Frct (a, numeral b) \<le> Frct (c, numeral d) \<longleftrightarrow> a * numeral d \<le> c * numeral b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Frct (a, numeral b) \<le> Frct (c, numeral d)) = (a * numeral d \<le> c * numeral b)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in weak_upper_semilattice) joinI:
  "[| !!l. least L l (Upper L {x, y}) ==> P l; x \<in> carrier L; y \<in> carrier L |]
  ==> P (x \<squnion> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>l. is_lub L l {x, y} \<Longrightarrow> P l; x \<in> carrier L; y \<in> carrier L\<rbrakk> \<Longrightarrow> P (x \<squnion> y)
[PROOF STEP]
proof (unfold join_def sup_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>l. is_lub L l {x, y} \<Longrightarrow> P l; x \<in> carrier L; y \<in> carrier L\<rbrakk> \<Longrightarrow> P (SOME xa. is_lub L xa {x, y})
[PROOF STEP]
assume L: "x \<in> carrier L"  "y \<in> carrier L"
    and P: "!!l. least L l (Upper L {x, y}) ==> P l"
[PROOF STATE]
proof (state)
this:
x \<in> carrier L
y \<in> carrier L
is_lub L ?l {x, y} \<Longrightarrow> P ?l

goal (1 subgoal):
 1. \<lbrakk>\<And>l. is_lub L l {x, y} \<Longrightarrow> P l; x \<in> carrier L; y \<in> carrier L\<rbrakk> \<Longrightarrow> P (SOME xa. is_lub L xa {x, y})
[PROOF STEP]
with sup_of_two_exists
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> carrier L; ?y \<in> carrier L\<rbrakk> \<Longrightarrow> \<exists>s. is_lub L s {?x, ?y}
x \<in> carrier L
y \<in> carrier L
is_lub L ?l {x, y} \<Longrightarrow> P ?l
[PROOF STEP]
obtain s where "least L s (Upper L {x, y})"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier L; ?y \<in> carrier L\<rbrakk> \<Longrightarrow> \<exists>s. is_lub L s {?x, ?y}
x \<in> carrier L
y \<in> carrier L
is_lub L ?l {x, y} \<Longrightarrow> P ?l

goal (1 subgoal):
 1. (\<And>s. is_lub L s {x, y} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
is_lub L s {x, y}

goal (1 subgoal):
 1. \<lbrakk>\<And>l. is_lub L l {x, y} \<Longrightarrow> P l; x \<in> carrier L; y \<in> carrier L\<rbrakk> \<Longrightarrow> P (SOME xa. is_lub L xa {x, y})
[PROOF STEP]
with L
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier L
y \<in> carrier L
is_lub L s {x, y}
[PROOF STEP]
show "P (SOME l. least L l (Upper L {x, y}))"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier L
y \<in> carrier L
is_lub L s {x, y}

goal (1 subgoal):
 1. P (SOME l. is_lub L l {x, y})
[PROOF STEP]
by (fast intro: someI2 P)
[PROOF STATE]
proof (state)
this:
P (SOME l. is_lub L l {x, y})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_topology_subtopology_eu [simp]:
  "prod_topology (subtopology euclidean S) (subtopology euclidean T) = subtopology euclidean (S \<times> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_topology (top_of_set S) (top_of_set T) = top_of_set (S \<times> T)
[PROOF STEP]
by (simp add: prod_topology_subtopology subtopology_subtopology Times_Int_Times)


[STATEMENT]
lemma asymp_equivD_strong:
  assumes "f \<sim>[F] g" "eventually (\<lambda>x. f x \<noteq> 0 \<or> g x \<noteq> 0) F"
  shows   "((\<lambda>x. f x / g x) \<longlongrightarrow> 1) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
f \<sim>[F] g
[PROOF STEP]
have "((\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<longlongrightarrow> 1) F"
[PROOF STATE]
proof (prove)
using this:
f \<sim>[F] g

goal (1 subgoal):
 1. ((\<lambda>x. if f x = (0::'b) \<and> g x = (0::'b) then 1::'b else f x / g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
by (rule asymp_equivD)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if f x = (0::'b) \<and> g x = (0::'b) then 1::'b else f x / g x) \<longlongrightarrow> (1::'b)) F

goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if f x = (0::'b) \<and> g x = (0::'b) then 1::'b else f x / g x) \<longlongrightarrow> (1::'b)) F

goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
have "?this \<longleftrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if f x = (0::'b) \<and> g x = (0::'b) then 1::'b else f x / g x) \<longlongrightarrow> (1::'b)) F = ((\<lambda>x. f x / g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
by (intro filterlim_cong eventually_mono[OF assms(2)]) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if f x = (0::'b) \<and> g x = (0::'b) then 1::'b else f x / g x) \<longlongrightarrow> (1::'b)) F = ((\<lambda>x. f x / g x) \<longlongrightarrow> (1::'b)) F

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

goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x / g x) \<longlongrightarrow> (1::'b)) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_of_pm_power [simp]: "poly_of_pm x (p ^ m) = poly_of_pm x p ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_pm x (p ^ m) = poly_of_pm x p ^ m
[PROOF STEP]
by (induct m) (simp_all add: poly_of_pm_times)


[STATEMENT]
lemma qbs_morphism_snd'':
  assumes "f \<in> X \<rightarrow>\<^sub>Q Y"
  shows "(\<lambda>k. f (snd k)) \<in> Z \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. f (snd k)) \<in> Z \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Y
[PROOF STEP]
using qbs_morphism_comp[OF snd_qbs_morphism assms,of Z]
[PROOF STATE]
proof (prove)
using this:
f \<circ> snd \<in> Z \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Y

goal (1 subgoal):
 1. (\<lambda>k. f (snd k)) \<in> Z \<Otimes>\<^sub>Q X \<rightarrow>\<^sub>Q Y
[PROOF STEP]
by(simp add: comp_def)


[STATEMENT]
lemma numeral_or_not_num_eq:
  \<open>numeral (or_not_num_neg m n) = - (numeral m OR NOT (numeral n :: int))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral (or_not_num_neg m n) = - (numeral m OR NOT (numeral n))
[PROOF STEP]
using int_numeral_or_not_num_neg [of m n]
[PROOF STATE]
proof (prove)
using this:
numeral m OR NOT (numeral n) = - numeral (or_not_num_neg m n)

goal (1 subgoal):
 1. numeral (or_not_num_neg m n) = - (numeral m OR NOT (numeral n))
[PROOF STEP]
by simp


[STATEMENT]
lemma minus_one_smod_word_eq [simp]:
  \<open>- 1 smod w = - (1 smod w)\<close> for w :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 smod w = - (1 smod w)
[PROOF STEP]
using sdiv_smod_id [of \<open>- 1\<close> w]
[PROOF STATE]
proof (prove)
using this:
- 1 sdiv w * w + - 1 smod w = - 1

goal (1 subgoal):
 1. - 1 smod w = - (1 smod w)
[PROOF STEP]
by auto


[STATEMENT]
lemma Raise_subst:
    shows "Raise n k (subst v t) = subst (Raise n k v) (Raise (Suc n) k t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Raise n k (Subst 0 v t) = Subst 0 (Raise n k v) (Raise (Suc n) k t)
[PROOF STEP]
using Raise_0
[PROOF STATE]
proof (prove)
using this:
Raise ?d 0 ?t = ?t

goal (1 subgoal):
 1. Raise n k (Subst 0 v t) = Subst 0 (Raise n k v) (Raise (Suc n) k t)
[PROOF STEP]
apply (induct t arbitrary: v k n, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>t v k n. \<lbrakk>\<And>v k n. Raise n k (Subst 0 v t) = Subst 0 (Raise n k v) (Raise (Suc n) k t); \<And>d t. Raise d 0 t = t\<rbrakk> \<Longrightarrow> Raise (Suc n) k (Subst (Suc 0) v t) = Subst (Suc 0) (Raise n k v) (Raise (Suc (Suc n)) k t)
 2. \<And>t1 t2 v k n. \<lbrakk>\<And>v k n. Raise n k (Subst 0 v t1) = Subst 0 (Raise n k v) (Raise (Suc n) k t1); \<And>v k n. Raise n k (Subst 0 v t2) = Subst 0 (Raise n k v) (Raise (Suc n) k t2); \<And>d t. Raise d 0 t = t\<rbrakk> \<Longrightarrow> Raise (Suc n) k (Subst (Suc 0) v t1) = Subst (Suc 0) (Raise n k v) (Raise (Suc (Suc n)) k t1)
[PROOF STEP]
by (metis One_nat_def Raise_Subst plus_1_eq_Suc)+


[STATEMENT]
lemma image_to_nat_on: "countable A \<Longrightarrow> infinite A \<Longrightarrow> to_nat_on A ` A = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; infinite A\<rbrakk> \<Longrightarrow> to_nat_on A ` A = UNIV
[PROOF STEP]
using to_nat_on_infinite[of A]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>countable A; infinite A\<rbrakk> \<Longrightarrow> bij_betw (to_nat_on A) A UNIV

goal (1 subgoal):
 1. \<lbrakk>countable A; infinite A\<rbrakk> \<Longrightarrow> to_nat_on A ` A = UNIV
[PROOF STEP]
by (simp add: bij_betw_def)


[STATEMENT]
lemma permutes_insert_lemma:
  assumes "p permutes (insert a S)"
  shows "transpose a (p a) \<circ> p permutes S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Transposition.transpose a (p a) \<circ> p permutes S
[PROOF STEP]
apply (rule permutes_superset[where S = "insert a S"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Transposition.transpose a (p a) \<circ> p permutes insert a S
 2. \<And>x. x \<in> insert a S - S \<Longrightarrow> (Transposition.transpose a (p a) \<circ> p) x = x
[PROOF STEP]
apply (rule permutes_compose[OF assms])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Transposition.transpose a (p a) permutes insert a S
 2. \<And>x. x \<in> insert a S - S \<Longrightarrow> (Transposition.transpose a (p a) \<circ> p) x = x
[PROOF STEP]
apply (rule permutes_swap_id, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. p a \<in> insert a S
 2. \<And>x. x \<in> insert a S - S \<Longrightarrow> (Transposition.transpose a (p a) \<circ> p) x = x
[PROOF STEP]
using permutes_in_image[OF assms, of a]
[PROOF STATE]
proof (prove)
using this:
(p a \<in> insert a S) = (a \<in> insert a S)

goal (2 subgoals):
 1. p a \<in> insert a S
 2. \<And>x. x \<in> insert a S - S \<Longrightarrow> (Transposition.transpose a (p a) \<circ> p) x = x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> insert a S - S \<Longrightarrow> (Transposition.transpose a (p a) \<circ> p) x = x
[PROOF STEP]
apply (auto simp add: Ball_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done