[STATEMENT]
lemma powreal_mult1:
      "\<lbrakk> 1 \<le> a; 0 \<le> x \<rbrakk> \<Longrightarrow> (a pow\<^sub>\<real> x) pow\<^sub>\<real> y = a pow\<^sub>\<real> (x * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 \<le> a; 0 \<le> x\<rbrakk> \<Longrightarrow> (a pow\<^sub>\<real> x) pow\<^sub>\<real> y = a pow\<^sub>\<real> (x * y)
[PROOF STEP]
by (metis powa_mult powreal_eq_powa powreal_ge_one)


[STATEMENT]
lemma (in Ring) principal_ideal_n_pow:"\<lbrakk>a \<in> carrier R; I = Rxa R a\<rbrakk> \<Longrightarrow>
                                  I \<^bsup>\<diamondsuit>R n\<^esup>  = Rxa R (a^\<^bsup>R n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; I = R \<diamondsuit>\<^sub>p a\<rbrakk> \<Longrightarrow> I \<^bsup>\<diamondsuit>R n\<^esup> = R \<diamondsuit>\<^sub>p (a^\<^bsup>R n\<^esup>)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; I = R \<diamondsuit>\<^sub>p a\<rbrakk> \<Longrightarrow> R \<diamondsuit>\<^sub>p a \<^bsup>\<diamondsuit>R n\<^esup> = R \<diamondsuit>\<^sub>p (a^\<^bsup>R n\<^esup>)
[PROOF STEP]
apply (rule principal_ideal_n_pow1[of "a" "n"], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_nat_prod_mset: "of_nat (prod_mset A) = prod_mset (image_mset of_nat A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (\<Prod>\<^sub># A) = \<Prod>\<^sub># (image_mset of_nat A)
[PROOF STEP]
by (induction A) auto


[STATEMENT]
lemma mult_col_div_row_carrier[simp]:
  "dim_row (mult_col_div_row a k A) = dim_row A"
  "dim_col (mult_col_div_row a k A) = dim_col A"
  "A \<in> carrier_mat n n \<Longrightarrow> mult_col_div_row a k A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mult_col_div_row a k A) = dim_row A &&& dim_col (mult_col_div_row a k A) = dim_col A &&& (A \<in> carrier_mat n n \<Longrightarrow> mult_col_div_row a k A \<in> carrier_mat n n)
[PROOF STEP]
unfolding mult_col_div_row_def carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (multrow k (inverse a) (multcol k a A)) = dim_row A &&& dim_col (multrow k (inverse a) (multcol k a A)) = dim_col A &&& (A \<in> {m. dim_row m = n \<and> dim_col m = n} \<Longrightarrow> multrow k (inverse a) (multcol k a A) \<in> {m. dim_row m = n \<and> dim_col m = n})
[PROOF STEP]
by auto


[STATEMENT]
lemma mat_of_cblinfun_classical_operator:
  fixes f::"'a::enum \<Rightarrow> 'b::enum option"
  shows "mat_of_cblinfun (classical_operator f) = mat (CARD('b)) (CARD('a))
           (\<lambda>(r,c). if f (Enum.enum!c) = Some (Enum.enum!r) then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
define nA where "nA = CARD('a)"
[PROOF STATE]
proof (state)
this:
nA = CARD('a)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
define nB where "nB = CARD('b)"
[PROOF STATE]
proof (state)
this:
nB = CARD('b)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
define BasisA where "BasisA = (canonical_basis::'a ell2 list)"
[PROOF STATE]
proof (state)
this:
BasisA = canonical_basis

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
define BasisB where "BasisB = (canonical_basis::'b ell2 list)"
[PROOF STATE]
proof (state)
this:
BasisB = canonical_basis

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
have "mat_of_cblinfun (classical_operator f) \<in> carrier_mat nB nA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) \<in> carrier_mat nB nA
[PROOF STEP]
unfolding nA_def nB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat nB nA

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat nB nA

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
have "nA = CARD ('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nA = CARD('a)
[PROOF STEP]
unfolding nA_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a) = CARD('a)
[PROOF STEP]
by (simp add:)
[PROOF STATE]
proof (state)
this:
nA = CARD('a)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
nA = CARD('a)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
have "nB = CARD ('b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nB = CARD('b)
[PROOF STEP]
unfolding nB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('b) = CARD('b)
[PROOF STEP]
by (simp add:)
[PROOF STATE]
proof (state)
this:
nB = CARD('b)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat nB nA
nA = CARD('a)
nB = CARD('b)
[PROOF STEP]
have "mat_of_cblinfun (classical_operator f) \<in> carrier_mat (CARD('b)) (CARD('a))"
[PROOF STATE]
proof (prove)
using this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat nB nA
nA = CARD('a)
nB = CARD('b)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a)
[PROOF STEP]
unfolding nA_def nB_def
[PROOF STATE]
proof (prove)
using this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a)
CARD('a) = CARD('a)
CARD('b) = CARD('b)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
have "(mat_of_cblinfun (classical_operator f))$$(r,c)
  = (mat (CARD('b)) (CARD('a))
    (\<lambda>(r,c). if f (Enum.enum!c) = Some (Enum.enum!r) then 1 else 0))$$(r,c)"
    if a1: "r < CARD('b)" and a2: "c < CARD('a)"
    for r c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
have "CARD('a) = length (enum_class.enum::'a list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a) = length enum_class.enum
[PROOF STEP]
using card_UNIV_length_enum[where 'a = 'a]
[PROOF STATE]
proof (prove)
using this:
CARD('a) = length enum_class.enum

goal (1 subgoal):
 1. CARD('a) = length enum_class.enum
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
CARD('a) = length enum_class.enum

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
hence x1: "BasisA!c = ket ((Enum.enum::'a list)!c)"
[PROOF STATE]
proof (prove)
using this:
CARD('a) = length enum_class.enum

goal (1 subgoal):
 1. BasisA ! c = ket (enum_class.enum ! c)
[PROOF STEP]
unfolding BasisA_def
[PROOF STATE]
proof (prove)
using this:
CARD('a) = length enum_class.enum

goal (1 subgoal):
 1. canonical_basis ! c = ket (enum_class.enum ! c)
[PROOF STEP]
using a2 canonical_basis_ell2_def
        nth_map[where n = c and xs = "Enum.enum::'a list" and f = ket]
[PROOF STATE]
proof (prove)
using this:
CARD('a) = length enum_class.enum
c < CARD('a)
canonical_basis = map ket enum_class.enum
c < length enum_class.enum \<Longrightarrow> map ket enum_class.enum ! c = ket (enum_class.enum ! c)

goal (1 subgoal):
 1. canonical_basis ! c = ket (enum_class.enum ! c)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
BasisA ! c = ket (enum_class.enum ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
have cardb: "CARD('b) = length (enum_class.enum::'b list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('b) = length enum_class.enum
[PROOF STEP]
using card_UNIV_length_enum[where 'a = 'b]
[PROOF STATE]
proof (prove)
using this:
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. CARD('b) = length enum_class.enum
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
hence x2: "BasisB!r = ket ((Enum.enum::'b list)!r)"
[PROOF STATE]
proof (prove)
using this:
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. BasisB ! r = ket (enum_class.enum ! r)
[PROOF STEP]
unfolding BasisB_def
[PROOF STATE]
proof (prove)
using this:
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. canonical_basis ! r = ket (enum_class.enum ! r)
[PROOF STEP]
using a1 canonical_basis_ell2_def
        nth_map[where n = r and xs = "Enum.enum::'b list" and f = ket]
[PROOF STATE]
proof (prove)
using this:
CARD('b) = length enum_class.enum
r < CARD('b)
canonical_basis = map ket enum_class.enum
r < length enum_class.enum \<Longrightarrow> map ket enum_class.enum ! r = ket (enum_class.enum ! r)

goal (1 subgoal):
 1. canonical_basis ! r = ket (enum_class.enum ! r)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
BasisB ! r = ket (enum_class.enum ! r)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
have "inj (map (ket::'b \<Rightarrow>_))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (map ket)
[PROOF STEP]
by (meson injI ket_injective list.inj_map)
[PROOF STATE]
proof (state)
this:
inj (map ket)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
hence "length (Enum.enum::'b list) = length (map (ket::'b \<Rightarrow>_) (Enum.enum::'b list))"
[PROOF STATE]
proof (prove)
using this:
inj (map ket)

goal (1 subgoal):
 1. length enum_class.enum = length (map ket enum_class.enum)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length enum_class.enum = length (map ket enum_class.enum)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
hence lengthBasisB: "CARD('b) = length BasisB"
[PROOF STATE]
proof (prove)
using this:
length enum_class.enum = length (map ket enum_class.enum)

goal (1 subgoal):
 1. CARD('b) = length BasisB
[PROOF STEP]
unfolding BasisB_def canonical_basis_ell2_def
[PROOF STATE]
proof (prove)
using this:
length enum_class.enum = length (map ket enum_class.enum)

goal (1 subgoal):
 1. CARD('b) = length (map ket enum_class.enum)
[PROOF STEP]
using cardb
[PROOF STATE]
proof (prove)
using this:
length enum_class.enum = length (map ket enum_class.enum)
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. CARD('b) = length (map ket enum_class.enum)
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
CARD('b) = length BasisB

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
have v1: "(mat_of_cblinfun (classical_operator f))$$(r,c) = 0"
      if c1: "f (Enum.enum!c) = None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "(classical_operator f) *\<^sub>V ket (Enum.enum!c)
          = (case f (Enum.enum!c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)
[PROOF STEP]
using classical_operator_ket_finite
[PROOF STATE]
proof (prove)
using this:
classical_operator ?\<pi> *\<^sub>V ket ?x = (case ?\<pi> ?x of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)

goal (1 subgoal):
 1. classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i) = 0
[PROOF STEP]
using c1
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) = None

goal (1 subgoal):
 1. (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i) = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = 0
[PROOF STEP]
have "(classical_operator f) *\<^sub>V ket (Enum.enum!c) = 0"
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = 0

goal (1 subgoal):
 1. classical_operator f *\<^sub>V ket (enum_class.enum ! c) = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
hence *: "(classical_operator f) *\<^sub>V BasisA!c = 0"
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = 0

goal (1 subgoal):
 1. classical_operator f *\<^sub>V BasisA ! c = 0
[PROOF STEP]
using x1
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = 0
BasisA ! c = ket (enum_class.enum ! c)

goal (1 subgoal):
 1. classical_operator f *\<^sub>V BasisA ! c = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V BasisA ! c = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
hence "is_orthogonal (BasisB!r) (classical_operator f *\<^sub>V BasisA!c)"
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V BasisA ! c = 0

goal (1 subgoal):
 1. is_orthogonal (BasisB ! r) (classical_operator f *\<^sub>V BasisA ! c)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_orthogonal (BasisB ! r) (classical_operator f *\<^sub>V BasisA ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
is_orthogonal (BasisB ! r) (classical_operator f *\<^sub>V BasisA ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
unfolding mat_of_cblinfun_def BasisA_def BasisB_def
[PROOF STATE]
proof (prove)
using this:
is_orthogonal (canonical_basis ! r) (classical_operator f *\<^sub>V canonical_basis ! c)

goal (1 subgoal):
 1. mat (length canonical_basis) (length canonical_basis) (\<lambda>(i, j). crepresentation (set canonical_basis) (classical_operator f *\<^sub>V canonical_basis ! j) (canonical_basis ! i)) $$ (r, c) = 0
[PROOF STEP]
by (smt (verit, del_insts) BasisA_def * a1 a2 canonical_basis_length_ell2 complex_vector.representation_zero index_mat(1) old.prod.case)
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) = None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
have v2: "(mat_of_cblinfun (classical_operator f))$$(r,c) = 0"
      if c1: "f (Enum.enum!c) = Some (Enum.enum!r')" and c2: "r\<noteq>r'"
        and c3: "r' < CARD('b)"
      for r'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have x3: "BasisB!r' = ket ((Enum.enum::'b list)!r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. BasisB ! r' = ket (enum_class.enum ! r')
[PROOF STEP]
unfolding BasisB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canonical_basis ! r' = ket (enum_class.enum ! r')
[PROOF STEP]
using cardb c3 canonical_basis_ell2_def
          nth_map[where n = r' and xs = "Enum.enum::'b list" and f = ket]
[PROOF STATE]
proof (prove)
using this:
CARD('b) = length enum_class.enum
r' < CARD('b)
canonical_basis = map ket enum_class.enum
r' < length enum_class.enum \<Longrightarrow> map ket enum_class.enum ! r' = ket (enum_class.enum ! r')

goal (1 subgoal):
 1. canonical_basis ! r' = ket (enum_class.enum ! r')
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
BasisB ! r' = ket (enum_class.enum ! r')

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "distinct BasisB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct BasisB
[PROOF STEP]
unfolding BasisB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct canonical_basis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct BasisB

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
distinct BasisB

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "r < length BasisB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r < length BasisB
[PROOF STEP]
using a1 lengthBasisB
[PROOF STATE]
proof (prove)
using this:
r < CARD('b)
CARD('b) = length BasisB

goal (1 subgoal):
 1. r < length BasisB
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r < length BasisB

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r < length BasisB

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "r' < length BasisB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r' < length BasisB
[PROOF STEP]
using c3 lengthBasisB
[PROOF STATE]
proof (prove)
using this:
r' < CARD('b)
CARD('b) = length BasisB

goal (1 subgoal):
 1. r' < length BasisB
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r' < length BasisB

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
distinct BasisB
r < length BasisB
r' < length BasisB
[PROOF STEP]
have h1: "BasisB!r \<noteq> BasisB!r'"
[PROOF STATE]
proof (prove)
using this:
distinct BasisB
r < length BasisB
r' < length BasisB

goal (1 subgoal):
 1. BasisB ! r \<noteq> BasisB ! r'
[PROOF STEP]
using nth_eq_iff_index_eq[where xs = BasisB and i = r and j = r'] c2
[PROOF STATE]
proof (prove)
using this:
distinct BasisB
r < length BasisB
r' < length BasisB
\<lbrakk>distinct BasisB; r < length BasisB; r' < length BasisB\<rbrakk> \<Longrightarrow> (BasisB ! r = BasisB ! r') = (r = r')
r \<noteq> r'

goal (1 subgoal):
 1. BasisB ! r \<noteq> BasisB ! r'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
BasisB ! r \<noteq> BasisB ! r'

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "(classical_operator f) *\<^sub>V ket (Enum.enum!c)
          = (case f (Enum.enum!c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)
[PROOF STEP]
using classical_operator_ket_finite
[PROOF STATE]
proof (prove)
using this:
classical_operator ?\<pi> *\<^sub>V ket ?x = (case ?\<pi> ?x of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)

goal (1 subgoal):
 1. classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "\<dots> = ket (Enum.enum!r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i) = ket (enum_class.enum ! r')
[PROOF STEP]
using c1
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) = Some (enum_class.enum ! r')

goal (1 subgoal):
 1. (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i) = ket (enum_class.enum ! r')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i) = ket (enum_class.enum ! r')

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = ket (enum_class.enum ! r')
[PROOF STEP]
have "(classical_operator f) *\<^sub>V ket (Enum.enum!c) = ket (Enum.enum!r')"
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = ket (enum_class.enum ! r')

goal (1 subgoal):
 1. classical_operator f *\<^sub>V ket (enum_class.enum ! c) = ket (enum_class.enum ! r')
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = ket (enum_class.enum ! r')

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
hence *: "(classical_operator f) *\<^sub>V BasisA!c = BasisB!r'"
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = ket (enum_class.enum ! r')

goal (1 subgoal):
 1. classical_operator f *\<^sub>V BasisA ! c = BasisB ! r'
[PROOF STEP]
using x1 x3
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = ket (enum_class.enum ! r')
BasisA ! c = ket (enum_class.enum ! c)
BasisB ! r' = ket (enum_class.enum ! r')

goal (1 subgoal):
 1. classical_operator f *\<^sub>V BasisA ! c = BasisB ! r'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V BasisA ! c = BasisB ! r'

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V BasisA ! c = BasisB ! r'

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "is_orthogonal (BasisB!r) (BasisB!r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_orthogonal (BasisB ! r) (BasisB ! r')
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
BasisB ! r \<noteq> BasisB ! r'

goal (1 subgoal):
 1. is_orthogonal (BasisB ! r) (BasisB ! r')
[PROOF STEP]
using BasisB_def \<open>r < length BasisB\<close> \<open>r' < length BasisB\<close> is_ortho_set_def is_orthonormal nth_mem
[PROOF STATE]
proof (prove)
using this:
BasisB ! r \<noteq> BasisB ! r'
BasisB = canonical_basis
r < length BasisB
r' < length BasisB
is_ortho_set ?S = ((\<forall>x\<in>?S. \<forall>y\<in>?S. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::?'a) \<notin> ?S)
is_ortho_set (set canonical_basis)
?n < length ?xs \<Longrightarrow> ?xs ! ?n \<in> set ?xs

goal (1 subgoal):
 1. is_orthogonal (BasisB ! r) (BasisB ! r')
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
is_orthogonal (BasisB ! r) (BasisB ! r')

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
classical_operator f *\<^sub>V BasisA ! c = BasisB ! r'
is_orthogonal (BasisB ! r) (BasisB ! r')
[PROOF STEP]
have "is_orthogonal (BasisB!r) (classical_operator f *\<^sub>V BasisA!c)"
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V BasisA ! c = BasisB ! r'
is_orthogonal (BasisB ! r) (BasisB ! r')

goal (1 subgoal):
 1. is_orthogonal (BasisB ! r) (classical_operator f *\<^sub>V BasisA ! c)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_orthogonal (BasisB ! r) (classical_operator f *\<^sub>V BasisA ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
is_orthogonal (BasisB ! r) (classical_operator f *\<^sub>V BasisA ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
unfolding mat_of_cblinfun_def BasisA_def BasisB_def
[PROOF STATE]
proof (prove)
using this:
is_orthogonal (canonical_basis ! r) (classical_operator f *\<^sub>V canonical_basis ! c)

goal (1 subgoal):
 1. mat (length canonical_basis) (length canonical_basis) (\<lambda>(i, j). crepresentation (set canonical_basis) (classical_operator f *\<^sub>V canonical_basis ! j) (canonical_basis ! i)) $$ (r, c) = 0
[PROOF STEP]
by (smt (z3) BasisA_def BasisB_def * \<open>r < length BasisB\<close> \<open>r' < length BasisB\<close> a2 canonical_basis_length_ell2 case_prod_conv complex_vector.representation_basis h1 index_mat(1) is_cindependent_set nth_mem)
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>f (enum_class.enum ! c) = Some (enum_class.enum ! ?r'); r \<noteq> ?r'; ?r' < CARD('b)\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
have "(mat_of_cblinfun (classical_operator f))$$(r,c) = 0"
      if b1: "f (Enum.enum!c) \<noteq> Some (Enum.enum!r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
proof (cases "f (Enum.enum!c) = None")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f (enum_class.enum ! c) = None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
 2. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) = None

goal (2 subgoals):
 1. f (enum_class.enum ! c) = None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
 2. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) = None

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
using v1
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) = None
f (enum_class.enum ! c) = None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) \<noteq> None

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
hence "\<exists>R. f (Enum.enum!c) = Some R"
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) \<noteq> None

goal (1 subgoal):
 1. \<exists>R. f (enum_class.enum ! c) = Some R
[PROOF STEP]
apply (induction "f (Enum.enum!c)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>None = f (enum_class.enum ! c); f (enum_class.enum ! c) \<noteq> None\<rbrakk> \<Longrightarrow> \<exists>R. f (enum_class.enum ! c) = Some R
 2. \<And>option. \<lbrakk>Some option = f (enum_class.enum ! c); f (enum_class.enum ! c) \<noteq> None\<rbrakk> \<Longrightarrow> \<exists>R. f (enum_class.enum ! c) = Some R
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>option. \<lbrakk>Some option = f (enum_class.enum ! c); f (enum_class.enum ! c) \<noteq> None\<rbrakk> \<Longrightarrow> \<exists>R. f (enum_class.enum ! c) = Some R
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>R. f (enum_class.enum ! c) = Some R

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>R. f (enum_class.enum ! c) = Some R
[PROOF STEP]
obtain R where R0: "f (Enum.enum!c) = Some R"
[PROOF STATE]
proof (prove)
using this:
\<exists>R. f (enum_class.enum ! c) = Some R

goal (1 subgoal):
 1. (\<And>R. f (enum_class.enum ! c) = Some R \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) = Some R

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "R \<in> set (Enum.enum::'b list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<in> set enum_class.enum
[PROOF STEP]
using UNIV_enum
[PROOF STATE]
proof (prove)
using this:
UNIV = set enum_class.enum

goal (1 subgoal):
 1. R \<in> set enum_class.enum
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
R \<in> set enum_class.enum

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
hence "\<exists>r'. R = (Enum.enum::'b list)!r' \<and> r' < length (Enum.enum::'b list)"
[PROOF STATE]
proof (prove)
using this:
R \<in> set enum_class.enum

goal (1 subgoal):
 1. \<exists>r'. R = enum_class.enum ! r' \<and> r' < length enum_class.enum
[PROOF STEP]
by (metis in_set_conv_nth)
[PROOF STATE]
proof (state)
this:
\<exists>r'. R = enum_class.enum ! r' \<and> r' < length enum_class.enum

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>r'. R = enum_class.enum ! r' \<and> r' < length enum_class.enum
[PROOF STEP]
obtain r' where u1: "R = (Enum.enum::'b list)!r'"
        and u2: "r' < length (Enum.enum::'b list)"
[PROOF STATE]
proof (prove)
using this:
\<exists>r'. R = enum_class.enum ! r' \<and> r' < length enum_class.enum

goal (1 subgoal):
 1. (\<And>r'. \<lbrakk>R = enum_class.enum ! r'; r' < length enum_class.enum\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
R = enum_class.enum ! r'
r' < length enum_class.enum

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have R1: "f (Enum.enum!c) = Some (Enum.enum!r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (enum_class.enum ! c) = Some (enum_class.enum ! r')
[PROOF STEP]
using R0 u1
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) = Some R
R = enum_class.enum ! r'

goal (1 subgoal):
 1. f (enum_class.enum ! c) = Some (enum_class.enum ! r')
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) = Some (enum_class.enum ! r')

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "Some ((Enum.enum::'b list)!r') \<noteq> Some ((Enum.enum::'b list)!r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)
[PROOF STEP]
proof(rule classical)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r) \<Longrightarrow> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)
[PROOF STEP]
assume "\<not>(Some ((Enum.enum::'b list)!r') \<noteq> Some ((Enum.enum::'b list)!r))"
[PROOF STATE]
proof (state)
this:
\<not> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)

goal (1 subgoal):
 1. \<not> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r) \<Longrightarrow> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)
[PROOF STEP]
hence "Some ((Enum.enum::'b list)!r') = Some ((Enum.enum::'b list)!r)"
[PROOF STATE]
proof (prove)
using this:
\<not> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)

goal (1 subgoal):
 1. Some (enum_class.enum ! r') = Some (enum_class.enum ! r)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Some (enum_class.enum ! r') = Some (enum_class.enum ! r)

goal (1 subgoal):
 1. \<not> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r) \<Longrightarrow> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)
[PROOF STEP]
hence "f (Enum.enum!c) = Some ((Enum.enum::'b list)!r)"
[PROOF STATE]
proof (prove)
using this:
Some (enum_class.enum ! r') = Some (enum_class.enum ! r)

goal (1 subgoal):
 1. f (enum_class.enum ! c) = Some (enum_class.enum ! r)
[PROOF STEP]
using R1
[PROOF STATE]
proof (prove)
using this:
Some (enum_class.enum ! r') = Some (enum_class.enum ! r)
f (enum_class.enum ! c) = Some (enum_class.enum ! r')

goal (1 subgoal):
 1. f (enum_class.enum ! c) = Some (enum_class.enum ! r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) = Some (enum_class.enum ! r)

goal (1 subgoal):
 1. \<not> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r) \<Longrightarrow> Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) = Some (enum_class.enum ! r)

goal (1 subgoal):
 1. Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)
[PROOF STEP]
using b1
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) = Some (enum_class.enum ! r)
f (enum_class.enum ! c) \<noteq> Some (enum_class.enum ! r)

goal (1 subgoal):
 1. Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
hence "((Enum.enum::'b list)!r') \<noteq> ((Enum.enum::'b list)!r)"
[PROOF STATE]
proof (prove)
using this:
Some (enum_class.enum ! r') \<noteq> Some (enum_class.enum ! r)

goal (1 subgoal):
 1. enum_class.enum ! r' \<noteq> enum_class.enum ! r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
enum_class.enum ! r' \<noteq> enum_class.enum ! r

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
hence "r' \<noteq> r"
[PROOF STATE]
proof (prove)
using this:
enum_class.enum ! r' \<noteq> enum_class.enum ! r

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

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r' \<noteq> r

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
have "r' < CARD('b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r' < CARD('b)
[PROOF STEP]
using u2 cardb
[PROOF STATE]
proof (prove)
using this:
r' < length enum_class.enum
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. r' < CARD('b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r' < CARD('b)

goal (1 subgoal):
 1. f (enum_class.enum ! c) \<noteq> None \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r' \<noteq> r
r' < CARD('b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r' \<noteq> r
r' < CARD('b)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
using R1 v2[where r' = r']
[PROOF STATE]
proof (prove)
using this:
r' \<noteq> r
r' < CARD('b)
f (enum_class.enum ! c) = Some (enum_class.enum ! r')
\<lbrakk>f (enum_class.enum ! c) = Some (enum_class.enum ! r'); r \<noteq> r'; r' < CARD('b)\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) \<noteq> Some (enum_class.enum ! r) \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) \<noteq> Some (enum_class.enum ! r) \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
have "(mat_of_cblinfun (classical_operator f))$$(r,c) = 1"
      if b1: "f (Enum.enum!c) = Some (Enum.enum!r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
have "CARD('b) = length (enum_class.enum::'b list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('b) = length enum_class.enum
[PROOF STEP]
using card_UNIV_length_enum[where 'a = 'b]
[PROOF STATE]
proof (prove)
using this:
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. CARD('b) = length enum_class.enum
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
hence "length (map (ket::'b\<Rightarrow>_) enum_class.enum) = CARD('b)"
[PROOF STATE]
proof (prove)
using this:
CARD('b) = length enum_class.enum

goal (1 subgoal):
 1. length (map ket enum_class.enum) = CARD('b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (map ket enum_class.enum) = CARD('b)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
hence w0: "map (ket::'b\<Rightarrow>_) enum_class.enum ! r = ket (enum_class.enum ! r)"
[PROOF STATE]
proof (prove)
using this:
length (map ket enum_class.enum) = CARD('b)

goal (1 subgoal):
 1. map ket enum_class.enum ! r = ket (enum_class.enum ! r)
[PROOF STEP]
by (simp add: a1)
[PROOF STATE]
proof (state)
this:
map ket enum_class.enum ! r = ket (enum_class.enum ! r)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
have "CARD('a) = length (enum_class.enum::'a list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a) = length enum_class.enum
[PROOF STEP]
using card_UNIV_length_enum[where 'a = 'a]
[PROOF STATE]
proof (prove)
using this:
CARD('a) = length enum_class.enum

goal (1 subgoal):
 1. CARD('a) = length enum_class.enum
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
CARD('a) = length enum_class.enum

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
hence "length (map (ket::'a\<Rightarrow>_) enum_class.enum) = CARD('a)"
[PROOF STATE]
proof (prove)
using this:
CARD('a) = length enum_class.enum

goal (1 subgoal):
 1. length (map ket enum_class.enum) = CARD('a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (map ket enum_class.enum) = CARD('a)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
hence "map (ket::'a\<Rightarrow>_) enum_class.enum ! c = ket (enum_class.enum ! c)"
[PROOF STATE]
proof (prove)
using this:
length (map ket enum_class.enum) = CARD('a)

goal (1 subgoal):
 1. map ket enum_class.enum ! c = ket (enum_class.enum ! c)
[PROOF STEP]
by (simp add: a2)
[PROOF STATE]
proof (state)
this:
map ket enum_class.enum ! c = ket (enum_class.enum ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
hence "(classical_operator f) *\<^sub>V (BasisA!c) = (classical_operator f) *\<^sub>V (ket (Enum.enum!c))"
[PROOF STATE]
proof (prove)
using this:
map ket enum_class.enum ! c = ket (enum_class.enum ! c)

goal (1 subgoal):
 1. classical_operator f *\<^sub>V BasisA ! c = classical_operator f *\<^sub>V ket (enum_class.enum ! c)
[PROOF STEP]
unfolding BasisA_def canonical_basis_ell2_def
[PROOF STATE]
proof (prove)
using this:
map ket enum_class.enum ! c = ket (enum_class.enum ! c)

goal (1 subgoal):
 1. classical_operator f *\<^sub>V map ket enum_class.enum ! c = classical_operator f *\<^sub>V ket (enum_class.enum ! c)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V BasisA ! c = classical_operator f *\<^sub>V ket (enum_class.enum ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V BasisA ! c = classical_operator f *\<^sub>V ket (enum_class.enum ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
have "... = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x)
[PROOF STEP]
by (rule classical_operator_ket_finite)
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V ket (enum_class.enum ! c) = (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
have "\<dots> = BasisB!r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x) = BasisB ! r
[PROOF STEP]
using w0 b1
[PROOF STATE]
proof (prove)
using this:
map ket enum_class.enum ! r = ket (enum_class.enum ! r)
f (enum_class.enum ! c) = Some (enum_class.enum ! r)

goal (1 subgoal):
 1. (case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x) = BasisB ! r
[PROOF STEP]
by (simp add: BasisB_def canonical_basis_ell2_def)
[PROOF STATE]
proof (state)
this:
(case f (enum_class.enum ! c) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x) = BasisB ! r

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
classical_operator f *\<^sub>V BasisA ! c = BasisB ! r
[PROOF STEP]
have w1: "(classical_operator f) *\<^sub>V (BasisA!c) = BasisB!r"
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V BasisA ! c = BasisB ! r

goal (1 subgoal):
 1. classical_operator f *\<^sub>V BasisA ! c = BasisB ! r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
classical_operator f *\<^sub>V BasisA ! c = BasisB ! r

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
have "(mat_of_cblinfun (classical_operator f))$$(r,c)
        = (BasisB!r) \<bullet>\<^sub>C (classical_operator f *\<^sub>V (BasisA!c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = BasisB ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V BasisA ! c)
[PROOF STEP]
unfolding BasisB_def BasisA_def mat_of_cblinfun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (length canonical_basis) (length canonical_basis) (\<lambda>(i, j). crepresentation (set canonical_basis) (classical_operator f *\<^sub>V canonical_basis ! j) (canonical_basis ! i)) $$ (r, c) = canonical_basis ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V canonical_basis ! c)
[PROOF STEP]
using \<open>nA = CARD('a)\<close> \<open>nB = CARD('b)\<close> a1 a2 nA_def nB_def
[PROOF STATE]
proof (prove)
using this:
nA = CARD('a)
nB = CARD('b)
r < CARD('b)
c < CARD('a)
nA = CARD('a)
nB = CARD('b)

goal (1 subgoal):
 1. mat (length canonical_basis) (length canonical_basis) (\<lambda>(i, j). crepresentation (set canonical_basis) (classical_operator f *\<^sub>V canonical_basis ! j) (canonical_basis ! i)) $$ (r, c) = canonical_basis ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V canonical_basis ! c)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r < CARD('b); c < CARD('a); nA = CARD('a); nB = CARD('b)\<rbrakk> \<Longrightarrow> crepresentation (set canonical_basis) (classical_operator f *\<^sub>V canonical_basis ! c) (canonical_basis ! r) = canonical_basis ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V canonical_basis ! c)
[PROOF STEP]
by (metis BasisA_def BasisB_def canonical_basis_length_ell2 cinner_canonical_basis complex_vector.representation_basis is_cindependent_set nth_mem w1)
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = BasisB ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V BasisA ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = BasisB ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V BasisA ! c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
have "\<dots> = (BasisB!r) \<bullet>\<^sub>C (BasisB!r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. BasisB ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V BasisA ! c) = BasisB ! r \<bullet>\<^sub>C BasisB ! r
[PROOF STEP]
using w1
[PROOF STATE]
proof (prove)
using this:
classical_operator f *\<^sub>V BasisA ! c = BasisB ! r

goal (1 subgoal):
 1. BasisB ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V BasisA ! c) = BasisB ! r \<bullet>\<^sub>C BasisB ! r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
BasisB ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V BasisA ! c) = BasisB ! r \<bullet>\<^sub>C BasisB ! r

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
BasisB ! r \<bullet>\<^sub>C (classical_operator f *\<^sub>V BasisA ! c) = BasisB ! r \<bullet>\<^sub>C BasisB ! r

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. BasisB ! r \<bullet>\<^sub>C BasisB ! r = 1
[PROOF STEP]
unfolding BasisB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. canonical_basis ! r \<bullet>\<^sub>C canonical_basis ! r = 1
[PROOF STEP]
using \<open>nB = CARD('b)\<close> a1 nB_def
[PROOF STATE]
proof (prove)
using this:
nB = CARD('b)
r < CARD('b)
nB = CARD('b)

goal (1 subgoal):
 1. canonical_basis ! r \<bullet>\<^sub>C canonical_basis ! r = 1
[PROOF STEP]
by (simp add: cinner_canonical_basis)
[PROOF STATE]
proof (state)
this:
BasisB ! r \<bullet>\<^sub>C BasisB ! r = 1

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = 1

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (enum_class.enum ! c) = Some (enum_class.enum ! r) \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 1

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f (enum_class.enum ! c) \<noteq> Some (enum_class.enum ! r) \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
f (enum_class.enum ! c) = Some (enum_class.enum ! r) \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f (enum_class.enum ! c) \<noteq> Some (enum_class.enum ! r) \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 0
f (enum_class.enum ! c) = Some (enum_class.enum ! r) \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = 1

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)
[PROOF STEP]
by (simp add: a1 a2)
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?r < CARD('b); ?c < CARD('a)\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (?r, ?c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (?r, ?c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a)
\<lbrakk>?r < CARD('b); ?c < CARD('a)\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (?r, ?c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (?r, ?c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a)
\<lbrakk>?r < CARD('b); ?c < CARD('a)\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (?r, ?c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (?r, ?c)

goal (1 subgoal):
 1. mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)
[PROOF STEP]
apply (rule_tac eq_matI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a); \<And>r c. \<lbrakk>r < CARD('b); c < CARD('a)\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c); i < dim_row (mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)); j < dim_col (mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0))\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (i, j) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (i, j)
 2. \<lbrakk>mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a); \<And>r c. \<lbrakk>r < CARD('b); c < CARD('a)\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)\<rbrakk> \<Longrightarrow> dim_row (mat_of_cblinfun (classical_operator f)) = dim_row (mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0))
 3. \<lbrakk>mat_of_cblinfun (classical_operator f) \<in> carrier_mat CARD('b) CARD('a); \<And>r c. \<lbrakk>r < CARD('b); c < CARD('a)\<rbrakk> \<Longrightarrow> mat_of_cblinfun (classical_operator f) $$ (r, c) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0) $$ (r, c)\<rbrakk> \<Longrightarrow> dim_col (mat_of_cblinfun (classical_operator f)) = dim_col (mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_of_cblinfun (classical_operator f) = mat CARD('b) CARD('a) (\<lambda>(r, c). if f (enum_class.enum ! c) = Some (enum_class.enum ! r) then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_sum_nonneg_SUPREMUM_real:
  fixes f :: "'a \<Rightarrow> real"
  assumes "f summable_on A" and "\<And>x. x\<in>A \<Longrightarrow> f x \<ge> 0"
  shows "has_sum f A (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. (sum f F))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum f A (Sup (sum f ` {F. finite F \<and> F \<subseteq> A}))
[PROOF STEP]
by (metis (mono_tags, lifting) assms has_sum_infsum infsum_nonneg_is_SUPREMUM_real)


[STATEMENT]
lemma Quadratic_Reciprocity_Jacobi:
  fixes p q :: int
  assumes "coprime p q"
      and "2 < p" "2 < q"
      and "odd p" "odd q"
    shows "Jacobi p q * Jacobi q p =
           (- 1) ^ (nat ((p - 1) div 2 * ((q - 1) div 2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
coprime p q
2 < p
2 < q
odd p
odd q

goal (1 subgoal):
 1. Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
proof (induction "nat p" "nat q" arbitrary: p q
         rule: measure_induct_rule[where f = "\<lambda>(a, b). a + b", split_format(complete), simplified])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
case (1 p q)
[PROOF STATE]
proof (state)
this:
\<lbrakk>nat ?p + nat ?q < nat p + nat q; coprime ?p ?q; 2 < ?p; 2 < ?q; odd ?p; odd ?q\<rbrakk> \<Longrightarrow> Jacobi ?p ?q * Jacobi ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
coprime p q
2 < p
2 < q
odd p
odd q

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>nat ?p + nat ?q < nat p + nat q; coprime ?p ?q; 2 < ?p; 2 < ?q; odd ?p; odd ?q\<rbrakk> \<Longrightarrow> Jacobi ?p ?q * Jacobi ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
coprime p q
2 < p
2 < q
odd p
odd q

goal (1 subgoal):
 1. Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
proof (induction p q rule: prime_nonprime_wlog)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>p q. \<lbrakk>prime p; prime q; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
 2. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
 3. \<And>p q. \<lbrakk>\<lbrakk>\<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2)); \<And>pa qa. \<lbrakk>nat pa + nat qa < nat q + nat p; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime q p; 2 < q; 2 < p; odd q; odd p\<rbrakk> \<Longrightarrow> Jacobi q p * Jacobi p q = (- 1) ^ nat ((q - 1) div 2 * ((p - 1) div 2))
[PROOF STEP]
case (sym p q)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>p q. \<lbrakk>nat p + nat q < nat p + nat q; coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
\<lbrakk>nat ?p + nat ?q < nat q + nat p; coprime ?p ?q; 2 < ?p; 2 < ?q; odd ?p; odd ?q\<rbrakk> \<Longrightarrow> Jacobi ?p ?q * Jacobi ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
coprime q p
2 < q
2 < p
odd q
odd p

goal (3 subgoals):
 1. \<And>p q. \<lbrakk>prime p; prime q; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
 2. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
 3. \<And>p q. \<lbrakk>\<lbrakk>\<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2)); \<And>pa qa. \<lbrakk>nat pa + nat qa < nat q + nat p; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime q p; 2 < q; 2 < p; odd q; odd p\<rbrakk> \<Longrightarrow> Jacobi q p * Jacobi p q = (- 1) ^ nat ((q - 1) div 2 * ((p - 1) div 2))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>p q. \<lbrakk>nat p + nat q < nat p + nat q; coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
\<lbrakk>nat ?p + nat ?q < nat q + nat p; coprime ?p ?q; 2 < ?p; 2 < ?q; odd ?p; odd ?q\<rbrakk> \<Longrightarrow> Jacobi ?p ?q * Jacobi ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
coprime q p
2 < q
2 < p
odd q
odd p

goal (1 subgoal):
 1. Jacobi q p * Jacobi p q = (- 1) ^ nat ((q - 1) div 2 * ((p - 1) div 2))
[PROOF STEP]
by (simp only: add_ac coprime_commute mult_ac) blast
[PROOF STATE]
proof (state)
this:
Jacobi q p * Jacobi p q = (- 1) ^ nat ((q - 1) div 2 * ((p - 1) div 2))

goal (2 subgoals):
 1. \<And>p q. \<lbrakk>prime p; prime q; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
 2. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p q. \<lbrakk>prime p; prime q; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
 2. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
case (primes p q)
[PROOF STATE]
proof (state)
this:
prime p
prime q
\<lbrakk>nat ?p + nat ?q < nat p + nat q; coprime ?p ?q; 2 < ?p; 2 < ?q; odd ?p; odd ?q\<rbrakk> \<Longrightarrow> Jacobi ?p ?q * Jacobi ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
coprime p q
2 < p
2 < q
odd p
odd q

goal (2 subgoals):
 1. \<And>p q. \<lbrakk>prime p; prime q; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
 2. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
from \<open>prime p\<close> \<open>prime q\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
prime q
[PROOF STEP]
have "prime (nat p)" "prime (nat q)" "p \<noteq> q"
[PROOF STATE]
proof (prove)
using this:
prime p
prime q

goal (1 subgoal):
 1. prime (nat p) &&& prime (nat q) &&& p \<noteq> q
[PROOF STEP]
using prime_int_nat_transfer primes(4) non_trivial_coprime_neq prime_gt_1_int
[PROOF STATE]
proof (prove)
using this:
prime p
prime q
prime ?k = (0 \<le> ?k \<and> prime (nat ?k))
coprime p q
\<lbrakk>1 < ?a; 1 < ?b; coprime ?a ?b\<rbrakk> \<Longrightarrow> ?a \<noteq> ?b
prime ?p \<Longrightarrow> 1 < ?p

goal (1 subgoal):
 1. prime (nat p) &&& prime (nat q) &&& p \<noteq> q
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
prime (nat p)
prime (nat q)
p \<noteq> q

goal (2 subgoals):
 1. \<And>p q. \<lbrakk>prime p; prime q; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
 2. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
with Quadratic_Reciprocity_int and prime_p_Jacobi_eq_Legendre
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>prime (nat ?p); 2 < ?p; prime (nat ?q); 2 < ?q; ?p \<noteq> ?q\<rbrakk> \<Longrightarrow> Legendre ?p ?q * Legendre ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
prime ?p \<Longrightarrow> Jacobi ?a ?p = Legendre ?a ?p
prime (nat p)
prime (nat q)
p \<noteq> q
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime (nat ?p); 2 < ?p; prime (nat ?q); 2 < ?q; ?p \<noteq> ?q\<rbrakk> \<Longrightarrow> Legendre ?p ?q * Legendre ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
prime ?p \<Longrightarrow> Jacobi ?a ?p = Legendre ?a ?p
prime (nat p)
prime (nat q)
p \<noteq> q

goal (1 subgoal):
 1. Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
using \<open>prime p\<close> \<open>prime q\<close> primes(5-)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime (nat ?p); 2 < ?p; prime (nat ?q); 2 < ?q; ?p \<noteq> ?q\<rbrakk> \<Longrightarrow> Legendre ?p ?q * Legendre ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
prime ?p \<Longrightarrow> Jacobi ?a ?p = Legendre ?a ?p
prime (nat p)
prime (nat q)
p \<noteq> q
prime p
prime q
2 < p
2 < q
odd p
odd q

goal (1 subgoal):
 1. Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
case (nonprime p q)
[PROOF STATE]
proof (state)
this:
\<not> prime p
\<lbrakk>nat ?p + nat ?q < nat p + nat q; coprime ?p ?q; 2 < ?p; 2 < ?q; odd ?p; odd ?q\<rbrakk> \<Longrightarrow> Jacobi ?p ?q * Jacobi ?q ?p = (- 1) ^ nat ((?p - 1) div 2 * ((?q - 1) div 2))
coprime p q
2 < p
2 < q
odd p
odd q

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
from \<open>\<not>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> prime p
[PROOF STEP]
obtain a b where *: "p = a * b" "1 < b" "1 < a"
[PROOF STATE]
proof (prove)
using this:
\<not> prime p

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>p = a * b; 1 < b; 1 < a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>2 < p\<close> prime_divisor_exists_strong[of p]
[PROOF STATE]
proof (prove)
using this:
\<not> prime p
2 < p
\<lbrakk>1 < p; \<not> prime p\<rbrakk> \<Longrightarrow> \<exists>n k. p = n * k \<and> 1 < n \<and> n < p \<and> 1 < k \<and> k < p

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

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
hence odd_ab: "odd a" "odd b"
[PROOF STATE]
proof (prove)
using this:
p = a * b
1 < b
1 < a

goal (1 subgoal):
 1. odd a &&& odd b
[PROOF STEP]
using \<open>odd p\<close>
[PROOF STATE]
proof (prove)
using this:
p = a * b
1 < b
1 < a
odd p

goal (1 subgoal):
 1. odd a &&& odd b
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
odd a
odd b

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
odd a
odd b

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
have "2 < b" and "2 < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 < b &&& 2 < a
[PROOF STEP]
using odd_ab and *
[PROOF STATE]
proof (prove)
using this:
odd a
odd b
p = a * b
1 < b
1 < a

goal (1 subgoal):
 1. 2 < b &&& 2 < a
[PROOF STEP]
by presburger+
[PROOF STATE]
proof (state)
this:
2 < b
2 < a

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 < b
2 < a

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
have "coprime a q" and "coprime b q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a q &&& coprime b q
[PROOF STEP]
using \<open>coprime p q\<close>
[PROOF STATE]
proof (prove)
using this:
coprime p q

goal (1 subgoal):
 1. coprime a q &&& coprime b q
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
coprime (a * b) q

goal (1 subgoal):
 1. coprime a q &&& coprime b q
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
coprime a q
coprime b q

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
odd a
odd b
2 < b
2 < a
coprime a q
coprime b q
[PROOF STEP]
have IH: "Jacobi a q * Jacobi q a = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2))"
                        "Jacobi b q * Jacobi q b = (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))"
[PROOF STATE]
proof (prove)
using this:
odd a
odd b
2 < b
2 < a
coprime a q
coprime b q

goal (1 subgoal):
 1. Jacobi a q * Jacobi q a = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2)) &&& Jacobi b q * Jacobi q b = (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
by (auto simp: * nonprime)
[PROOF STATE]
proof (state)
this:
Jacobi a q * Jacobi q a = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2))
Jacobi b q * Jacobi q b = (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
have pos: "0 < q" "0 < p" "0 < a" "0 < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < q &&& 0 < p) &&& 0 < a &&& 0 < b
[PROOF STEP]
using * \<open>2 < q\<close>
[PROOF STATE]
proof (prove)
using this:
p = a * b
1 < b
1 < a
2 < q

goal (1 subgoal):
 1. (0 < q &&& 0 < p) &&& 0 < a &&& 0 < b
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < q
0 < p
0 < a
0 < b

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
have "Jacobi p q * Jacobi q p = (Jacobi a q * Jacobi q a) * (Jacobi b q * Jacobi q b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi p q * Jacobi q p = Jacobi a q * Jacobi q a * (Jacobi b q * Jacobi q b)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
p = a * b
1 < b
1 < a

goal (1 subgoal):
 1. Jacobi p q * Jacobi q p = Jacobi a q * Jacobi q a * (Jacobi b q * Jacobi q b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Jacobi p q * Jacobi q p = Jacobi a q * Jacobi q a * (Jacobi b q * Jacobi q b)

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Jacobi p q * Jacobi q p = Jacobi a q * Jacobi q a * (Jacobi b q * Jacobi q b)

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
have "... = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2)) *
                     (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi a q * Jacobi q a * (Jacobi b q * Jacobi q b) = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2)) * (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
Jacobi a q * Jacobi q a = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2))
Jacobi b q * Jacobi q b = (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))

goal (1 subgoal):
 1. Jacobi a q * Jacobi q a * (Jacobi b q * Jacobi q b) = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2)) * (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
Jacobi a q * Jacobi q a * (Jacobi b q * Jacobi q b) = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2)) * (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Jacobi a q * Jacobi q a * (Jacobi b q * Jacobi q b) = (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2)) * (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2))

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
from odd_odd_even[OF odd_ab]
[PROOF STATE]
proof (chain)
picking this:
even ((a * b - 1) div 2) = even ((a - 1) div 2 + (b - 1) div 2)
[PROOF STEP]
have "... = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))"
[PROOF STATE]
proof (prove)
using this:
even ((a * b - 1) div 2) = even ((a - 1) div 2 + (b - 1) div 2)

goal (1 subgoal):
 1. (- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2)) * (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2)) = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
unfolding * minus_one_power_iff
[PROOF STATE]
proof (prove)
using this:
even ((a * b - 1) div 2) = even ((a - 1) div 2 + (b - 1) div 2)

goal (1 subgoal):
 1. (if even (nat ((a - 1) div 2 * ((q - 1) div 2))) then 1 else - 1) * (if even (nat ((b - 1) div 2 * ((q - 1) div 2))) then 1 else - 1) = (if even (nat ((a * b - 1) div 2 * ((q - 1) div 2))) then 1 else - 1)
[PROOF STEP]
using \<open>2 < q\<close> *
[PROOF STATE]
proof (prove)
using this:
even ((a * b - 1) div 2) = even ((a - 1) div 2 + (b - 1) div 2)
2 < q
p = a * b
1 < b
1 < a

goal (1 subgoal):
 1. (if even (nat ((a - 1) div 2 * ((q - 1) div 2))) then 1 else - 1) * (if even (nat ((b - 1) div 2 * ((q - 1) div 2))) then 1 else - 1) = (if even (nat ((a * b - 1) div 2 * ((q - 1) div 2))) then 1 else - 1)
[PROOF STEP]
by (auto simp add: even_nat_iff pos_imp_zdiv_nonneg_iff)
[PROOF STATE]
proof (state)
this:
(- 1) ^ nat ((a - 1) div 2 * ((q - 1) div 2)) * (- 1) ^ nat ((b - 1) div 2 * ((q - 1) div 2)) = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>\<not> prime p; \<And>pa qa. \<lbrakk>nat pa + nat qa < nat p + nat q; coprime pa qa; 2 < pa; 2 < qa; odd pa; odd qa\<rbrakk> \<Longrightarrow> Jacobi pa qa * Jacobi qa pa = (- 1) ^ nat ((pa - 1) div 2 * ((qa - 1) div 2)); coprime p q; 2 < p; 2 < q; odd p; odd q\<rbrakk> \<Longrightarrow> Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))

goal (1 subgoal):
 1. Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Jacobi p q * Jacobi q p = (- 1) ^ nat ((p - 1) div 2 * ((q - 1) div 2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in weak_partial_order) least_Upper_cong_l:
  assumes "x .= x'"
    and "x \<in> carrier L" "x' \<in> carrier L"
    and "A \<subseteq> carrier L"
  shows "least L x (Upper L A) = least L x' (Upper L A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_lub L x A = is_lub L x' A
[PROOF STEP]
apply (rule least_cong)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. x .= x'
 2. x \<in> carrier L
 3. x' \<in> carrier L
 4. is_closed (Upper L A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x .= x'
x \<in> carrier L
x' \<in> carrier L
A \<subseteq> carrier L

goal (4 subgoals):
 1. x .= x'
 2. x \<in> carrier L
 3. x' \<in> carrier L
 4. is_closed (Upper L A)
[PROOF STEP]
by auto


[STATEMENT]
lemma post_pre_left_dist_sup:
  "x\<squnion>y\<guillemotleft>-q = (x\<guillemotleft>-q)*(y\<guillemotleft>-q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> y \<guillemotleft> - q = (x \<guillemotleft> - q) * (y \<guillemotleft> - q)
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<squnion> y \<guillemotleft> - q \<le> (x \<guillemotleft> - q) * (y \<guillemotleft> - q)
 2. (x \<guillemotleft> - q) * (y \<guillemotleft> - q) \<le> x \<squnion> y \<guillemotleft> - q
[PROOF STEP]
apply (metis mult_isotone pre_closed sup_commute tests_dual.sup_idempotent pre_left_sub_dist)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<guillemotleft> - q) * (y \<guillemotleft> - q) \<le> x \<squnion> y \<guillemotleft> - q
[PROOF STEP]
by (smt (z3) order.refl pre_closed pre_post_galois sup.boundedI tests_dual.sba_dual.greatest_lower_bound tests_dual.sub_sup_closed)