[STATEMENT]
lemma complete_bipartite_digraph_are_iso:
  assumes "K\<^bsub>m,n\<^esub> G" "K\<^bsub>m,n\<^esub> H" shows "digraph_iso G H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
interpret G: graph G
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
K\<^bsub>m,n\<^esub> G
K\<^bsub>m,n\<^esub> H

goal (1 subgoal):
 1. graph G
[PROOF STEP]
by (simp add: complete_bipartite_digraph_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
interpret H: graph H
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
K\<^bsub>m,n\<^esub> G
K\<^bsub>m,n\<^esub> H

goal (1 subgoal):
 1. graph H
[PROOF STEP]
by (simp add: complete_bipartite_digraph_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
K\<^bsub>m,n\<^esub> G
K\<^bsub>m,n\<^esub> H
[PROOF STEP]
obtain GU GV where G_parts: "verts G = GU \<union> GV" "GU \<inter> GV = {}"
      "card GU = m" "card GV = n" "arcs_ends G = GU \<times> GV \<union> GV \<times> GU"
[PROOF STATE]
proof (prove)
using this:
K\<^bsub>m,n\<^esub> G
K\<^bsub>m,n\<^esub> H

goal (1 subgoal):
 1. (\<And>GU GV. \<lbrakk>verts G = GU \<union> GV; GU \<inter> GV = {}; card GU = m; card GV = n; arcs_ends G = GU \<times> GV \<union> GV \<times> GU\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: complete_bipartite_digraph_def)
[PROOF STATE]
proof (state)
this:
verts G = GU \<union> GV
GU \<inter> GV = {}
card GU = m
card GV = n
arcs_ends G = GU \<times> GV \<union> GV \<times> GU

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
K\<^bsub>m,n\<^esub> G
K\<^bsub>m,n\<^esub> H
[PROOF STEP]
obtain HU HV where H_parts: "verts H = HU \<union> HV" "HU \<inter> HV = {}"
      "card HU = m" "card HV = n" "arcs_ends H = HU \<times> HV \<union> HV \<times> HU"
[PROOF STATE]
proof (prove)
using this:
K\<^bsub>m,n\<^esub> G
K\<^bsub>m,n\<^esub> H

goal (1 subgoal):
 1. (\<And>HU HV. \<lbrakk>verts H = HU \<union> HV; HU \<inter> HV = {}; card HU = m; card HV = n; arcs_ends H = HU \<times> HV \<union> HV \<times> HU\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: complete_bipartite_digraph_def)
[PROOF STATE]
proof (state)
this:
verts H = HU \<union> HV
HU \<inter> HV = {}
card HU = m
card HV = n
arcs_ends H = HU \<times> HV \<union> HV \<times> HU

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
have fin: "finite GU" "finite GV" "finite HU" "finite HV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite GU &&& finite GV) &&& finite HU &&& finite HV
[PROOF STEP]
using G_parts H_parts G.finite_verts H.finite_verts
[PROOF STATE]
proof (prove)
using this:
verts G = GU \<union> GV
GU \<inter> GV = {}
card GU = m
card GV = n
arcs_ends G = GU \<times> GV \<union> GV \<times> GU
verts H = HU \<union> HV
HU \<inter> HV = {}
card HU = m
card HV = n
arcs_ends H = HU \<times> HV \<union> HV \<times> HU
finite (verts G)
finite (verts H)

goal (1 subgoal):
 1. (finite GU &&& finite GV) &&& finite HU &&& finite HV
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
finite GU
finite GV
finite HU
finite HV

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
obtain fv_U where fv_U: "bij_betw fv_U GU HU"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>fv_U. bij_betw fv_U GU HU \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>card GU = _\<close> \<open>card HU = _\<close> \<open>finite GU\<close> \<open>finite HU\<close>
[PROOF STATE]
proof (prove)
using this:
card GU = m
card HU = m
finite GU
finite HU

goal (1 subgoal):
 1. (\<And>fv_U. bij_betw fv_U GU HU \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis finite_same_card_bij)
[PROOF STATE]
proof (state)
this:
bij_betw fv_U GU HU

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
obtain fv_V where fv_V: "bij_betw fv_V GV HV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>fv_V. bij_betw fv_V GV HV \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>card GV = _\<close> \<open>card HV = _\<close> \<open>finite GV\<close> \<open>finite HV\<close>
[PROOF STATE]
proof (prove)
using this:
card GV = n
card HV = n
finite GV
finite HV

goal (1 subgoal):
 1. (\<And>fv_V. bij_betw fv_V GV HV \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis finite_same_card_bij)
[PROOF STATE]
proof (state)
this:
bij_betw fv_V GV HV

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
define fv where "fv x = (if x \<in> GU then fv_U x else fv_V x)" for x
[PROOF STATE]
proof (state)
this:
fv ?x = (if ?x \<in> GU then fv_U ?x else fv_V ?x)

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
have "\<And>x. x \<in> GV \<Longrightarrow> x \<notin> GU"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> GV \<Longrightarrow> x \<notin> GU
[PROOF STEP]
using \<open>GU \<inter> GV = {}\<close>
[PROOF STATE]
proof (prove)
using this:
GU \<inter> GV = {}

goal (1 subgoal):
 1. \<And>x. x \<in> GV \<Longrightarrow> x \<notin> GU
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x1 \<in> GV \<Longrightarrow> ?x1 \<notin> GU

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x1 \<in> GV \<Longrightarrow> ?x1 \<notin> GU
[PROOF STEP]
have bij_fv_UV: "bij_betw fv GU HU" "bij_betw fv GV HV"
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> GV \<Longrightarrow> ?x1 \<notin> GU

goal (1 subgoal):
 1. bij_betw fv GU HU &&& bij_betw fv GV HV
[PROOF STEP]
using fv_U fv_V
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> GV \<Longrightarrow> ?x1 \<notin> GU
bij_betw fv_U GU HU
bij_betw fv_V GV HV

goal (1 subgoal):
 1. bij_betw fv GU HU &&& bij_betw fv GV HV
[PROOF STEP]
by (auto simp: fv_def cong: bij_betw_cong)
[PROOF STATE]
proof (state)
this:
bij_betw fv GU HU
bij_betw fv GV HV

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw fv GU HU
bij_betw fv GV HV
[PROOF STEP]
have "bij_betw fv (verts G) (verts H)"
[PROOF STATE]
proof (prove)
using this:
bij_betw fv GU HU
bij_betw fv GV HV

goal (1 subgoal):
 1. bij_betw fv (verts G) (verts H)
[PROOF STEP]
unfolding \<open>verts G = _\<close> \<open>verts H = _\<close>
[PROOF STATE]
proof (prove)
using this:
bij_betw fv GU HU
bij_betw fv GV HV

goal (1 subgoal):
 1. bij_betw fv (GU \<union> GV) (HU \<union> HV)
[PROOF STEP]
using \<open>HU \<inter> _ = {}\<close>
[PROOF STATE]
proof (prove)
using this:
bij_betw fv GU HU
bij_betw fv GV HV
HU \<inter> HV = {}

goal (1 subgoal):
 1. bij_betw fv (GU \<union> GV) (HU \<union> HV)
[PROOF STEP]
by (rule bij_betw_combine)
[PROOF STATE]
proof (state)
this:
bij_betw fv (verts G) (verts H)

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw fv (verts G) (verts H)
[PROOF STEP]
have fv: "inj_on fv (verts G)" "verts H = fv ` verts G"
[PROOF STATE]
proof (prove)
using this:
bij_betw fv (verts G) (verts H)

goal (1 subgoal):
 1. inj_on fv (verts G) &&& verts H = fv ` verts G
[PROOF STEP]
by (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
inj_on fv (verts G)
verts H = fv ` verts G

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
have "arcs_ends H = HU \<times> HV \<union> HV \<times> HU"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arcs_ends H = HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
using \<open>K\<^bsub>m,n\<^esub> H\<close> H_parts
[PROOF STATE]
proof (prove)
using this:
K\<^bsub>m,n\<^esub> H
verts H = HU \<union> HV
HU \<inter> HV = {}
card HU = m
card HV = n
arcs_ends H = HU \<times> HV \<union> HV \<times> HU

goal (1 subgoal):
 1. arcs_ends H = HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
by (auto simp: complete_digraph_def)
[PROOF STATE]
proof (state)
this:
arcs_ends H = HU \<times> HV \<union> HV \<times> HU

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arcs_ends H = HU \<times> HV \<union> HV \<times> HU

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
have "\<dots> = pairself fv ` (GU \<times> GV \<union> GV \<times> GU)" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HU \<times> HV \<union> HV \<times> HU = pairself fv ` (GU \<times> GV \<union> GV \<times> GU)
[PROOF STEP]
proof (intro set_eqI iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> HU \<times> HV \<union> HV \<times> HU \<Longrightarrow> x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)
 2. \<And>x. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU) \<Longrightarrow> x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> HU \<times> HV \<union> HV \<times> HU \<Longrightarrow> x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)
 2. \<And>x. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU) \<Longrightarrow> x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
assume "x \<in> ?L"
[PROOF STATE]
proof (state)
this:
x \<in> HU \<times> HV \<union> HV \<times> HU

goal (2 subgoals):
 1. \<And>x. x \<in> HU \<times> HV \<union> HV \<times> HU \<Longrightarrow> x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)
 2. \<And>x. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU) \<Longrightarrow> x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
have "(fst x \<in> fv ` GU \<and> snd x \<in> fv ` GV) \<or> (fst x \<in> fv ` GV \<and> snd x \<in> fv ` GU)"
[PROOF STATE]
proof (prove)
using this:
x \<in> HU \<times> HV \<union> HV \<times> HU

goal (1 subgoal):
 1. fst x \<in> fv ` GU \<and> snd x \<in> fv ` GV \<or> fst x \<in> fv ` GV \<and> snd x \<in> fv ` GU
[PROOF STEP]
using bij_fv_UV
[PROOF STATE]
proof (prove)
using this:
x \<in> HU \<times> HV \<union> HV \<times> HU
bij_betw fv GU HU
bij_betw fv GV HV

goal (1 subgoal):
 1. fst x \<in> fv ` GU \<and> snd x \<in> fv ` GV \<or> fst x \<in> fv ` GV \<and> snd x \<in> fv ` GU
[PROOF STEP]
by (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
fst x \<in> fv ` GU \<and> snd x \<in> fv ` GV \<or> fst x \<in> fv ` GV \<and> snd x \<in> fv ` GU

goal (2 subgoals):
 1. \<And>x. x \<in> HU \<times> HV \<union> HV \<times> HU \<Longrightarrow> x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)
 2. \<And>x. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU) \<Longrightarrow> x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fst x \<in> fv ` GU \<and> snd x \<in> fv ` GV \<or> fst x \<in> fv ` GV \<and> snd x \<in> fv ` GU
[PROOF STEP]
show "x \<in> ?R"
[PROOF STATE]
proof (prove)
using this:
fst x \<in> fv ` GU \<and> snd x \<in> fv ` GV \<or> fst x \<in> fv ` GV \<and> snd x \<in> fv ` GU

goal (1 subgoal):
 1. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)
[PROOF STEP]
by (cases x) (auto simp: pairself_image_prod image_Un)
[PROOF STATE]
proof (state)
this:
x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)

goal (1 subgoal):
 1. \<And>x. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU) \<Longrightarrow> x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU) \<Longrightarrow> x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU) \<Longrightarrow> x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
assume "x \<in> ?R"
[PROOF STATE]
proof (state)
this:
x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)

goal (1 subgoal):
 1. \<And>x. x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU) \<Longrightarrow> x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)
[PROOF STEP]
show "x \<in> ?L"
[PROOF STATE]
proof (prove)
using this:
x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)

goal (1 subgoal):
 1. x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
using bij_fv_UV
[PROOF STATE]
proof (prove)
using this:
x \<in> pairself fv ` (GU \<times> GV \<union> GV \<times> GU)
bij_betw fv GU HU
bij_betw fv GV HV

goal (1 subgoal):
 1. x \<in> HU \<times> HV \<union> HV \<times> HU
[PROOF STEP]
by (auto simp: pairself_image_prod image_Un bij_betw_def)
[PROOF STATE]
proof (state)
this:
x \<in> HU \<times> HV \<union> HV \<times> HU

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
HU \<times> HV \<union> HV \<times> HU = pairself fv ` (GU \<times> GV \<union> GV \<times> GU)

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
HU \<times> HV \<union> HV \<times> HU = pairself fv ` (GU \<times> GV \<union> GV \<times> GU)

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
have "\<dots> = pairself fv ` arcs_ends G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairself fv ` (GU \<times> GV \<union> GV \<times> GU) = pairself fv ` arcs_ends G
[PROOF STEP]
using \<open>K\<^bsub>m,n\<^esub> G\<close> G_parts
[PROOF STATE]
proof (prove)
using this:
K\<^bsub>m,n\<^esub> G
verts G = GU \<union> GV
GU \<inter> GV = {}
card GU = m
card GV = n
arcs_ends G = GU \<times> GV \<union> GV \<times> GU

goal (1 subgoal):
 1. pairself fv ` (GU \<times> GV \<union> GV \<times> GU) = pairself fv ` arcs_ends G
[PROOF STEP]
by (auto simp: complete_bipartite_digraph_def)
[PROOF STATE]
proof (state)
this:
pairself fv ` (GU \<times> GV \<union> GV \<times> GU) = pairself fv ` arcs_ends G

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arcs_ends H = pairself fv ` arcs_ends G
[PROOF STEP]
have arcs_ends: "arcs_ends H = pairself fv ` arcs_ends G"
[PROOF STATE]
proof (prove)
using this:
arcs_ends H = pairself fv ` arcs_ends G

goal (1 subgoal):
 1. arcs_ends H = pairself fv ` arcs_ends G
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
arcs_ends H = pairself fv ` arcs_ends G

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
using H.nomulti_digraph fv arcs_ends
[PROOF STATE]
proof (prove)
using this:
nomulti_digraph H
inj_on fv (verts G)
verts H = fv ` verts G
arcs_ends H = pairself fv ` arcs_ends G

goal (1 subgoal):
 1. digraph_iso G H
[PROOF STEP]
by (rule G.digraph_iso_mk_iso_nomulti)
[PROOF STATE]
proof (state)
this:
digraph_iso G H

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nlists_0: "nlists A 0 = {[]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nlists A 0 = {[]}
[PROOF STEP]
unfolding nlists_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l. set l \<subseteq> A \<and> length l = 0} = {[]}
[PROOF STEP]
by auto


[STATEMENT]
lemma image_linear_greaterThan:
  fixes x::"'a::linordered_field"
  assumes "c\<noteq>0"
  shows "((\<lambda>x. c*x+b) ` {x<..}) = (if c>0 then {c*x+b <..} else {..< c*x+b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c * x + b) ` {x<..} = (if (0::'a) < c then {c * x + b<..} else {..<c * x + b})
[PROOF STEP]
using \<open>c\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<lambda>x. c * x + b) ` {x<..} = (if (0::'a) < c then {c * x + b<..} else {..<c * x + b})
[PROOF STEP]
apply (auto simp add:image_iff field_simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>(0::'a) < c; b + c * x < xa\<rbrakk> \<Longrightarrow> \<exists>x\<in>{x<..}. xa = b + x * c
 2. \<And>xa. \<lbrakk>c \<noteq> (0::'a); \<not> (0::'a) < c; xa < b + c * x\<rbrakk> \<Longrightarrow> \<exists>x\<in>{x<..}. xa = b + x * c
[PROOF STEP]
subgoal for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) < c; b + c * x < y\<rbrakk> \<Longrightarrow> \<exists>x\<in>{x<..}. y = b + x * c
[PROOF STEP]
by (rule bexI[where x="(y-b)/c"],auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>c \<noteq> (0::'a); \<not> (0::'a) < c; xa < b + c * x\<rbrakk> \<Longrightarrow> \<exists>x\<in>{x<..}. xa = b + x * c
[PROOF STEP]
subgoal for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<noteq> (0::'a); \<not> (0::'a) < c; y < b + c * x\<rbrakk> \<Longrightarrow> \<exists>x\<in>{x<..}. y = b + x * c
[PROOF STEP]
by (rule bexI[where x="(y-b)/c"],auto simp add:field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma poly_mapping_nat_ge_0 [simp]: "(m :: nat \<Rightarrow>\<^sub>0 nat) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> m
[PROOF STEP]
proof (cases "m = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = 0 \<Longrightarrow> 0 \<le> m
 2. m \<noteq> 0 \<Longrightarrow> 0 \<le> m
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
m \<noteq> 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> 0 \<le> m
 2. m \<noteq> 0 \<Longrightarrow> 0 \<le> m
[PROOF STEP]
hence "Poly_Mapping.lookup m \<noteq> Poly_Mapping.lookup 0"
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0

goal (1 subgoal):
 1. lookup m \<noteq> lookup 0
[PROOF STEP]
by transfer auto
[PROOF STATE]
proof (state)
this:
lookup m \<noteq> lookup 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> 0 \<le> m
 2. m \<noteq> 0 \<Longrightarrow> 0 \<le> m
[PROOF STEP]
hence "\<exists>k. Poly_Mapping.lookup m k \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
lookup m \<noteq> lookup 0

goal (1 subgoal):
 1. \<exists>k. lookup m k \<noteq> 0
[PROOF STEP]
by (auto simp: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
\<exists>k. lookup m k \<noteq> 0

goal (2 subgoals):
 1. m = 0 \<Longrightarrow> 0 \<le> m
 2. m \<noteq> 0 \<Longrightarrow> 0 \<le> m
[PROOF STEP]
from LeastI_ex[OF this] Least_le[of "\<lambda>k. Poly_Mapping.lookup m k \<noteq> 0"]
[PROOF STATE]
proof (chain)
picking this:
lookup m (LEAST k. lookup m k \<noteq> 0) \<noteq> 0
lookup m ?k \<noteq> 0 \<Longrightarrow> (LEAST x. lookup m x \<noteq> 0) \<le> ?k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lookup m (LEAST k. lookup m k \<noteq> 0) \<noteq> 0
lookup m ?k \<noteq> 0 \<Longrightarrow> (LEAST x. lookup m x \<noteq> 0) \<le> ?k

goal (1 subgoal):
 1. 0 \<le> m
[PROOF STEP]
by (force simp: less_eq_poly_mapping_def less_fun_def)
[PROOF STATE]
proof (state)
this:
0 \<le> m

goal (1 subgoal):
 1. m = 0 \<Longrightarrow> 0 \<le> m
[PROOF STEP]
qed auto


[STATEMENT]
lemma set_orbit_list':
  assumes "permutation f" shows "set (orbit_list f x) = orbit f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (orbit_list f x) = orbit f x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
permutation f

goal (1 subgoal):
 1. set (orbit_list f x) = orbit f x
[PROOF STEP]
by (simp add: permutation_self_in_orbit set_orbit_list)


[STATEMENT]
lemma dimension_direct_sum_space:
  assumes "dimension n K E" and "dimension m K F" and "E \<inter> F = { \<zero> }"
  shows "dimension (n + m) K (E <+>\<^bsub>R\<^esub> F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dimension (n + m) K (E <+> F)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dimension (n + m) K (E <+> F)
[PROOF STEP]
obtain Us Vs
    where Vs: "set Vs \<subseteq> carrier R" "independent K Vs" "length Vs = n" "Span K Vs = E"
      and Us: "set Us \<subseteq> carrier R" "independent K Us" "length Us = m" "Span K Us = F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Vs Us. \<lbrakk>set Vs \<subseteq> carrier R; local.independent K Vs; length Vs = n; Span K Vs = E; set Us \<subseteq> carrier R; local.independent K Us; length Us = m; Span K Us = F\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1-2)[THEN exists_base]
[PROOF STATE]
proof (prove)
using this:
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = n \<and> Span K Vs = E
\<exists>Vs. set Vs \<subseteq> carrier R \<and> local.independent K Vs \<and> length Vs = m \<and> Span K Vs = F

goal (1 subgoal):
 1. (\<And>Vs Us. \<lbrakk>set Vs \<subseteq> carrier R; local.independent K Vs; length Vs = n; Span K Vs = E; set Us \<subseteq> carrier R; local.independent K Us; length Us = m; Span K Us = F\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Vs \<subseteq> carrier R
local.independent K Vs
length Vs = n
Span K Vs = E
set Us \<subseteq> carrier R
local.independent K Us
length Us = m
Span K Us = F

goal (1 subgoal):
 1. dimension (n + m) K (E <+> F)
[PROOF STEP]
hence "Span K (Vs @ Us) = E <+>\<^bsub>R\<^esub> F"
[PROOF STATE]
proof (prove)
using this:
set Vs \<subseteq> carrier R
local.independent K Vs
length Vs = n
Span K Vs = E
set Us \<subseteq> carrier R
local.independent K Us
length Us = m
Span K Us = F

goal (1 subgoal):
 1. Span K (Vs @ Us) = E <+> F
[PROOF STEP]
using Span_append_eq_set_add
[PROOF STATE]
proof (prove)
using this:
set Vs \<subseteq> carrier R
local.independent K Vs
length Vs = n
Span K Vs = E
set Us \<subseteq> carrier R
local.independent K Us
length Us = m
Span K Us = F
\<lbrakk>set ?Us \<subseteq> carrier R; set ?Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> Span K (?Us @ ?Vs) = Span K ?Us <+> Span K ?Vs

goal (1 subgoal):
 1. Span K (Vs @ Us) = E <+> F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Span K (Vs @ Us) = E <+> F

goal (1 subgoal):
 1. dimension (n + m) K (E <+> F)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Span K (Vs @ Us) = E <+> F

goal (1 subgoal):
 1. dimension (n + m) K (E <+> F)
[PROOF STEP]
have "independent K (Vs @ Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.independent K (Vs @ Us)
[PROOF STEP]
using assms(3) independent_append[OF Vs(2) Us(2)]
[PROOF STATE]
proof (prove)
using this:
E \<inter> F = {\<zero>}
Span K Vs \<inter> Span K Us = {\<zero>} \<Longrightarrow> local.independent K (Vs @ Us)

goal (1 subgoal):
 1. local.independent K (Vs @ Us)
[PROOF STEP]
unfolding Vs(4) Us(4)
[PROOF STATE]
proof (prove)
using this:
E \<inter> F = {\<zero>}
E \<inter> F = {\<zero>} \<Longrightarrow> local.independent K (Vs @ Us)

goal (1 subgoal):
 1. local.independent K (Vs @ Us)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.independent K (Vs @ Us)

goal (1 subgoal):
 1. dimension (n + m) K (E <+> F)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Span K (Vs @ Us) = E <+> F
local.independent K (Vs @ Us)
[PROOF STEP]
show "dimension (n + m) K (E <+>\<^bsub>R\<^esub> F)"
[PROOF STATE]
proof (prove)
using this:
Span K (Vs @ Us) = E <+> F
local.independent K (Vs @ Us)

goal (1 subgoal):
 1. dimension (n + m) K (E <+> F)
[PROOF STEP]
using dimensionI[of "Vs @ Us"] Vs(3) Us(3)
[PROOF STATE]
proof (prove)
using this:
Span K (Vs @ Us) = E <+> F
local.independent K (Vs @ Us)
\<lbrakk>local.independent K (Vs @ Us); Span K (Vs @ Us) = ?E\<rbrakk> \<Longrightarrow> dimension (length (Vs @ Us)) K ?E
length Vs = n
length Us = m

goal (1 subgoal):
 1. dimension (n + m) K (E <+> F)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dimension (n + m) K (E <+> F)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma S_inf_1_below_Z:
  "S \<sqinter> 1 \<le> Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
have "(S \<sqinter> 1) * S\<^sup>T \<le> S \<sqinter> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<sqinter> (1::'a)) * S\<^sup>T \<le> S \<sqinter> (1::'a)
[PROOF STEP]
by (metis S_injective conv_dist_comp coreflexive_symmetric inf.boundedI inf.cobounded1 inf.cobounded2 injective_codomain)
[PROOF STATE]
proof (state)
this:
(S \<sqinter> (1::'a)) * S\<^sup>T \<le> S \<sqinter> (1::'a)

goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
hence "(S \<sqinter> 1) * S\<^sup>T\<^sup>\<star> \<le> S \<sqinter> 1"
[PROOF STATE]
proof (prove)
using this:
(S \<sqinter> (1::'a)) * S\<^sup>T \<le> S \<sqinter> (1::'a)

goal (1 subgoal):
 1. (S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> \<le> S \<sqinter> (1::'a)
[PROOF STEP]
using star_right_induct_mult
[PROOF STATE]
proof (prove)
using this:
(S \<sqinter> (1::'a)) * S\<^sup>T \<le> S \<sqinter> (1::'a)
?y * ?x \<le> ?y \<Longrightarrow> ?y * ?x\<^sup>\<star> \<le> ?y

goal (1 subgoal):
 1. (S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> \<le> S \<sqinter> (1::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> \<le> S \<sqinter> (1::'a)

goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
hence "(S \<sqinter> 1) * S\<^sup>T\<^sup>\<star> * Z \<le> (S \<sqinter> 1) * Z"
[PROOF STATE]
proof (prove)
using this:
(S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> \<le> S \<sqinter> (1::'a)

goal (1 subgoal):
 1. (S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> * Z \<le> (S \<sqinter> (1::'a)) * Z
[PROOF STEP]
by (simp add: mult_left_isotone)
[PROOF STATE]
proof (state)
this:
(S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> * Z \<le> (S \<sqinter> (1::'a)) * Z

goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> * Z \<le> (S \<sqinter> (1::'a)) * Z

goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
have "... \<le> Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<sqinter> (1::'a)) * Z \<le> Z
[PROOF STEP]
by (metis comp_left_subdist_inf inf.boundedE mult_1_left)
[PROOF STATE]
proof (state)
this:
(S \<sqinter> (1::'a)) * Z \<le> Z

goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> * Z \<le> Z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> * Z \<le> Z

goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
using S_star_Z_top inf.order_trans top_right_mult_increasing mult_assoc
[PROOF STATE]
proof (prove)
using this:
(S \<sqinter> (1::'a)) * S\<^sup>T\<^sup>\<star> * Z \<le> Z
S\<^sup>T\<^sup>\<star> * Z = top
\<lbrakk>?y \<le> ?x; ?z \<le> ?y\<rbrakk> \<Longrightarrow> ?z \<le> ?x
?x \<le> ?x * top
?a * ?b * ?c = ?a * (?b * ?c)

goal (1 subgoal):
 1. S \<sqinter> (1::'a) \<le> Z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<sqinter> (1::'a) \<le> Z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma FRESH_binop_iff:
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
  fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
  assumes P: "finite (supp P)"
  and     Q: "finite (supp Q)"
  shows "(FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (supp P)
finite (supp Q)
[PROOF STEP]
have "finite (supp (P, Q))"
[PROOF STATE]
proof (prove)
using this:
finite (supp P)
finite (supp Q)

goal (1 subgoal):
 1. finite (supp (P, Q))
[PROOF STEP]
by (simp add: supp_Pair)
[PROOF STATE]
proof (state)
this:
finite (supp (P, Q))

goal (1 subgoal):
 1. (FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (supp (P, Q))
[PROOF STEP]
obtain a::'a where "atom a \<sharp> (P, Q)"
[PROOF STATE]
proof (prove)
using this:
finite (supp (P, Q))

goal (1 subgoal):
 1. (\<And>a. atom a \<sharp> (P, Q) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule obtain_fresh')
[PROOF STATE]
proof (state)
this:
atom a \<sharp> (P, Q)

goal (1 subgoal):
 1. (FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
atom a \<sharp> (P, Q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
atom a \<sharp> (P, Q)

goal (1 subgoal):
 1. (FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)
[PROOF STEP]
by (simp add: pure_fresh)
[PROOF STATE]
proof (state)
this:
(FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diff_null_sets_lebesgue: "\<lbrakk>N \<in> null_sets (lebesgue_on S); X-N \<in> sets (lebesgue_on S); N \<subseteq> X\<rbrakk>
    \<Longrightarrow> X \<in> sets (lebesgue_on S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>N \<in> null_sets (lebesgue_on S); X - N \<in> sets (lebesgue_on S); N \<subseteq> X\<rbrakk> \<Longrightarrow> X \<in> sets (lebesgue_on S)
[PROOF STEP]
by (metis Int_Diff_Un inf.commute inf.orderE null_setsD2 sets.Un)


[STATEMENT]
lemma arr_comp_commutative_square:
    assumes "commutative_square f g h k" and "seq l f"
    shows "commutative_square (l \<cdot> f) (l \<cdot> g) h k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. commutative_square (l \<cdot> f) (l \<cdot> g) h k
[PROOF STEP]
using assms comp_assoc
[PROOF STATE]
proof (prove)
using this:
commutative_square f g h k
seq l f
(?h \<cdot> ?g) \<cdot> ?f = ?h \<cdot> ?g \<cdot> ?f

goal (1 subgoal):
 1. commutative_square (l \<cdot> f) (l \<cdot> g) h k
[PROOF STEP]
by (elim commutative_squareE, intro commutative_squareI, auto)


[STATEMENT]
lemma connected_Un: "connected s \<Longrightarrow> connected t \<Longrightarrow> s \<inter> t \<noteq> {} \<Longrightarrow> connected (s \<union> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connected s; connected t; s \<inter> t \<noteq> {}\<rbrakk> \<Longrightarrow> connected (s \<union> t)
[PROOF STEP]
using connected_Union [of "{s,t}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>sa. sa \<in> {s, t} \<Longrightarrow> connected sa; \<Inter> {s, t} \<noteq> {}\<rbrakk> \<Longrightarrow> connected (\<Union> {s, t})

goal (1 subgoal):
 1. \<lbrakk>connected s; connected t; s \<inter> t \<noteq> {}\<rbrakk> \<Longrightarrow> connected (s \<union> t)
[PROOF STEP]
by auto


[STATEMENT]
lemma sort_mergesort: "sort = mergesort"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sort = mergesort
[PROOF STEP]
unfolding mergesort_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sort = mergesort_by_rel (\<le>)
[PROOF STEP]
by (rule sort_mergesort_by_rel)


[STATEMENT]
lemma inorder_delete:
  "sorted (inorder t) \<Longrightarrow> inorder (delete x t) = del_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (Tree2.inorder t) \<Longrightarrow> Tree2.inorder (delete x t) = del_list x (Tree2.inorder t)
[PROOF STEP]
by (induct t)
   (auto simp: del_list_simps split_minD Let_def split: prod.splits)


[STATEMENT]
lemma insertion_chop :
  shows "insertion f p = sum_list [insertion f term * (f v) ^ i. (term,i)\<leftarrow>(chop (to_list v p))]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f p = (\<Sum>(term, i)\<leftarrow>chop (to_list v p). insertion f term * f v ^ i)
[PROOF STEP]
proof(cases "chophelper (to_list v p) []")
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. chophelper (to_list v p) [] = (a, b) \<Longrightarrow> insertion f p = (\<Sum>(term, i)\<leftarrow>chop (to_list v p). insertion f term * f v ^ i)
[PROOF STEP]
case (Pair a b)
[PROOF STATE]
proof (state)
this:
chophelper (to_list v p) [] = (a, b)

goal (1 subgoal):
 1. \<And>a b. chophelper (to_list v p) [] = (a, b) \<Longrightarrow> insertion f p = (\<Sum>(term, i)\<leftarrow>chop (to_list v p). insertion f term * f v ^ i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f p = (\<Sum>(term, i)\<leftarrow>chop (to_list v p). insertion f term * f v ^ i)
[PROOF STEP]
using chopped[OF Pair[symmetric], of f]
[PROOF STATE]
proof (prove)
using this:
insertion f p = (\<Sum>(term, i)\<leftarrow>b. insertion f term * f v ^ i)

goal (1 subgoal):
 1. insertion f p = (\<Sum>(term, i)\<leftarrow>chop (to_list v p). insertion f term * f v ^ i)
[PROOF STEP]
unfolding compare[OF Pair[symmetric], symmetric]
[PROOF STATE]
proof (prove)
using this:
insertion f p = (\<Sum>(term, i)\<leftarrow>chop (to_list v p). insertion f term * f v ^ i)

goal (1 subgoal):
 1. insertion f p = (\<Sum>(term, i)\<leftarrow>chop (to_list v p). insertion f term * f v ^ i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
insertion f p = (\<Sum>(term, i)\<leftarrow>chop (to_list v p). insertion f term * f v ^ i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_invertible:
  fixes A :: "('a::real_algebra_1)^'m^'n"
  assumes "k \<noteq> 0" and "invertible A"
  shows "invertible (k *\<^sub>R A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (k *\<^sub>R A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible (k *\<^sub>R A)
[PROOF STEP]
obtain A' where "A ** A' = mat 1" and "A' ** A = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A ** A' = mat (1::'a); A' ** A = mat (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
invertible A

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A ** A' = mat (1::'a); A' ** A = mat (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding invertible_def
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
\<exists>A'. A ** A' = mat (1::'a) \<and> A' ** A = mat (1::'a)

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A ** A' = mat (1::'a); A' ** A = mat (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A ** A' = mat (1::'a)
A' ** A = mat (1::'a)

goal (1 subgoal):
 1. invertible (k *\<^sub>R A)
[PROOF STEP]
with \<open>k \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> 0
A ** A' = mat (1::'a)
A' ** A = mat (1::'a)
[PROOF STEP]
have "(k *\<^sub>R A) ** ((1/k) *\<^sub>R A') = mat 1" "((1/k) *\<^sub>R A') ** (k *\<^sub>R A) = mat 1"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
A ** A' = mat (1::'a)
A' ** A = mat (1::'a)

goal (1 subgoal):
 1. k *\<^sub>R A ** (1 / k) *\<^sub>R A' = mat (1::'a) &&& (1 / k) *\<^sub>R A' ** k *\<^sub>R A = mat (1::'a)
[PROOF STEP]
by (simp_all add: assms matrix_scalar_ac)
[PROOF STATE]
proof (state)
this:
k *\<^sub>R A ** (1 / k) *\<^sub>R A' = mat (1::'a)
(1 / k) *\<^sub>R A' ** k *\<^sub>R A = mat (1::'a)

goal (1 subgoal):
 1. invertible (k *\<^sub>R A)
[PROOF STEP]
thus "invertible (k *\<^sub>R A)"
[PROOF STATE]
proof (prove)
using this:
k *\<^sub>R A ** (1 / k) *\<^sub>R A' = mat (1::'a)
(1 / k) *\<^sub>R A' ** k *\<^sub>R A = mat (1::'a)

goal (1 subgoal):
 1. invertible (k *\<^sub>R A)
[PROOF STEP]
unfolding invertible_def
[PROOF STATE]
proof (prove)
using this:
k *\<^sub>R A ** (1 / k) *\<^sub>R A' = mat (1::'a)
(1 / k) *\<^sub>R A' ** k *\<^sub>R A = mat (1::'a)

goal (1 subgoal):
 1. \<exists>A'. k *\<^sub>R A ** A' = mat (1::'a) \<and> A' ** k *\<^sub>R A = mat (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
invertible (k *\<^sub>R A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma representation_extend:
  assumes basis: "independent basis" and v: "v \<in> span basis'" and basis': "basis' \<subseteq> basis"
  shows "representation basis v = representation basis' v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. representation basis v = representation basis' v
[PROOF STEP]
proof (rule representation_eqI[OF basis])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. v \<in> span basis
 2. \<And>b. representation basis' v b \<noteq> (0::'a) \<Longrightarrow> b \<in> basis
 3. finite {b. representation basis' v b \<noteq> (0::'a)}
 4. (\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v
[PROOF STEP]
show v': "v \<in> span basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> span basis
[PROOF STEP]
using span_mono[OF basis'] v
[PROOF STATE]
proof (prove)
using this:
span basis' \<subseteq> span basis
v \<in> span basis'

goal (1 subgoal):
 1. v \<in> span basis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> span basis

goal (3 subgoals):
 1. \<And>b. representation basis' v b \<noteq> (0::'a) \<Longrightarrow> b \<in> basis
 2. finite {b. representation basis' v b \<noteq> (0::'a)}
 3. (\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v
[PROOF STEP]
have *: "independent basis'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent basis'
[PROOF STEP]
using basis' basis
[PROOF STATE]
proof (prove)
using this:
basis' \<subseteq> basis
independent basis

goal (1 subgoal):
 1. independent basis'
[PROOF STEP]
by (auto intro: dependent_mono)
[PROOF STATE]
proof (state)
this:
independent basis'

goal (3 subgoals):
 1. \<And>b. representation basis' v b \<noteq> (0::'a) \<Longrightarrow> b \<in> basis
 2. finite {b. representation basis' v b \<noteq> (0::'a)}
 3. (\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v
[PROOF STEP]
show "representation basis' v b \<noteq> 0 \<Longrightarrow> b \<in> basis" for b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. representation basis' v b \<noteq> (0::'a) \<Longrightarrow> b \<in> basis
[PROOF STEP]
using representation_ne_zero basis'
[PROOF STATE]
proof (prove)
using this:
representation ?basis ?v ?b \<noteq> (0::'a) \<Longrightarrow> ?b \<in> ?basis
basis' \<subseteq> basis

goal (1 subgoal):
 1. representation basis' v b \<noteq> (0::'a) \<Longrightarrow> b \<in> basis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
representation basis' v ?b \<noteq> (0::'a) \<Longrightarrow> ?b \<in> basis

goal (2 subgoals):
 1. finite {b. representation basis' v b \<noteq> (0::'a)}
 2. (\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v
[PROOF STEP]
show "finite {b. representation basis' v b \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {b. representation basis' v b \<noteq> (0::'a)}
[PROOF STEP]
using finite_representation
[PROOF STATE]
proof (prove)
using this:
finite {b. representation ?basis ?v b \<noteq> (0::'a)}

goal (1 subgoal):
 1. finite {b. representation basis' v b \<noteq> (0::'a)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite {b. representation basis' v b \<noteq> (0::'a)}

goal (1 subgoal):
 1. (\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v
[PROOF STEP]
show "(\<Sum>b | representation basis' v b \<noteq> 0. representation basis' v b *s b) = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v
[PROOF STEP]
using sum_nonzero_representation_eq[OF * v]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v

goal (1 subgoal):
 1. (\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>b | representation basis' v b \<noteq> (0::'a). representation basis' v b *s b) = v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma START_REFINEG_TRANSFER:
  assumes "REFINEG_TRANSFER_ALIGN d c"
  assumes "c\<le>a"
  assumes "REFINEG_TRANSFER_POST_SIMP c d"
  shows "d\<le>a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<le> a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
REFINEG_TRANSFER_ALIGN d c
c \<le> a
REFINEG_TRANSFER_POST_SIMP c d

goal (1 subgoal):
 1. d \<le> a
[PROOF STEP]
by (simp add: REFINEG_TRANSFER_POST_SIMP_def)


[STATEMENT]
lemma range_strict_mono_ext:
  fixes f::"nat \<Rightarrow> 'a::linorder"
  assumes eq: "range f = range g"
      and sm: "strict_mono f" "strict_mono g"
    shows "f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = g
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. f x = g x
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. f x = g x
[PROOF STEP]
show "f n = g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f n = g n
[PROOF STEP]
proof (induction n rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> f y = g y) \<Longrightarrow> f x = g x
[PROOF STEP]
case (less n)
[PROOF STATE]
proof (state)
this:
?y < n \<Longrightarrow> f ?y = g ?y

goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> f y = g y) \<Longrightarrow> f x = g x
[PROOF STEP]
obtain x y where xy: "f n = g y" "f x = g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y x. \<lbrakk>f n = g y; f x = g n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis eq imageE rangeI)
[PROOF STATE]
proof (state)
this:
f n = g y
f x = g n

goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> f y = g y) \<Longrightarrow> f x = g x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f n = g y
f x = g n
[PROOF STEP]
have "n = y"
[PROOF STATE]
proof (prove)
using this:
f n = g y
f x = g n

goal (1 subgoal):
 1. n = y
[PROOF STEP]
by (metis (no_types) less.IH neq_iff sm strict_mono_less xy)
[PROOF STATE]
proof (state)
this:
n = y

goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> f y = g y) \<Longrightarrow> f x = g x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
n = y

goal (1 subgoal):
 1. f n = g n
[PROOF STEP]
using xy
[PROOF STATE]
proof (prove)
using this:
n = y
f n = g y
f x = g n

goal (1 subgoal):
 1. f n = g n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f n = g n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f n = g n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Pi_I[intro!]: "(\<And>x. x \<in> A \<Longrightarrow> f x \<in> B x) \<Longrightarrow> f \<in> Pi A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x \<in> B x) \<Longrightarrow> f \<in> Pi A B
[PROOF STEP]
by (simp add: Pi_def)


[STATEMENT]
lemma "rec_lambda var app lam (Lam x) = lam ((\<lambda>lambda. (lambda, rec_lambda var app lam lambda)) \<circ> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_lambda var app lam (Lam x) = lam ((\<lambda>lambda. (lambda, rec_lambda var app lam lambda)) \<circ> x)
[PROOF STEP]
nitpick [card = 1-3, expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_lambda var app lam (Lam x) = lam ((\<lambda>lambda. (lambda, rec_lambda var app lam lambda)) \<circ> x)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma indicator_scaleR_eq_if:
  fixes f :: "'a \<Rightarrow> 'b::real_vector"
  shows "indicator S x *\<^sub>R f x = (if x \<in> S then f x else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indicat_real S x *\<^sub>R f x = (if x \<in> S then f x else (0::'b))
[PROOF STEP]
by simp


[STATEMENT]
lemma isDiagonal:
  assumes "isDiagonal A"
    and "to_nat a \<noteq> to_nat b" shows "A $ a $ b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ a $ b = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isDiagonal A
to_nat a \<noteq> to_nat b

goal (1 subgoal):
 1. A $ a $ b = (0::'a)
[PROOF STEP]
unfolding isDiagonal_def
[PROOF STATE]
proof (prove)
using this:
\<forall>a b. to_nat a \<noteq> to_nat b \<longrightarrow> A $ a $ b = (0::'a)
to_nat a \<noteq> to_nat b

goal (1 subgoal):
 1. A $ a $ b = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma Im_sgn [simp]: "Im(sgn z) = Im(z)/cmod z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (sgn z) = Im z / cmod z
[PROOF STEP]
by (simp add: complex_sgn_def divide_inverse)


[STATEMENT]
lemma P_set_one:
  assumes "n \<noteq> 0"
  shows "\<one> \<in> P_set (n::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> \<in> P_set n
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<one> \<in> P_set n
[PROOF STEP]
have 0: "\<one>[^]n = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> [^] n = \<one>
[PROOF STEP]
using Qp.nat_pow_one
[PROOF STATE]
proof (prove)
using this:
\<one> [^] ?n = \<one>

goal (1 subgoal):
 1. \<one> [^] n = \<one>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<one> [^] n = \<one>

goal (1 subgoal):
 1. \<one> \<in> P_set n
[PROOF STEP]
have 1: "\<one> \<in> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> \<in> carrier Q\<^sub>p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<one> \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. \<one> \<in> P_set n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<one> \<in> carrier Q\<^sub>p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<one> \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. \<one> \<in> P_set n
[PROOF STEP]
using one_nonzero
[PROOF STATE]
proof (prove)
using this:
\<one> \<in> carrier Q\<^sub>p
\<one> \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. \<one> \<in> P_set n
[PROOF STEP]
unfolding P_set_def
[PROOF STATE]
proof (prove)
using this:
\<one> \<in> carrier Q\<^sub>p
\<one> \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. \<one> \<in> {a \<in> nonzero Q\<^sub>p. \<exists>y\<in>carrier Q\<^sub>p. y [^] n = a}
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
\<one> \<in> carrier Q\<^sub>p
\<one> \<in> nonzero Q\<^sub>p
\<one> [^] n = \<one>

goal (1 subgoal):
 1. \<one> \<in> {a \<in> nonzero Q\<^sub>p. \<exists>y\<in>carrier Q\<^sub>p. y [^] n = a}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<one> \<in> P_set n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma relpow_Suc: "r ^^ Suc n = r O r ^^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r ^^ Suc n = r O r ^^ n
[PROOF STEP]
using relpow_add[of 1 n r]
[PROOF STATE]
proof (prove)
using this:
r ^^ (1 + n) = r ^^ 1 O r ^^ n

goal (1 subgoal):
 1. r ^^ Suc n = r O r ^^ n
[PROOF STEP]
by auto


[STATEMENT]
lemma borel_measurable_ennreal_iff[simp]:
  assumes [simp]: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
  shows "(\<lambda>x. ennreal (f x)) \<in> M \<rightarrow>\<^sub>M borel \<longleftrightarrow> f \<in> M \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ennreal (f x)) \<in> borel_measurable M) = (f \<in> borel_measurable M)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. ennreal (f x)) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M
 2. f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. ennreal (f x)) \<in> borel_measurable M
[PROOF STEP]
assume "(\<lambda>x. ennreal (f x)) \<in> M \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ennreal (f x)) \<in> borel_measurable M

goal (2 subgoals):
 1. (\<lambda>x. ennreal (f x)) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M
 2. f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. ennreal (f x)) \<in> borel_measurable M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. ennreal (f x)) \<in> borel_measurable M
[PROOF STEP]
have "(\<lambda>x. enn2real (ennreal (f x))) \<in> M \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ennreal (f x)) \<in> borel_measurable M

goal (1 subgoal):
 1. (\<lambda>x. enn2real (ennreal (f x))) \<in> borel_measurable M
[PROOF STEP]
by measurable
[PROOF STATE]
proof (state)
this:
(\<lambda>x. enn2real (ennreal (f x))) \<in> borel_measurable M

goal (2 subgoals):
 1. (\<lambda>x. ennreal (f x)) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M
 2. f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. ennreal (f x)) \<in> borel_measurable M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. enn2real (ennreal (f x))) \<in> borel_measurable M
[PROOF STEP]
show "f \<in> M \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. enn2real (ennreal (f x))) \<in> borel_measurable M

goal (1 subgoal):
 1. f \<in> borel_measurable M
[PROOF STEP]
by (rule measurable_cong[THEN iffD1, rotated]) auto
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable M

goal (1 subgoal):
 1. f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. ennreal (f x)) \<in> borel_measurable M
[PROOF STEP]
qed measurable


[STATEMENT]
lemma finite_glitOfC[simp]: "finite (glitOfC c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (glitOfC c)
[PROOF STEP]
unfolding glitOfC_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union> (set (map glitOfL c)))
[PROOF STEP]
apply(rule finite_Union)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (set (map glitOfL c))
 2. \<And>M. M \<in> set (map glitOfL c) \<Longrightarrow> finite M
[PROOF STEP]
using finite_glitOfL
[PROOF STATE]
proof (prove)
using this:
finite (glitOfL ?l)

goal (2 subgoals):
 1. finite (set (map glitOfL c))
 2. \<And>M. M \<in> set (map glitOfL c) \<Longrightarrow> finite M
[PROOF STEP]
by auto


[STATEMENT]
theorem msgrel_imp_eq_freediscrim:
  assumes a: "U \<sim> V"
  shows "freediscrim U = freediscrim V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. freediscrim U = freediscrim V
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
U \<sim> V

goal (1 subgoal):
 1. freediscrim U = freediscrim V
[PROOF STEP]
by (induct) (auto)


[STATEMENT]
lemma invert_invert_id: "invert \<circ> invert = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invert \<circ> invert = id
[PROOF STEP]
apply(clarsimp simp add: fun_eq_iff, rename_tac x, case_tac x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x x1. x = Pos x1 \<Longrightarrow> invert (invert x) = x
 2. \<And>x x2. x = Neg x2 \<Longrightarrow> invert (invert x) = x
[PROOF STEP]
by simp+


[STATEMENT]
lemma connected_Un: "connected s \<Longrightarrow> connected t \<Longrightarrow> s \<inter> t \<noteq> {} \<Longrightarrow> connected (s \<union> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connected s; connected t; s \<inter> t \<noteq> {}\<rbrakk> \<Longrightarrow> connected (s \<union> t)
[PROOF STEP]
using connected_Union [of "{s,t}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>sa. sa \<in> {s, t} \<Longrightarrow> connected sa; \<Inter> {s, t} \<noteq> {}\<rbrakk> \<Longrightarrow> connected (\<Union> {s, t})

goal (1 subgoal):
 1. \<lbrakk>connected s; connected t; s \<inter> t \<noteq> {}\<rbrakk> \<Longrightarrow> connected (s \<union> t)
[PROOF STEP]
by auto


[STATEMENT]
lemma bin_neq_iff': "c \<noteq> d \<longleftrightarrow> c = 1-(d :: binA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c \<noteq> d) = (c = 1 - d)
[PROOF STEP]
unfolding bin_neq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d = 1 - c) = (c = 1 - d)
[PROOF STEP]
by force


[STATEMENT]
lemma lead_coeff_comp:
  fixes p q :: "'a::{comm_semiring_1,semiring_no_zero_divisors} poly"
  assumes "degree q > 0"
  shows "lead_coeff (pcompose p q) = lead_coeff p * lead_coeff q ^ (degree p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p
[PROOF STEP]
proof (induct p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. lead_coeff (0 \<circ>\<^sub>p q) = lead_coeff 0 * lead_coeff q ^ degree 0
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p\<rbrakk> \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. lead_coeff (0 \<circ>\<^sub>p q) = lead_coeff 0 * lead_coeff q ^ degree 0
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p\<rbrakk> \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (0 \<circ>\<^sub>p q) = lead_coeff 0 * lead_coeff q ^ degree 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lead_coeff (0 \<circ>\<^sub>p q) = lead_coeff 0 * lead_coeff q ^ degree 0

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p\<rbrakk> \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p\<rbrakk> \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
case (pCons a p)
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a) \<or> p \<noteq> 0
lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p\<rbrakk> \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
consider "degree (q * pcompose p q) = 0" | "degree (q * pcompose p q) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> thesis; 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> ?thesis; 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p\<rbrakk> \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> ?thesis; 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> ?thesis; 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
 2. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
case prems: 1
[PROOF STATE]
proof (state)
this:
degree (q * p \<circ>\<^sub>p q) = 0

goal (2 subgoals):
 1. degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
 2. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree (q * p \<circ>\<^sub>p q) = 0
[PROOF STEP]
have "pcompose p q = 0"
[PROOF STATE]
proof (prove)
using this:
degree (q * p \<circ>\<^sub>p q) = 0

goal (1 subgoal):
 1. p \<circ>\<^sub>p q = 0
[PROOF STEP]
by (metis assms degree_0 degree_mult_eq_0 neq0_conv)
[PROOF STATE]
proof (state)
this:
p \<circ>\<^sub>p q = 0

goal (2 subgoals):
 1. degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
 2. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
with pcompose_eq_0[OF _ \<open>degree q > 0\<close>]
[PROOF STATE]
proof (chain)
picking this:
?p \<circ>\<^sub>p q = 0 \<Longrightarrow> ?p = 0
p \<circ>\<^sub>p q = 0
[PROOF STEP]
have "p = 0"
[PROOF STATE]
proof (prove)
using this:
?p \<circ>\<^sub>p q = 0 \<Longrightarrow> ?p = 0
p \<circ>\<^sub>p q = 0

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

goal (2 subgoals):
 1. degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
 2. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
case prems: 2
[PROOF STATE]
proof (state)
this:
0 < degree (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < degree (q * p \<circ>\<^sub>p q)
[PROOF STEP]
have "degree [:a:] < degree (q * pcompose p q)"
[PROOF STATE]
proof (prove)
using this:
0 < degree (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. degree [:a:] < degree (q * p \<circ>\<^sub>p q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree [:a:] < degree (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree [:a:] < degree (q * p \<circ>\<^sub>p q)
[PROOF STEP]
have "lead_coeff ([:a:] + q * p \<circ>\<^sub>p q) = lead_coeff (q * p \<circ>\<^sub>p q)"
[PROOF STATE]
proof (prove)
using this:
degree [:a:] < degree (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. lead_coeff ([:a:] + q * p \<circ>\<^sub>p q) = lead_coeff (q * p \<circ>\<^sub>p q)
[PROOF STEP]
by (rule lead_coeff_add_le)
[PROOF STATE]
proof (state)
this:
lead_coeff ([:a:] + q * p \<circ>\<^sub>p q) = lead_coeff (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
lead_coeff ([:a:] + q * p \<circ>\<^sub>p q) = lead_coeff (q * p \<circ>\<^sub>p q)
[PROOF STEP]
have "lead_coeff (pcompose (pCons a p) q) = lead_coeff (q * pcompose p q)"
[PROOF STATE]
proof (prove)
using this:
lead_coeff ([:a:] + q * p \<circ>\<^sub>p q) = lead_coeff (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (q * p \<circ>\<^sub>p q)
[PROOF STEP]
by (simp add: pcompose_pCons)
[PROOF STATE]
proof (state)
this:
lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
have "\<dots> = lead_coeff q * (lead_coeff p * lead_coeff q ^ degree p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (q * p \<circ>\<^sub>p q) = lead_coeff q * (lead_coeff p * lead_coeff q ^ degree p)
[PROOF STEP]
using pCons.hyps(2) lead_coeff_mult[of q "pcompose p q"]
[PROOF STATE]
proof (prove)
using this:
lead_coeff (p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ degree p
lead_coeff (q * p \<circ>\<^sub>p q) = lead_coeff q * lead_coeff (p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. lead_coeff (q * p \<circ>\<^sub>p q) = lead_coeff q * (lead_coeff p * lead_coeff q ^ degree p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lead_coeff (q * p \<circ>\<^sub>p q) = lead_coeff q * (lead_coeff p * lead_coeff q ^ degree p)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lead_coeff (q * p \<circ>\<^sub>p q) = lead_coeff q * (lead_coeff p * lead_coeff q ^ degree p)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
have "\<dots> = lead_coeff p * lead_coeff q ^ (degree p + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff q * (lead_coeff p * lead_coeff q ^ degree p) = lead_coeff p * lead_coeff q ^ (degree p + 1)
[PROOF STEP]
by (auto simp: mult_ac)
[PROOF STATE]
proof (state)
this:
lead_coeff q * (lead_coeff p * lead_coeff q ^ degree p) = lead_coeff p * lead_coeff q ^ (degree p + 1)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ (degree p + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff p * lead_coeff q ^ (degree p + 1)

goal (1 subgoal):
 1. lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lead_coeff (pCons a p \<circ>\<^sub>p q) = lead_coeff (pCons a p) * lead_coeff q ^ degree (pCons a p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_Collect_T:
  assumes [measurable]: "Measurable.pred St P"
  shows "emeasure (T cfg) {x\<in>space St. P x} =
    (\<integral>\<^sup>+cfg'. emeasure (T cfg') {x\<in>space St. P (state cfg' ## x)} \<partial>K_cfg cfg)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (T cfg) {x \<in> space St. P x} = \<integral>\<^sup>+ cfg'. emeasure (T cfg') {x \<in> space St. P (state cfg' ## x)} \<partial>measure_pmf (K_cfg cfg)
[PROOF STEP]
using MC.emeasure_Collect_T[of "\<lambda>x. P (smap state x)" cfg]
[PROOF STATE]
proof (prove)
using this:
Measurable.pred (stream_space (count_space UNIV)) (\<lambda>x. P (smap state x)) \<Longrightarrow> emeasure (MC.T cfg) {x \<in> space (MC.T cfg). P (smap state x)} = \<integral>\<^sup>+ t. emeasure (MC.T t) {x \<in> space (MC.T t). P (smap state (t ## x))} \<partial>measure_pmf (K_cfg cfg)

goal (1 subgoal):
 1. emeasure (T cfg) {x \<in> space St. P x} = \<integral>\<^sup>+ cfg'. emeasure (T cfg') {x \<in> space St. P (state cfg' ## x)} \<partial>measure_pmf (K_cfg cfg)
[PROOF STEP]
by (simp add: nn_integral_distr emeasure_Collect_distr T_def)


[STATEMENT]
lemma basic_semialg_is_semialgebraic':
  assumes "f \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>])"
  assumes "m \<noteq>0"
  assumes "A = basic_semialg_set n m f"
  shows "is_semialgebraic n A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic n A
[PROOF STEP]
using assms(1) assms(2) assms(3) basic_semialg_is_semialg' is_semialgebraicI
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
m \<noteq> 0
A = basic_semialg_set n m f
\<lbrakk>?f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?n\<^esub>]); ?m \<noteq> 0; ?A = basic_semialg_set ?n ?m ?f\<rbrakk> \<Longrightarrow> ?A \<in> semialg_sets ?n
?S \<in> semialg_sets ?n \<Longrightarrow> is_semialgebraic ?n ?S

goal (1 subgoal):
 1. is_semialgebraic n A
[PROOF STEP]
by blast


[STATEMENT]
lemma FAddSA_RootEx_def:
  "\<lbrakk> S \<in> dom G; (States SA) \<inter> (dom G) = {} \<rbrakk> \<Longrightarrow>
    RootEx F (G [f+] (S,SA)) = (\<exists>! A . A \<in> F \<and> A \<notin> insert SA (\<Union> (ran G)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<in> dom G; States SA \<inter> dom G = {}\<rbrakk> \<Longrightarrow> RootEx F (G [f+] (S, SA)) = (\<exists>!A. A \<in> F \<and> A \<notin> insert SA (\<Union> (ran G)))
[PROOF STEP]
apply (unfold RootEx_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<in> dom G; States SA \<inter> dom G = {}\<rbrakk> \<Longrightarrow> (\<exists>!A. A \<in> F \<and> A \<notin> \<Union> (ran (G [f+] (S, SA)))) = (\<exists>!A. A \<in> F \<and> A \<notin> insert SA (\<Union> (ran G)))
[PROOF STEP]
apply (simp only: FAddSA_Union_ran Int_commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nat_to_set_upper_bound: "x \<in> nat_to_set u \<Longrightarrow> 2 ^ x \<le> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> nat_to_set u \<Longrightarrow> 2 ^ x \<le> u
[PROOF STEP]
by (simp add: nat_to_set_def)


[STATEMENT]
lemma (in left_kleene_algebra) add_star_eq:
  "x + y \<cdot> y\<^sup>\<star> \<cdot> x = y\<^sup>\<star> \<cdot> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + y \<cdot> y\<^sup>\<star> \<cdot> x = y\<^sup>\<star> \<cdot> x
[PROOF STEP]
by (metis add.commute mult_onel star2 star_one troeger)


[STATEMENT]
lemma count_roots_above_code[code]:
  "count_roots_above p a =
     (let q = pderiv p
       in if p = 0 then 0
       else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0
            then (let ps = sturm p
                   in sign_changes ps a - sign_changes_inf ps)
            else (let ps = sturm_squarefree p
                   in sign_changes ps a - sign_changes_inf ps))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
proof (cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
 2. p \<noteq> 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
 2. p \<noteq> 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
by (auto simp add: count_roots_above_def Let_def)
[PROOF STATE]
proof (state)
this:
count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
note False1 = this
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
hence "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
proof (cases "(poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
 2. \<lbrakk>p \<noteq> 0; \<not> (poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0)\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0)

goal (2 subgoals):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
 2. \<lbrakk>p \<noteq> 0; \<not> (poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0)\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0)

goal (1 subgoal):
 1. count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
using False1
[PROOF STATE]
proof (prove)
using this:
\<not> (poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0)
p \<noteq> 0

goal (1 subgoal):
 1. count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
by (auto simp add: Let_def count_roots_above_def)
[PROOF STATE]
proof (state)
this:
count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
hence A: "poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0

goal (1 subgoal):
 1. poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
define d where "d = gcd p (pderiv p)"
[PROOF STATE]
proof (state)
this:
d = gcd p (pderiv p)

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
from \<open>p \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
[PROOF STEP]
have [simp]: "p div d \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. p div d \<noteq> 0
[PROOF STEP]
using poly_div_gcd_squarefree(1)[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
coprime (p div gcd p (pderiv p)) (pderiv (p div gcd p (pderiv p)))

goal (1 subgoal):
 1. p div d \<noteq> 0
[PROOF STEP]
by (auto simp add: d_def)
[PROOF STATE]
proof (state)
this:
p div d \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
from sturm_seq_sturm_squarefree'[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (chain)
picking this:
sturm_seq (sturm_squarefree' p) (p div gcd p (pderiv p))
[PROOF STEP]
interpret sturm_seq "sturm_squarefree' p" "p div d"
[PROOF STATE]
proof (prove)
using this:
sturm_seq (sturm_squarefree' p) (p div gcd p (pderiv p))

goal (1 subgoal):
 1. sturm_seq (sturm_squarefree' p) (p div d)
[PROOF STEP]
unfolding sturm_squarefree'_def Let_def d_def
[PROOF STATE]
proof (prove)
using this:
sturm_seq (map (\<lambda>p'. p' div gcd p (pderiv p)) (sturm p)) (p div gcd p (pderiv p))

goal (1 subgoal):
 1. sturm_seq (map (\<lambda>p'. p' div gcd p (pderiv p)) (sturm p)) (p div gcd p (pderiv p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
note count_roots_above_correct
[PROOF STATE]
proof (state)
this:
count_roots_above ?p ?a = card {x. ?a < x \<and> poly ?p x = 0}

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_roots_above ?p ?a = card {x. ?a < x \<and> poly ?p x = 0}

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
have "{x. a < x \<and> poly p x = 0} =
                 {x. a < x \<and> poly (p div d) x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. a < x \<and> poly p x = 0} = {x. a < x \<and> poly (p div d) x = 0}
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. a < x \<and> poly p x = 0} = {x. a < x \<and> poly (p div gcd p (pderiv p)) x = 0}
[PROOF STEP]
using poly_div_gcd_squarefree(2)[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (prove)
using this:
(poly (p div gcd p (pderiv p)) ?x = 0) = (poly p ?x = 0)

goal (1 subgoal):
 1. {x. a < x \<and> poly p x = 0} = {x. a < x \<and> poly (p div gcd p (pderiv p)) x = 0}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{x. a < x \<and> poly p x = 0} = {x. a < x \<and> poly (p div d) x = 0}

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x. a < x \<and> poly p x = 0} = {x. a < x \<and> poly (p div d) x = 0}

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
note count_roots_above[OF \<open>p div d \<noteq> 0\<close>, symmetric]
[PROOF STATE]
proof (state)
this:
card {x. ?a < x \<and> poly (p div d) x = 0} = sign_changes (sturm_squarefree' p) ?a - sign_changes_inf (sturm_squarefree' p)

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {x. ?a < x \<and> poly (p div d) x = 0} = sign_changes (sturm_squarefree' p) ?a - sign_changes_inf (sturm_squarefree' p)

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
note sturm_sturm_squarefree'_same_sign_changes(1)[OF A]
[PROOF STATE]
proof (state)
this:
sign_changes (sturm_squarefree' p) a = sign_changes (sturm p) a

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sign_changes (sturm_squarefree' p) a = sign_changes (sturm p) a

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
note sturm_sturm_squarefree'_same_sign_changes(2)[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (state)
this:
sign_changes_inf (sturm_squarefree' p) = sign_changes_inf (sturm p)

goal (1 subgoal):
 1. \<lbrakk>p \<noteq> 0; poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0\<rbrakk> \<Longrightarrow> count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count_roots_above p a = sign_changes (sturm p) a - sign_changes_inf (sturm p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count_roots_above p a = sign_changes (sturm p) a - sign_changes_inf (sturm p)

goal (1 subgoal):
 1. count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
using True False
[PROOF STATE]
proof (prove)
using this:
count_roots_above p a = sign_changes (sturm p) a - sign_changes_inf (sturm p)
poly p a \<noteq> 0 \<or> poly (pderiv p) a \<noteq> 0
p \<noteq> 0

goal (1 subgoal):
 1. count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)
[PROOF STEP]
by (simp add: Let_def)
[PROOF STATE]
proof (state)
this:
count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
count_roots_above p a = (let q = pderiv p in if p = 0 then 0 else if poly p a \<noteq> 0 \<or> poly q a \<noteq> 0 then let ps = sturm p in sign_changes ps a - sign_changes_inf ps else let ps = sturm_squarefree p in sign_changes ps a - sign_changes_inf ps)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_eq_zero_iff: "f x = 0 \<longleftrightarrow> x \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f x = 0) = (x \<le> 0)
[PROOF STEP]
by (auto simp: f_def)


[STATEMENT]
lemma unat_plus_if_size:
  "unat (x + y) =
    (if unat x + unat y < 2^size x
     then unat x + unat y
     else unat x + unat y - 2^size x)"
  for x y :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat (x + y) = (if unat x + unat y < 2 ^ size x then unat x + unat y else unat x + unat y - 2 ^ size x)
[PROOF STEP]
by (simp add: size_word.rep_eq unat_arith_simps)


[STATEMENT]
lemma nprv_neg_fls:
"nprv F (neg \<phi>) \<Longrightarrow> nprv F \<phi> \<Longrightarrow>
 F \<subseteq> fmla \<Longrightarrow> finite F \<Longrightarrow> \<phi> \<in> fmla \<Longrightarrow> \<psi> \<in> fmla \<Longrightarrow>
 nprv F fls"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nprv F (neg \<phi>); nprv F \<phi>; F \<subseteq> fmla; finite F; \<phi> \<in> fmla; \<psi> \<in> fmla\<rbrakk> \<Longrightarrow> nprv F fls
[PROOF STEP]
unfolding neg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>nprv F (imp \<phi> fls); nprv F \<phi>; F \<subseteq> fmla; finite F; \<phi> \<in> fmla; \<psi> \<in> fmla\<rbrakk> \<Longrightarrow> nprv F fls
[PROOF STEP]
using nprv_mp
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>nprv ?F (imp ?\<phi> ?\<psi>); nprv ?F ?\<phi>; ?F \<subseteq> fmla; finite ?F; ?\<phi> \<in> fmla; ?\<psi> \<in> fmla\<rbrakk> \<Longrightarrow> nprv ?F ?\<psi>

goal (1 subgoal):
 1. \<lbrakk>nprv F (imp \<phi> fls); nprv F \<phi>; F \<subseteq> fmla; finite F; \<phi> \<in> fmla; \<psi> \<in> fmla\<rbrakk> \<Longrightarrow> nprv F fls
[PROOF STEP]
by blast


[STATEMENT]
lemma compact_diff: "\<lbrakk>compact S; open T\<rbrakk> \<Longrightarrow> compact(S - T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>compact S; open T\<rbrakk> \<Longrightarrow> compact (S - T)
[PROOF STEP]
by (simp add: Diff_eq compact_Int_closed open_closed)


[STATEMENT]
lemma to_Zp_int_neg:
"to_Zp ([(-int (a::nat))]\<cdot>\<one>) = \<ominus>\<^bsub>Z\<^sub>p\<^esub>([int a]\<cdot>\<^bsub>Z\<^sub>p\<^esub>\<one> \<^bsub>Z\<^sub>p\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_Zp ([(- int a)] \<cdot> \<one>) = \<ominus>\<^bsub>Z\<^sub>p\<^esub> ([int a] \<cdot>\<^bsub>Z\<^sub>p\<^esub> \<one>\<^bsub>Z\<^sub>p\<^esub>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. to_Zp ([(- int a)] \<cdot> \<one>) = \<ominus>\<^bsub>Z\<^sub>p\<^esub> ([int a] \<cdot>\<^bsub>Z\<^sub>p\<^esub> \<one>\<^bsub>Z\<^sub>p\<^esub>)
[PROOF STEP]
have 0: "[(-int (a::nat))]\<cdot>\<one> = \<ominus> ([int a]\<cdot>\<one>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(- int a)] \<cdot> \<one> = \<ominus> ([int a] \<cdot> \<one>)
[PROOF STEP]
using Qp.add.int_pow_neg
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier Q\<^sub>p \<Longrightarrow> [(- ?i)] \<cdot> ?x = \<ominus> ([?i] \<cdot> ?x)

goal (1 subgoal):
 1. [(- int a)] \<cdot> \<one> = \<ominus> ([int a] \<cdot> \<one>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[(- int a)] \<cdot> \<one> = \<ominus> ([int a] \<cdot> \<one>)

goal (1 subgoal):
 1. to_Zp ([(- int a)] \<cdot> \<one>) = \<ominus>\<^bsub>Z\<^sub>p\<^esub> ([int a] \<cdot>\<^bsub>Z\<^sub>p\<^esub> \<one>\<^bsub>Z\<^sub>p\<^esub>)
[PROOF STEP]
have 1: "[int a]\<cdot>\<one> \<in> \<O>\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [int a] \<cdot> \<one> \<in> \<O>\<^sub>p
[PROOF STEP]
using Qp.int_inc_closed val_of_int_inc val_ring_memI
[PROOF STATE]
proof (prove)
using this:
[?n] \<cdot> \<one> \<in> carrier Q\<^sub>p
0 \<le> val ([?k] \<cdot> \<one>)
\<lbrakk>?a \<in> carrier Q\<^sub>p; 0 \<le> val ?a\<rbrakk> \<Longrightarrow> ?a \<in> \<O>\<^sub>p

goal (1 subgoal):
 1. [int a] \<cdot> \<one> \<in> \<O>\<^sub>p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[int a] \<cdot> \<one> \<in> \<O>\<^sub>p

goal (1 subgoal):
 1. to_Zp ([(- int a)] \<cdot> \<one>) = \<ominus>\<^bsub>Z\<^sub>p\<^esub> ([int a] \<cdot>\<^bsub>Z\<^sub>p\<^esub> \<one>\<^bsub>Z\<^sub>p\<^esub>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_Zp ([(- int a)] \<cdot> \<one>) = \<ominus>\<^bsub>Z\<^sub>p\<^esub> ([int a] \<cdot>\<^bsub>Z\<^sub>p\<^esub> \<one>\<^bsub>Z\<^sub>p\<^esub>)
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
[int a] \<cdot> \<one> \<in> \<O>\<^sub>p

goal (1 subgoal):
 1. to_Zp ([(- int a)] \<cdot> \<one>) = \<ominus>\<^bsub>Z\<^sub>p\<^esub> ([int a] \<cdot>\<^bsub>Z\<^sub>p\<^esub> \<one>\<^bsub>Z\<^sub>p\<^esub>)
[PROOF STEP]
unfolding 0
[PROOF STATE]
proof (prove)
using this:
[int a] \<cdot> \<one> \<in> \<O>\<^sub>p

goal (1 subgoal):
 1. to_Zp (\<ominus> ([int a] \<cdot> \<one>)) = \<ominus>\<^bsub>Z\<^sub>p\<^esub> ([int a] \<cdot>\<^bsub>Z\<^sub>p\<^esub> \<one>\<^bsub>Z\<^sub>p\<^esub>)
[PROOF STEP]
by (metis Zp.int_inc_closed inc_of_int inc_to_Zp to_Zp_ominus)
[PROOF STATE]
proof (state)
this:
to_Zp ([(- int a)] \<cdot> \<one>) = \<ominus>\<^bsub>Z\<^sub>p\<^esub> ([int a] \<cdot>\<^bsub>Z\<^sub>p\<^esub> \<one>\<^bsub>Z\<^sub>p\<^esub>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rightrec_41: "n > 0 \<Longrightarrow>
             rightrec u v lc rc ((4 * real m + 1) / 2 ^ (Suc n)) =
                 lc (leftrec u v lc rc ((2 * real m + 1) / 2^n)) (rightrec u v lc rc ((2 * real m + 1) / 2^n))
                 (midpoint (leftrec u v lc rc ((2 * real m + 1) / 2^n)) (rightrec u v lc rc ((2 * real m + 1) / 2^n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> rightrec u v lc rc ((4 * real m + 1) / 2 ^ Suc n) = lc (leftrec u v lc rc ((2 * real m + 1) / 2 ^ n)) (rightrec u v lc rc ((2 * real m + 1) / 2 ^ n)) (midpoint (leftrec u v lc rc ((2 * real m + 1) / 2 ^ n)) (rightrec u v lc rc ((2 * real m + 1) / 2 ^ n)))
[PROOF STEP]
unfolding dyad_rec2_def dyad_rec_41_times2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> snd (case dyad_rec (\<lambda>z. (u, v)) (\<lambda>(a, b). (a, lc a b (midpoint a b))) (\<lambda>(a, b). (rc a b (midpoint a b), b)) (2 * (2 * real m + 1) / 2 ^ n) of (a, b) \<Rightarrow> (a, lc a b (midpoint a b))) = lc (fst (dyad_rec (\<lambda>z. (u, v)) (\<lambda>(a, b). (a, lc a b (midpoint a b))) (\<lambda>(a, b). (rc a b (midpoint a b), b)) (2 * ((2 * real m + 1) / 2 ^ n)))) (snd (dyad_rec (\<lambda>z. (u, v)) (\<lambda>(a, b). (a, lc a b (midpoint a b))) (\<lambda>(a, b). (rc a b (midpoint a b), b)) (2 * ((2 * real m + 1) / 2 ^ n)))) (midpoint (fst (dyad_rec (\<lambda>z. (u, v)) (\<lambda>(a, b). (a, lc a b (midpoint a b))) (\<lambda>(a, b). (rc a b (midpoint a b), b)) (2 * ((2 * real m + 1) / 2 ^ n)))) (snd (dyad_rec (\<lambda>z. (u, v)) (\<lambda>(a, b). (a, lc a b (midpoint a b))) (\<lambda>(a, b). (rc a b (midpoint a b), b)) (2 * ((2 * real m + 1) / 2 ^ n)))))
[PROOF STEP]
by (simp add: case_prod_beta)


[STATEMENT]
lemma star_def_var1: "star x = Sup{y. \<exists>i. y = x ^ i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quantale_class.star x = Sup {y. \<exists>i. y = x ^ i}
[PROOF STEP]
by (simp add: star_def full_SetCompr_eq)


[STATEMENT]
lemma "filterlim (\<lambda>x::real. x + sin x) at_top at_top"
      "filterlim (\<lambda>x::real. sin x + x) at_top at_top"
      "filterlim (\<lambda>x::real. x + (sin x + sin x)) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. x + sin x :> at_top &&& LIM x at_top. sin x + x :> at_top &&& LIM x at_top. x + (sin x + sin x) :> at_top
[PROOF STEP]
by real_asymp+


[STATEMENT]
lemma less_LiminfD:
  "y < Liminf F (f :: _ \<Rightarrow> 'a :: complete_linorder) \<Longrightarrow> eventually (\<lambda>x. f x > y) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y < Liminf F f \<Longrightarrow> \<forall>\<^sub>F x in F. y < f x
[PROOF STEP]
using le_Liminf_iff[of "Liminf F f" F f]
[PROOF STATE]
proof (prove)
using this:
(Liminf F f \<le> Liminf F f) = (\<forall>y<Liminf F f. \<forall>\<^sub>F x in F. y < f x)

goal (1 subgoal):
 1. y < Liminf F f \<Longrightarrow> \<forall>\<^sub>F x in F. y < f x
[PROOF STEP]
by simp


[STATEMENT]
lemma enc_atom_lang_AQ: "\<lbrakk>r < length I;
   case I ! r of Inl p' \<Rightarrow> p = p' | Inr P \<Rightarrow> p \<in> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow>
  [enc_atom I p a] \<in> lang n (Atom (AQ r a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r < length I; case I ! r of Inl p' \<Rightarrow> p = p' | Inr P \<Rightarrow> p \<in> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> [enc_atom I p a] \<in> lang n (Atom (AQ r a))
[PROOF STEP]
unfolding lang.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r < length I; case I ! r of Inl p' \<Rightarrow> p = p' | Inr P \<Rightarrow> p \<in> P; length I = n; a \<in> set \<Sigma>\<rbrakk> \<Longrightarrow> [enc_atom I p a] \<in> {[x] |x. lookup (AQ r a) x \<and> x \<in> (set \<circ> \<sigma> \<Sigma>) n}
[PROOF STEP]
by (force intro!: enc_atom_bool_take_drop_True
    image_eqI[of _ _ "(\<lambda>J. take r J @ drop (r + 1) J) (enc_atom_bool I p)"]
    simp: \<sigma>_def set_n_lists)


[STATEMENT]
lemma euler_genus_da: "H.euler_genus = G.euler_genus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H.euler_genus = G.euler_genus
[PROOF STEP]
unfolding G.euler_genus_def H.euler_genus_def G.euler_char_def H.euler_char_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int (2 * card H.sccs) - int (card H.isolated_verts) - (int (card (verts H)) - int (card (arcs H) div 2) + int (card H.face_cycle_sets))) div 2 = (int (2 * card G.sccs) - int (card G.isolated_verts) - (int (card (verts G)) - int (card (arcs G) div 2) + int (card G.face_cycle_sets))) div 2
[PROOF STEP]
by (simp add: isolated_verts_da verts_H card_arcs_da card_face_cycle_sets_da card_sccs_da)


[STATEMENT]
lemma is_pole_shift_iff:
  fixes f :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector)"
  shows "is_pole (f \<circ> (+) d) a = is_pole f (a + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_pole (f \<circ> (+) d) a = is_pole f (a + d)
[PROOF STEP]
by (metis add_diff_cancel_right' filterlim_shift_iff is_pole_def)


[STATEMENT]
lemma "\<exists>(x::'a::linordered_field) y z. x + 7 * y < 5 * z \<and> 5 * y \<ge> 7 * z \<and> x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y z. x + (7::'a) * y < (5::'a) * z \<and> (7::'a) * z \<le> (5::'a) * y \<and> x < (0::'a)
[PROOF STEP]
by ferrack


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


[STATEMENT]
lemma sgn_root: "0 < n \<Longrightarrow> sgn (root n x) = sgn x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> sgn (root n x) = sgn x
[PROOF STEP]
by (auto split: split_root simp: sgn_real_def)


[STATEMENT]
lemma ccw'_not_coll:
  "ccw' a b c \<Longrightarrow> \<not>coll a b c"
  "ccw' a b c \<Longrightarrow> \<not>coll a c b"
  "ccw' a b c \<Longrightarrow> \<not>coll b a c"
  "ccw' a b c \<Longrightarrow> \<not>coll b c a"
  "ccw' a b c \<Longrightarrow> \<not>coll c a b"
  "ccw' a b c \<Longrightarrow> \<not>coll c b a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((ccw' a b c \<Longrightarrow> det3 a b c \<noteq> 0) &&& (ccw' a b c \<Longrightarrow> det3 a c b \<noteq> 0) &&& (ccw' a b c \<Longrightarrow> det3 b a c \<noteq> 0)) &&& (ccw' a b c \<Longrightarrow> det3 b c a \<noteq> 0) &&& (ccw' a b c \<Longrightarrow> det3 c a b \<noteq> 0) &&& (ccw' a b c \<Longrightarrow> det3 c b a \<noteq> 0)
[PROOF STEP]
by (auto simp: det3_def' ccw'_def algebra_simps)


[STATEMENT]
lemma length_vec: "length (vec A) = prod_list (dims A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (vec A) = prod_list (dims A)
[PROOF STEP]
by (metis (mono_tags, lifting) Rep_tensor Tensor.vec_def dims_def mem_Collect_eq)