[STATEMENT]
lemma isDiagonal_diagonal_to_Smith_i:
  assumes "isDiagonal A"
    and elements_xs_range: "\<forall>x. x \<in> set xs \<longrightarrow> x<min (nrows A) (ncols A)"
    and "i<min (nrows A) (ncols A)"
  shows "isDiagonal (diagonal_to_Smith_i xs A i bezout)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i xs A i bezout)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isDiagonal A
\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A)
i < min (nrows A) (ncols A)

goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i xs A i bezout)
[PROOF STEP]
proof (induct xs A i bezout rule: diagonal_to_Smith_i.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A i bezout. \<lbrakk>isDiagonal A; \<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i [] A i bezout)
 2. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
case (1 A i bezout)
[PROOF STATE]
proof (state)
this:
isDiagonal A
\<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A)
i < min (nrows A) (ncols A)

goal (2 subgoals):
 1. \<And>A i bezout. \<lbrakk>isDiagonal A; \<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i [] A i bezout)
 2. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isDiagonal A
\<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A)
i < min (nrows A) (ncols A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
isDiagonal A
\<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A)
i < min (nrows A) (ncols A)

goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i [] A i bezout)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_to_Smith_i [] A i bezout)

goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
case (2 j xs A i bezout)
[PROOF STATE]
proof (state)
this:
\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout)
\<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; ?x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (?xa, ?y) = ?x; (?xb, ?ya) = ?y; (?xc, ?yb) = ?ya; (?xd, ?yc) = ?yb; ?xe = diagonal_step A i j ?yc ?xd; isDiagonal ?xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows ?xe) (ncols ?xe); i < min (nrows ?xe) (ncols ?xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs ?xe i bezout)
isDiagonal A
\<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A)
i < min (nrows A) (ncols A)

goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
let ?Aii = "A $ from_nat i $ from_nat i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
let ?Ajj = "A $ from_nat j $ from_nat j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
let ?p="case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p,q,u,v,d) \<Rightarrow> p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
let ?q="case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p,q,u,v,d) \<Rightarrow> q"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
let ?u="case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p,q,u,v,d) \<Rightarrow> u"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
let ?v="case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p,q,u,v,d) \<Rightarrow> v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
let ?d="case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p,q,u,v,d) \<Rightarrow> d"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
let ?A'="diagonal_step A i j ?d ?v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
have pquvd: "(?p, ?q, ?u, ?v,?d) = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> p, case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> q, case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> u, case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v, case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j)
[PROOF STEP]
by (simp add: split_beta)
[PROOF STATE]
proof (state)
this:
(case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> p, case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> q, case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> u, case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v, case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j)

goal (1 subgoal):
 1. \<And>j xs A i bezout. \<lbrakk>\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout); \<And>x xa y xb ya xc yb xd yc xe. \<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (xa, y) = x; (xb, ya) = y; (xc, yb) = ya; (xd, yc) = yb; xe = diagonal_step A i j yc xd; isDiagonal xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows xe) (ncols xe); i < min (nrows xe) (ncols xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs xe i bezout); isDiagonal A; \<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
proof (cases "?Aii dvd ?Ajj")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
 2. \<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j

goal (2 subgoals):
 1. A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
 2. \<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j

goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
using "2.hyps" "2.prems"
[PROOF STATE]
proof (prove)
using this:
A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j
\<lbrakk>A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; isDiagonal A; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A); i < min (nrows A) (ncols A)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs A i bezout)
\<lbrakk>\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j; ?x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j); (?xa, ?y) = ?x; (?xb, ?ya) = ?y; (?xc, ?yb) = ?ya; (?xd, ?yc) = ?yb; ?xe = diagonal_step A i j ?yc ?xd; isDiagonal ?xe; \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows ?xe) (ncols ?xe); i < min (nrows ?xe) (ncols ?xe)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_i xs ?xe i bezout)
isDiagonal A
\<forall>x. x \<in> set (j # xs) \<longrightarrow> x < min (nrows A) (ncols A)
i < min (nrows A) (ncols A)

goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)

goal (1 subgoal):
 1. \<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j

goal (1 subgoal):
 1. \<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
have "diagonal_to_Smith_i (j # xs) A i bezout = diagonal_to_Smith_i xs ?A' i bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_to_Smith_i (j # xs) A i bezout = diagonal_to_Smith_i xs (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)) i bezout
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j

goal (1 subgoal):
 1. diagonal_to_Smith_i (j # xs) A i bezout = diagonal_to_Smith_i xs (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)) i bezout
[PROOF STEP]
by (simp add: split_beta)
[PROOF STATE]
proof (state)
this:
diagonal_to_Smith_i (j # xs) A i bezout = diagonal_to_Smith_i xs (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)) i bezout

goal (1 subgoal):
 1. \<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
diagonal_to_Smith_i (j # xs) A i bezout = diagonal_to_Smith_i xs (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)) i bezout

goal (1 subgoal):
 1. \<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
have "isDiagonal ..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i xs (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)) i bezout)
[PROOF STEP]
thm "2.prems"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i xs (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)) i bezout)
[PROOF STEP]
proof (rule "2.hyps"(2)[OF False])
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. ?x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j)
 2. (?xa, ?y) = ?x
 3. (?xb, ?ya) = ?y
 4. (?xc, ?yb) = ?ya
 5. (?xd, ?yc) = ?yb
 6. diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v) = diagonal_step A i j ?yc ?xd
 7. isDiagonal (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v))
 8. \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v))) (ncols (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)))
 9. i < min (nrows (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v))) (ncols (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)))
[PROOF STEP]
show "isDiagonal
        (diagonal_step A i j ?d ?v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v))
[PROOF STEP]
by (rule isDiagonal_diagonal_step, insert "2.prems", auto)
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v))

goal (8 subgoals):
 1. ?x = bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j)
 2. (?xa, ?y) = ?x
 3. (?xb, ?ya) = ?y
 4. (?xc, ?yb) = ?ya
 5. (?xd, ?yc) = ?yb
 6. diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v) = diagonal_step A i j ?yc ?xd
 7. \<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v))) (ncols (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)))
 8. i < min (nrows (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v))) (ncols (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)))
[PROOF STEP]
qed (insert pquvd "2.prems", auto)
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_to_Smith_i xs (diagonal_step A i j (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> d) (case bezout (A $ from_nat i $ from_nat i) (A $ from_nat j $ from_nat j) of (p, q, u, v, d) \<Rightarrow> v)) i bezout)

goal (1 subgoal):
 1. \<not> A $ from_nat i $ from_nat i dvd A $ from_nat j $ from_nat j \<Longrightarrow> isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)

goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_to_Smith_i (j # xs) A i bezout)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_eq_mset_impl: "(subset_eq_mset_impl xs ys = None \<longleftrightarrow> \<not> mset xs \<subseteq># mset ys) \<and>
  (subset_eq_mset_impl xs ys = Some True \<longleftrightarrow> mset xs \<subset># mset ys) \<and>
  (subset_eq_mset_impl xs ys = Some False \<longrightarrow> mset xs = mset ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subset_eq_mset_impl xs ys = None) = (\<not> mset xs \<subseteq># mset ys) \<and> (subset_eq_mset_impl xs ys = Some True) = (mset xs \<subset># mset ys) \<and> (subset_eq_mset_impl xs ys = Some False \<longrightarrow> mset xs = mset ys)
[PROOF STEP]
proof (induct xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. (subset_eq_mset_impl [] ys = None) = (\<not> mset [] \<subseteq># mset ys) \<and> (subset_eq_mset_impl [] ys = Some True) = (mset [] \<subset># mset ys) \<and> (subset_eq_mset_impl [] ys = Some False \<longrightarrow> mset [] = mset ys)
 2. \<And>a xs ys. (\<And>ys. (subset_eq_mset_impl xs ys = None) = (\<not> mset xs \<subseteq># mset ys) \<and> (subset_eq_mset_impl xs ys = Some True) = (mset xs \<subset># mset ys) \<and> (subset_eq_mset_impl xs ys = Some False \<longrightarrow> mset xs = mset ys)) \<Longrightarrow> (subset_eq_mset_impl (a # xs) ys = None) = (\<not> mset (a # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some True) = (mset (a # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some False \<longrightarrow> mset (a # xs) = mset ys)
[PROOF STEP]
case (Nil ys)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>ys. (subset_eq_mset_impl [] ys = None) = (\<not> mset [] \<subseteq># mset ys) \<and> (subset_eq_mset_impl [] ys = Some True) = (mset [] \<subset># mset ys) \<and> (subset_eq_mset_impl [] ys = Some False \<longrightarrow> mset [] = mset ys)
 2. \<And>a xs ys. (\<And>ys. (subset_eq_mset_impl xs ys = None) = (\<not> mset xs \<subseteq># mset ys) \<and> (subset_eq_mset_impl xs ys = Some True) = (mset xs \<subset># mset ys) \<and> (subset_eq_mset_impl xs ys = Some False \<longrightarrow> mset xs = mset ys)) \<Longrightarrow> (subset_eq_mset_impl (a # xs) ys = None) = (\<not> mset (a # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some True) = (mset (a # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some False \<longrightarrow> mset (a # xs) = mset ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subset_eq_mset_impl [] ys = None) = (\<not> mset [] \<subseteq># mset ys) \<and> (subset_eq_mset_impl [] ys = Some True) = (mset [] \<subset># mset ys) \<and> (subset_eq_mset_impl [] ys = Some False \<longrightarrow> mset [] = mset ys)
[PROOF STEP]
by (auto simp: subset_mset.zero_less_iff_neq_zero)
[PROOF STATE]
proof (state)
this:
(subset_eq_mset_impl [] ys = None) = (\<not> mset [] \<subseteq># mset ys) \<and> (subset_eq_mset_impl [] ys = Some True) = (mset [] \<subset># mset ys) \<and> (subset_eq_mset_impl [] ys = Some False \<longrightarrow> mset [] = mset ys)

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (subset_eq_mset_impl xs ys = None) = (\<not> mset xs \<subseteq># mset ys) \<and> (subset_eq_mset_impl xs ys = Some True) = (mset xs \<subset># mset ys) \<and> (subset_eq_mset_impl xs ys = Some False \<longrightarrow> mset xs = mset ys)) \<Longrightarrow> (subset_eq_mset_impl (a # xs) ys = None) = (\<not> mset (a # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some True) = (mset (a # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some False \<longrightarrow> mset (a # xs) = mset ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (subset_eq_mset_impl xs ys = None) = (\<not> mset xs \<subseteq># mset ys) \<and> (subset_eq_mset_impl xs ys = Some True) = (mset xs \<subset># mset ys) \<and> (subset_eq_mset_impl xs ys = Some False \<longrightarrow> mset xs = mset ys)) \<Longrightarrow> (subset_eq_mset_impl (a # xs) ys = None) = (\<not> mset (a # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some True) = (mset (a # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some False \<longrightarrow> mset (a # xs) = mset ys)
[PROOF STEP]
case (Cons x xs ys)
[PROOF STATE]
proof (state)
this:
(subset_eq_mset_impl xs ?ys = None) = (\<not> mset xs \<subseteq># mset ?ys) \<and> (subset_eq_mset_impl xs ?ys = Some True) = (mset xs \<subset># mset ?ys) \<and> (subset_eq_mset_impl xs ?ys = Some False \<longrightarrow> mset xs = mset ?ys)

goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. (subset_eq_mset_impl xs ys = None) = (\<not> mset xs \<subseteq># mset ys) \<and> (subset_eq_mset_impl xs ys = Some True) = (mset xs \<subset># mset ys) \<and> (subset_eq_mset_impl xs ys = Some False \<longrightarrow> mset xs = mset ys)) \<Longrightarrow> (subset_eq_mset_impl (a # xs) ys = None) = (\<not> mset (a # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some True) = (mset (a # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (a # xs) ys = Some False \<longrightarrow> mset (a # xs) = mset ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
proof (cases "List.extract ((=) x) ys")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
case None
[PROOF STATE]
proof (state)
this:
List.extract ((=) x) ys = None

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
hence x: "x \<notin> set ys"
[PROOF STATE]
proof (prove)
using this:
List.extract ((=) x) ys = None

goal (1 subgoal):
 1. x \<notin> set ys
[PROOF STEP]
by (simp add: extract_None_iff)
[PROOF STATE]
proof (state)
this:
x \<notin> set ys

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x \<notin> set ys

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
assume "mset (x # xs) \<subseteq># mset ys"
[PROOF STATE]
proof (state)
this:
mset (x # xs) \<subseteq># mset ys

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
from set_mset_mono[OF this] x
[PROOF STATE]
proof (chain)
picking this:
set_mset (mset (x # xs)) \<subseteq> set_mset (mset ys)
x \<notin> set ys
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
set_mset (mset (x # xs)) \<subseteq> set_mset (mset ys)
x \<notin> set ys

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

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
mset (x # xs) \<subseteq># mset ys \<Longrightarrow> False

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
note nle = this
[PROOF STATE]
proof (state)
this:
mset (x # xs) \<subseteq># mset ys \<Longrightarrow> False

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mset (x # xs) \<subseteq># mset ys \<Longrightarrow> False

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
mset (x # xs) \<subseteq># mset ys \<Longrightarrow> False

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
assume "mset (x # xs) \<subset># mset ys"
[PROOF STATE]
proof (state)
this:
mset (x # xs) \<subset># mset ys

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
hence "mset (x # xs) \<subseteq># mset ys"
[PROOF STATE]
proof (prove)
using this:
mset (x # xs) \<subset># mset ys

goal (1 subgoal):
 1. mset (x # xs) \<subseteq># mset ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mset (x # xs) \<subseteq># mset ys

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
from nle[OF this]
[PROOF STATE]
proof (chain)
picking this:
False
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
False

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

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
mset (x # xs) \<subset># mset ys \<Longrightarrow> False

goal (2 subgoals):
 1. List.extract ((=) x) ys = None \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
 2. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mset (x # xs) \<subseteq># mset ys \<Longrightarrow> False
mset (x # xs) \<subset># mset ys \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mset (x # xs) \<subseteq># mset ys \<Longrightarrow> False
mset (x # xs) \<subset># mset ys \<Longrightarrow> False

goal (1 subgoal):
 1. (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
using None
[PROOF STATE]
proof (prove)
using this:
mset (x # xs) \<subseteq># mset ys \<Longrightarrow> False
mset (x # xs) \<subset># mset ys \<Longrightarrow> False
List.extract ((=) x) ys = None

goal (1 subgoal):
 1. (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)

goal (1 subgoal):
 1. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
case (Some res)
[PROOF STATE]
proof (state)
this:
List.extract ((=) x) ys = Some res

goal (1 subgoal):
 1. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
obtain ys1 y ys2 where res: "res = (ys1,y,ys2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>ys1 y ys2. res = (ys1, y, ys2) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases res, auto)
[PROOF STATE]
proof (state)
this:
res = (ys1, y, ys2)

goal (1 subgoal):
 1. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
note Some = Some[unfolded res]
[PROOF STATE]
proof (state)
this:
List.extract ((=) x) ys = Some (ys1, y, ys2)

goal (1 subgoal):
 1. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
from extract_SomeE[OF Some]
[PROOF STATE]
proof (chain)
picking this:
ys = ys1 @ y # ys2 \<and> x = y \<and> \<not> (\<exists>y\<in>set ys1. x = y)
[PROOF STEP]
have "ys = ys1 @ x # ys2"
[PROOF STATE]
proof (prove)
using this:
ys = ys1 @ y # ys2 \<and> x = y \<and> \<not> (\<exists>y\<in>set ys1. x = y)

goal (1 subgoal):
 1. ys = ys1 @ x # ys2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ys = ys1 @ x # ys2

goal (1 subgoal):
 1. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
hence id: "mset ys = add_mset x (mset (ys1 @ ys2))"
[PROOF STATE]
proof (prove)
using this:
ys = ys1 @ x # ys2

goal (1 subgoal):
 1. mset ys = add_mset x (mset (ys1 @ ys2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mset ys = add_mset x (mset (ys1 @ ys2))

goal (1 subgoal):
 1. \<And>a. List.extract ((=) x) ys = Some a \<Longrightarrow> (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
unfolding subset_eq_mset_impl.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((case List.extract ((=) x) ys of None \<Rightarrow> None | Some (ys1, x, ys2) \<Rightarrow> subset_eq_mset_impl xs (ys1 @ ys2)) = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> ((case List.extract ((=) x) ys of None \<Rightarrow> None | Some (ys1, x, ys2) \<Rightarrow> subset_eq_mset_impl xs (ys1 @ ys2)) = Some True) = (mset (x # xs) \<subset># mset ys) \<and> ((case List.extract ((=) x) ys of None \<Rightarrow> None | Some (ys1, x, ys2) \<Rightarrow> subset_eq_mset_impl xs (ys1 @ ys2)) = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
unfolding Some option.simps split
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subset_eq_mset_impl xs (ys1 @ ys2) = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some False \<longrightarrow> mset (x # xs) = mset ys)
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (subset_eq_mset_impl xs (ys1 @ ys2) = None) = (\<not> mset (x # xs) \<subseteq># add_mset x (mset (ys1 @ ys2))) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some True) = (mset (x # xs) \<subset># add_mset x (mset (ys1 @ ys2))) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some False \<longrightarrow> mset (x # xs) = add_mset x (mset (ys1 @ ys2)))
[PROOF STEP]
using Cons[of "ys1 @ ys2"]
[PROOF STATE]
proof (prove)
using this:
(subset_eq_mset_impl xs (ys1 @ ys2) = None) = (\<not> mset xs \<subseteq># mset (ys1 @ ys2)) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some True) = (mset xs \<subset># mset (ys1 @ ys2)) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some False \<longrightarrow> mset xs = mset (ys1 @ ys2))

goal (1 subgoal):
 1. (subset_eq_mset_impl xs (ys1 @ ys2) = None) = (\<not> mset (x # xs) \<subseteq># add_mset x (mset (ys1 @ ys2))) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some True) = (mset (x # xs) \<subset># add_mset x (mset (ys1 @ ys2))) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some False \<longrightarrow> mset (x # xs) = add_mset x (mset (ys1 @ ys2)))
[PROOF STEP]
unfolding subset_mset_def subseteq_mset_def
[PROOF STATE]
proof (prove)
using this:
(subset_eq_mset_impl xs (ys1 @ ys2) = None) = (\<not> (\<forall>a. count (mset xs) a \<le> count (mset (ys1 @ ys2)) a)) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some True) = ((\<forall>a. count (mset xs) a \<le> count (mset (ys1 @ ys2)) a) \<and> mset xs \<noteq> mset (ys1 @ ys2)) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some False \<longrightarrow> mset xs = mset (ys1 @ ys2))

goal (1 subgoal):
 1. (subset_eq_mset_impl xs (ys1 @ ys2) = None) = (\<not> (\<forall>a. count (mset (x # xs)) a \<le> count (add_mset x (mset (ys1 @ ys2))) a)) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some True) = ((\<forall>a. count (mset (x # xs)) a \<le> count (add_mset x (mset (ys1 @ ys2))) a) \<and> mset (x # xs) \<noteq> add_mset x (mset (ys1 @ ys2))) \<and> (subset_eq_mset_impl xs (ys1 @ ys2) = Some False \<longrightarrow> mset (x # xs) = add_mset x (mset (ys1 @ ys2)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(subset_eq_mset_impl (x # xs) ys = None) = (\<not> mset (x # xs) \<subseteq># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some True) = (mset (x # xs) \<subset># mset ys) \<and> (subset_eq_mset_impl (x # xs) ys = Some False \<longrightarrow> mset (x # xs) = mset ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ODnum_segmentTr1:"\<lbrakk>Worder D; x = ordinal_number D; y \<in> ODnums; y \<sqsubset> x\<rbrakk>
        \<Longrightarrow> \<exists>c. c \<in> carrier D \<and> (y = ordinal_number (Iod D (segment D c)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Worder D; x = ordinal_number D; y \<in> ODnums; y \<sqsubset> x\<rbrakk> \<Longrightarrow> \<exists>c. c \<in> carrier D \<and> y = ordinal_number (Iod D (segment D c))
[PROOF STEP]
apply (frule ODnum_segmentTr[of D x y], assumption+, erule exE, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c. \<lbrakk>Worder D; x = ordinal_number D; y \<in> ODnums; y \<sqsubset> x; c \<in> carrier D; \<forall>Y\<in>y. ord_equiv Y (Iod D (segment D c))\<rbrakk> \<Longrightarrow> \<exists>c. c \<in> carrier D \<and> y = ordinal_number (Iod D (segment D c))
[PROOF STEP]
apply (frule mem_ODnums_nonempty[of y], erule exE,
       frule_tac x = xa in bspec, assumption,
       thin_tac "\<forall>Y\<in>y. ord_equiv Y (Iod D (segment D c))")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c xa. \<lbrakk>Worder D; x = ordinal_number D; y \<in> ODnums; y \<sqsubset> x; c \<in> carrier D; xa \<in> y; ord_equiv xa (Iod D (segment D c))\<rbrakk> \<Longrightarrow> \<exists>c. c \<in> carrier D \<and> y = ordinal_number (Iod D (segment D c))
[PROOF STEP]
(** going to apply ordinal_number_eq **)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c xa. \<lbrakk>Worder D; x = ordinal_number D; y \<in> ODnums; y \<sqsubset> x; c \<in> carrier D; xa \<in> y; ord_equiv xa (Iod D (segment D c))\<rbrakk> \<Longrightarrow> \<exists>c. c \<in> carrier D \<and> y = ordinal_number (Iod D (segment D c))
[PROOF STEP]
apply (frule_tac D = xa in ordinal_numberTr5[of y], assumption, simp,
        frule_tac a = c in Worder.segment_Worder[of D],
        rotate_tac -2, frule sym, thin_tac "y = ordinal_number xa", simp,
        frule_tac X = xa in mem_ordinal_number_Worder1[of y], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c xa. \<lbrakk>Worder (Iod D (segment D c)); Worder D; x = ordinal_number D; y \<in> ODnums; y \<sqsubset> ordinal_number D; c \<in> carrier D; xa \<in> y; ord_equiv xa (Iod D (segment D c)); ordinal_number xa = y; Worder xa\<rbrakk> \<Longrightarrow> \<exists>c. c \<in> carrier D \<and> y = ordinal_number (Iod D (segment D c))
[PROOF STEP]
apply (simp add:ordinal_number_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c xa. \<lbrakk>Worder (Iod D (segment D c)); Worder D; x = ordinal_number D; ordinal_number (Iod D (segment D c)) \<in> ODnums; ordinal_number (Iod D (segment D c)) \<sqsubset> ordinal_number D; c \<in> carrier D; xa \<in> ordinal_number (Iod D (segment D c)); y = ordinal_number (Iod D (segment D c)); ordinal_number xa = ordinal_number (Iod D (segment D c)); Worder xa\<rbrakk> \<Longrightarrow> \<exists>ca. ca \<in> carrier D \<and> ordinal_number (Iod D (segment D c)) = ordinal_number (Iod D (segment D ca))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem pax1 [simp_unl]: "|~ (\<circle>\<not>F) = (\<not>\<circle>F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |~ \<circle>\<not> F = \<not> \<circle>F
[PROOF STEP]
by (auto simp: nexts_def)


[STATEMENT]
lemma cf_bcomp_Hom_ArrMap_vdomain[cat_cs_simps]:
  assumes "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>" and "\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  shows "\<D>\<^sub>\<circ> (Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,\<GG>-)\<lparr>ArrMap\<rparr>) = (op_cat \<AA> \<times>\<^sub>C \<BB>)\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,\<GG>-)\<lparr>ArrMap\<rparr>) = (op_cat \<AA> \<times>\<^sub>C \<BB>)\<lparr>Arr\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,\<GG>-)\<lparr>ArrMap\<rparr>) = (op_cat \<AA> \<times>\<^sub>C \<BB>)\<lparr>Arr\<rparr>
[PROOF STEP]
unfolding cf_bcomp_Hom_def
[PROOF STATE]
proof (prove)
using this:
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_cn_cov_bcomp Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-) \<FF> \<GG>\<lparr>ArrMap\<rparr>) = (op_cat \<AA> \<times>\<^sub>C \<BB>)\<lparr>Arr\<rparr>
[PROOF STEP]
by (rule cf_cn_cov_bcomp_ArrMap_vdomain)


[STATEMENT]
lemma sum_mset_add_diff: "(\<Sum> x \<in># A. f x - g x) = (\<Sum> x \<in># A . f x) -  (\<Sum> x \<in># A . g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>#A. f x - g x) = \<Sum>\<^sub># (image_mset f A) - \<Sum>\<^sub># (image_mset g A)
[PROOF STEP]
by (induction A) (auto simp add: algebra_simps)


[STATEMENT]
lemma lt_\<omega>_imp_times_minus_left: "m < \<omega> \<Longrightarrow> n < \<omega> \<Longrightarrow> (m - n) * l = m * l - n * l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m < \<omega>; n < \<omega>\<rbrakk> \<Longrightarrow> (m - n) * l = m * l - n * l
[PROOF STEP]
by (metis lt_\<omega>_imp_ex_of_nat times_of_nat_minus_left)


[STATEMENT]
lemma cos_c_: "cos (\<angle>c z1 z2) = cos (\<angle> z1 z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (\<angle>c z1 z2) = cos (\<angle> z1 z2)
[PROOF STEP]
unfolding ang_vec_c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos \<bar>\<angle> z1 z2\<bar> = cos (\<angle> z1 z2)
[PROOF STEP]
by (smt cos_minus)


[STATEMENT]
lemma trg_simps [simp]:
    assumes "arr F"
    shows "Dom (trg F) = E.Trg (Dom F)" and "Cod (trg F) = E.Trg (Dom F)"
    and "Map (trg F) = \<lbrace>E.Trg (Dom F)\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dom (trg F) = E.Trg (Dom F) &&& Cod (trg F) = E.Trg (Dom F) &&& Map (trg F) = EVAL (E.Trg (Dom F))
[PROOF STEP]
using assms trg_def arr_char
[PROOF STATE]
proof (prove)
using this:
arr F
trg ?F \<equiv> if arr ?F then MkIde (E.Trg (Dom ?F)) else null
arr ?F = (E.Nml (Dom ?F) \<and> E.Ide (Dom ?F) \<and> E.Nml (Cod ?F) \<and> E.Ide (Cod ?F) \<and> E.Src (Dom ?F) = E.Src (Cod ?F) \<and> E.Trg (Dom ?F) = E.Trg (Cod ?F) \<and> \<guillemotleft>Map ?F : EVAL (Dom ?F) \<rightarrow>\<^sub>B EVAL (Cod ?F)\<guillemotright> \<and> ?F \<noteq> Null)

goal (1 subgoal):
 1. Dom (trg F) = E.Trg (Dom F) &&& Cod (trg F) = E.Trg (Dom F) &&& Map (trg F) = EVAL (E.Trg (Dom F))
[PROOF STEP]
by auto


[STATEMENT]
lemma interior_rel_interior_gen:
  fixes S :: "'n::euclidean_space set"
  shows "interior S = (if aff_dim S = int(DIM('n)) then rel_interior S else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior S = (if aff_dim S = int DIM('n) then rel_interior S else {})
[PROOF STEP]
by (metis interior_rel_interior low_dim_interior)


[STATEMENT]
lemma (in encoding) indRelST_to_TRel:
  fixes SRel  :: "('procS \<times> 'procS) set"
    and TRel  :: "('procT \<times> 'procT) set"
    and TP TQ :: "'procT"
  assumes rel: "TargetTerm TP \<R>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> TargetTerm TQ"
  shows "(TP, TQ) \<in> TRel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (TP, TQ) \<in> TRel
[PROOF STEP]
using rel
[PROOF STATE]
proof (prove)
using this:
TargetTerm TP \<R>\<lbrakk>\<cdot>\<rbrakk><SRel,TRel> TargetTerm TQ

goal (1 subgoal):
 1. (TP, TQ) \<in> TRel
[PROOF STEP]
by (simp add: indRelST.simps)


[STATEMENT]
lemma topological_tendstoI:
  "(\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F) \<Longrightarrow> (f \<longlongrightarrow> l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S. \<lbrakk>open S; l \<in> S\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<in> S) \<Longrightarrow> (f \<longlongrightarrow> l) F
[PROOF STEP]
by (auto simp: tendsto_def)


[STATEMENT]
lemma valof_zero[simp]: "valof 0 = 0" "valof minus_zero = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valof 0 = 0 &&& valof (- 0) = 0
[PROOF STEP]
by (auto simp add: zerosign_def valof_eq zero_simps)


[STATEMENT]
lemma mset_le_not_sym: "M < N \<Longrightarrow> \<not> N < (M::'a::preorder multiset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M < N \<Longrightarrow> \<not> N < M
[PROOF STEP]
by (fact less_not_sym)


[STATEMENT]
lemma imirror_eq_imirror_bounds: "
  imirror I = imirror_bounds I (iMin I) (Max I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. imirror I = imirror_bounds I (iMin I) (Max I)
[PROOF STEP]
unfolding imirror_def imirror_bounds_def nat_mirror_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (-) (iMin I + Max I) ` I = (-) (iMin I + Max I) ` I
[PROOF STEP]
by simp


[STATEMENT]
lemma fls_integral_mult_const_left:
  "fls_integral (fls_const c * f) = fls_const c * fls_integral (f :: 'a::division_ring fls)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_integral (fls_const c * f) = fls_const c * fls_integral f
[PROOF STEP]
by (intro fls_eqI) (simp add: mult.assoc mult_inverse_of_int_commute)


[STATEMENT]
lemma fv_subterms_set_subst: "fv\<^sub>s\<^sub>e\<^sub>t (subterms\<^sub>s\<^sub>e\<^sub>t M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>) = fv\<^sub>s\<^sub>e\<^sub>t (subterms\<^sub>s\<^sub>e\<^sub>t (M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv\<^sub>s\<^sub>e\<^sub>t (subterms\<^sub>s\<^sub>e\<^sub>t M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>) = fv\<^sub>s\<^sub>e\<^sub>t (subterms\<^sub>s\<^sub>e\<^sub>t (M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>))
[PROOF STEP]
using fv_subterms_subst_eq[of _ \<theta>]
[PROOF STATE]
proof (prove)
using this:
fv\<^sub>s\<^sub>e\<^sub>t (subterms (?t \<cdot> \<theta>)) = fv\<^sub>s\<^sub>e\<^sub>t (subterms ?t \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>)

goal (1 subgoal):
 1. fv\<^sub>s\<^sub>e\<^sub>t (subterms\<^sub>s\<^sub>e\<^sub>t M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>) = fv\<^sub>s\<^sub>e\<^sub>t (subterms\<^sub>s\<^sub>e\<^sub>t (M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>))
[PROOF STEP]
by auto


[STATEMENT]
lemma injectionPowerset:
  assumes "inj_on f Y" "X \<subseteq> Y"
  shows "inj_on (image f) (Pow X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((`) f) (Pow X)
[PROOF STEP]
using assms lm025
[PROOF STATE]
proof (prove)
using this:
inj_on f Y
X \<subseteq> Y
inj_on ?f ?X \<Longrightarrow> inj_on ((`) ?f) (Pow ?X)

goal (1 subgoal):
 1. inj_on ((`) f) (Pow X)
[PROOF STEP]
by (metis subset_inj_on)


[STATEMENT]
lemma poly_mapping_sum_monomials: "(\<Sum>a\<in>keys p. monomial (lookup p a) a) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p
[PROOF STEP]
proof (induct p rule: poly_mapping_plus_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>a\<in>keys 0. monomial (lookup 0 a) a) = 0
 2. \<And>p c t. \<lbrakk>c \<noteq> (0::'b); t \<notin> keys p; (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<Sum>a\<in>keys 0. monomial (lookup 0 a) a) = 0
 2. \<And>p c t. \<lbrakk>c \<noteq> (0::'b); t \<notin> keys p; (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>keys 0. monomial (lookup 0 a) a) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>keys 0. monomial (lookup 0 a) a) = 0

goal (1 subgoal):
 1. \<And>p c t. \<lbrakk>c \<noteq> (0::'b); t \<notin> keys p; (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p c t. \<lbrakk>c \<noteq> (0::'b); t \<notin> keys p; (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
case step: (2 p c t)
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'b)
t \<notin> keys p
(\<Sum>a\<in>keys p. monomial (lookup p a) a) = p

goal (1 subgoal):
 1. \<And>p c t. \<lbrakk>c \<noteq> (0::'b); t \<notin> keys p; (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
from step(2)
[PROOF STATE]
proof (chain)
picking this:
t \<notin> keys p
[PROOF STEP]
have "lookup p t = 0"
[PROOF STATE]
proof (prove)
using this:
t \<notin> keys p

goal (1 subgoal):
 1. lookup p t = (0::'b)
[PROOF STEP]
by (simp add: in_keys_iff)
[PROOF STATE]
proof (state)
this:
lookup p t = (0::'b)

goal (1 subgoal):
 1. \<And>p c t. \<lbrakk>c \<noteq> (0::'b); t \<notin> keys p; (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
have *: "keys (monomial c t + p) = insert t (keys p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (monomial c t + p) = insert t (keys p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. keys (monomial c t + p) = insert t (keys p)
[PROOF STEP]
from step(1)
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'b)
[PROOF STEP]
have a: "keys (monomial c t) = {t}"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b)

goal (1 subgoal):
 1. keys (monomial c t) = {t}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
keys (monomial c t) = {t}

goal (1 subgoal):
 1. keys (monomial c t + p) = insert t (keys p)
[PROOF STEP]
with step(2)
[PROOF STATE]
proof (chain)
picking this:
t \<notin> keys p
keys (monomial c t) = {t}
[PROOF STEP]
have "keys (monomial c t) \<inter> keys p = {}"
[PROOF STATE]
proof (prove)
using this:
t \<notin> keys p
keys (monomial c t) = {t}

goal (1 subgoal):
 1. keys (monomial c t) \<inter> keys p = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
keys (monomial c t) \<inter> keys p = {}

goal (1 subgoal):
 1. keys (monomial c t + p) = insert t (keys p)
[PROOF STEP]
hence "keys (monomial c t + p) = {t} \<union> keys p"
[PROOF STATE]
proof (prove)
using this:
keys (monomial c t) \<inter> keys p = {}

goal (1 subgoal):
 1. keys (monomial c t + p) = {t} \<union> keys p
[PROOF STEP]
by (simp only: a keys_plus_eqI)
[PROOF STATE]
proof (state)
this:
keys (monomial c t + p) = {t} \<union> keys p

goal (1 subgoal):
 1. keys (monomial c t + p) = insert t (keys p)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
keys (monomial c t + p) = {t} \<union> keys p

goal (1 subgoal):
 1. keys (monomial c t + p) = insert t (keys p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
keys (monomial c t + p) = insert t (keys p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
keys (monomial c t + p) = insert t (keys p)

goal (1 subgoal):
 1. \<And>p c t. \<lbrakk>c \<noteq> (0::'b); t \<notin> keys p; (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
have **: "(\<Sum>ta\<in>keys p. monomial ((c when t = ta) + lookup p ta) ta) = (\<Sum>ta\<in>keys p. monomial (lookup p ta) ta)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ta\<in>keys p. monomial ((c when t = ta) + lookup p ta) ta) = (\<Sum>ta\<in>keys p. monomial (lookup p ta) ta)
[PROOF STEP]
proof (rule comm_monoid_add_class.sum.cong, rule refl)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> keys p \<Longrightarrow> monomial ((c when t = x) + lookup p x) x = monomial (lookup p x) x
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> keys p \<Longrightarrow> monomial ((c when t = x) + lookup p x) x = monomial (lookup p x) x
[PROOF STEP]
assume "s \<in> keys p"
[PROOF STATE]
proof (state)
this:
s \<in> keys p

goal (1 subgoal):
 1. \<And>x. x \<in> keys p \<Longrightarrow> monomial ((c when t = x) + lookup p x) x = monomial (lookup p x) x
[PROOF STEP]
with step(2)
[PROOF STATE]
proof (chain)
picking this:
t \<notin> keys p
s \<in> keys p
[PROOF STEP]
have "t \<noteq> s"
[PROOF STATE]
proof (prove)
using this:
t \<notin> keys p
s \<in> keys p

goal (1 subgoal):
 1. t \<noteq> s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<noteq> s

goal (1 subgoal):
 1. \<And>x. x \<in> keys p \<Longrightarrow> monomial ((c when t = x) + lookup p x) x = monomial (lookup p x) x
[PROOF STEP]
thus "monomial ((c when t = s) + lookup p s) s = monomial (lookup p s) s"
[PROOF STATE]
proof (prove)
using this:
t \<noteq> s

goal (1 subgoal):
 1. monomial ((c when t = s) + lookup p s) s = monomial (lookup p s) s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
monomial ((c when t = s) + lookup p s) s = monomial (lookup p s) s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>ta\<in>keys p. monomial ((c when t = ta) + lookup p ta) ta) = (\<Sum>ta\<in>keys p. monomial (lookup p ta) ta)

goal (1 subgoal):
 1. \<And>p c t. \<lbrakk>c \<noteq> (0::'b); t \<notin> keys p; (\<Sum>a\<in>keys p. monomial (lookup p a) a) = p\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p
[PROOF STEP]
by (simp only: * comm_monoid_add_class.sum.insert[OF finite_keys step(2)],
                   simp add: lookup_add lookup_single \<open>lookup p t = 0\<close> ** step(3))
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>keys (monomial c t + p). monomial (lookup (monomial c t + p) a) a) = monomial c t + p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult: "f1 \<in> L F (g1) \<Longrightarrow> f2 \<in> L F (g2) \<Longrightarrow> (\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. g1 x * g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f1 \<in> L F g1; f2 \<in> L F g2\<rbrakk> \<Longrightarrow> (\<lambda>x. f1 x * f2 x) \<in> L F (\<lambda>x. g1 x * g2 x)
[PROOF STEP]
by (rule trans, erule mult_left, erule mult_right)


[STATEMENT]
lemma shiftr_mul_not_mask_eq_and_not_mask:
  "(x >> n) * NOT(mask n) = - (x AND NOT(mask n))"
  for x :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x >> n) * NOT (mask n) = - (x AND NOT (mask n))
[PROOF STEP]
by (metis NOT_mask and_not_mask mult_minus_left semiring_normalization_rules(7) shiftl_t2n)


[STATEMENT]
lemma MatchOr_MatchNot: "matches \<gamma> (MatchNot (MatchOr m1 m2)) a p \<longleftrightarrow> matches \<gamma> (MatchNot m1) a p \<and> matches \<gamma> (MatchNot m2) a p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matches \<gamma> (MatchNot (MatchOr m1 m2)) a p = (matches \<gamma> (MatchNot m1) a p \<and> matches \<gamma> (MatchNot m2) a p)
[PROOF STEP]
by(simp add: MatchOr_def matches_DeMorgan bunch_of_lemmata_about_matches)


[STATEMENT]
lemma card1_tr1:"(constmap {0::nat} {x}) \<in> {0} \<rightarrow> {x} \<and>
                       surj_to (constmap {0::nat} {x}) {0} {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. constmap {0} {x} \<in> {0} \<rightarrow> {x} \<and> surj_to (constmap {0} {x}) {0} {x}
[PROOF STEP]
apply (rule conjI, simp add:constmap_def Pi_def,
       simp add:surj_to_def image_def constmap_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cf_array_ArrMap_vdomain[cat_cs_simps]:
  "\<D>\<^sub>\<circ> (cf_array \<BB> \<CC> \<DD> \<FF> \<GG>\<lparr>ArrMap\<rparr>) = (\<BB> \<times>\<^sub>C \<CC>)\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_array \<BB> \<CC> \<DD> \<FF> \<GG>\<lparr>ArrMap\<rparr>) = (\<BB> \<times>\<^sub>C \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
unfolding cf_array_components
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<lambda>f\<in>\<^sub>\<circ>(\<BB> \<times>\<^sub>C \<CC>)\<lparr>Arr\<rparr>. \<GG> (\<BB>\<lparr>Cod\<rparr>\<lparr>f\<lparr>[]\<^sub>\<circ>\<rparr>\<rparr>)\<lparr>ArrMap\<rparr>\<lparr>f\<lparr>1\<^sub>\<nat>\<rparr>\<rparr> \<circ>\<^sub>A\<^bsub>\<DD>\<^esub> \<FF> (\<CC>\<lparr>Dom\<rparr>\<lparr>f\<lparr>1\<^sub>\<nat>\<rparr>\<rparr>)\<lparr>ArrMap\<rparr>\<lparr>f\<lparr>[]\<^sub>\<circ>\<rparr>\<rparr>) = (\<BB> \<times>\<^sub>C \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
by simp


[STATEMENT]
lemma to_fun_unit_eq':
  assumes "f \<in> carrier (SA n)"
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "f x = \<zero>"
  shows "to_fun_unit n f x = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun_unit n f x = \<one>
[PROOF STEP]
unfolding to_fun_unit_def fun_glue_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). if x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<noteq> \<zero>} then f x else \<one>\<^bsub>SA n\<^esub> x) x = \<one>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (SA n)
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
f x = \<zero>

goal (1 subgoal):
 1. (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). if x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<noteq> \<zero>} then f x else \<one>\<^bsub>SA n\<^esub> x) x = \<one>
[PROOF STEP]
by (simp add: SA_oneE)


[STATEMENT]
lemma (in Corps) n_val_n_pow:"\<lbrakk>valuation K v; x \<in> carrier (Vr K v); 0 \<le> n\<rbrakk> \<Longrightarrow>
         (n \<le> (n_val K v x)) = (x \<in> (vp K v) \<^bsup>(Vr K v)  n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; x \<in> carrier (Vr K v); 0 \<le> n\<rbrakk> \<Longrightarrow> (n \<le> n_val K v x) = (x \<in> vp K v\<^bsup> Vr K v n\<^esup>)
[PROOF STEP]
by (rule iffI, simp add:n_value_x_2, simp add:n_value_x_1)


[STATEMENT]
lemma galois_1: "x \<cdot> -y \<le> z \<longleftrightarrow> x \<le> y + z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot> - y \<le> z) = (x \<le> y + z)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<cdot> - y \<le> z \<Longrightarrow> x \<le> y + z
 2. x \<le> y + z \<Longrightarrow> x \<cdot> - y \<le> z
[PROOF STEP]
apply (metis inf_le2 join_iso le_iff_sup le_supE join_isol aux4)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y + z \<Longrightarrow> x \<cdot> - y \<le> z
[PROOF STEP]
apply (metis meet_iso aux6 le_infE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done