[STATEMENT]
lemma signof_permutation_insert:
  assumes p: "p permutes {0..<n}" and i: "i < Suc n" and j: "j < Suc n"
  shows "signof (permutation_insert i j p) = (-1::'a::ring_1)^(i+j) * signof p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
assume "j \<le> n"
[PROOF STATE]
proof (state)
this:
j \<le> n

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
hence "signof (permutation_insert n (n-j) p) = (-1::'a)^(n+(n-j)) * signof p"
[PROOF STATE]
proof (prove)
using this:
j \<le> n

goal (1 subgoal):
 1. of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)
[PROOF STEP]
proof(induct "j")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - 0) p)) = (- (1::'a)) ^ (n + (n - 0)) * of_int (sign p)
 2. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<le> n

goal (2 subgoals):
 1. 0 \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - 0) p)) = (- (1::'a)) ^ (n + (n - 0)) * of_int (sign p)
 2. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert n (n - 0) p)) = (- (1::'a)) ^ (n + (n - 0)) * of_int (sign p)
[PROOF STEP]
using permutation_insert_base[OF p]
[PROOF STATE]
proof (prove)
using this:
permutation_insert n n p = p

goal (1 subgoal):
 1. of_int (sign (permutation_insert n (n - 0) p)) = (- (1::'a)) ^ (n + (n - 0)) * of_int (sign p)
[PROOF STEP]
by (simp add: mult_2[symmetric])
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n (n - 0) p)) = (- (1::'a)) ^ (n + (n - 0)) * of_int (sign p)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
case (Suc j)
[PROOF STATE]
proof (state)
this:
j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)
Suc j \<le> n

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
hence Sjn: "Suc j \<le> n" and j: "j < n" and Sj: "n - Suc j < n"
[PROOF STATE]
proof (prove)
using this:
j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)
Suc j \<le> n

goal (1 subgoal):
 1. Suc j \<le> n &&& j < n &&& n - Suc j < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc j \<le> n
j < n
n - Suc j < n

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
hence n0: "n > 0"
[PROOF STATE]
proof (prove)
using this:
Suc j \<le> n
j < n
n - Suc j < n

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have ease: "Suc (n - Suc j) = n - j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (n - Suc j) = n - j
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < n

goal (1 subgoal):
 1. Suc (n - Suc j) = n - j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc (n - Suc j) = n - j

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
let ?swap = "transpose (n - Suc j) (n - j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
let ?prev = "permutation_insert n (n - j) p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "signof (permutation_insert n (n - Suc j) p) = signof (?swap \<circ> ?prev)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert n (n - Suc j) p)) = of_int (sign (Transposition.transpose (n - Suc j) (n - j) \<circ> permutation_insert n (n - j) p))
[PROOF STEP]
unfolding permutation_insert_column_step [OF p Sj, unfolded ease]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert n (n - Suc j) p)) = of_int (sign (permutation_insert n (n - Suc j) p))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n (n - Suc j) p)) = of_int (sign (Transposition.transpose (n - Suc j) (n - j) \<circ> permutation_insert n (n - j) p))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n (n - Suc j) p)) = of_int (sign (Transposition.transpose (n - Suc j) (n - j) \<circ> permutation_insert n (n - j) p))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "... = signof ?swap * signof ?prev"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc j) (n - j) \<circ> permutation_insert n (n - j) p)) = of_int (sign (Transposition.transpose (n - Suc j) (n - j))) * of_int (sign (permutation_insert n (n - j) p))
[PROOF STEP]
proof(rule signof_compose)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Transposition.transpose (n - Suc j) (n - j) permutes {0..<?n}
 2. permutation_insert n (n - j) p permutes {0..<?m}
[PROOF STEP]
show "?swap permutes {0..<Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Transposition.transpose (n - Suc j) (n - j) permutes {0..<Suc n}
[PROOF STEP]
by (rule permutes_swap_id,auto)
[PROOF STATE]
proof (state)
this:
Transposition.transpose (n - Suc j) (n - j) permutes {0..<Suc n}

goal (1 subgoal):
 1. permutation_insert n (n - j) p permutes {0..<?m}
[PROOF STEP]
show "?prev permutes {0..<Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert n (n - j) p permutes {0..<Suc n}
[PROOF STEP]
by (rule permutation_insert_permutes[OF p],auto)
[PROOF STATE]
proof (state)
this:
permutation_insert n (n - j) p permutes {0..<Suc n}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_int (sign (Transposition.transpose (n - Suc j) (n - j) \<circ> permutation_insert n (n - j) p)) = of_int (sign (Transposition.transpose (n - Suc j) (n - j))) * of_int (sign (permutation_insert n (n - j) p))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (sign (Transposition.transpose (n - Suc j) (n - j) \<circ> permutation_insert n (n - j) p)) = of_int (sign (Transposition.transpose (n - Suc j) (n - j))) * of_int (sign (permutation_insert n (n - j) p))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "signof ?swap = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc j) (n - j))) = - (1::'b)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc j) (n - j))) = - (1::'b)
[PROOF STEP]
have "n - Suc j < n - j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - Suc j < n - j
[PROOF STEP]
using Sjn
[PROOF STATE]
proof (prove)
using this:
Suc j \<le> n

goal (1 subgoal):
 1. n - Suc j < n - j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n - Suc j < n - j

goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc j) (n - j))) = - (1::'b)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n - Suc j < n - j

goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc j) (n - j))) = - (1::'b)
[PROOF STEP]
unfolding sign_swap_id
[PROOF STATE]
proof (prove)
using this:
n - Suc j < n - j

goal (1 subgoal):
 1. of_int (if n - Suc j = n - j then 1 else - 1) = - (1::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int (sign (Transposition.transpose (n - Suc j) (n - j))) = - (1::'b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_int (sign (Transposition.transpose (n - Suc j) (n - j))) = - (1::?'b3)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (sign (Transposition.transpose (n - Suc j) (n - j))) = - (1::?'b3)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "signof ?prev = (-1::'a) ^ (n + (n - j)) * signof p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)
[PROOF STEP]
using Suc(1) j
[PROOF STATE]
proof (prove)
using this:
j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)
j < n

goal (1 subgoal):
 1. of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "(-1) * ... =  (-1) ^ (1 + n + (n - j)) * signof p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (1::'a) * ((- (1::'a)) ^ (n + (n - j)) * of_int (sign p)) = (- (1::'a)) ^ (1 + n + (n - j)) * of_int (sign p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (1::'a) * ((- (1::'a)) ^ (n + (n - j)) * of_int (sign p)) = (- (1::'a)) ^ (1 + n + (n - j)) * of_int (sign p)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (1::'a) * ((- (1::'a)) ^ (n + (n - j)) * of_int (sign p)) = (- (1::'a)) ^ (1 + n + (n - j)) * of_int (sign p)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "n - j = 1 + (n - Suc j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - j = 1 + (n - Suc j)
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < n

goal (1 subgoal):
 1. n - j = 1 + (n - Suc j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n - j = 1 + (n - Suc j)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n - j = 1 + (n - Suc j)

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "1 + n + ... = 2 + (n + (n - Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + n + (1 + (n - Suc j)) = 2 + (n + (n - Suc j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 + n + (1 + (n - Suc j)) = 2 + (n + (n - Suc j))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 + n + (1 + (n - Suc j)) = 2 + (n + (n - Suc j))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "(-1::'a) ^ ... = (-1) ^ 2 * (-1) ^ (n + (n - Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ (2 + (n + (n - Suc j))) = (- (1::'a))\<^sup>2 * (- (1::'a)) ^ (n + (n - Suc j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ (2 + (n + (n - Suc j))) = (- (1::'a))\<^sup>2 * (- (1::'a)) ^ (n + (n - Suc j))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ (2 + (n + (n - Suc j))) = (- (1::'a))\<^sup>2 * (- (1::'a)) ^ (n + (n - Suc j))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
have "... = (-1) ^ (n + (n - Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a))\<^sup>2 * (- (1::'a)) ^ (n + (n - Suc j)) = (- (1::'a)) ^ (n + (n - Suc j))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- (1::'a))\<^sup>2 * (- (1::'a)) ^ (n + (n - Suc j)) = (- (1::'a)) ^ (n + (n - Suc j))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p); Suc j \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n (n - Suc j) p)) = (- (1::'a)) ^ (n + (n - Suc j)) * of_int (sign p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n (n - j) p)) = (- (1::'a)) ^ (n + (n - j)) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?ja2 \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - ?ja2) p)) = (- (1::'a)) ^ (n + (n - ?ja2)) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
note col = this
[PROOF STATE]
proof (state)
this:
?ja2 \<le> n \<Longrightarrow> of_int (sign (permutation_insert n (n - ?ja2) p)) = (- (1::'a)) ^ (n + (n - ?ja2)) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
have nj: "n - j \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - j \<le> n
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < Suc n

goal (1 subgoal):
 1. n - j \<le> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n - j \<le> n

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
have row_base: "signof (permutation_insert n j p) = (-1::'a)^(n+j) * signof p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert n j p)) = (- (1::'a)) ^ (n + j) * of_int (sign p)
[PROOF STEP]
using col[OF nj]
[PROOF STATE]
proof (prove)
using this:
of_int (sign (permutation_insert n (n - (n - j)) p)) = (- (1::'a)) ^ (n + (n - (n - j))) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert n j p)) = (- (1::'a)) ^ (n + j) * of_int (sign p)
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
of_int (sign (permutation_insert n (n - (n - j)) p)) = (- (1::'a)) ^ (n + (n - (n - j))) * of_int (sign p)
j < Suc n

goal (1 subgoal):
 1. of_int (sign (permutation_insert n j p)) = (- (1::'a)) ^ (n + j) * of_int (sign p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n j p)) = (- (1::'a)) ^ (n + j) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert n j p)) = (- (1::'a)) ^ (n + j) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
assume "i \<le> n"
[PROOF STATE]
proof (state)
this:
i \<le> n

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
hence "signof (permutation_insert (n-i) j p) = (-1::'a)^((n-i)+j) * signof p"
[PROOF STATE]
proof (prove)
using this:
i \<le> n

goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)
[PROOF STEP]
proof (induct i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - 0) j p)) = (- (1::'a)) ^ (n - 0 + j) * of_int (sign p)
 2. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<le> n

goal (2 subgoals):
 1. 0 \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - 0) j p)) = (- (1::'a)) ^ (n - 0 + j) * of_int (sign p)
 2. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - 0) j p)) = (- (1::'a)) ^ (n - 0 + j) * of_int (sign p)
[PROOF STEP]
using row_base
[PROOF STATE]
proof (prove)
using this:
of_int (sign (permutation_insert n j p)) = (- (1::'a)) ^ (n + j) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - 0) j p)) = (- (1::'a)) ^ (n - 0 + j) * of_int (sign p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - 0) j p)) = (- (1::'a)) ^ (n - 0 + j) * of_int (sign p)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)
Suc i \<le> n

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
hence Sin: "Suc i \<le> n" and i: "i \<le> n" and Si: "n - Suc i < n"
[PROOF STATE]
proof (prove)
using this:
i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)
Suc i \<le> n

goal (1 subgoal):
 1. Suc i \<le> n &&& i \<le> n &&& n - Suc i < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc i \<le> n
i \<le> n
n - Suc i < n

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
have ease: "Suc (n - Suc i) = n - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (n - Suc i) = n - i
[PROOF STEP]
using Sin
[PROOF STATE]
proof (prove)
using this:
Suc i \<le> n

goal (1 subgoal):
 1. Suc (n - Suc i) = n - i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc (n - Suc i) = n - i

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
let ?prev = "permutation_insert (n-i) j p"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
let ?swap = "transpose (n - Suc i) (n-i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
have "signof (permutation_insert (n - Suc i) j p) = signof (?prev \<circ> ?swap)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - Suc i) j p)) = of_int (sign (permutation_insert (n - i) j p \<circ> Transposition.transpose (n - Suc i) (n - i)))
[PROOF STEP]
using permutation_insert_row_step[of "n - Suc i"]
[PROOF STATE]
proof (prove)
using this:
permutation_insert (Suc (n - Suc i)) ?j ?p \<circ> Transposition.transpose (n - Suc i) (Suc (n - Suc i)) = permutation_insert (n - Suc i) ?j ?p

goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - Suc i) j p)) = of_int (sign (permutation_insert (n - i) j p \<circ> Transposition.transpose (n - Suc i) (n - i)))
[PROOF STEP]
unfolding ease
[PROOF STATE]
proof (prove)
using this:
permutation_insert (n - i) ?j ?p \<circ> Transposition.transpose (n - Suc i) (n - i) = permutation_insert (n - Suc i) ?j ?p

goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - Suc i) j p)) = of_int (sign (permutation_insert (n - i) j p \<circ> Transposition.transpose (n - Suc i) (n - i)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - Suc i) j p)) = of_int (sign (permutation_insert (n - i) j p \<circ> Transposition.transpose (n - Suc i) (n - i)))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - Suc i) j p)) = of_int (sign (permutation_insert (n - i) j p \<circ> Transposition.transpose (n - Suc i) (n - i)))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
have "... = signof ?prev * signof ?swap"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - i) j p \<circ> Transposition.transpose (n - Suc i) (n - i))) = of_int (sign (permutation_insert (n - i) j p)) * of_int (sign (Transposition.transpose (n - Suc i) (n - i)))
[PROOF STEP]
proof(rule signof_compose)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. permutation_insert (n - i) j p permutes {0..<?n}
 2. Transposition.transpose (n - Suc i) (n - i) permutes {0..<?m}
[PROOF STEP]
show "?swap permutes {0..<Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Transposition.transpose (n - Suc i) (n - i) permutes {0..<Suc n}
[PROOF STEP]
by (rule permutes_swap_id,auto)
[PROOF STATE]
proof (state)
this:
Transposition.transpose (n - Suc i) (n - i) permutes {0..<Suc n}

goal (1 subgoal):
 1. permutation_insert (n - i) j p permutes {0..<?n}
[PROOF STEP]
show "?prev permutes {0..<Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert (n - i) j p permutes {0..<Suc n}
[PROOF STEP]
apply(rule permutation_insert_permutes[OF p])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n - i < Suc n
 2. j < Suc n
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < Suc n

goal (2 subgoals):
 1. n - i < Suc n
 2. j < Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
permutation_insert (n - i) j p permutes {0..<Suc n}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - i) j p \<circ> Transposition.transpose (n - Suc i) (n - i))) = of_int (sign (permutation_insert (n - i) j p)) * of_int (sign (Transposition.transpose (n - Suc i) (n - i)))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - i) j p \<circ> Transposition.transpose (n - Suc i) (n - i))) = of_int (sign (permutation_insert (n - i) j p)) * of_int (sign (Transposition.transpose (n - Suc i) (n - i)))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
have "signof ?swap = (-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc i) (n - i))) = - (1::'b)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc i) (n - i))) = - (1::'b)
[PROOF STEP]
have "n - Suc i < n - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - Suc i < n - i
[PROOF STEP]
using Sin
[PROOF STATE]
proof (prove)
using this:
Suc i \<le> n

goal (1 subgoal):
 1. n - Suc i < n - i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n - Suc i < n - i

goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc i) (n - i))) = - (1::'b)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n - Suc i < n - i

goal (1 subgoal):
 1. of_int (sign (Transposition.transpose (n - Suc i) (n - i))) = - (1::'b)
[PROOF STEP]
unfolding sign_swap_id
[PROOF STATE]
proof (prove)
using this:
n - Suc i < n - i

goal (1 subgoal):
 1. of_int (if n - Suc i = n - i then 1 else - 1) = - (1::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int (sign (Transposition.transpose (n - Suc i) (n - i))) = - (1::'b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_int (sign (Transposition.transpose (n - Suc i) (n - i))) = - (1::?'b3)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (sign (Transposition.transpose (n - Suc i) (n - i))) = - (1::?'b3)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
have "signof ?prev = (-1::'a) ^ (n - i + j) * signof p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)
[PROOF STEP]
using Suc(1)[OF i]
[PROOF STATE]
proof (prove)
using this:
of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
have "... * (-1) = (-1) ^ Suc (n - i + j) * signof p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ (n - i + j) * of_int (sign p) * - (1::'a) = (- (1::'a)) ^ Suc (n - i + j) * of_int (sign p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ (n - i + j) * of_int (sign p) * - (1::'a) = (- (1::'a)) ^ Suc (n - i + j) * of_int (sign p)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ (n - i + j) * of_int (sign p) * - (1::'a) = (- (1::'a)) ^ Suc (n - i + j) * of_int (sign p)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
have "Suc (n - i + j) = Suc (Suc (n - Suc i + j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (n - i + j) = Suc (Suc (n - Suc i + j))
[PROOF STEP]
using Sin
[PROOF STATE]
proof (prove)
using this:
Suc i \<le> n

goal (1 subgoal):
 1. Suc (n - i + j) = Suc (Suc (n - Suc i + j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc (n - i + j) = Suc (Suc (n - Suc i + j))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc (n - i + j) = Suc (Suc (n - Suc i + j))

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
have "(-1::int) ^ ... = (-1) ^ (n - Suc i + j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ Suc (Suc (n - Suc i + j)) = (- 1) ^ (n - Suc i + j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(- 1) ^ Suc (Suc (n - Suc i + j)) = (- 1) ^ (n - Suc i + j)

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p); Suc i \<le> n\<rbrakk> \<Longrightarrow> of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ Suc (Suc (n - Suc i + j)) * of_int (sign p)
(- 1) ^ Suc (Suc (n - Suc i + j)) = (- 1) ^ (n - Suc i + j)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ Suc (Suc (n - Suc i + j)) * of_int (sign p)
(- 1) ^ Suc (Suc (n - Suc i + j)) = (- 1) ^ (n - Suc i + j)

goal (1 subgoal):
 1. of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - Suc i) j p)) = (- (1::'a)) ^ (n - Suc i + j) * of_int (sign p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert (n - i) j p)) = (- (1::'a)) ^ (n - i + j) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?ia2 \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - ?ia2) j p)) = (- (1::'a)) ^ (n - ?ia2 + j) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
note row = this
[PROOF STATE]
proof (state)
this:
?ia2 \<le> n \<Longrightarrow> of_int (sign (permutation_insert (n - ?ia2) j p)) = (- (1::'a)) ^ (n - ?ia2 + j) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
have ni: "n - i \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - i \<le> n
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < Suc n

goal (1 subgoal):
 1. n - i \<le> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n - i \<le> n

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
using row[OF ni]
[PROOF STATE]
proof (prove)
using this:
of_int (sign (permutation_insert (n - (n - i)) j p)) = (- (1::'a)) ^ (n - (n - i) + j) * of_int (sign p)

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
of_int (sign (permutation_insert (n - (n - i)) j p)) = (- (1::'a)) ^ (n - (n - i) + j) * of_int (sign p)
i < Suc n

goal (1 subgoal):
 1. of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int (sign (permutation_insert i j p)) = (- (1::'a)) ^ (i + j) * of_int (sign p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stream_vwb_lens: "vwb_lens (stream_lens i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vwb_lens (stream_lens i)
[PROOF STEP]
apply (unfold_locales; simp add: stream_lens_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>\<sigma> v. stream_update \<sigma> i v !! i = v
 2. \<And>\<sigma>. stream_update \<sigma> i (\<sigma> !! i) = \<sigma>
 3. \<And>\<sigma> v u. stream_update (stream_update \<sigma> i v) i u = stream_update \<sigma> i u
[PROOF STEP]
apply (rule stream_update_snth)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>\<sigma>. stream_update \<sigma> i (\<sigma> !! i) = \<sigma>
 2. \<And>\<sigma> v u. stream_update (stream_update \<sigma> i v) i u = stream_update \<sigma> i u
[PROOF STEP]
apply (rule stream_update_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>\<sigma> v u. stream_update (stream_update \<sigma> i v) i u = stream_update \<sigma> i u
[PROOF STEP]
apply (rule stream_update_override)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mat_diag_diag[simp]: "mat_diag n f * mat_diag n g = mat_diag n (\<lambda> i. f i * g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_diag n f * mat_diag n g = mat_diag n (\<lambda>i. f i * g i)
[PROOF STEP]
by (subst mat_diag_mult_left[of _ n n], auto simp: mat_diag_def)


[STATEMENT]
lemma theI':
  assumes "P a"
    and "\<And>x. P x \<Longrightarrow> x = a"
  shows "P (THE x. P x) \<and> (\<forall> y. P y \<longrightarrow> y = (THE x. P x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (THE x. P x) \<and> (\<forall>y. P y \<longrightarrow> y = (THE x. P x))
[PROOF STEP]
using theI assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P ?a; \<And>x. ?P x \<Longrightarrow> x = ?a\<rbrakk> \<Longrightarrow> ?P (THE x. ?P x)
P a
P ?x5 \<Longrightarrow> ?x5 = a

goal (1 subgoal):
 1. P (THE x. P x) \<and> (\<forall>y. P y \<longrightarrow> y = (THE x. P x))
[PROOF STEP]
by metis


[STATEMENT]
lemma f_Exec_Stream_expand_shrink_last_map_nth_eq_f_Exec_Comp: "
  \<lbrakk> 0 < k; n < length xs \<rbrakk> \<Longrightarrow>
  map f (f_Exec_Comp_Stream trans_fun (xs \<odot>\<^sub>f k) c) \<div>\<^bsub>fl\<^esub> k ! n =
  f (f_Exec_Comp trans_fun ((xs \<down> Suc n) \<odot>\<^sub>f k) c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; n < length xs\<rbrakk> \<Longrightarrow> map f (f_Exec_Comp_Stream trans_fun (xs \<odot> k) c) \<div>\<^sub>l k ! n = f (f_Exec_Comp trans_fun (xs \<down> Suc n \<odot> k) c)
[PROOF STEP]
apply (simp add: f_shrink_last_map f_shrink_last_length f_shrink_last_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; n < length xs\<rbrakk> \<Longrightarrow> f (f_Exec_Comp_Stream trans_fun (xs \<odot> k) c ! (n * k + k - Suc 0)) = f (f_Exec_Comp trans_fun (xs \<down> Suc n \<odot> k) c)
[PROOF STEP]
apply (subgoal_tac "n * k + k - Suc 0 < length xs * k")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; n < length xs; n * k + k - Suc 0 < length xs * k\<rbrakk> \<Longrightarrow> f (f_Exec_Comp_Stream trans_fun (xs \<odot> k) c ! (n * k + k - Suc 0)) = f (f_Exec_Comp trans_fun (xs \<down> Suc n \<odot> k) c)
 2. \<lbrakk>0 < k; n < length xs\<rbrakk> \<Longrightarrow> n * k + k - Suc 0 < length xs * k
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; n < length xs\<rbrakk> \<Longrightarrow> n * k + k - Suc 0 < length xs * k
 2. \<lbrakk>0 < k; n < length xs; n * k + k - Suc 0 < length xs * k\<rbrakk> \<Longrightarrow> f (f_Exec_Comp_Stream trans_fun (xs \<odot> k) c ! (n * k + k - Suc 0)) = f (f_Exec_Comp trans_fun (xs \<down> Suc n \<odot> k) c)
[PROOF STEP]
apply (drule Suc_leI[of n])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; Suc n \<le> length xs\<rbrakk> \<Longrightarrow> n * k + k - Suc 0 < length xs * k
 2. \<lbrakk>0 < k; n < length xs; n * k + k - Suc 0 < length xs * k\<rbrakk> \<Longrightarrow> f (f_Exec_Comp_Stream trans_fun (xs \<odot> k) c ! (n * k + k - Suc 0)) = f (f_Exec_Comp trans_fun (xs \<down> Suc n \<odot> k) c)
[PROOF STEP]
apply (drule mult_le_mono1[of _ _ k], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; n < length xs; n * k + k - Suc 0 < length xs * k\<rbrakk> \<Longrightarrow> f (f_Exec_Comp_Stream trans_fun (xs \<odot> k) c ! (n * k + k - Suc 0)) = f (f_Exec_Comp trans_fun (xs \<down> Suc n \<odot> k) c)
[PROOF STEP]
apply (simp add: f_Exec_Stream_nth add.commute[of k] f_expand_take_mult[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_states_to_list_states_observable :
  assumes "\<And> x . x \<in> states M \<Longrightarrow> finite x"
  assumes "observable M"
  shows "observable (set_states_to_list_states M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. observable (set_states_to_list_states M)
[PROOF STEP]
using rename_states_observable[OF linorder_set_list_bij[OF assms(1)] assms(2)]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> FSM.states M \<Longrightarrow> x \<in> FSM.states M) \<Longrightarrow> observable (FSM.rename_states M sorted_list_of_set)

goal (1 subgoal):
 1. observable (set_states_to_list_states M)
[PROOF STEP]
unfolding set_states_to_list_states_def
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> FSM.states M \<Longrightarrow> x \<in> FSM.states M) \<Longrightarrow> observable (FSM.rename_states M sorted_list_of_set)

goal (1 subgoal):
 1. observable (FSM.rename_states M sorted_list_of_set)
[PROOF STEP]
by blast


[STATEMENT]
lemma iMOD_minus_divisor_mult: "
  \<lbrakk> x \<in> [r, mod m]; k * m \<le> x - r \<rbrakk> \<Longrightarrow> x - k * m \<in> [r, mod m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> [ r, mod m ]; k * m \<le> x - r\<rbrakk> \<Longrightarrow> x - k * m \<in> [ r, mod m ]
[PROOF STEP]
by (fastforce simp: iMOD_def mod_diff_mult_self1)


[STATEMENT]
lemma distinguishing_set_or_state_identifier_distinguishes :
  assumes "observable M"
  and     "minimal M"
  and     "q1 \<in> states M" and "q2 \<in> states M" and "q1 \<noteq> q2"
shows "\<exists> io . \<forall> k1 k2 . io \<in> set (distinguishing_set_or_state_identifier l M k1 q1) \<inter> set (distinguishing_set_or_state_identifier l M k2 q2) \<and> distinguishes M q1 q2 io"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k1 q1) \<inter> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k2 q2) \<and> distinguishes M q1 q2 io
[PROOF STEP]
using get_HSI_distinguishes[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>io\<in>Prefix_Tree.set (get_HSI M q1) \<inter> Prefix_Tree.set (get_HSI M q2). distinguishes M q1 q2 io

goal (1 subgoal):
 1. \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k1 q1) \<inter> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k2 q2) \<and> distinguishes M q1 q2 io
[PROOF STEP]
using distinguishing_set_distinguishes[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>io\<in>Prefix_Tree.set (get_HSI M q1) \<inter> Prefix_Tree.set (get_HSI M q2). distinguishes M q1 q2 io
\<exists>io\<in>Prefix_Tree.set (distinguishing_set M). distinguishes M q1 q2 io

goal (1 subgoal):
 1. \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k1 q1) \<inter> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k2 q2) \<and> distinguishes M q1 q2 io
[PROOF STEP]
using get_HSI_subset[OF assms(1,2,3)]
[PROOF STATE]
proof (prove)
using this:
\<exists>io\<in>Prefix_Tree.set (get_HSI M q1) \<inter> Prefix_Tree.set (get_HSI M q2). distinguishes M q1 q2 io
\<exists>io\<in>Prefix_Tree.set (distinguishing_set M). distinguishes M q1 q2 io
Prefix_Tree.set (get_HSI M q1) \<subseteq> Prefix_Tree.set (distinguishing_set M)

goal (1 subgoal):
 1. \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k1 q1) \<inter> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k2 q2) \<and> distinguishes M q1 q2 io
[PROOF STEP]
using get_HSI_subset[OF assms(1,2,4)]
[PROOF STATE]
proof (prove)
using this:
\<exists>io\<in>Prefix_Tree.set (get_HSI M q1) \<inter> Prefix_Tree.set (get_HSI M q2). distinguishes M q1 q2 io
\<exists>io\<in>Prefix_Tree.set (distinguishing_set M). distinguishes M q1 q2 io
Prefix_Tree.set (get_HSI M q1) \<subseteq> Prefix_Tree.set (distinguishing_set M)
Prefix_Tree.set (get_HSI M q2) \<subseteq> Prefix_Tree.set (distinguishing_set M)

goal (1 subgoal):
 1. \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k1 q1) \<inter> Prefix_Tree.set (distinguishing_set_or_state_identifier l M k2 q2) \<and> distinguishes M q1 q2 io
[PROOF STEP]
unfolding distinguishing_set_or_state_identifier.simps
[PROOF STATE]
proof (prove)
using this:
\<exists>io\<in>Prefix_Tree.set (get_HSI M q1) \<inter> Prefix_Tree.set (get_HSI M q2). distinguishes M q1 q2 io
\<exists>io\<in>Prefix_Tree.set (distinguishing_set M). distinguishes M q1 q2 io
Prefix_Tree.set (get_HSI M q1) \<subseteq> Prefix_Tree.set (distinguishing_set M)
Prefix_Tree.set (get_HSI M q2) \<subseteq> Prefix_Tree.set (distinguishing_set M)

goal (1 subgoal):
 1. \<exists>io. \<forall>k1 k2. io \<in> Prefix_Tree.set (if k1 = l then get_HSI M q1 else distinguishing_set M) \<inter> Prefix_Tree.set (if k2 = l then get_HSI M q2 else distinguishing_set M) \<and> distinguishes M q1 q2 io
[PROOF STEP]
by auto


[STATEMENT]
lemma rk_\<alpha>\<beta>\<gamma>_special_case_2 :
  assumes "desargues_config_2D A B C A' B' C' P \<alpha> \<beta> \<gamma>" and "rk {B', P} = 1"
  shows "rk {\<alpha>, \<beta>, \<gamma>} \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
have "desargues_config_2D B A C B' A' C' P \<beta> \<alpha> \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. desargues_config_2D B A C B' A' C' P \<beta> \<alpha> \<gamma>
[PROOF STEP]
using assms(1) desargues_config_2D_def[of A B C A' B' C' P \<alpha> \<beta> \<gamma>]
      desargues_config_2D_def[of B A C B' A' C' P \<beta> \<alpha> \<gamma>]
[PROOF STATE]
proof (prove)
using this:
desargues_config_2D A B C A' B' C' P \<alpha> \<beta> \<gamma>
desargues_config_2D A B C A' B' C' P \<alpha> \<beta> \<gamma> \<equiv> rk {A, B, C} = 3 \<and> rk {A', B', C'} = 3 \<and> rk {A, A', P} = 2 \<and> rk {B, B', P} = 2 \<and> rk {C, C', P} = 2 \<and> rk {A, B, \<gamma>} = 2 \<and> rk {A', B', \<gamma>} = 2 \<and> rk {A, C, \<beta>} = 2 \<and> rk {A', C', \<beta>} = 2 \<and> rk {B, C, \<alpha>} = 2 \<and> rk {B', C', \<alpha>} = 2 \<and> rk {A, B, C, A', B', C'} = 3 \<and> rk {A, B, P} = 3 \<and> rk {A, C, P} = 3 \<and> rk {B, C, P} = 3 \<and> rk {A, A'} = 2 \<and> rk {B, B'} = 2 \<and> rk {C, C'} = 2
desargues_config_2D B A C B' A' C' P \<beta> \<alpha> \<gamma> \<equiv> rk {B, A, C} = 3 \<and> rk {B', A', C'} = 3 \<and> rk {B, B', P} = 2 \<and> rk {A, A', P} = 2 \<and> rk {C, C', P} = 2 \<and> rk {B, A, \<gamma>} = 2 \<and> rk {B', A', \<gamma>} = 2 \<and> rk {B, C, \<alpha>} = 2 \<and> rk {B', C', \<alpha>} = 2 \<and> rk {A, C, \<beta>} = 2 \<and> rk {A', C', \<beta>} = 2 \<and> rk {B, A, C, B', A', C'} = 3 \<and> rk {B, A, P} = 3 \<and> rk {B, C, P} = 3 \<and> rk {A, C, P} = 3 \<and> rk {B, B'} = 2 \<and> rk {A, A'} = 2 \<and> rk {C, C'} = 2

goal (1 subgoal):
 1. desargues_config_2D B A C B' A' C' P \<beta> \<alpha> \<gamma>
[PROOF STEP]
by (metis insert_commute)
[PROOF STATE]
proof (state)
this:
desargues_config_2D B A C B' A' C' P \<beta> \<alpha> \<gamma>

goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
thus "rk {\<alpha>, \<beta>, \<gamma>} \<le> 2"
[PROOF STATE]
proof (prove)
using this:
desargues_config_2D B A C B' A' C' P \<beta> \<alpha> \<gamma>

goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
using rk_\<alpha>\<beta>\<gamma>_special_case_1[of B A C B' A' C' P \<beta> \<alpha> \<gamma>] assms(2)
[PROOF STATE]
proof (prove)
using this:
desargues_config_2D B A C B' A' C' P \<beta> \<alpha> \<gamma>
\<lbrakk>desargues_config_2D B A C B' A' C' P \<beta> \<alpha> \<gamma>; rk {B', P} = 1\<rbrakk> \<Longrightarrow> rk {\<beta>, \<alpha>, \<gamma>} \<le> 2
rk {B', P} = 1

goal (1 subgoal):
 1. rk {\<alpha>, \<beta>, \<gamma>} \<le> 2
[PROOF STEP]
by (simp add: insert_commute)
[PROOF STATE]
proof (state)
this:
rk {\<alpha>, \<beta>, \<gamma>} \<le> 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ints_not_limpt: "\<not>((x :: 'a :: real_normed_algebra_1) islimpt \<int>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> x islimpt \<int>
[PROOF STEP]
by (rule discrete_imp_not_islimpt[of 1]) (auto elim!: Ints_cases simp: dist_of_int)


[STATEMENT]
lemma mat_associativity: "mat_mul (mat_mul D B) C = mat_mul D (mat_mul B C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_mul (mat_mul D B) C = mat_mul D (mat_mul B C)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. (mat_11 D * mat_11 B + mat_12 D * mat_21 B) * mat_11 C + (mat_11 D * mat_12 B + mat_12 D * mat_22 B) * mat_21 C = mat_11 D * (mat_11 B * mat_11 C + mat_12 B * mat_21 C) + mat_12 D * (mat_21 B * mat_11 C + mat_22 B * mat_21 C)
 2. (mat_11 D * mat_11 B + mat_12 D * mat_21 B) * mat_12 C + (mat_11 D * mat_12 B + mat_12 D * mat_22 B) * mat_22 C = mat_11 D * (mat_11 B * mat_12 C + mat_12 B * mat_22 C) + mat_12 D * (mat_21 B * mat_12 C + mat_22 B * mat_22 C)
 3. (mat_21 D * mat_11 B + mat_22 D * mat_21 B) * mat_11 C + (mat_21 D * mat_12 B + mat_22 D * mat_22 B) * mat_21 C = mat_21 D * (mat_11 B * mat_11 C + mat_12 B * mat_21 C) + mat_22 D * (mat_21 B * mat_11 C + mat_22 B * mat_21 C)
 4. (mat_21 D * mat_11 B + mat_22 D * mat_21 B) * mat_12 C + (mat_21 D * mat_12 B + mat_22 D * mat_22 B) * mat_22 C = mat_21 D * (mat_11 B * mat_12 C + mat_12 B * mat_22 C) + mat_22 D * (mat_21 B * mat_12 C + mat_22 B * mat_22 C)
[PROOF STEP]
by algebra+


[STATEMENT]
lemma one_strongly_connected_implies_8:
  assumes "one_strongly_connected x"
    shows "x;1;x \<le> x\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ; 1 ; x \<le> x\<^sup>\<star>
[PROOF STEP]
using assms one_strongly_connected_iff
[PROOF STATE]
proof (prove)
using this:
one_strongly_connected x
one_strongly_connected ?x = (connected ?x \<and> many_strongly_connected ?x)

goal (1 subgoal):
 1. x ; 1 ; x \<le> x\<^sup>\<star>
[PROOF STEP]
by fastforce


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


[STATEMENT]
lemma lowner_le_trace:
  assumes A: "A \<in> carrier_mat n n"
    and B: "B \<in> carrier_mat n n"
  shows "A \<le>\<^sub>L B \<longleftrightarrow> (\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<le>\<^sub>L B) = (\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>))
[PROOF STEP]
proof (rule iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
have dimBmA: "B - A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B - A \<in> carrier_mat n n
[PROOF STEP]
using A B
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. B - A \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B - A \<in> carrier_mat n n

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
B - A \<in> carrier_mat n n

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
assume "A \<le>\<^sub>L B"
[PROOF STATE]
proof (state)
this:
A \<le>\<^sub>L B

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<le>\<^sub>L B
[PROOF STEP]
have pBmA: "positive (B - A)"
[PROOF STATE]
proof (prove)
using this:
A \<le>\<^sub>L B

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
using lowner_le_def
[PROOF STATE]
proof (prove)
using this:
A \<le>\<^sub>L B
(?A \<le>\<^sub>L ?B) = (dim_row ?A = dim_row ?B \<and> dim_col ?A = dim_col ?B \<and> positive (?B - ?A))

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
positive (B - A)

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
positive (B - A)

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
have "B - A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B - A \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. B - A \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B - A \<in> carrier_mat n n

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
positive (B - A)
B - A \<in> carrier_mat n n
[PROOF STEP]
have "\<exists>M\<in>carrier_mat n n. M * adjoint M = B - A"
[PROOF STATE]
proof (prove)
using this:
positive (B - A)
B - A \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>M\<in>carrier_mat n n. M * adjoint M = B - A
[PROOF STEP]
using positive_iff_decomp[of "B - A"]
[PROOF STATE]
proof (prove)
using this:
positive (B - A)
B - A \<in> carrier_mat n n
B - A \<in> carrier_mat ?n ?n \<Longrightarrow> positive (B - A) = (\<exists>M\<in>carrier_mat ?n ?n. M * adjoint M = B - A)

goal (1 subgoal):
 1. \<exists>M\<in>carrier_mat n n. M * adjoint M = B - A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>M\<in>carrier_mat n n. M * adjoint M = B - A

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>M\<in>carrier_mat n n. M * adjoint M = B - A
[PROOF STEP]
obtain M where dimM: "M \<in> carrier_mat n n" and M: "M * adjoint M = B - A"
[PROOF STATE]
proof (prove)
using this:
\<exists>M\<in>carrier_mat n n. M * adjoint M = B - A

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

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
M \<in> carrier_mat n n
M * adjoint M = B - A

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
fix \<rho>
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
assume dimr: "\<rho> \<in> carrier_mat n n" and pdr: "partial_density_operator \<rho>"
[PROOF STATE]
proof (state)
this:
\<rho> \<in> carrier_mat n n
partial_density_operator \<rho>

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
have eq: "trace(B * \<rho>) - trace(A * \<rho>) = trace((B - A) * \<rho>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (B * \<rho>) - trace (A * \<rho>) = trace ((B - A) * \<rho>)
[PROOF STEP]
using A B dimr
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
\<rho> \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (B * \<rho>) - trace (A * \<rho>) = trace ((B - A) * \<rho>)
[PROOF STEP]
apply (subst minus_mult_distrib_mat, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat n n; B \<in> carrier_mat n n; \<rho> \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> trace (B * \<rho>) - trace (A * \<rho>) = trace (B * \<rho> - A * \<rho>)
[PROOF STEP]
apply (subst trace_minus_linear, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
trace (B * \<rho>) - trace (A * \<rho>) = trace ((B - A) * \<rho>)

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
have pr: "positive \<rho>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive \<rho>
[PROOF STEP]
using pdr partial_density_operator_def
[PROOF STATE]
proof (prove)
using this:
partial_density_operator \<rho>
partial_density_operator ?A = (positive ?A \<and> trace ?A \<le> 1)

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

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
positive \<rho>
[PROOF STEP]
have "\<exists>P\<in>carrier_mat n n. \<rho> = P * adjoint P"
[PROOF STATE]
proof (prove)
using this:
positive \<rho>

goal (1 subgoal):
 1. \<exists>P\<in>carrier_mat n n. \<rho> = P * adjoint P
[PROOF STEP]
using positive_iff_decomp dimr
[PROOF STATE]
proof (prove)
using this:
positive \<rho>
?A \<in> carrier_mat ?n ?n \<Longrightarrow> positive ?A = (\<exists>M\<in>carrier_mat ?n ?n. M * adjoint M = ?A)
\<rho> \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>P\<in>carrier_mat n n. \<rho> = P * adjoint P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>P\<in>carrier_mat n n. \<rho> = P * adjoint P

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>P\<in>carrier_mat n n. \<rho> = P * adjoint P
[PROOF STEP]
obtain P where dimP: "P \<in> carrier_mat n n" and P: "\<rho> = P * adjoint P"
[PROOF STATE]
proof (prove)
using this:
\<exists>P\<in>carrier_mat n n. \<rho> = P * adjoint P

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>P \<in> carrier_mat n n; \<rho> = P * adjoint P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat n n
\<rho> = P * adjoint P

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
have "trace((B - A) * \<rho>) = trace(M * adjoint M * (P * adjoint P))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace ((B - A) * \<rho>) = trace (M * adjoint M * (P * adjoint P))
[PROOF STEP]
using P M
[PROOF STATE]
proof (prove)
using this:
\<rho> = P * adjoint P
M * adjoint M = B - A

goal (1 subgoal):
 1. trace ((B - A) * \<rho>) = trace (M * adjoint M * (P * adjoint P))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace ((B - A) * \<rho>) = trace (M * adjoint M * (P * adjoint P))

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace ((B - A) * \<rho>) = trace (M * adjoint M * (P * adjoint P))

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
have "\<dots> = trace((adjoint P * M) * adjoint (adjoint P * M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M * adjoint M * (P * adjoint P)) = trace (adjoint P * M * adjoint (adjoint P * M))
[PROOF STEP]
using dimM dimP
[PROOF STATE]
proof (prove)
using this:
M \<in> carrier_mat n n
P \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (M * adjoint M * (P * adjoint P)) = trace (adjoint P * M * adjoint (adjoint P * M))
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
trace (M * adjoint M * (P * adjoint P)) = trace (adjoint P * M * adjoint (adjoint P * M))

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (M * adjoint M * (P * adjoint P)) = trace (adjoint P * M * adjoint (adjoint P * M))

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
have "\<dots> \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> trace (adjoint P * M * adjoint (adjoint P * M))
[PROOF STEP]
using trace_adjoint_positive
[PROOF STATE]
proof (prove)
using this:
0 \<le> trace (?A * adjoint ?A)

goal (1 subgoal):
 1. 0 \<le> trace (adjoint P * M * adjoint (adjoint P * M))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> trace (adjoint P * M * adjoint (adjoint P * M))

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<le> trace ((B - A) * \<rho>)
[PROOF STEP]
have "trace((B - A) * \<rho>) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> trace ((B - A) * \<rho>)

goal (1 subgoal):
 1. 0 \<le> trace ((B - A) * \<rho>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
0 \<le> trace ((B - A) * \<rho>)

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
trace (B * \<rho>) - trace (A * \<rho>) = trace ((B - A) * \<rho>)
0 \<le> trace ((B - A) * \<rho>)
[PROOF STEP]
have " trace (B * \<rho>) - trace (A * \<rho>) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
trace (B * \<rho>) - trace (A * \<rho>) = trace ((B - A) * \<rho>)
0 \<le> trace ((B - A) * \<rho>)

goal (1 subgoal):
 1. 0 \<le> trace (B * \<rho>) - trace (A * \<rho>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> trace (B * \<rho>) - trace (A * \<rho>)

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?\<rho>2 \<in> carrier_mat n n; partial_density_operator ?\<rho>2\<rbrakk> \<Longrightarrow> 0 \<le> trace (B * ?\<rho>2) - trace (A * ?\<rho>2)

goal (2 subgoals):
 1. A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
 2. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?\<rho>2 \<in> carrier_mat n n; partial_density_operator ?\<rho>2\<rbrakk> \<Longrightarrow> 0 \<le> trace (B * ?\<rho>2) - trace (A * ?\<rho>2)
[PROOF STEP]
show "\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<rho>2 \<in> carrier_mat n n; partial_density_operator ?\<rho>2\<rbrakk> \<Longrightarrow> 0 \<le> trace (B * ?\<rho>2) - trace (A * ?\<rho>2)

goal (1 subgoal):
 1. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)

goal (1 subgoal):
 1. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)

goal (1 subgoal):
 1. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
A \<le>\<^sub>L B \<Longrightarrow> \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)

goal (1 subgoal):
 1. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
assume asm: "\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)"
[PROOF STATE]
proof (state)
this:
\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)

goal (1 subgoal):
 1. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
have "positive (B - A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
assume "dim_vec (v::complex vec) = dim_col (B - A) \<and> vec_norm v = 1"
[PROOF STATE]
proof (state)
this:
dim_vec v = dim_col (B - A) \<and> vec_norm v = 1

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_vec v = dim_col (B - A) \<and> vec_norm v = 1
[PROOF STEP]
have dimv: "v \<in> carrier_vec n" and nv: "vec_norm v = 1"
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_col (B - A) \<and> vec_norm v = 1

goal (1 subgoal):
 1. v \<in> carrier_vec n &&& vec_norm v = 1
[PROOF STEP]
using carrier_matD[OF dimBmA]
[PROOF STATE]
proof (prove)
using this:
dim_vec v = dim_col (B - A) \<and> vec_norm v = 1
dim_row (B - A) = n
dim_col (B - A) = n

goal (1 subgoal):
 1. v \<in> carrier_vec n &&& vec_norm v = 1
[PROOF STEP]
by (auto intro: carrier_vecI)
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec n
vec_norm v = 1

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
have dimov: "outer_prod v v \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod v v \<in> carrier_mat n n
[PROOF STEP]
using dimv
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n

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

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
outer_prod v v \<in> carrier_mat n n
[PROOF STEP]
have "partial_density_operator (outer_prod v v)"
[PROOF STATE]
proof (prove)
using this:
outer_prod v v \<in> carrier_mat n n

goal (1 subgoal):
 1. partial_density_operator (outer_prod v v)
[PROOF STEP]
using dimv nv pure_state_self_outer_prod_is_partial_density_operator
[PROOF STATE]
proof (prove)
using this:
outer_prod v v \<in> carrier_mat n n
v \<in> carrier_vec n
vec_norm v = 1
\<lbrakk>?v \<in> carrier_vec ?n; vec_norm ?v = 1\<rbrakk> \<Longrightarrow> partial_density_operator (outer_prod ?v ?v)

goal (1 subgoal):
 1. partial_density_operator (outer_prod v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
partial_density_operator (outer_prod v v)

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
partial_density_operator (outer_prod v v)
[PROOF STEP]
have leq: "trace(A * (outer_prod v v)) \<le> trace(B * (outer_prod v v))"
[PROOF STATE]
proof (prove)
using this:
partial_density_operator (outer_prod v v)

goal (1 subgoal):
 1. trace (A * outer_prod v v) \<le> trace (B * outer_prod v v)
[PROOF STEP]
using asm dimov
[PROOF STATE]
proof (prove)
using this:
partial_density_operator (outer_prod v v)
\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>)
outer_prod v v \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (A * outer_prod v v) \<le> trace (B * outer_prod v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (A * outer_prod v v) \<le> trace (B * outer_prod v v)

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
have "trace((B - A) * (outer_prod v v)) = trace(B * (outer_prod v v)) - trace(A * (outer_prod v v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace ((B - A) * outer_prod v v) = trace (B * outer_prod v v) - trace (A * outer_prod v v)
[PROOF STEP]
using A B dimov
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
outer_prod v v \<in> carrier_mat n n

goal (1 subgoal):
 1. trace ((B - A) * outer_prod v v) = trace (B * outer_prod v v) - trace (A * outer_prod v v)
[PROOF STEP]
apply (subst minus_mult_distrib_mat, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat n n; B \<in> carrier_mat n n; outer_prod v v \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> trace (B * outer_prod v v - A * outer_prod v v) = trace (B * outer_prod v v) - trace (A * outer_prod v v)
[PROOF STEP]
apply (subst trace_minus_linear, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
trace ((B - A) * outer_prod v v) = trace (B * outer_prod v v) - trace (A * outer_prod v v)

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
trace ((B - A) * outer_prod v v) = trace (B * outer_prod v v) - trace (A * outer_prod v v)
[PROOF STEP]
have "trace((B - A) * (outer_prod v v)) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
trace ((B - A) * outer_prod v v) = trace (B * outer_prod v v) - trace (A * outer_prod v v)

goal (1 subgoal):
 1. 0 \<le> trace ((B - A) * outer_prod v v)
[PROOF STEP]
using leq
[PROOF STATE]
proof (prove)
using this:
trace ((B - A) * outer_prod v v) = trace (B * outer_prod v v) - trace (A * outer_prod v v)
trace (A * outer_prod v v) \<le> trace (B * outer_prod v v)

goal (1 subgoal):
 1. 0 \<le> trace ((B - A) * outer_prod v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> trace ((B - A) * outer_prod v v)

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> trace ((B - A) * outer_prod v v)
[PROOF STEP]
have "inner_prod v ((B - A) *\<^sub>v v) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> trace ((B - A) * outer_prod v v)

goal (1 subgoal):
 1. 0 \<le> inner_prod v ((B - A) *\<^sub>v v)
[PROOF STEP]
using trace_outer_prod_right[OF dimBmA dimv dimv]
[PROOF STATE]
proof (prove)
using this:
0 \<le> trace ((B - A) * outer_prod v v)
trace ((B - A) * outer_prod v v) = inner_prod v ((B - A) *\<^sub>v v)

goal (1 subgoal):
 1. 0 \<le> inner_prod v ((B - A) *\<^sub>v v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> inner_prod v ((B - A) *\<^sub>v v)

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
dim_vec ?v2 = dim_col (B - A) \<and> vec_norm ?v2 = 1 \<Longrightarrow> 0 \<le> inner_prod ?v2 ((B - A) *\<^sub>v ?v2)

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_vec ?v2 = dim_col (B - A) \<and> vec_norm ?v2 = 1 \<Longrightarrow> 0 \<le> inner_prod ?v2 ((B - A) *\<^sub>v ?v2)
[PROOF STEP]
show "positive (B - A)"
[PROOF STATE]
proof (prove)
using this:
dim_vec ?v2 = dim_col (B - A) \<and> vec_norm ?v2 = 1 \<Longrightarrow> 0 \<le> inner_prod ?v2 ((B - A) *\<^sub>v ?v2)

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
using positive_iff_normalized_vec[of "B - A"] dimBmA A
[PROOF STATE]
proof (prove)
using this:
dim_vec ?v2 = dim_col (B - A) \<and> vec_norm ?v2 = 1 \<Longrightarrow> 0 \<le> inner_prod ?v2 ((B - A) *\<^sub>v ?v2)
positive (B - A) = (B - A \<in> carrier_mat (dim_col (B - A)) (dim_col (B - A)) \<and> (\<forall>v. dim_vec v = dim_col (B - A) \<and> vec_norm v = 1 \<longrightarrow> 0 \<le> inner_prod v ((B - A) *\<^sub>v v)))
B - A \<in> carrier_mat n n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. positive (B - A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
positive (B - A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
positive (B - A)

goal (1 subgoal):
 1. \<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
positive (B - A)
[PROOF STEP]
show "A \<le>\<^sub>L B"
[PROOF STATE]
proof (prove)
using this:
positive (B - A)

goal (1 subgoal):
 1. A \<le>\<^sub>L B
[PROOF STEP]
using lowner_le_def A B
[PROOF STATE]
proof (prove)
using this:
positive (B - A)
(?A \<le>\<^sub>L ?B) = (dim_row ?A = dim_row ?B \<and> dim_col ?A = dim_col ?B \<and> positive (?B - ?A))
A \<in> carrier_mat n n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. A \<le>\<^sub>L B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<le>\<^sub>L B

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<forall>\<rho>\<in>carrier_mat n n. partial_density_operator \<rho> \<longrightarrow> trace (A * \<rho>) \<le> trace (B * \<rho>) \<Longrightarrow> A \<le>\<^sub>L B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma times_matrix_assoc [simp]:
  "(x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<otimes> y \<otimes> z = x \<otimes> (y \<otimes> z)
[PROOF STEP]
by (simp add: times_matrix_def field_simps split_def)


[STATEMENT]
lemma closure_of_unique:
   "\<lbrakk>S \<subseteq> T; closedin X T;
     \<And>T'. \<lbrakk>S \<subseteq> T'; closedin X T'\<rbrakk> \<Longrightarrow> T \<subseteq> T'\<rbrakk>
    \<Longrightarrow> X closure_of S = T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> T; closedin X T; \<And>T'. \<lbrakk>S \<subseteq> T'; closedin X T'\<rbrakk> \<Longrightarrow> T \<subseteq> T'\<rbrakk> \<Longrightarrow> X closure_of S = T
[PROOF STEP]
by (meson closedin_closure_of closedin_subset closure_of_minimal closure_of_subset eq_iff order.trans)


[STATEMENT]
lemma bij_betw_nth:
  assumes "distinct xs" "A = {..<length xs}" "B = set xs"
  shows   "bij_betw ((!) xs) A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((!) xs) A B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs
A = {..<length xs}
B = set xs

goal (1 subgoal):
 1. bij_betw ((!) xs) A B
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
distinct xs
A = {..<length xs}
B = set xs

goal (1 subgoal):
 1. inj_on ((!) xs) A \<and> (!) xs ` A = B
[PROOF STEP]
by (auto intro!: inj_on_nth simp: set_conv_nth)


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


[STATEMENT]
lemma type_to_set2:
  shows "class.nontriv TYPE('b)" (is ?a) and "p=CARD('b)" (is ?b)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.nontriv TYPE('b) &&& p = CARD('b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. p = CARD('b)
[PROOF STEP]
from local_typedef
[PROOF STATE]
proof (chain)
picking this:
\<exists>Rep Abs. type_definition Rep Abs {0..<int p}
[PROOF STEP]
obtain Rep::"('b \<Rightarrow> int)" and Abs
    where t: "type_definition Rep Abs {0..<p :: int}"
[PROOF STATE]
proof (prove)
using this:
\<exists>Rep Abs. type_definition Rep Abs {0..<int p}

goal (1 subgoal):
 1. (\<And>Rep Abs. type_definition Rep Abs {0..<int p} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
type_definition Rep Abs {0..<int p}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. p = CARD('b)
[PROOF STEP]
have "card (UNIV :: 'b set) = card {0..<p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('b) = card {0..<p}
[PROOF STEP]
using t type_definition.card
[PROOF STATE]
proof (prove)
using this:
type_definition Rep Abs {0..<int p}
type_definition ?Rep ?Abs ?A \<Longrightarrow> CARD(?'b) = card ?A

goal (1 subgoal):
 1. CARD('b) = card {0..<p}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
CARD('b) = card {0..<p}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. p = CARD('b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
CARD('b) = card {0..<p}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. p = CARD('b)
[PROOF STEP]
have "... = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<p} = p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {0..<p} = p

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. p = CARD('b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
CARD('b) = p
[PROOF STEP]
show ?b
[PROOF STATE]
proof (prove)
using this:
CARD('b) = p

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

goal (1 subgoal):
 1. class.nontriv TYPE('b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = CARD('b)
[PROOF STEP]
show ?a
[PROOF STATE]
proof (prove)
using this:
p = CARD('b)

goal (1 subgoal):
 1. class.nontriv TYPE('b)
[PROOF STEP]
unfolding class.nontriv_def
[PROOF STATE]
proof (prove)
using this:
p = CARD('b)

goal (1 subgoal):
 1. 1 < CARD('b)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p = CARD('b)
1 < p

goal (1 subgoal):
 1. 1 < CARD('b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
class.nontriv TYPE('b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_all3_list_all2_conv: "list_all3 R xs xs ys = list_all2 (\<lambda>x. R x x) xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all3 R xs xs ys = list_all2 (\<lambda>x. R x x) xs ys
[PROOF STEP]
by (auto simp: list_all3_conv_all_nth list_all2_conv_all_nth)


[STATEMENT]
lemma set_zip_map: "set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` set xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` set xs
[PROOF STEP]
have "{(map f xs ! i, map g xs ! i) |i. i < length xs} = {(f (xs ! i), g (xs ! i)) |i. i < length xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(map f xs ! i, map g xs ! i) |i. i < length xs} = {(f (xs ! i), g (xs ! i)) |i. i < length xs}
[PROOF STEP]
proof (rule Collect_eqI, rule, elim exE conjE, intro exI conjI, simp add: map_nth, assumption,
      elim exE conjE, intro exI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x i. \<lbrakk>x = (f (xs ! i), g (xs ! i)); i < length xs\<rbrakk> \<Longrightarrow> x = (map f xs ! ?i14 x i, map g xs ! ?i14 x i) \<and> ?i14 x i < length xs
[PROOF STEP]
fix x i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x i. \<lbrakk>x = (f (xs ! i), g (xs ! i)); i < length xs\<rbrakk> \<Longrightarrow> x = (map f xs ! ?i14 x i, map g xs ! ?i14 x i) \<and> ?i14 x i < length xs
[PROOF STEP]
assume "x = (f (xs ! i), g (xs ! i))" and "i < length xs"
[PROOF STATE]
proof (state)
this:
x = (f (xs ! i), g (xs ! i))
i < length xs

goal (1 subgoal):
 1. \<And>x i. \<lbrakk>x = (f (xs ! i), g (xs ! i)); i < length xs\<rbrakk> \<Longrightarrow> x = (map f xs ! ?i14 x i, map g xs ! ?i14 x i) \<and> ?i14 x i < length xs
[PROOF STEP]
thus "x = (map f xs ! i, map g xs ! i) \<and> i < length xs"
[PROOF STATE]
proof (prove)
using this:
x = (f (xs ! i), g (xs ! i))
i < length xs

goal (1 subgoal):
 1. x = (map f xs ! i, map g xs ! i) \<and> i < length xs
[PROOF STEP]
by (simp add: map_nth)
[PROOF STATE]
proof (state)
this:
x = (map f xs ! i, map g xs ! i) \<and> i < length xs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{(map f xs ! i, map g xs ! i) |i. i < length xs} = {(f (xs ! i), g (xs ! i)) |i. i < length xs}

goal (1 subgoal):
 1. set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` set xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{(map f xs ! i, map g xs ! i) |i. i < length xs} = {(f (xs ! i), g (xs ! i)) |i. i < length xs}

goal (1 subgoal):
 1. set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` set xs
[PROOF STEP]
have "... = (\<lambda>x. (f x, g x)) ` {xs ! i | i. i < length xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(f (xs ! i), g (xs ! i)) |i. i < length xs} = (\<lambda>x. (f x, g x)) ` {xs ! i |i. i < length xs}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{(f (xs ! i), g (xs ! i)) |i. i < length xs} = (\<lambda>x. (f x, g x)) ` {xs ! i |i. i < length xs}

goal (1 subgoal):
 1. set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` set xs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{(map f xs ! i, map g xs ! i) |i. i < length xs} = (\<lambda>x. (f x, g x)) ` {xs ! i |i. i < length xs}
[PROOF STEP]
show "set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` (set xs)"
[PROOF STATE]
proof (prove)
using this:
{(map f xs ! i, map g xs ! i) |i. i < length xs} = (\<lambda>x. (f x, g x)) ` {xs ! i |i. i < length xs}

goal (1 subgoal):
 1. set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` set xs
[PROOF STEP]
by (simp add: set_zip set_conv_nth[symmetric])
[PROOF STATE]
proof (state)
this:
set (zip (map f xs) (map g xs)) = (\<lambda>x. (f x, g x)) ` set xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord_0_nat [simp]: "ord 0 (n :: nat) = (if n = 1 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord 0 n = (if n = 1 then 1 else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ord 0 n = (if n = 1 then 1 else 0)
[PROOF STEP]
have "(LEAST k. k > 0) = (1 :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST k. 0 < k) = 1
[PROOF STEP]
by (rule Least_equality) auto
[PROOF STATE]
proof (state)
this:
(LEAST k. 0 < k) = 1

goal (1 subgoal):
 1. ord 0 n = (if n = 1 then 1 else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(LEAST k. 0 < k) = 1

goal (1 subgoal):
 1. ord 0 n = (if n = 1 then 1 else 0)
[PROOF STEP]
by (auto simp: ord_def)
[PROOF STATE]
proof (state)
this:
ord 0 n = (if n = 1 then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma expectation_pair_pmf_snd [simp]:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  shows "measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f
[PROOF STEP]
have "measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) =
          measure_pmf.expectation (map_pmf snd (pair_pmf p q)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation (map_pmf snd (pair_pmf p q)) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation (map_pmf snd (pair_pmf p q)) f

goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation (map_pmf snd (pair_pmf p q)) f

goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f
[PROOF STEP]
have "map_pmf snd (pair_pmf p q) = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf snd (pair_pmf p q) = q
[PROOF STEP]
by (simp add: map_snd_pair_pmf)
[PROOF STATE]
proof (state)
this:
map_pmf snd (pair_pmf p q) = q

goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f

goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (snd x)) = measure_pmf.expectation q f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma type_to_set2:
  shows "class.nontriv TYPE('c)" (is ?a) and "n=CARD('c)" (is ?b)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.nontriv TYPE('c) &&& n = CARD('c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
from local_typedef2
[PROOF STATE]
proof (chain)
picking this:
\<exists>Rep Abs. type_definition Rep Abs {0..<int n}
[PROOF STEP]
obtain Rep::"('c \<Rightarrow> int)" and Abs
    where t: "type_definition Rep Abs {0..<n :: int}"
[PROOF STATE]
proof (prove)
using this:
\<exists>Rep Abs. type_definition Rep Abs {0..<int n}

goal (1 subgoal):
 1. (\<And>Rep Abs. type_definition Rep Abs {0..<int n} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
type_definition Rep Abs {0..<int n}

goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
have "card (UNIV :: 'c set) = card {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('c) = card {0..<n}
[PROOF STEP]
using t type_definition.card
[PROOF STATE]
proof (prove)
using this:
type_definition Rep Abs {0..<int n}
type_definition ?Rep ?Abs ?A \<Longrightarrow> CARD(?'b) = card ?A

goal (1 subgoal):
 1. CARD('c) = card {0..<n}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
CARD('c) = card {0..<n}

goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
CARD('c) = card {0..<n}

goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
have "... = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<n} = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {0..<n} = n

goal (2 subgoals):
 1. class.nontriv TYPE('c)
 2. n = CARD('c)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
CARD('c) = n
[PROOF STEP]
show ?b
[PROOF STATE]
proof (prove)
using this:
CARD('c) = n

goal (1 subgoal):
 1. n = CARD('c)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
n = CARD('c)

goal (1 subgoal):
 1. class.nontriv TYPE('c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = CARD('c)
[PROOF STEP]
show ?a
[PROOF STATE]
proof (prove)
using this:
n = CARD('c)

goal (1 subgoal):
 1. class.nontriv TYPE('c)
[PROOF STEP]
unfolding class.nontriv_def
[PROOF STATE]
proof (prove)
using this:
n = CARD('c)

goal (1 subgoal):
 1. 1 < CARD('c)
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
n = CARD('c)
1 < n

goal (1 subgoal):
 1. 1 < CARD('c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
class.nontriv TYPE('c)

goal:
No subgoals!
[PROOF STEP]
qed