[STATEMENT]
lemma max_degree_adjugate:
  fixes A :: "_^^'n"
  shows "max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1"
    (is "?R = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
let ?M = "minor (\<^bold>X - \<^bold>C A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
let ?D = "\<lambda>i j k l. degree (to_fun (?M i j) k l)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
have M: "\<And>i j k l. to_fun (?M i j) k l = (if k = i \<and> l = j then 1
    else if k = i \<or> l = j then 0
    else if k = l then [: - to_fun A k l, 1 :] else [: - to_fun A k l :])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j k l. to_fun (minor (\<^bold>X - \<^bold>C A) i j) k l = (if k = i \<and> l = j then 1 else if k = i \<or> l = j then 0 else if k = l then [:- to_fun A k l, 1::'b:] else [:- to_fun A k l:])
[PROOF STEP]
by transfer' (simp add: vec_eq_iff C_def X_def)
[PROOF STATE]
proof (state)
this:
to_fun (minor (\<^bold>X - \<^bold>C A) ?i ?j) ?k ?l = (if ?k = ?i \<and> ?l = ?j then 1 else if ?k = ?i \<or> ?l = ?j then 0 else if ?k = ?l then [:- to_fun A ?k ?l, 1::'b:] else [:- to_fun A ?k ?l:])

goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
have "?R = Max (range (\<lambda>(i, j). degree (det (?M j i))))" (is "_ = Max ?Max")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
unfolding max_degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MAX (i, j). degree (to_fun (adjugate (\<^bold>X - \<^bold>C A)) i j)) = (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
by (simp add: transpose.rep_eq cofactor_def adjugate_def of_fun_inverse)
[PROOF STATE]
proof (state)
this:
max_degree (adjugate (\<^bold>X - \<^bold>C A)) = (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))

goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
max_degree (adjugate (\<^bold>X - \<^bold>C A)) = (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))

goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
have "\<dots> = CARD('n) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))) = CARD('n) - 1
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))) \<le> CARD('n) - 1
 2. CARD('n) - 1 \<le> (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
show "Max ?Max \<le> CARD('n) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))) \<le> CARD('n) - 1
[PROOF STEP]
proof (safe intro!: Max.boundedI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (range (\<lambda>(i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))))
 2. \<And>a aa b. (aa, b) \<in> UNIV \<Longrightarrow> degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) b aa)) \<le> CARD('n) - 1
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (range (\<lambda>(i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))))
 2. \<And>a aa b. (aa, b) \<in> UNIV \<Longrightarrow> degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) b aa)) \<le> CARD('n) - 1
[PROOF STEP]
have "max_perm_degree (?M j i) = card (UNIV - {i, j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_perm_degree (minor (\<^bold>X - \<^bold>C A) j i) = card (UNIV - {i, j})
[PROOF STEP]
by (intro max_perm_degree_eqI)
           (auto simp: M sum.If_cases if_distrib[of degree] simp del: card_Diff_insert
                 intro!: card_mono permutes_id arg_cong[where f=card])
[PROOF STATE]
proof (state)
this:
max_perm_degree (minor (\<^bold>X - \<^bold>C A) j i) = card (UNIV - {i, j})

goal (2 subgoals):
 1. finite (range (\<lambda>(i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))))
 2. \<And>a aa b. (aa, b) \<in> UNIV \<Longrightarrow> degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) b aa)) \<le> CARD('n) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
max_perm_degree (minor (\<^bold>X - \<^bold>C A) j i) = card (UNIV - {i, j})
[PROOF STEP]
show "degree (det (?M j i)) \<le> CARD('n) - 1"
[PROOF STATE]
proof (prove)
using this:
max_perm_degree (minor (\<^bold>X - \<^bold>C A) j i) = card (UNIV - {i, j})

goal (1 subgoal):
 1. degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)) \<le> CARD('n) - 1
[PROOF STEP]
using degree_le_max_perm_degree[of "?M j i"]
[PROOF STATE]
proof (prove)
using this:
max_perm_degree (minor (\<^bold>X - \<^bold>C A) j i) = card (UNIV - {i, j})
degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)) \<le> max_perm_degree (minor (\<^bold>X - \<^bold>C A) j i)

goal (1 subgoal):
 1. degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)) \<le> CARD('n) - 1
[PROOF STEP]
by (cases "i = j") auto
[PROOF STATE]
proof (state)
this:
degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)) \<le> CARD('n) - 1

goal (1 subgoal):
 1. finite (range (\<lambda>(i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))))
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))) \<le> CARD('n) - 1

goal (1 subgoal):
 1. CARD('n) - 1 \<le> (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. CARD('n) - 1 \<le> (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
obtain x :: 'n where True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (True \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
True

goal (1 subgoal):
 1. CARD('n) - 1 \<le> (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
let ?P = "\<lambda>j k p. \<Prod>i\<in>UNIV. to_fun (?M j k) i (p i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. CARD('n) - 1 \<le> (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
have "degree (det (?M x x)) = CARD('n) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) x x)) = CARD('n) - 1
[PROOF STEP]
proof (subst degree_det)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
 2. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i) = CARD('n) - 1
[PROOF STEP]
have "CARD('n) - 1 = (\<Sum>i\<in>UNIV. ?D x x i i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) - 1 = (\<Sum>i\<in>UNIV. degree (to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i))
[PROOF STEP]
by (simp add: M if_distrib[where f="degree"] sum.If_cases Collect_neg_eq Compl_eq_Diff_UNIV)
[PROOF STATE]
proof (state)
this:
CARD('n) - 1 = (\<Sum>i\<in>UNIV. degree (to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i))

goal (2 subgoals):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
 2. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i) = CARD('n) - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
CARD('n) - 1 = (\<Sum>i\<in>UNIV. degree (to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i))

goal (2 subgoals):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
 2. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i) = CARD('n) - 1
[PROOF STEP]
have "\<dots> = degree (?P x x id)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. degree (to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)) = degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (id i))
[PROOF STEP]
by (auto intro!: antisym degree_prod_le le_degree simp add: coeff_mult_prod_sum)
           (simp add: M if_distrib[where f="\<lambda>x. coeff x b" for b] prod.If_cases)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>UNIV. degree (to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)) = degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (id i))

goal (2 subgoals):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
 2. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i) = CARD('n) - 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
CARD('n) - 1 = degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (id i))
[PROOF STEP]
show *: "degree (?P x x (\<lambda>x. x)) = CARD('n) - 1"
[PROOF STATE]
proof (prove)
using this:
CARD('n) - 1 = degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (id i))

goal (1 subgoal):
 1. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i) = CARD('n) - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i) = CARD('n) - 1

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
fix p :: "'n \<Rightarrow> 'n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
assume "p permutes UNIV" "p \<noteq> id"
[PROOF STATE]
proof (state)
this:
p permutes UNIV
p \<noteq> id

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p permutes UNIV
p \<noteq> id
[PROOF STEP]
obtain i j where ij: "i \<noteq> j" "p i = j"  and p: "i \<noteq> p i" "j \<noteq> p j"
[PROOF STATE]
proof (prove)
using this:
p permutes UNIV
p \<noteq> id

goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i \<noteq> j; p i = j; i \<noteq> p i; j \<noteq> p j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding id_def
[PROOF STATE]
proof (prove)
using this:
p permutes UNIV
p \<noteq> (\<lambda>x. x)

goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i \<noteq> j; p i = j; i \<noteq> p i; j \<noteq> p j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp (metis permutes_univ)
[PROOF STATE]
proof (state)
this:
i \<noteq> j
p i = j
i \<noteq> p i
j \<noteq> p j

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<noteq> j
p i = j
i \<noteq> p i
j \<noteq> p j
[PROOF STEP]
have "card {i,j} \<le> CARD('n)"
[PROOF STATE]
proof (prove)
using this:
i \<noteq> j
p i = j
i \<noteq> p i
j \<noteq> p j

goal (1 subgoal):
 1. card {i, j} \<le> CARD('n)
[PROOF STEP]
by (intro card_mono) auto
[PROOF STATE]
proof (state)
this:
card {i, j} \<le> CARD('n)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
have "degree (?P x x p) \<le> card (UNIV - {i, j})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) \<le> card (UNIV - {i, j})
[PROOF STEP]
using degree_prod_le
[PROOF STATE]
proof (prove)
using this:
degree (prod ?f ?S) \<le> (\<Sum>i\<in>?S. degree (?f i))

goal (1 subgoal):
 1. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) \<le> card (UNIV - {i, j})
[PROOF STEP]
by (rule order_trans)
           (auto simp: M if_distrib[where f="degree"] sum.If_cases Collect_neg_eq Compl_eq_Diff_UNIV p intro!: card_mono)
[PROOF STATE]
proof (state)
this:
degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) \<le> card (UNIV - {i, j})

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) \<le> card (UNIV - {i, j})

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
have "\<dots> < CARD('n) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (UNIV - {i, j}) < CARD('n) - 1
[PROOF STEP]
using \<open>card {i, j} \<le> CARD('n)\<close> ij
[PROOF STATE]
proof (prove)
using this:
card {i, j} \<le> CARD('n)
i \<noteq> j
p i = j

goal (1 subgoal):
 1. card (UNIV - {i, j}) < CARD('n) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (UNIV - {i, j}) < CARD('n) - 1

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j permutes UNIV; j \<noteq> id\<rbrakk> \<Longrightarrow> degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (j i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) < CARD('n) - 1
[PROOF STEP]
show "degree (?P x x p) < degree (?P x x (\<lambda>x. x))"
[PROOF STATE]
proof (prove)
using this:
degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) < CARD('n) - 1

goal (1 subgoal):
 1. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) < CARD('n) - 1
degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i) = CARD('n) - 1

goal (1 subgoal):
 1. degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i (p i)) < degree (\<Prod>i\<in>UNIV. to_fun (minor (\<^bold>X - \<^bold>C A) x x) i i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) x x)) = CARD('n) - 1

goal (1 subgoal):
 1. CARD('n) - 1 \<le> (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) x x)) = CARD('n) - 1
[PROOF STEP]
show "CARD('n) - 1 \<le> Max ?Max"
[PROOF STATE]
proof (prove)
using this:
degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) x x)) = CARD('n) - 1

goal (1 subgoal):
 1. CARD('n) - 1 \<le> (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))
[PROOF STEP]
by (auto simp add: Max_ge_iff intro!: exI[of _ x])
[PROOF STATE]
proof (state)
this:
CARD('n) - 1 \<le> (MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(MAX (i, j). degree (Square_Matrix.det (minor (\<^bold>X - \<^bold>C A) j i))) = CARD('n) - 1

goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1

goal (1 subgoal):
 1. max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
max_degree (adjugate (\<^bold>X - \<^bold>C A)) = CARD('n) - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dia_conjugate:
  "(\<forall>x. ( |R\<rangle> (f::'b \<Rightarrow> 'c::complete_boolean_algebra) x) \<sqinter> g x = \<bottom>) \<longleftrightarrow> (\<forall>x. f x \<sqinter> (\<langle>R| g x) = \<bottom>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x.  |R\<rangle> f x \<sqinter> g x = \<bottom>) = (\<forall>x. f x \<sqinter>  \<langle>R| g x = \<bottom>)
[PROOF STEP]
by (simp add: meet_shunt fdia_bbox_galois bdia_bbox_demorgan)


[STATEMENT]
lemma plus_ivl_nice: "[l1,h1] + [l2,h2] =
  (if [l1,h1] = \<bottom> \<or> [l2,h2] = \<bottom> then \<bottom> else [l1+l2 , h1+h2])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [l1, h1] + [l2, h2] = (if [l1, h1] = \<bottom> \<or> [l2, h2] = \<bottom> then \<bottom> else [l1 + l2, h1 + h2])
[PROOF STEP]
unfolding bot_ivl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [l1, h1] + [l2, h2] = (if [l1, h1] = empty_ivl \<or> [l2, h2] = empty_ivl then empty_ivl else [l1 + l2, h1 + h2])
[PROOF STEP]
by transfer (auto simp: plus_rep_def eq_ivl_empty)


[STATEMENT]
lemma div_mult_le: "(n::nat) div m * m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div m * m \<le> n
[PROOF STEP]
by (simp add: mult.commute minus_mod_eq_mult_div [symmetric])


[STATEMENT]
lemma fast_select_code [code]:
  "fast_select k xs = (
     if length xs \<le> 20 then
       fold insort xs [] ! k
     else
       let x = fast_select (((length xs + 4) div 5 - 1) div 2) (map median_le_5 (chop 5 xs));
           (ls, es, gs) = threeway_partition x xs;
           nl = length ls; ne = nl + length es
       in
         if k < nl then fast_select k ls
         else if k < ne then x
         else fast_select (k - ne) gs
      )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fast_select k xs = (if length xs \<le> 20 then fold insort xs [] ! k else let x = fast_select (((length xs + 4) div 5 - 1) div 2) (map median_le_5 (chop 5 xs)); (ls, es, gs) = threeway_partition x xs; nl = length ls; ne = nl + length es in if k < nl then fast_select k ls else if k < ne then x else fast_select (k - ne) gs)
[PROOF STEP]
by (subst fast_select.simps) (simp_all only: Let_def algebra_simps sort_conv_fold)


[STATEMENT]
lemma map_eq_imp_length_eq:
  assumes "map f xs = map g ys"
  shows "length xs = length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
map f xs = map g ys

goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
proof (induct ys arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. map f xs = map g [] \<Longrightarrow> length xs = length []
 2. \<And>a ys xs. \<lbrakk>\<And>xs. map f xs = map g ys \<Longrightarrow> length xs = length ys; map f xs = map g (a # ys)\<rbrakk> \<Longrightarrow> length xs = length (a # ys)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
map f xs = map g []

goal (2 subgoals):
 1. \<And>xs. map f xs = map g [] \<Longrightarrow> length xs = length []
 2. \<And>a ys xs. \<lbrakk>\<And>xs. map f xs = map g ys \<Longrightarrow> length xs = length ys; map f xs = map g (a # ys)\<rbrakk> \<Longrightarrow> length xs = length (a # ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
map f xs = map g []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
map f xs = map g []

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

goal (1 subgoal):
 1. \<And>a ys xs. \<lbrakk>\<And>xs. map f xs = map g ys \<Longrightarrow> length xs = length ys; map f xs = map g (a # ys)\<rbrakk> \<Longrightarrow> length xs = length (a # ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ys xs. \<lbrakk>\<And>xs. map f xs = map g ys \<Longrightarrow> length xs = length ys; map f xs = map g (a # ys)\<rbrakk> \<Longrightarrow> length xs = length (a # ys)
[PROOF STEP]
case (Cons y ys)
[PROOF STATE]
proof (state)
this:
map f ?xs = map g ys \<Longrightarrow> length ?xs = length ys
map f xs = map g (y # ys)

goal (1 subgoal):
 1. \<And>a ys xs. \<lbrakk>\<And>xs. map f xs = map g ys \<Longrightarrow> length xs = length ys; map f xs = map g (a # ys)\<rbrakk> \<Longrightarrow> length xs = length (a # ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
map f ?xs = map g ys \<Longrightarrow> length ?xs = length ys
map f xs = map g (y # ys)
[PROOF STEP]
obtain z zs where xs: "xs = z # zs"
[PROOF STATE]
proof (prove)
using this:
map f ?xs = map g ys \<Longrightarrow> length ?xs = length ys
map f xs = map g (y # ys)

goal (1 subgoal):
 1. (\<And>z zs. xs = z # zs \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs = z # zs

goal (1 subgoal):
 1. \<And>a ys xs. \<lbrakk>\<And>xs. map f xs = map g ys \<Longrightarrow> length xs = length ys; map f xs = map g (a # ys)\<rbrakk> \<Longrightarrow> length xs = length (a # ys)
[PROOF STEP]
from Cons xs
[PROOF STATE]
proof (chain)
picking this:
map f ?xs = map g ys \<Longrightarrow> length ?xs = length ys
map f xs = map g (y # ys)
xs = z # zs
[PROOF STEP]
have "map f zs = map g ys"
[PROOF STATE]
proof (prove)
using this:
map f ?xs = map g ys \<Longrightarrow> length ?xs = length ys
map f xs = map g (y # ys)
xs = z # zs

goal (1 subgoal):
 1. map f zs = map g ys
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map f zs = map g ys

goal (1 subgoal):
 1. \<And>a ys xs. \<lbrakk>\<And>xs. map f xs = map g ys \<Longrightarrow> length xs = length ys; map f xs = map g (a # ys)\<rbrakk> \<Longrightarrow> length xs = length (a # ys)
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
map f ?xs = map g ys \<Longrightarrow> length ?xs = length ys
map f xs = map g (y # ys)
map f zs = map g ys
[PROOF STEP]
have "length zs = length ys"
[PROOF STATE]
proof (prove)
using this:
map f ?xs = map g ys \<Longrightarrow> length ?xs = length ys
map f xs = map g (y # ys)
map f zs = map g ys

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

goal (1 subgoal):
 1. \<And>a ys xs. \<lbrakk>\<And>xs. map f xs = map g ys \<Longrightarrow> length xs = length ys; map f xs = map g (a # ys)\<rbrakk> \<Longrightarrow> length xs = length (a # ys)
[PROOF STEP]
with xs
[PROOF STATE]
proof (chain)
picking this:
xs = z # zs
length zs = length ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
xs = z # zs
length zs = length ys

goal (1 subgoal):
 1. length xs = length (y # ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length xs = length (y # ys)

goal:
No subgoals!
[PROOF STEP]
qed


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

goal (2 subgoals):
 1. \<And>xs n. take n (take 0 xs) = take (min n 0) xs
 2. \<And>m xs n. (\<And>xs n. take n (take m xs) = take (min n m) xs) \<Longrightarrow> take n (take (Suc m) xs) = take (min n (Suc m)) xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n (take 0 xs) = take (min n 0) xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
take n (take 0 xs) = take (min n 0) xs

goal (1 subgoal):
 1. \<And>m xs n. (\<And>xs n. take n (take m xs) = take (min n m) xs) \<Longrightarrow> take n (take (Suc m) xs) = take (min n (Suc m)) xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m xs n. (\<And>xs n. take n (take m xs) = take (min n m) xs) \<Longrightarrow> take n (take (Suc m) xs) = take (min n (Suc m)) xs
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
take ?n (take m_ ?xs) = take (min ?n m_) ?xs

goal (1 subgoal):
 1. \<And>m xs n. (\<And>xs n. take n (take m xs) = take (min n m) xs) \<Longrightarrow> take n (take (Suc m) xs) = take (min n (Suc m)) xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
take ?n (take m_ ?xs) = take (min ?n m_) ?xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
take ?n (take m_ ?xs) = take (min ?n m_) ?xs

goal (1 subgoal):
 1. take n (take (Suc m_) xs) = take (min n (Suc m_)) xs
[PROOF STEP]
by (cases xs; cases n) simp_all
[PROOF STATE]
proof (state)
this:
take n (take (Suc m_) xs) = take (min n (Suc m_)) xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_of_Times_singl2: "|A| =o |{b} \<times> A|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| =o |{b} \<times> A|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |A| =o |{b} \<times> A|
[PROOF STEP]
have "bij_betw snd ({b} \<times> A) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw snd ({b} \<times> A) A
[PROOF STEP]
unfolding bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>{b} \<times> A. \<forall>y\<in>{b} \<times> A. snd x = snd y \<longrightarrow> x = y) \<and> snd ` ({b} \<times> A) = A
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
bij_betw snd ({b} \<times> A) A

goal (1 subgoal):
 1. |A| =o |{b} \<times> A|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw snd ({b} \<times> A) A

goal (1 subgoal):
 1. |A| =o |{b} \<times> A|
[PROOF STEP]
using card_of_ordIso ordIso_symmetric
[PROOF STATE]
proof (prove)
using this:
bij_betw snd ({b} \<times> A) A
(\<exists>f. bij_betw f ?A ?B) = (|?A| =o |?B|)
?r =o ?r' \<Longrightarrow> ?r' =o ?r

goal (1 subgoal):
 1. |A| =o |{b} \<times> A|
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
|A| =o |{b} \<times> A|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma memFreshSimp[simp]:
  fixes y    :: name
  and   yvec :: "name list"

  shows "(\<not>(y mem yvec)) = y \<sharp> yvec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<notin> set yvec) = y \<sharp> yvec
[PROOF STEP]
by(induct yvec)
  (auto simp add: fresh_list_nil fresh_list_cons)


[STATEMENT]
lemma monoseq_convergent:
  fixes X :: "nat \<Rightarrow> real"
  assumes X: "monoseq X" and B: "\<And>i. \<bar>X i\<bar> \<le> B"
  obtains L where "X \<longlonglongrightarrow> L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
monoseq X

goal (1 subgoal):
 1. (\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding monoseq_iff
[PROOF STATE]
proof (prove)
using this:
incseq X \<or> decseq X

goal (1 subgoal):
 1. (\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis; incseq X\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis; decseq X\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "incseq X"
[PROOF STATE]
proof (state)
this:
incseq X

goal (2 subgoals):
 1. \<lbrakk>\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis; incseq X\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis; decseq X\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
using abs_le_D1 [OF B] incseq_convergent [OF \<open>incseq X\<close>] that
[PROOF STATE]
proof (prove)
using this:
X ?i1 \<le> B
\<lbrakk>\<forall>i. X i \<le> ?B; \<And>L. \<lbrakk>X \<longlonglongrightarrow> L; \<forall>i. X i \<le> L\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
X \<longlonglongrightarrow> ?L \<Longrightarrow> thesis

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

goal (1 subgoal):
 1. \<lbrakk>\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis; decseq X\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis; decseq X\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "decseq X"
[PROOF STATE]
proof (state)
this:
decseq X

goal (1 subgoal):
 1. \<lbrakk>\<And>L. X \<longlonglongrightarrow> L \<Longrightarrow> thesis; decseq X\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
using decseq_convergent [OF \<open>decseq X\<close>] that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>i. ?B \<le> X i; \<And>L. \<lbrakk>X \<longlonglongrightarrow> L; \<forall>i. L \<le> X i\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
X \<longlonglongrightarrow> ?L \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (metis B abs_le_iff add.inverse_inverse neg_le_iff_le)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma adm_single_valued:
 assumes "cont (\<lambda>x. f x)"
 shows "adm (\<lambda>x. single_valued (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adm (\<lambda>x. single_valued (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cont f

goal (1 subgoal):
 1. adm (\<lambda>x. single_valued (f x))
[PROOF STEP]
unfolding single_valued_def
[PROOF STATE]
proof (prove)
using this:
cont f

goal (1 subgoal):
 1. adm (\<lambda>x. \<forall>xa y. (xa, y) \<in> f x \<longrightarrow> (\<forall>z. (xa, z) \<in> f x \<longrightarrow> y = z))
[PROOF STEP]
by (intro adm_lemmas adm_not_mem cont2cont adm_subst[of f])


[STATEMENT]
lemma iter_tensor_of_gate_is_gate:
  fixes A:: "complex Matrix.mat" and n m:: "nat"
  assumes "gate m A" and "n \<ge> 1"
  shows "gate (m*n) (A \<otimes>\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

goal (1 subgoal):
 1. gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)
[PROOF STEP]
proof(rule nat_induct_at_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. gate (m * 1) (A \<otimes>\<^bsup>1\<^esup>)
 2. \<And>n. \<lbrakk>1 \<le> n; gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
show "gate (m * 1) (A \<otimes>\<^bsup>1\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate (m * 1) (A \<otimes>\<^bsup>1\<^esup>)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
gate m A

goal (1 subgoal):
 1. gate (m * 1) (A \<otimes>\<^bsup>1\<^esup>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gate (m * 1) (A \<otimes>\<^bsup>1\<^esup>)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
fix n:: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
assume "n \<ge> 1" and IH:"gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (state)
this:
1 \<le> n
gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> n
gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)
[PROOF STEP]
have "A \<otimes>\<^bsup>(Suc n)\<^esup> = A \<Otimes> (A \<otimes>\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. A \<otimes>\<^bsup>Suc n\<^esup> = A \<Otimes> A \<otimes>\<^bsup>n\<^esup>
[PROOF STEP]
by (simp add: iter_tensor_suc)
[PROOF STATE]
proof (state)
this:
A \<otimes>\<^bsup>Suc n\<^esup> = A \<Otimes> A \<otimes>\<^bsup>n\<^esup>

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<otimes>\<^bsup>Suc n\<^esup> = A \<Otimes> A \<otimes>\<^bsup>n\<^esup>

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
have "gate (m*n + m) (A \<otimes>\<^bsup>(Suc n)\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate (m * n + m) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
using tensor_gate assms(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>gate ?m ?G1.0; gate ?n ?G2.0\<rbrakk> \<Longrightarrow> gate (?m + ?n) (?G1.0 \<Otimes> ?G2.0)
gate m A

goal (1 subgoal):
 1. gate (m * n + m) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
by (simp add: IH add.commute calculation(1))
[PROOF STATE]
proof (state)
this:
gate (m * n + m) (A \<otimes>\<^bsup>Suc n\<^esup>)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; gate (m * n) (A \<otimes>\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
gate (m * n + m) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
show "gate (m*(Suc n)) (A \<otimes>\<^bsup>(Suc n)\<^esup>)"
[PROOF STATE]
proof (prove)
using this:
gate (m * n + m) (A \<otimes>\<^bsup>Suc n\<^esup>)

goal (1 subgoal):
 1. gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
gate (m * Suc n) (A \<otimes>\<^bsup>Suc n\<^esup>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) pow_eq_div2:
  fixes m n :: nat
  assumes x_car: "x \<in> carrier G"
  assumes pow_eq: "x [^] m = x [^] n"
  shows "x [^] (m - n) = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] (m - n) = \<one>
[PROOF STEP]
proof (cases "m < n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m < n \<Longrightarrow> x [^] (m - n) = \<one>
 2. \<not> m < n \<Longrightarrow> x [^] (m - n) = \<one>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> m < n

goal (2 subgoals):
 1. m < n \<Longrightarrow> x [^] (m - n) = \<one>
 2. \<not> m < n \<Longrightarrow> x [^] (m - n) = \<one>
[PROOF STEP]
have "\<one> \<otimes> x [^] m = x [^] m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> \<otimes> x [^] m = x [^] m
[PROOF STEP]
by (simp add: x_car)
[PROOF STATE]
proof (state)
this:
\<one> \<otimes> x [^] m = x [^] m

goal (2 subgoals):
 1. m < n \<Longrightarrow> x [^] (m - n) = \<one>
 2. \<not> m < n \<Longrightarrow> x [^] (m - n) = \<one>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<one> \<otimes> x [^] m = x [^] m

goal (2 subgoals):
 1. m < n \<Longrightarrow> x [^] (m - n) = \<one>
 2. \<not> m < n \<Longrightarrow> x [^] (m - n) = \<one>
[PROOF STEP]
have "\<dots> = x [^] (m - n) \<otimes> x [^] n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] m = x [^] (m - n) \<otimes> x [^] n
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> m < n

goal (1 subgoal):
 1. x [^] m = x [^] (m - n) \<otimes> x [^] n
[PROOF STEP]
by (simp add: nat_pow_mult x_car)
[PROOF STATE]
proof (state)
this:
x [^] m = x [^] (m - n) \<otimes> x [^] n

goal (2 subgoals):
 1. m < n \<Longrightarrow> x [^] (m - n) = \<one>
 2. \<not> m < n \<Longrightarrow> x [^] (m - n) = \<one>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x [^] m = x [^] (m - n) \<otimes> x [^] n

goal (2 subgoals):
 1. m < n \<Longrightarrow> x [^] (m - n) = \<one>
 2. \<not> m < n \<Longrightarrow> x [^] (m - n) = \<one>
[PROOF STEP]
have "\<dots> = x [^] (m - n) \<otimes> x [^] m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] (m - n) \<otimes> x [^] n = x [^] (m - n) \<otimes> x [^] m
[PROOF STEP]
by (simp add: pow_eq)
[PROOF STATE]
proof (state)
this:
x [^] (m - n) \<otimes> x [^] n = x [^] (m - n) \<otimes> x [^] m

goal (2 subgoals):
 1. m < n \<Longrightarrow> x [^] (m - n) = \<one>
 2. \<not> m < n \<Longrightarrow> x [^] (m - n) = \<one>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<one> \<otimes> x [^] m = x [^] (m - n) \<otimes> x [^] m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<one> \<otimes> x [^] m = x [^] (m - n) \<otimes> x [^] m

goal (1 subgoal):
 1. x [^] (m - n) = \<one>
[PROOF STEP]
by (metis nat_pow_closed one_closed right_cancel x_car)
[PROOF STATE]
proof (state)
this:
x [^] (m - n) = \<one>

goal (1 subgoal):
 1. m < n \<Longrightarrow> x [^] (m - n) = \<one>
[PROOF STEP]
qed simp


[STATEMENT]
lemma piecewise_C1_differentiable_cases [derivative_intros]:
  fixes c::real
  assumes "f piecewise_C1_differentiable_on {a..c}"
          "g piecewise_C1_differentiable_on {c..b}"
           "a \<le> c" "c \<le> b" "f c = g c"
  shows "(\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
obtain S T where st: "f C1_differentiable_on ({a..c} - S)"
                       "g C1_differentiable_on ({c..b} - T)"
                       "finite S" "finite T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S T. \<lbrakk>f C1_differentiable_on {a..c} - S; g C1_differentiable_on {c..b} - T; finite S; finite T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f piecewise_C1_differentiable_on {a..c}
g piecewise_C1_differentiable_on {c..b}
a \<le> c
c \<le> b
f c = g c

goal (1 subgoal):
 1. (\<And>S T. \<lbrakk>f C1_differentiable_on {a..c} - S; g C1_differentiable_on {c..b} - T; finite S; finite T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: piecewise_C1_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
f C1_differentiable_on {a..c} - S
g C1_differentiable_on {c..b} - T
finite S
finite T

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f C1_differentiable_on {a..c} - S
g C1_differentiable_on {c..b} - T
finite S
finite T
[PROOF STEP]
have f_diff: "f differentiable_on {a..<c} - S"
        and g_diff: "g differentiable_on {c<..b} - T"
[PROOF STATE]
proof (prove)
using this:
f C1_differentiable_on {a..c} - S
g C1_differentiable_on {c..b} - T
finite S
finite T

goal (1 subgoal):
 1. f differentiable_on {a..<c} - S &&& g differentiable_on {c<..b} - T
[PROOF STEP]
by (simp_all add: C1_differentiable_on_eq differentiable_at_withinI differentiable_on_def)
[PROOF STATE]
proof (state)
this:
f differentiable_on {a..<c} - S
g differentiable_on {c<..b} - T

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
have "continuous_on {a..c} f" "continuous_on {c..b} g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {a..c} f &&& continuous_on {c..b} g
[PROOF STEP]
using assms piecewise_C1_differentiable_on_def
[PROOF STATE]
proof (prove)
using this:
f piecewise_C1_differentiable_on {a..c}
g piecewise_C1_differentiable_on {c..b}
a \<le> c
c \<le> b
f c = g c
?f piecewise_C1_differentiable_on ?i \<equiv> continuous_on ?i ?f \<and> (\<exists>S. finite S \<and> ?f C1_differentiable_on ?i - S)

goal (1 subgoal):
 1. continuous_on {a..c} f &&& continuous_on {c..b} g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
continuous_on {a..c} f
continuous_on {c..b} g

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on {a..c} f
continuous_on {c..b} g
[PROOF STEP]
have cab: "continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)"
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..c} f
continuous_on {c..b} g

goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)
[PROOF STEP]
using continuous_on_cases [OF closed_real_atLeastAtMost [of a c],
                               OF closed_real_atLeastAtMost [of c b],
                               of f g "\<lambda>x. x\<le>c"]  assms
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..c} f
continuous_on {c..b} g
\<lbrakk>continuous_on {a..c} f; continuous_on {c..b} g; \<forall>x. x \<in> {a..c} \<and> \<not> x \<le> c \<or> x \<in> {c..b} \<and> x \<le> c \<longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> continuous_on ({a..c} \<union> {c..b}) (\<lambda>x. if x \<le> c then f x else g x)
f piecewise_C1_differentiable_on {a..c}
g piecewise_C1_differentiable_on {c..b}
a \<le> c
c \<le> b
f c = g c

goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)
[PROOF STEP]
by (force simp: ivl_disj_un_two_touch)
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
assume x: "x \<in> {a..b} - insert c (S \<union> T)"
[PROOF STATE]
proof (state)
this:
x \<in> {a..b} - insert c (S \<union> T)

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
have "(\<lambda>x. if x \<le> c then f x else g x) differentiable at x" (is "?diff_fg")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
proof (cases x c rule: le_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<le> c \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
 2. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
case le
[PROOF STATE]
proof (state)
this:
x \<le> c

goal (2 subgoals):
 1. x \<le> c \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
 2. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
show ?diff_fg
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
apply (rule differentiable_transform_within [where f=f and d = "dist x c"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. f differentiable at x
 2. 0 < dist x c
 3. x \<in> UNIV
 4. \<And>x'. \<lbrakk>x' \<in> UNIV; dist x' x < dist x c\<rbrakk> \<Longrightarrow> f x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
using x dist_real_def le st
[PROOF STATE]
proof (prove)
using this:
x \<in> {a..b} - insert c (S \<union> T)
dist ?x ?y = \<bar>?x - ?y\<bar>
x \<le> c
f C1_differentiable_on {a..c} - S
g C1_differentiable_on {c..b} - T
finite S
finite T

goal (4 subgoals):
 1. f differentiable at x
 2. 0 < dist x c
 3. x \<in> UNIV
 4. \<And>x'. \<lbrakk>x' \<in> UNIV; dist x' x < dist x c\<rbrakk> \<Longrightarrow> f x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
by (auto simp: C1_differentiable_on_eq)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<le> c then f x else g x) differentiable at x

goal (1 subgoal):
 1. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
case ge
[PROOF STATE]
proof (state)
this:
c \<le> x

goal (1 subgoal):
 1. c \<le> x \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
show ?diff_fg
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
apply (rule differentiable_transform_within [where f=g and d = "dist x c"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. g differentiable at x
 2. 0 < dist x c
 3. x \<in> UNIV
 4. \<And>x'. \<lbrakk>x' \<in> UNIV; dist x' x < dist x c\<rbrakk> \<Longrightarrow> g x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
using dist_nz x dist_real_def ge st x
[PROOF STATE]
proof (prove)
using this:
(?x \<noteq> ?y) = (0 < dist ?x ?y)
x \<in> {a..b} - insert c (S \<union> T)
dist ?x ?y = \<bar>?x - ?y\<bar>
c \<le> x
f C1_differentiable_on {a..c} - S
g C1_differentiable_on {c..b} - T
finite S
finite T
x \<in> {a..b} - insert c (S \<union> T)

goal (4 subgoals):
 1. g differentiable at x
 2. 0 < dist x c
 3. x \<in> UNIV
 4. \<And>x'. \<lbrakk>x' \<in> UNIV; dist x' x < dist x c\<rbrakk> \<Longrightarrow> g x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
by (auto simp: C1_differentiable_on_eq)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<le> c then f x else g x) differentiable at x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<le> c then f x else g x) differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> {a..b} - insert c (S \<union> T) \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at ?x2

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> {a..b} - insert c (S \<union> T) \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at ?x2
[PROOF STEP]
have "(\<forall>x \<in> {a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x)"
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> {a..b} - insert c (S \<union> T) \<Longrightarrow> (\<lambda>x. if x \<le> c then f x else g x) differentiable at ?x2

goal (1 subgoal):
 1. \<forall>x\<in>{a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
assume fcon: "continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative f (at x))"
       and gcon: "continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative g (at x))"
[PROOF STATE]
proof (state)
this:
continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative f (at x))
continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative g (at x))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
have "open ({a<..<c} - S)"  "open ({c<..<b} - T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open ({a<..<c} - S) &&& open ({c<..<b} - T)
[PROOF STEP]
using st
[PROOF STATE]
proof (prove)
using this:
f C1_differentiable_on {a..c} - S
g C1_differentiable_on {c..b} - T
finite S
finite T

goal (1 subgoal):
 1. open ({a<..<c} - S) &&& open ({c<..<b} - T)
[PROOF STEP]
by (simp_all add: open_Diff finite_imp_closed)
[PROOF STATE]
proof (state)
this:
open ({a<..<c} - S)
open ({c<..<b} - T)

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open ({a<..<c} - S)
open ({c<..<b} - T)

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
have "continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
have "((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at x))            (at x)"
        if "a < x" "x < c" "x \<notin> S" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at x)) (at x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at x)) (at x)
[PROOF STEP]
have f: "f differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f differentiable at x
[PROOF STEP]
by (meson C1_differentiable_on_eq Diff_iff atLeastAtMost_iff less_eq_real_def st(1) that)
[PROOF STATE]
proof (state)
this:
f differentiable at x

goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at x)) (at x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at x)) (at x)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
a < x
x < c
x \<notin> S

goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at x)) (at x)
[PROOF STEP]
apply (rule_tac f=f and d="dist x c" in has_vector_derivative_transform_within)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>a < x; x < c; x \<notin> S\<rbrakk> \<Longrightarrow> (f has_vector_derivative vector_derivative f (at x)) (at x)
 2. \<lbrakk>a < x; x < c; x \<notin> S\<rbrakk> \<Longrightarrow> 0 < dist x c
 3. \<lbrakk>a < x; x < c; x \<notin> S\<rbrakk> \<Longrightarrow> x \<in> UNIV
 4. \<And>x'. \<lbrakk>a < x; x < c; x \<notin> S; x' \<in> UNIV; dist x' x < dist x c\<rbrakk> \<Longrightarrow> f x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
apply (auto simp: dist_norm vector_derivative_works [symmetric] f)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at x)) (at x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>a < ?x; ?x < c; ?x \<notin> S\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at ?x)) (at ?x)

goal (1 subgoal):
 1. continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>a < ?x; ?x < c; ?x \<notin> S\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at ?x)) (at ?x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a < ?x; ?x < c; ?x \<notin> S\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative f (at ?x)) (at ?x)

goal (1 subgoal):
 1. continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
by (metis (no_types, lifting) continuous_on_eq [OF fcon] DiffE greaterThanLessThan_iff vector_derivative_at)
[PROOF STATE]
proof (state)
this:
continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
have "continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
have "((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at x))            (at x)"
        if "c < x" "x < b" "x \<notin> T" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at x)) (at x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at x)) (at x)
[PROOF STEP]
have g: "g differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g differentiable at x
[PROOF STEP]
by (metis C1_differentiable_on_eq DiffD1 DiffI atLeastAtMost_diff_ends greaterThanLessThan_iff st(2) that)
[PROOF STATE]
proof (state)
this:
g differentiable at x

goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at x)) (at x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at x)) (at x)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
c < x
x < b
x \<notin> T

goal (1 subgoal):
 1. ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at x)) (at x)
[PROOF STEP]
apply (rule_tac f=g and d="dist x c" in has_vector_derivative_transform_within)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>c < x; x < b; x \<notin> T\<rbrakk> \<Longrightarrow> (g has_vector_derivative vector_derivative g (at x)) (at x)
 2. \<lbrakk>c < x; x < b; x \<notin> T\<rbrakk> \<Longrightarrow> 0 < dist x c
 3. \<lbrakk>c < x; x < b; x \<notin> T\<rbrakk> \<Longrightarrow> x \<in> UNIV
 4. \<And>x'. \<lbrakk>c < x; x < b; x \<notin> T; x' \<in> UNIV; dist x' x < dist x c\<rbrakk> \<Longrightarrow> g x' = (if x' \<le> c then f x' else g x')
[PROOF STEP]
apply (auto simp: dist_norm vector_derivative_works [symmetric] g)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at x)) (at x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>c < ?x; ?x < b; ?x \<notin> T\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at ?x)) (at ?x)

goal (1 subgoal):
 1. continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>c < ?x; ?x < b; ?x \<notin> T\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at ?x)) (at ?x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>c < ?x; ?x < b; ?x \<notin> T\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x \<le> c then f x else g x) has_vector_derivative vector_derivative g (at ?x)) (at ?x)

goal (1 subgoal):
 1. continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
by (metis (no_types, lifting) continuous_on_eq [OF gcon] DiffE greaterThanLessThan_iff vector_derivative_at)
[PROOF STATE]
proof (state)
this:
continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
open ({a<..<c} - S)
open ({c<..<b} - T)
continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
have "continuous_on ({a<..<b} - insert c (S \<union> T))
        (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))"
[PROOF STATE]
proof (prove)
using this:
open ({a<..<c} - S)
open ({c<..<b} - T)
continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
by (rule continuous_on_subset [OF continuous_on_open_Un], auto)
[PROOF STATE]
proof (state)
this:
continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative f (at x)); continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative g (at x))\<rbrakk> \<Longrightarrow> continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
note * = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>continuous_on ({a<..<c} - S) (\<lambda>x. vector_derivative f (at x)); continuous_on ({c<..<b} - T) (\<lambda>x. vector_derivative g (at x))\<rbrakk> \<Longrightarrow> continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
have "continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
using st
[PROOF STATE]
proof (prove)
using this:
f C1_differentiable_on {a..c} - S
g C1_differentiable_on {c..b} - T
finite S
finite T

goal (1 subgoal):
 1. continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
by (auto simp: C1_differentiable_on_eq elim!: continuous_on_subset intro: *)
[PROOF STATE]
proof (state)
this:
continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>{a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))
[PROOF STEP]
have "\<exists>S. finite S \<and> ((\<lambda>x. if x \<le> c then f x else g x) C1_differentiable_on {a..b} - S)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x
continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))

goal (1 subgoal):
 1. \<exists>S. finite S \<and> (\<lambda>x. if x \<le> c then f x else g x) C1_differentiable_on {a..b} - S
[PROOF STEP]
apply (rule_tac x="{a,b,c} \<union> S \<union> T" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>{a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x; continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))\<rbrakk> \<Longrightarrow> finite ({a, b, c} \<union> S \<union> T) \<and> (\<lambda>x. if x \<le> c then f x else g x) C1_differentiable_on {a..b} - ({a, b, c} \<union> S \<union> T)
[PROOF STEP]
using st
[PROOF STATE]
proof (prove)
using this:
f C1_differentiable_on {a..c} - S
g C1_differentiable_on {c..b} - T
finite S
finite T

goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>{a..b} - insert c (S \<union> T). (\<lambda>x. if x \<le> c then f x else g x) differentiable at x; continuous_on ({a<..<b} - insert c (S \<union> T)) (\<lambda>x. vector_derivative (\<lambda>x. if x \<le> c then f x else g x) (at x))\<rbrakk> \<Longrightarrow> finite ({a, b, c} \<union> S \<union> T) \<and> (\<lambda>x. if x \<le> c then f x else g x) C1_differentiable_on {a..b} - ({a, b, c} \<union> S \<union> T)
[PROOF STEP]
by (auto simp: C1_differentiable_on_eq elim!: continuous_on_subset)
[PROOF STATE]
proof (state)
this:
\<exists>S. finite S \<and> (\<lambda>x. if x \<le> c then f x else g x) C1_differentiable_on {a..b} - S

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
with cab
[PROOF STATE]
proof (chain)
picking this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)
\<exists>S. finite S \<and> (\<lambda>x. if x \<le> c then f x else g x) C1_differentiable_on {a..b} - S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} (\<lambda>x. if x \<le> c then f x else g x)
\<exists>S. finite S \<and> (\<lambda>x. if x \<le> c then f x else g x) C1_differentiable_on {a..b} - S

goal (1 subgoal):
 1. (\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}
[PROOF STEP]
by (simp add: piecewise_C1_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<le> c then f x else g x) piecewise_C1_differentiable_on {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bdd_above_infdist_aux:
  assumes "bounded A" "bounded B"
  shows "bdd_above ((\<lambda>x. infdist x B)`A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
proof (cases "B = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B = {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
 2. B \<noteq> {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
B = {}

goal (2 subgoals):
 1. B = {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
 2. B \<noteq> {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B = {}

goal (1 subgoal):
 1. bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
unfolding infdist_def
[PROOF STATE]
proof (prove)
using this:
B = {}

goal (1 subgoal):
 1. bdd_above ((\<lambda>x. if B = {} then 0 else Inf (dist x ` B)) ` A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bdd_above ((\<lambda>x. infdist x B) ` A)

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
B \<noteq> {}

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<noteq> {}
[PROOF STEP]
obtain y where "y \<in> B"
[PROOF STATE]
proof (prove)
using this:
B \<noteq> {}

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

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> B
[PROOF STEP]
have "infdist x B \<le> dist x y" if "x \<in> A" for x
[PROOF STATE]
proof (prove)
using this:
y \<in> B

goal (1 subgoal):
 1. infdist x B \<le> dist x y
[PROOF STEP]
by (simp add: infdist_le)
[PROOF STATE]
proof (state)
this:
?x \<in> A \<Longrightarrow> infdist ?x B \<le> dist ?x y

goal (1 subgoal):
 1. B \<noteq> {} \<Longrightarrow> bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> A \<Longrightarrow> infdist ?x B \<le> dist ?x y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> infdist ?x B \<le> dist ?x y

goal (1 subgoal):
 1. bdd_above ((\<lambda>x. infdist x B) ` A)
[PROOF STEP]
unfolding bdd_above_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> infdist ?x B \<le> dist ?x y

goal (1 subgoal):
 1. \<exists>M. \<forall>x\<in>(\<lambda>x. infdist x B) ` A. x \<le> M
[PROOF STEP]
by (auto, metis assms(1) bounded_any_center dist_commute order_trans)
[PROOF STATE]
proof (state)
this:
bdd_above ((\<lambda>x. infdist x B) ` A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_prod_le:
  fixes c :: "'a::linordered_field"
  assumes "c < 0"
  shows "c * x \<le> 0 \<equiv> x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * x \<le> (0::'a) \<equiv> (0::'a) \<le> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c * x \<le> (0::'a) \<equiv> (0::'a) \<le> x
[PROOF STEP]
have "c * x \<le> 0 \<longleftrightarrow> 0 / c \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c * x \<le> (0::'a)) = ((0::'a) / c \<le> x)
[PROOF STEP]
by (simp only: neg_divide_le_eq[OF \<open>c < 0\<close>] algebra_simps)
[PROOF STATE]
proof (state)
this:
(c * x \<le> (0::'a)) = ((0::'a) / c \<le> x)

goal (1 subgoal):
 1. c * x \<le> (0::'a) \<equiv> (0::'a) \<le> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * x \<le> (0::'a)) = ((0::'a) / c \<le> x)

goal (1 subgoal):
 1. c * x \<le> (0::'a) \<equiv> (0::'a) \<le> x
[PROOF STEP]
have "\<dots> \<longleftrightarrow> 0 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) / c \<le> x) = ((0::'a) \<le> x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((0::'a) / c \<le> x) = ((0::'a) \<le> x)

goal (1 subgoal):
 1. c * x \<le> (0::'a) \<equiv> (0::'a) \<le> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(c * x \<le> (0::'a)) = ((0::'a) \<le> x)
[PROOF STEP]
show "PROP ?thesis"
[PROOF STATE]
proof (prove)
using this:
(c * x \<le> (0::'a)) = ((0::'a) \<le> x)

goal (1 subgoal):
 1. c * x \<le> (0::'a) \<equiv> (0::'a) \<le> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * x \<le> (0::'a) \<equiv> (0::'a) \<le> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma autoref_rec_nat: "(rec_nat,rec_nat) \<in> R \<rightarrow> (Id \<rightarrow> R \<rightarrow> R) \<rightarrow> Id \<rightarrow> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rec_nat, rec_nat) \<in> R \<rightarrow> (nat_rel \<rightarrow> R \<rightarrow> R) \<rightarrow> nat_rel \<rightarrow> R
[PROOF STEP]
apply (intro fun_relI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a a' aa a'a ab a'b. \<lbrakk>(a, a') \<in> R; (aa, a'a) \<in> nat_rel \<rightarrow> R \<rightarrow> R; (ab, a'b) \<in> nat_rel\<rbrakk> \<Longrightarrow> (rec_nat a aa ab, rec_nat a' a'a a'b) \<in> R
[PROOF STEP]
proof goal_cases
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a a' aa a'a ab a'b. \<lbrakk>(a, a') \<in> R; (aa, a'a) \<in> nat_rel \<rightarrow> R \<rightarrow> R; (ab, a'b) \<in> nat_rel\<rbrakk> \<Longrightarrow> (rec_nat a aa ab, rec_nat a' a'a a'b) \<in> R
[PROOF STEP]
case (1 s s' f f' n n')
[PROOF STATE]
proof (state)
this:
(s, s') \<in> R
(f, f') \<in> nat_rel \<rightarrow> R \<rightarrow> R
(n, n') \<in> nat_rel

goal (1 subgoal):
 1. \<And>a a' aa a'a ab a'b. \<lbrakk>(a, a') \<in> R; (aa, a'a) \<in> nat_rel \<rightarrow> R \<rightarrow> R; (ab, a'b) \<in> nat_rel\<rbrakk> \<Longrightarrow> (rec_nat a aa ab, rec_nat a' a'a a'b) \<in> R
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(s, s') \<in> R
(f, f') \<in> nat_rel \<rightarrow> R \<rightarrow> R
(n, n') \<in> nat_rel

goal (1 subgoal):
 1. (rec_nat s f n, rec_nat s' f' n') \<in> R
[PROOF STEP]
apply (induct n' arbitrary: n s s')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n s s'. \<lbrakk>(s, s') \<in> R; (f, f') \<in> nat_rel \<rightarrow> R \<rightarrow> R; (n, 0) \<in> nat_rel\<rbrakk> \<Longrightarrow> (rec_nat s f n, rec_nat s' f' 0) \<in> R
 2. \<And>n' n s s'. \<lbrakk>\<And>n s s'. \<lbrakk>(s, s') \<in> R; (f, f') \<in> nat_rel \<rightarrow> R \<rightarrow> R; (n, n') \<in> nat_rel\<rbrakk> \<Longrightarrow> (rec_nat s f n, rec_nat s' f' n') \<in> R; (s, s') \<in> R; (f, f') \<in> nat_rel \<rightarrow> R \<rightarrow> R; (n, Suc n') \<in> nat_rel\<rbrakk> \<Longrightarrow> (rec_nat s f n, rec_nat s' f' (Suc n')) \<in> R
[PROOF STEP]
apply (fastforce simp: fun_rel_def)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(rec_nat s f n, rec_nat s' f' n') \<in> R

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subseqs_of_indices: "map (map (nth xs)) (subseqs [0..<length xs]) = subseqs xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (map ((!) xs)) (subseqs [0..<length xs]) = subseqs xs
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. map (map ((!) [])) (subseqs [0..<length []]) = subseqs []
 2. \<And>a xs. map (map ((!) xs)) (subseqs [0..<length xs]) = subseqs xs \<Longrightarrow> map (map ((!) (a # xs))) (subseqs [0..<length (a # xs)]) = subseqs (a # xs)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. map (map ((!) [])) (subseqs [0..<length []]) = subseqs []
 2. \<And>a xs. map (map ((!) xs)) (subseqs [0..<length xs]) = subseqs xs \<Longrightarrow> map (map ((!) (a # xs))) (subseqs [0..<length (a # xs)]) = subseqs (a # xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (map ((!) [])) (subseqs [0..<length []]) = subseqs []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map (map ((!) [])) (subseqs [0..<length []]) = subseqs []

goal (1 subgoal):
 1. \<And>a xs. map (map ((!) xs)) (subseqs [0..<length xs]) = subseqs xs \<Longrightarrow> map (map ((!) (a # xs))) (subseqs [0..<length (a # xs)]) = subseqs (a # xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. map (map ((!) xs)) (subseqs [0..<length xs]) = subseqs xs \<Longrightarrow> map (map ((!) (a # xs))) (subseqs [0..<length (a # xs)]) = subseqs (a # xs)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
map (map ((!) xs)) (subseqs [0..<length xs]) = subseqs xs

goal (1 subgoal):
 1. \<And>a xs. map (map ((!) xs)) (subseqs [0..<length xs]) = subseqs xs \<Longrightarrow> map (map ((!) (a # xs))) (subseqs [0..<length (a # xs)]) = subseqs (a # xs)
[PROOF STEP]
from this[symmetric]
[PROOF STATE]
proof (chain)
picking this:
subseqs xs = map (map ((!) xs)) (subseqs [0..<length xs])
[PROOF STEP]
have "subseqs xs = map (map ((!) (x#xs))) (subseqs [Suc 0..<Suc (length xs)])"
[PROOF STATE]
proof (prove)
using this:
subseqs xs = map (map ((!) xs)) (subseqs [0..<length xs])

goal (1 subgoal):
 1. subseqs xs = map (map ((!) (x # xs))) (subseqs [Suc 0..<Suc (length xs)])
[PROOF STEP]
by (fold map_Suc_upt, simp)
[PROOF STATE]
proof (state)
this:
subseqs xs = map (map ((!) (x # xs))) (subseqs [Suc 0..<Suc (length xs)])

goal (1 subgoal):
 1. \<And>a xs. map (map ((!) xs)) (subseqs [0..<length xs]) = subseqs xs \<Longrightarrow> map (map ((!) (a # xs))) (subseqs [0..<length (a # xs)]) = subseqs (a # xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subseqs xs = map (map ((!) (x # xs))) (subseqs [Suc 0..<Suc (length xs)])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
subseqs xs = map (map ((!) (x # xs))) (subseqs [Suc 0..<Suc (length xs)])

goal (1 subgoal):
 1. map (map ((!) (x # xs))) (subseqs [0..<length (x # xs)]) = subseqs (x # xs)
[PROOF STEP]
by (unfold length_Cons upt_conv_Cons[OF zero_less_Suc], simp)
[PROOF STATE]
proof (state)
this:
map (map ((!) (x # xs))) (subseqs [0..<length (x # xs)]) = subseqs (x # xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_support: "f \<in> fin_support z A \<Longrightarrow> finite (support z A f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> fin_support z A \<Longrightarrow> finite (support z A f)
[PROOF STEP]
unfolding support_def fin_support_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {f. finite {x \<in> A. f x \<noteq> z}} \<Longrightarrow> finite {x \<in> A. f x \<noteq> z}
[PROOF STEP]
by auto


[STATEMENT]
lemma Refl_above_aboveS:
  assumes REFL: "Refl r" and IN: "a \<in> Field r"
  shows "above r a = aboveS r a \<union> {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. above r a = aboveS r a \<union> {a}
[PROOF STEP]
proof(unfold above_def aboveS_def, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a, a) \<in> r
[PROOF STEP]
show "(a,a) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a, a) \<in> r
[PROOF STEP]
using REFL IN refl_on_def[of _ r]
[PROOF STATE]
proof (prove)
using this:
Refl r
a \<in> Field r
refl_on ?A r = (r \<subseteq> ?A \<times> ?A \<and> (\<forall>x\<in>?A. (x, x) \<in> r))

goal (1 subgoal):
 1. (a, a) \<in> r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(a, a) \<in> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diff_Union_span:
  assumes "A \<subseteq> G"
  shows "\<Union> ((\<lambda> d .{(a, b) | a b. a \<in> A \<and> b \<in> A \<and> (a \<ominus> b = d)}) ` (differenceset A A)) = A \<times> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d}) = A \<times> A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d}) \<subseteq> A \<times> A
 2. A \<times> A \<subseteq> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
show "\<Union> ((\<lambda> d .{(a, b) | a b. a \<in> A \<and> b \<in> A \<and> (a \<ominus> b = d)}) ` (differenceset A A)) \<subseteq> A \<times> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d}) \<subseteq> A \<times> A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d}) \<subseteq> A \<times> A

goal (1 subgoal):
 1. A \<times> A \<subseteq> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<times> A \<subseteq> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
show "A \<times> A \<subseteq> \<Union> ((\<lambda> d .{(a, b) | a b. a \<in> A \<and> b \<in> A \<and> (a \<ominus> b = d)}) ` (differenceset A A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<times> A \<subseteq> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
proof (intro subsetI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> A \<Longrightarrow> x \<in> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> A \<Longrightarrow> x \<in> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
assume hxA: "x \<in> A \<times> A"
[PROOF STATE]
proof (state)
this:
x \<in> A \<times> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> A \<Longrightarrow> x \<in> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> A \<times> A
[PROOF STEP]
obtain y z where hxyz: "x = (y, z)" and hy: "y \<in> A" and hz:"z \<in> A"
[PROOF STATE]
proof (prove)
using this:
x \<in> A \<times> A

goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>x = (y, z); y \<in> A; z \<in> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = (y, z)
y \<in> A
z \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<times> A \<Longrightarrow> x \<in> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
show "x \<in> (\<Union>d\<in>(differenceset A A).{(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
using hy hz assms hxA hxyz
[PROOF STATE]
proof (prove)
using this:
y \<in> A
z \<in> A
A \<subseteq> G
x \<in> A \<times> A
x = (y, z)

goal (1 subgoal):
 1. x \<in> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
A \<times> A \<subseteq> (\<Union>d\<in>differenceset A A. {(a, b) |a b. a \<in> A \<and> b \<in> A \<and> a \<ominus> b = d})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma discrete_compact_finite_iff:
  fixes S :: "'a::t1_space set"
  shows "discrete S \<and> compact S \<longleftrightarrow> finite S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (discrete S \<and> compact S) = finite S
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. discrete S \<and> compact S \<Longrightarrow> finite S
 2. finite S \<Longrightarrow> discrete S \<and> compact S
[PROOF STEP]
assume "finite S"
[PROOF STATE]
proof (state)
this:
finite S

goal (2 subgoals):
 1. discrete S \<and> compact S \<Longrightarrow> finite S
 2. finite S \<Longrightarrow> discrete S \<and> compact S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
[PROOF STEP]
have "compact S"
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. compact S
[PROOF STEP]
using finite_imp_compact
[PROOF STATE]
proof (prove)
using this:
finite S
finite ?s \<Longrightarrow> compact ?s

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

goal (2 subgoals):
 1. discrete S \<and> compact S \<Longrightarrow> finite S
 2. finite S \<Longrightarrow> discrete S \<and> compact S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
compact S

goal (2 subgoals):
 1. discrete S \<and> compact S \<Longrightarrow> finite S
 2. finite S \<Longrightarrow> discrete S \<and> compact S
[PROOF STEP]
have "discrete S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discrete S
[PROOF STEP]
unfolding discrete_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>S. x isolate S
[PROOF STEP]
using isolate_islimpt_iff islimpt_finite[OF \<open>finite S\<close>]
[PROOF STATE]
proof (prove)
using this:
?x isolate ?S = (\<not> ?x islimpt ?S \<and> ?x \<in> ?S)
\<not> ?x islimpt S

goal (1 subgoal):
 1. \<forall>x\<in>S. x isolate S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
discrete S

goal (2 subgoals):
 1. discrete S \<and> compact S \<Longrightarrow> finite S
 2. finite S \<Longrightarrow> discrete S \<and> compact S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
compact S
discrete S
[PROOF STEP]
show "discrete S \<and> compact S"
[PROOF STATE]
proof (prove)
using this:
compact S
discrete S

goal (1 subgoal):
 1. discrete S \<and> compact S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
discrete S \<and> compact S

goal (1 subgoal):
 1. discrete S \<and> compact S \<Longrightarrow> finite S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. discrete S \<and> compact S \<Longrightarrow> finite S
[PROOF STEP]
assume "discrete S \<and> compact S"
[PROOF STATE]
proof (state)
this:
discrete S \<and> compact S

goal (1 subgoal):
 1. discrete S \<and> compact S \<Longrightarrow> finite S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
discrete S \<and> compact S
[PROOF STEP]
show "finite S"
[PROOF STATE]
proof (prove)
using this:
discrete S \<and> compact S

goal (1 subgoal):
 1. finite S
[PROOF STEP]
by (meson discrete_def Heine_Borel_imp_Bolzano_Weierstrass isolate_islimpt_iff order_refl)
[PROOF STATE]
proof (state)
this:
finite S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inext_nth_surj_on:"surj_on (\<lambda>n. I \<rightarrow> n) UNIV I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj_on (inext_nth I) UNIV I
[PROOF STEP]
apply (simp add: surj_on_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b\<in>I. \<exists>a. b = I \<rightarrow> a
[PROOF STEP]
by (insert inext_nth_surj_aux1[of I], blast)


[STATEMENT]
lemma prv_nprvI: "prv \<phi> \<Longrightarrow> \<phi> \<in> fmla \<Longrightarrow> F \<subseteq> fmla \<Longrightarrow> finite F \<Longrightarrow> nprv F \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prv \<phi>; \<phi> \<in> fmla; F \<subseteq> fmla; finite F\<rbrakk> \<Longrightarrow> nprv F \<phi>
[PROOF STEP]
using prv_nprv0I
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prv ?\<phi>; ?\<phi> \<in> fmla\<rbrakk> \<Longrightarrow> nprv {} ?\<phi>

goal (1 subgoal):
 1. \<lbrakk>prv \<phi>; \<phi> \<in> fmla; F \<subseteq> fmla; finite F\<rbrakk> \<Longrightarrow> nprv F \<phi>
[PROOF STEP]
by (simp add: nprv_def prv_imp_triv)


[STATEMENT]
lemma word_add_le_iff:
  fixes i :: "'a :: len word"
  assumes uik: "unat i + unat k < 2 ^ len_of TYPE ('a)"
  and     ujk: "unat j + unat k < 2 ^ len_of TYPE ('a)"
  shows  "(i + k \<le> j + k) = (i \<le> j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i + k \<le> j + k) = (i \<le> j)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i + k \<le> j + k \<Longrightarrow> i \<le> j
 2. i \<le> j \<Longrightarrow> i + k \<le> j + k
[PROOF STEP]
assume "i \<le> j"
[PROOF STATE]
proof (state)
this:
i \<le> j

goal (2 subgoals):
 1. i + k \<le> j + k \<Longrightarrow> i \<le> j
 2. i \<le> j \<Longrightarrow> i + k \<le> j + k
[PROOF STEP]
show "i + k \<le> j + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + k \<le> j + k
[PROOF STEP]
by (rule word_add_le_mono1) fact+
[PROOF STATE]
proof (state)
this:
i + k \<le> j + k

goal (1 subgoal):
 1. i + k \<le> j + k \<Longrightarrow> i \<le> j
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i + k \<le> j + k \<Longrightarrow> i \<le> j
[PROOF STEP]
assume "i + k \<le> j + k"
[PROOF STATE]
proof (state)
this:
i + k \<le> j + k

goal (1 subgoal):
 1. i + k \<le> j + k \<Longrightarrow> i \<le> j
[PROOF STEP]
show "i \<le> j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j
[PROOF STEP]
by (rule word_add_le_dest) fact+
[PROOF STATE]
proof (state)
this:
i \<le> j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_poly_of_pm [simp]: "poly.coeff (poly_of_pm x p) k = lookup p (Poly_Mapping.single x k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff (poly_of_pm x p) k = lookup p (monomial k x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly.coeff (poly_of_pm x p) k = lookup p (monomial k x)
[PROOF STEP]
have 0:"Poly_Mapping.single x ` {d. lookup p (Poly_Mapping.single x d) \<noteq> 0} \<subseteq> {d. lookup p d \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly_Mapping.single x ` {d. lookup p (monomial d x) \<noteq> (0::'a)} \<subseteq> {d. lookup p d \<noteq> (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Poly_Mapping.single x ` {d. lookup p (monomial d x) \<noteq> (0::'a)} \<subseteq> {d. lookup p d \<noteq> (0::'a)}

goal (1 subgoal):
 1. poly.coeff (poly_of_pm x p) k = lookup p (monomial k x)
[PROOF STEP]
have "\<forall>\<^sub>\<infinity> k. lookup p (Poly_Mapping.single x k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>\<infinity>k. lookup p (monomial k x) = (0::'a)
[PROOF STEP]
unfolding coeff_def eventually_cofinite
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xa. lookup p (monomial xa x) \<noteq> (0::'a)}
[PROOF STEP]
using finite_imageD[OF finite_subset[OF 0 Poly_Mapping.finite_lookup]] inj_single
[PROOF STATE]
proof (prove)
using this:
inj_on (Poly_Mapping.single x) {d. lookup p (monomial d x) \<noteq> (0::'a)} \<Longrightarrow> finite {d. lookup p (monomial d x) \<noteq> (0::'a)}
inj (Poly_Mapping.single ?k)

goal (1 subgoal):
 1. finite {xa. lookup p (monomial xa x) \<noteq> (0::'a)}
[PROOF STEP]
by (metis inj_eq inj_onI)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>\<infinity>k. lookup p (monomial k x) = (0::'a)

goal (1 subgoal):
 1. poly.coeff (poly_of_pm x p) k = lookup p (monomial k x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>\<infinity>k. lookup p (monomial k x) = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>\<infinity>k. lookup p (monomial k x) = (0::'a)

goal (1 subgoal):
 1. poly.coeff (poly_of_pm x p) k = lookup p (monomial k x)
[PROOF STEP]
by (simp add: poly_of_pm_def Abs_poly_inverse)
[PROOF STATE]
proof (state)
this:
poly.coeff (poly_of_pm x p) k = lookup p (monomial k x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fun_chain_at_top_at_top:
  assumes "filterlim (f :: ('a::order) \<Rightarrow> 'a) at_top at_top"
  shows   "filterlim (f ^^ n) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim (f ^^ n) at_top at_top
[PROOF STEP]
by (induction n) (auto intro: filterlim_ident filterlim_compose[OF assms])


[STATEMENT]
lemma (in Ring) ideal_inc_set_mult:"\<lbrakk>A \<subseteq> carrier R; ideal R B; ideal R C;
                           set_mult R A B \<subseteq> C \<rbrakk> \<Longrightarrow> sum_mult R A B \<subseteq> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> carrier R; ideal R B; ideal R C; set_mult R A B \<subseteq> C\<rbrakk> \<Longrightarrow> sum_mult R A B \<subseteq> C
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>A \<subseteq> carrier R; ideal R B; ideal R C; set_mult R A B \<subseteq> C; x \<in> sum_mult R A B\<rbrakk> \<Longrightarrow> x \<in> C
[PROOF STEP]
apply (frule_tac x = x in sum_mult_mem1[of A B],
        simp add:ideal_subset1, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>A \<subseteq> carrier R; ideal R B; ideal R C; set_mult R A B \<subseteq> C; x \<in> sum_mult R A B; \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> set_mult R A B. \<Sigma>\<^sub>e R f n = x\<rbrakk> \<Longrightarrow> x \<in> C
[PROOF STEP]
apply (erule exE, erule bexE, frule sym, thin_tac "\<Sigma>\<^sub>e R f n = x", simp,
        thin_tac "x = \<Sigma>\<^sub>e R f n", simp add:subsetD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n f. \<lbrakk>A \<subseteq> carrier R; ideal R B; ideal R C; set_mult R A B \<subseteq> C; \<Sigma>\<^sub>e R f n \<in> sum_mult R A B; f \<in> {j. j \<le> n} \<rightarrow> set_mult R A B\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f n \<in> C
[PROOF STEP]
apply (simp add:ideal_inc_set_multTr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma almost_diff_const:"valid (Equals (Differential (Const 0)) (Const 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid (Equals (Differential (Const 0)) (Const 0))
[PROOF STEP]
using almost_diff_const_sound valid_of_sound
[PROOF STATE]
proof (prove)
using this:
sound ([], [], [Equals (Differential (Const 0)) (Const 0)])
sound ([], [], [?\<phi>]) \<Longrightarrow> valid ?\<phi>

goal (1 subgoal):
 1. valid (Equals (Differential (Const 0)) (Const 0))
[PROOF STEP]
by auto

\<comment> \<open>Note: this is just unpacking the definition: the axiom is defined as literally this formula\<close>


[STATEMENT]
lemma cong_cong_half_1:
  assumes "M Midpoint A B" and
    "M' Midpoint A' B'" and
    "Cong A B A' B'"
  shows "Cong A M A' M'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cong A M A' M'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Cong A M A' M'
[PROOF STEP]
obtain M'' where P1: "Bet A' M'' B' \<and> A M B Cong3 A' M'' B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>M''. Bet A' M'' B' \<and> A M B Cong3 A' M'' B' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1) assms(3) l4_5 midpoint_bet
[PROOF STATE]
proof (prove)
using this:
M Midpoint A B
Cong A B A' B'
\<lbrakk>Bet ?A ?B ?C; Cong ?A ?C ?A' ?C'\<rbrakk> \<Longrightarrow> \<exists>B'. Bet ?A' B' ?C' \<and> ?A ?B ?C Cong3 ?A' B' ?C'
?B Midpoint ?A ?C \<Longrightarrow> Bet ?A ?B ?C

goal (1 subgoal):
 1. (\<And>M''. Bet A' M'' B' \<and> A M B Cong3 A' M'' B' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Bet A' M'' B' \<and> A M B Cong3 A' M'' B'

goal (1 subgoal):
 1. Cong A M A' M'
[PROOF STEP]
have P2: "M'' Midpoint A' B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M'' Midpoint A' B'
[PROOF STEP]
by (meson Cong3_def P1 assms(1) cong_inner_transitivity midpoint_cong midpoint_def)
[PROOF STATE]
proof (state)
this:
M'' Midpoint A' B'

goal (1 subgoal):
 1. Cong A M A' M'
[PROOF STEP]
have P3: "M' = M''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M' = M''
[PROOF STEP]
using P2 assms(2) l7_17
[PROOF STATE]
proof (prove)
using this:
M'' Midpoint A' B'
M' Midpoint A' B'
\<lbrakk>?A Midpoint ?P ?P'; ?B Midpoint ?P ?P'\<rbrakk> \<Longrightarrow> ?A = ?B

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

goal (1 subgoal):
 1. Cong A M A' M'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M' = M''
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
M' = M''

goal (1 subgoal):
 1. Cong A M A' M'
[PROOF STEP]
using Cong3_def P1
[PROOF STATE]
proof (prove)
using this:
M' = M''
?A ?B ?C Cong3 ?A' ?B' ?C' \<equiv> Cong ?A ?B ?A' ?B' \<and> Cong ?A ?C ?A' ?C' \<and> Cong ?B ?C ?B' ?C'
Bet A' M'' B' \<and> A M B Cong3 A' M'' B'

goal (1 subgoal):
 1. Cong A M A' M'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Cong A M A' M'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_monom: "monom a n + monom b n = monom (a + b) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom a n + monom b n = monom (a + b) n
[PROOF STEP]
by (rule poly_eqI) simp


[STATEMENT]
lemma smod_word_alt_def:
  "(a :: ('a::len) word) smod b = a - (a sdiv b) * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a smod b = a - a sdiv b * b
[PROOF STEP]
by (simp add: minus_sdiv_mult_eq_smod)


[STATEMENT]
lemma card_UNIV_char:
  "card (UNIV :: char set) = 256"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card UNIV = 256
[PROOF STEP]
by (auto simp add: UNIV_char_of_nat card_image)


[STATEMENT]
lemma Rats_closure_real: "closure \<rat> = (UNIV::real set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure \<rat> = UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closure \<rat> = UNIV
[PROOF STEP]
have "\<And>x::real. x \<in> closure \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> closure \<rat>
[PROOF STEP]
by (metis closure_approachable dist_real_def rational_approximation)
[PROOF STATE]
proof (state)
this:
?x \<in> closure \<rat>

goal (1 subgoal):
 1. closure \<rat> = UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> closure \<rat>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> closure \<rat>

goal (1 subgoal):
 1. closure \<rat> = UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closure \<rat> = UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rename_Always: "bij h ==> (rename h F \<in> Always (h`A)) = (F \<in> Always A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> (rename h F \<in> Always (h ` A)) = (F \<in> Always A)
[PROOF STEP]
by (simp add: Always_def rename_Stable bij_is_inj [THEN inj_image_subset_iff])


[STATEMENT]
lemma [code abstract]: "vec_nth (rowvector v) = rowvector_row v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (rowvector v) = rowvector_row v
[PROOF STEP]
unfolding rowvector_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i. vec_lambda (($) v)) = rowvector_row v
[PROOF STEP]
unfolding rowvector_row_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i. vec_lambda (($) v)) = (\<lambda>i. vec_lambda (($) v))
[PROOF STEP]
by auto


[STATEMENT]
lemma quotient_of_inject:
  assumes "quotient_of a = quotient_of b"
  shows "a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = b
[PROOF STEP]
obtain p q r s where a: "a = Fract p q" and b: "b = Fract r s" and "q > 0" and "s > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p q r s. \<lbrakk>a = Fract p q; b = Fract r s; 0 < q; 0 < s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases a, cases b)
[PROOF STATE]
proof (state)
this:
a = Fract p q
b = Fract r s
0 < q
0 < s

goal (1 subgoal):
 1. a = b
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
quotient_of a = quotient_of b
a = Fract p q
b = Fract r s
0 < q
0 < s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
quotient_of a = quotient_of b
a = Fract p q
b = Fract r s
0 < q
0 < s

goal (1 subgoal):
 1. a = b
[PROOF STEP]
by (simp add: eq_rat quotient_of_Fract normalize_crossproduct)
[PROOF STATE]
proof (state)
this:
a = b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_fInf:
  fixes F :: "('a::order \<Rightarrow> 'b::complete_lattice) set"
  shows "\<forall>f \<in> F. mono f \<Longrightarrow> mono (\<Sqinter>F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ball F mono \<Longrightarrow> mono (\<Sqinter> F)
[PROOF STEP]
by (simp add: mono_def, safe, rule Inf_greatest, auto simp: INF_lower2)