[STATEMENT]
theorem inv_ntt_correct:
  assumes n_def: "length numbers = n"
  shows "NTT (INTT numbers) = map (\<lambda> x. (of_int_mod_ring n) * x ) numbers"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NTT (INTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. NTT (INTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers
[PROOF STEP]
have 0:"\<And> i. i < n \<Longrightarrow> (NTT (INTT numbers)) ! i = ntt (INTT numbers) i "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> NTT (INTT numbers) ! i = local.ntt (INTT numbers) i
[PROOF STEP]
using n_def length_NTT
[PROOF STATE]
proof (prove)
using this:
length numbers = n
length ?numbers = n \<Longrightarrow> length (NTT ?numbers) = n

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> NTT (INTT numbers) ! i = local.ntt (INTT numbers) i
[PROOF STEP]
unfolding INTT_def NTT_def intt_def
[PROOF STATE]
proof (prove)
using this:
length numbers = n
length ?numbers = n \<Longrightarrow> length (map (local.ntt ?numbers) [0..<n]) = n

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> map (local.ntt (map (\<lambda>i. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (i * j)) [0..<n])) [0..<n] ! i = local.ntt (map (\<lambda>i. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (i * j)) [0..<n]) i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> NTT (INTT numbers) ! ?i = local.ntt (INTT numbers) ?i

goal (1 subgoal):
 1. NTT (INTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers
[PROOF STEP]
have 1:"\<And> i. i < n \<Longrightarrow>ntt (INTT numbers) i = (of_int_mod_ring n)*numbers ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
assume i_assms:"i < n"
[PROOF STATE]
proof (state)
this:
i < n

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
hence 1:"ntt (INTT numbers) i  =
            (\<Sum>l = 0..<n.
               (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l))"
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. local.ntt (INTT numbers) i = (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l))
[PROOF STEP]
unfolding INTT_def ntt_def intt_def
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. (\<Sum>j = 0..<n. map (\<lambda>i. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (i * j)) [0..<n] ! j * \<omega> ^ (i * j)) = (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l))
[PROOF STEP]
using n_def length_map nth_map
[PROOF STATE]
proof (prove)
using this:
i < n
length numbers = n
length (map ?f ?xs) = length ?xs
?n < length ?xs \<Longrightarrow> map ?f ?xs ! ?n = ?f (?xs ! ?n)

goal (1 subgoal):
 1. (\<Sum>j = 0..<n. map (\<lambda>i. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (i * j)) [0..<n] ! j * \<omega> ^ (i * j)) = (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.ntt (INTT numbers) i = (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l))

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
hence 2:"\<dots> = (\<Sum>l = 0..<n.
                     (\<Sum>j = 0..<n. (numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l)))"
[PROOF STATE]
proof (prove)
using this:
local.ntt (INTT numbers) i = (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l))

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))
[PROOF STEP]
using sum_in
[PROOF STATE]
proof (prove)
using this:
local.ntt (INTT numbers) i = (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l))
(\<Sum>i = 0..<?x. ?f i * ?y) = sum ?f {0..<?x} * ?y

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
have 3:" \<dots> =(\<Sum>j = 0..<n.
                  (\<Sum>l = 0..<n. (numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))
[PROOF STEP]
using sum_swap
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<?x. sum (?f i) {0..<?y}) = (\<Sum>j = 0..<?y. \<Sum>i = 0..<?x. ?f i j)

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
have iisj:"\<And> j. j = i \<Longrightarrow> (\<Sum>l = 0..<n. (numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))) = (numbers ! j)* (of_int_mod_ring n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
assume "j=i"
[PROOF STATE]
proof (state)
this:
j = i

goal (1 subgoal):
 1. \<And>j. j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
hence "\<And> l. l < n \<Longrightarrow> (numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))= (numbers ! j)"
[PROOF STATE]
proof (prove)
using this:
j = i

goal (1 subgoal):
 1. \<And>l. l < n \<Longrightarrow> numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j
[PROOF STEP]
by (simp add: left_right_inverse_power mult.commute mu_properties(1))
[PROOF STATE]
proof (state)
this:
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j

goal (1 subgoal):
 1. \<And>j. j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j

goal (1 subgoal):
 1. \<And>j. j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
have "\<And> l. l < n  \<Longrightarrow> numbers ! j *  \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. l < n \<Longrightarrow> numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j
[PROOF STEP]
using calculation
[PROOF STATE]
proof (prove)
using this:
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j

goal (1 subgoal):
 1. \<And>l. l < n \<Longrightarrow> numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j

goal (1 subgoal):
 1. \<And>j. j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j
[PROOF STEP]
show "(\<Sum>l = 0..<n. (numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))) = (numbers ! j)* (of_int_mod_ring n)"
[PROOF STATE]
proof (prove)
using this:
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
using n_def sum_const[of "numbers ! j" n] exp_rule[of \<omega> \<mu>] mu_properties(1)
[PROOF STATE]
proof (prove)
using this:
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j
?l < n \<Longrightarrow> numbers ! j * \<mu> ^ (?l * j) * \<omega> ^ (i * ?l) = numbers ! j
length numbers = n
(\<Sum>i = 0..<n. numbers ! j) = of_int_mod_ring (int n) * numbers ! j
(\<omega> * \<mu>) ^ ?e = \<omega> ^ ?e * \<mu> ^ ?e
\<mu> * \<omega> = 1

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)
[PROOF STEP]
by (metis (no_types, lifting) atLeastLessThan_iff mult.commute sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! j * of_int_mod_ring (int n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! ?j * \<mu> ^ (l * ?j) * \<omega> ^ (i * l)) = numbers ! ?j * of_int_mod_ring (int n)

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
have jlsi:"\<And> j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. (numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
assume j_assms:"j < i"
[PROOF STATE]
proof (state)
this:
j < i

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
hence 00:"\<And>  (c::('a::prime_card) mod_ring) a b. c * a^j*b^i  = (a*b)^j*(c * b^(i-j))"
[PROOF STATE]
proof (prove)
using this:
j < i

goal (1 subgoal):
 1. \<And>c a b. c * a ^ j * b ^ i = (a * b) ^ j * (c * b ^ (i - j))
[PROOF STEP]
using  algebra_simps
[PROOF STATE]
proof (prove)
using this:
j < i
?a + ?b + ?c = ?a + (?b + ?c)
?a + ?b = ?b + ?a
?b + (?a + ?c) = ?a + (?b + ?c)
?a * ?b * ?c = ?a * (?b * ?c)
?a * ?b = ?b * ?a
?b * (?a * ?c) = ?a * (?b * ?c)
?a - ?b - ?c = ?a - (?b + ?c)
?a + (?b - ?c) = ?a + ?b - ?c
(?a - ?b = ?c) = (?a = ?c + ?b)
(?a = ?c - ?b) = (?a + ?b = ?c)
?a - (?b - ?c) = ?a + ?c - ?b
?a - ?b + ?c = ?a + ?c - ?b
(?a - ?b < ?c) = (?a < ?c + ?b)
(?a < ?c - ?b) = (?a + ?b < ?c)
(?a - ?b \<le> ?c) = (?a \<le> ?c + ?b)
(?a \<le> ?c - ?b) = (?a + ?b \<le> ?c)
(?a + ?b) * ?c = ?a * ?c + ?b * ?c
?a * (?b + ?c) = ?a * ?b + ?a * ?c
?a * (?b - ?c) = ?a * ?b - ?a * ?c
(?b - ?c) * ?a = ?b * ?a - ?c * ?a
?a * (?b - ?c) = ?a * ?b - ?a * ?c
(?a - ?b) * ?c = ?a * ?c - ?b * ?c
(?a * ?b) ^ ?n = ?a ^ ?n * ?b ^ ?n
?a *\<^sub>R (?x + ?y) = ?a *\<^sub>R ?x + ?a *\<^sub>R ?y
(?a + ?b) *\<^sub>R ?x = ?a *\<^sub>R ?x + ?b *\<^sub>R ?x
(?a - ?b) *\<^sub>R ?x = ?a *\<^sub>R ?x - ?b *\<^sub>R ?x
?a *\<^sub>R (?x - ?y) = ?a *\<^sub>R ?x - ?a *\<^sub>R ?y

goal (1 subgoal):
 1. \<And>c a b. c * a ^ j * b ^ i = (a * b) ^ j * (c * b ^ (i - j))
[PROOF STEP]
by (smt (z3) le_less ordered_cancel_comm_monoid_diff_class.add_diff_inverse power_add)
[PROOF STATE]
proof (state)
this:
?c * ?a ^ j * ?b ^ i = (?a * ?b) ^ j * (?c * ?b ^ (i - j))

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have 01:" (\<Sum>l = 0..<n. (numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))) =
                (\<Sum>l = 0..<n. (numbers ! j *  (\<omega>^l)^(i-j))) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j))
[PROOF STEP]
apply(rule sum_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. l < n \<Longrightarrow> numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j * (\<omega> ^ l) ^ (i - j)
[PROOF STEP]
using mu_properties(1) 00 algebra_simps(23)
[PROOF STATE]
proof (prove)
using this:
\<mu> * \<omega> = 1
?c * ?a ^ j * ?b ^ i = (?a * ?b) ^ j * (?c * ?b ^ (i - j))
(?a * ?b) ^ ?n = ?a ^ ?n * ?b ^ ?n

goal (1 subgoal):
 1. \<And>l. l < n \<Longrightarrow> numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j * (\<omega> ^ l) ^ (i - j)
[PROOF STEP]
by (smt (z3) mult.commute mult.left_neutral power_mult power_one)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j))

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j))

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have 02: "\<dots>=  numbers ! j *(\<Sum>l = 0..<n. ((\<omega>^l)^(i-j))) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j)) = numbers ! j * (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j))
[PROOF STEP]
using sum_in[of "\<lambda> l. numbers ! j * (\<mu> ^ l) ^ (i - j)" " numbers ! j" n]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>ia = 0..<n. numbers ! j * (\<mu> ^ ia) ^ (i - j) * numbers ! j) = (\<Sum>ia = 0..<n. numbers ! j * (\<mu> ^ ia) ^ (i - j)) * numbers ! j

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j)) = numbers ! j * (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j))
[PROOF STEP]
by (simp add: mult_hom.hom_sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j)) = numbers ! j * (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j))

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j)) = numbers ! j * (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j))

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have 03:"(\<Sum>l = 0..<n. ((\<omega>^l)^(i-j))) =
                     (\<Sum>l = 0..<n. ((\<omega>^(i-j))^l)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j)) = sum ((^) (\<omega> ^ (i - j))) {0..<n}
[PROOF STEP]
by(rule sum_eq) (metis mult.commute power_mult)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j)) = sum ((^) (\<omega> ^ (i - j))) {0..<n}

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have "\<omega>^(i-j) \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<omega> ^ (i - j) \<noteq> 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<omega> ^ (i - j) = 1 \<Longrightarrow> False
[PROOF STEP]
assume "\<omega> ^ (i - j) = 1"
[PROOF STATE]
proof (state)
this:
\<omega> ^ (i - j) = 1

goal (1 subgoal):
 1. \<omega> ^ (i - j) = 1 \<Longrightarrow> False
[PROOF STEP]
hence "ord p (to_int_mod_ring \<omega>) \<le> i-j"
[PROOF STATE]
proof (prove)
using this:
\<omega> ^ (i - j) = 1

goal (1 subgoal):
 1. ord (int p) (to_int_mod_ring \<omega>) \<le> i - j
[PROOF STEP]
by (simp add: j_assms not_le ord_max)
[PROOF STATE]
proof (state)
this:
ord (int p) (to_int_mod_ring \<omega>) \<le> i - j

goal (1 subgoal):
 1. \<omega> ^ (i - j) = 1 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ord (int p) (to_int_mod_ring \<omega>) \<le> i - j

goal (1 subgoal):
 1. \<omega> ^ (i - j) = 1 \<Longrightarrow> False
[PROOF STEP]
have "ord p (to_int_mod_ring \<omega>) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord (int p) (to_int_mod_ring \<omega>) = n
[PROOF STEP]
using omega_properties n_lst2
[PROOF STATE]
proof (prove)
using this:
\<omega> ^ n = 1
\<omega> \<noteq> 1
\<forall>m. \<omega> ^ m = 1 \<and> m \<noteq> 0 \<longrightarrow> n \<le> m
2 \<le> n

goal (1 subgoal):
 1. ord (int p) (to_int_mod_ring \<omega>) = n
[PROOF STEP]
unfolding ord_def
[PROOF STATE]
proof (prove)
using this:
\<omega> ^ n = 1
\<omega> \<noteq> 1
\<forall>m. \<omega> ^ m = 1 \<and> m \<noteq> 0 \<longrightarrow> n \<le> m
2 \<le> n

goal (1 subgoal):
 1. (if coprime (int p) (to_int_mod_ring \<omega>) then LEAST d. 0 < d \<and> [to_int_mod_ring \<omega> ^ d = 1] (mod int p) else 0) = n
[PROOF STEP]
by (meson \<open>\<omega> ^ (i - j) = 1\<close> diff_is_0_eq diff_le_self i_assms j_assms leD le_trans)
[PROOF STATE]
proof (state)
this:
ord (int p) (to_int_mod_ring \<omega>) = n

goal (1 subgoal):
 1. \<omega> ^ (i - j) = 1 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ord (int p) (to_int_mod_ring \<omega>) \<le> i - j
ord (int p) (to_int_mod_ring \<omega>) = n
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
ord (int p) (to_int_mod_ring \<omega>) \<le> i - j
ord (int p) (to_int_mod_ring \<omega>) = n

goal (1 subgoal):
 1. False
[PROOF STEP]
by (metis i_assms leD less_imp_diff_less)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<omega> ^ (i - j) \<noteq> 1

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j))
(\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j)) = numbers ! j * (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j))
\<omega> ^ (i - j) \<noteq> 1
[PROOF STEP]
have "(1-\<omega>^(i-j))*(\<Sum>l = 0..<n. ((\<omega>^(i-j))^l)) = (1-(\<omega>^(i-j))^n)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j))
(\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j)) = numbers ! j * (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j))
\<omega> ^ (i - j) \<noteq> 1

goal (1 subgoal):
 1. (1 - \<omega> ^ (i - j)) * sum ((^) (\<omega> ^ (i - j))) {0..<n} = 1 - (\<omega> ^ (i - j)) ^ n
[PROOF STEP]
using geo_sum[of "\<omega> ^ (i - j)" n]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j))
(\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j)) = numbers ! j * (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j))
\<omega> ^ (i - j) \<noteq> 1
\<omega> ^ (i - j) \<noteq> 1 \<Longrightarrow> (1 - \<omega> ^ (i - j)) * sum ((^) (\<omega> ^ (i - j))) {0..<n} = 1 - (\<omega> ^ (i - j)) ^ n

goal (1 subgoal):
 1. (1 - \<omega> ^ (i - j)) * sum ((^) (\<omega> ^ (i - j))) {0..<n} = 1 - (\<omega> ^ (i - j)) ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 - \<omega> ^ (i - j)) * sum ((^) (\<omega> ^ (i - j))) {0..<n} = 1 - (\<omega> ^ (i - j)) ^ n

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 - \<omega> ^ (i - j)) * sum ((^) (\<omega> ^ (i - j))) {0..<n} = 1 - (\<omega> ^ (i - j)) ^ n

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have "(\<omega>^(i-j))^n = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<omega> ^ (i - j)) ^ n = 1
[PROOF STEP]
by (metis (no_types)  mult.commute omega_properties(1) power_mult power_one)
[PROOF STATE]
proof (state)
this:
(\<omega> ^ (i - j)) ^ n = 1

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 - \<omega> ^ (i - j)) * sum ((^) (\<omega> ^ (i - j))) {0..<n} = 1 - (\<omega> ^ (i - j)) ^ n
(\<omega> ^ (i - j)) ^ n = 1
[PROOF STEP]
have "(\<Sum>l = 0..<n. ((\<omega>^(i-j))^l)) = 0"
[PROOF STATE]
proof (prove)
using this:
(1 - \<omega> ^ (i - j)) * sum ((^) (\<omega> ^ (i - j))) {0..<n} = 1 - (\<omega> ^ (i - j)) ^ n
(\<omega> ^ (i - j)) ^ n = 1

goal (1 subgoal):
 1. sum ((^) (\<omega> ^ (i - j))) {0..<n} = 0
[PROOF STEP]
by (metis \<open>\<omega> ^ (i - j) \<noteq> 1\<close> divisors_zero eq_iff_diff_eq_0)
[PROOF STATE]
proof (state)
this:
sum ((^) (\<omega> ^ (i - j))) {0..<n} = 0

goal (1 subgoal):
 1. \<And>j. j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
thus "(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0"
[PROOF STATE]
proof (prove)
using this:
sum ((^) (\<omega> ^ (i - j))) {0..<n} = 0

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
using  01 02 03
[PROOF STATE]
proof (prove)
using this:
sum ((^) (\<omega> ^ (i - j))) {0..<n} = 0
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j))
(\<Sum>l = 0..<n. numbers ! j * (\<omega> ^ l) ^ (i - j)) = numbers ! j * (\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j))
(\<Sum>l = 0..<n. (\<omega> ^ l) ^ (i - j)) = sum ((^) (\<omega> ^ (i - j))) {0..<n}

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! ?j * \<mu> ^ (l * ?j) * \<omega> ^ (i * l)) = 0

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
have ilsj:"\<And> j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. (numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
assume ij_Assm: "i < j \<and> j < n"
[PROOF STATE]
proof (state)
this:
i < j \<and> j < n

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
hence 00:"\<And>  (c::('a::prime_card) mod_ring) a b. (a*b)^i*(c * b^(j-i)) = c * a^i*b^j  "
[PROOF STATE]
proof (prove)
using this:
i < j \<and> j < n

goal (1 subgoal):
 1. \<And>c a b. (a * b) ^ i * (c * b ^ (j - i)) = c * a ^ i * b ^ j
[PROOF STEP]
by (simp add: field_simps flip: power_add)
[PROOF STATE]
proof (state)
this:
(?a * ?b) ^ i * (?c * ?b ^ (j - i)) = ?c * ?a ^ i * ?b ^ j

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have 01:" (\<Sum>l = 0..<n. (numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))) =
                (\<Sum>l = 0..<n. (numbers ! j *  (\<mu>^l)^(j-i))) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i))
[PROOF STEP]
apply(rule sum_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. l < n \<Longrightarrow> numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j * (\<mu> ^ l) ^ (j - i)
[PROOF STEP]
subgoal for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l < n \<Longrightarrow> numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j * (\<mu> ^ l) ^ (j - i)
[PROOF STEP]
using mu_properties(1) 00[of "\<omega>^l" "\<mu>^l" "numbers ! j "] algebra_simps(23)
[PROOF STATE]
proof (prove)
using this:
\<mu> * \<omega> = 1
(\<omega> ^ l * \<mu> ^ l) ^ i * (numbers ! j * (\<mu> ^ l) ^ (j - i)) = numbers ! j * (\<omega> ^ l) ^ i * (\<mu> ^ l) ^ j
(?a * ?b) ^ ?n = ?a ^ ?n * ?b ^ ?n

goal (1 subgoal):
 1. l < n \<Longrightarrow> numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l) = numbers ! j * (\<mu> ^ l) ^ (j - i)
[PROOF STEP]
by (smt (z3) "00" left_right_inverse_power mult.assoc mult.commute mult.right_neutral power_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i))

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i))

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have 02:"(\<Sum>l = 0..<n. (numbers ! j *   (\<mu>^l)^(j-i)))  =
            numbers ! j *(\<Sum>l = 0..<n. ( (\<mu>^l)^(j-i))) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i)) = numbers ! j * (\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i))
[PROOF STEP]
by (simp add: mult_hom.hom_sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i)) = numbers ! j * (\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i))

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i)) = numbers ! j * (\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i))

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have 03:"(\<Sum>l = 0..<n. ( (\<mu>^l)^(j-i))) =
                     (\<Sum>l = 0..<n. (( (\<mu>^(j-i))^l))) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i)) = sum ((^) (\<mu> ^ (j - i))) {0..<n}
[PROOF STEP]
by(rule sum_eq) (metis mult.commute power_mult)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i)) = sum ((^) (\<mu> ^ (j - i))) {0..<n}

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have "\<mu>^(j-i) \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> ^ (j - i) \<noteq> 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
assume "\<mu> ^ (j - i) = 1"
[PROOF STATE]
proof (state)
this:
\<mu> ^ (j - i) = 1

goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
hence "ord p (to_int_mod_ring \<mu>) \<le> j -i "
[PROOF STATE]
proof (prove)
using this:
\<mu> ^ (j - i) = 1

goal (1 subgoal):
 1. ord (int p) (to_int_mod_ring \<mu>) \<le> j - i
[PROOF STEP]
by (simp add: ij_Assm not_le ord_max)
[PROOF STATE]
proof (state)
this:
ord (int p) (to_int_mod_ring \<mu>) \<le> j - i

goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ord (int p) (to_int_mod_ring \<mu>) \<le> j - i

goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
hence "ord p (to_int_mod_ring \<omega>) \<le> j-i"
[PROOF STATE]
proof (prove)
using this:
ord (int p) (to_int_mod_ring \<mu>) \<le> j - i

goal (1 subgoal):
 1. ord (int p) (to_int_mod_ring \<omega>) \<le> j - i
[PROOF STEP]
by (metis \<open>\<mu> ^ (j - i) = 1\<close> diff_is_0_eq exp_rule ij_Assm leD mult.comm_neutral mult.commute mu_properties(1) ord_max)
[PROOF STATE]
proof (state)
this:
ord (int p) (to_int_mod_ring \<omega>) \<le> j - i

goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ord (int p) (to_int_mod_ring \<omega>) \<le> j - i

goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
hence "j-i < n"
[PROOF STATE]
proof (prove)
using this:
ord (int p) (to_int_mod_ring \<omega>) \<le> j - i

goal (1 subgoal):
 1. j - i < n
[PROOF STEP]
using ij_Assm i_assms p_fact k_bound n_lst2
[PROOF STATE]
proof (prove)
using this:
ord (int p) (to_int_mod_ring \<omega>) \<le> j - i
i < j \<and> j < n
i < n
p = k * n + 1
0 < k
2 \<le> n

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

goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
j - i < n

goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
have "ord p (to_int_mod_ring \<omega>) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord (int p) (to_int_mod_ring \<omega>) = n
[PROOF STEP]
using omega_properties n_lst2
[PROOF STATE]
proof (prove)
using this:
\<omega> ^ n = 1
\<omega> \<noteq> 1
\<forall>m. \<omega> ^ m = 1 \<and> m \<noteq> 0 \<longrightarrow> n \<le> m
2 \<le> n

goal (1 subgoal):
 1. ord (int p) (to_int_mod_ring \<omega>) = n
[PROOF STEP]
unfolding ord_def
[PROOF STATE]
proof (prove)
using this:
\<omega> ^ n = 1
\<omega> \<noteq> 1
\<forall>m. \<omega> ^ m = 1 \<and> m \<noteq> 0 \<longrightarrow> n \<le> m
2 \<le> n

goal (1 subgoal):
 1. (if coprime (int p) (to_int_mod_ring \<omega>) then LEAST d. 0 < d \<and> [to_int_mod_ring \<omega> ^ d = 1] (mod int p) else 0) = n
[PROOF STEP]
by (metis (no_types) \<open>\<mu> ^ (j-i) = 1\<close> calculation(3) diff_is_0_eq ij_Assm leD left_right_inverse_power mult.comm_neutral mult_cancel_left mu_properties(1) omega_properties(3) zero_neq_one)
[PROOF STATE]
proof (state)
this:
ord (int p) (to_int_mod_ring \<omega>) = n

goal (1 subgoal):
 1. \<mu> ^ (j - i) = 1 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ord (int p) (to_int_mod_ring \<mu>) \<le> j - i
ord (int p) (to_int_mod_ring \<omega>) \<le> j - i
j - i < n
ord (int p) (to_int_mod_ring \<omega>) = n
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
ord (int p) (to_int_mod_ring \<mu>) \<le> j - i
ord (int p) (to_int_mod_ring \<omega>) \<le> j - i
j - i < n
ord (int p) (to_int_mod_ring \<omega>) = n

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<mu> ^ (j - i) \<noteq> 1

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i))
(\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i)) = numbers ! j * (\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i))
\<mu> ^ (j - i) \<noteq> 1
[PROOF STEP]
have "(1-\<mu>^(j-i))* (\<Sum>l = 0..<n. ((\<mu>^(j-i))^l)) = (1-(\<mu>^(j-i))^n)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i))
(\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i)) = numbers ! j * (\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i))
\<mu> ^ (j - i) \<noteq> 1

goal (1 subgoal):
 1. (1 - \<mu> ^ (j - i)) * sum ((^) (\<mu> ^ (j - i))) {0..<n} = 1 - (\<mu> ^ (j - i)) ^ n
[PROOF STEP]
using geo_sum[of "\<mu> ^ (j-i)" n]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i))
(\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i)) = numbers ! j * (\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i))
\<mu> ^ (j - i) \<noteq> 1
\<mu> ^ (j - i) \<noteq> 1 \<Longrightarrow> (1 - \<mu> ^ (j - i)) * sum ((^) (\<mu> ^ (j - i))) {0..<n} = 1 - (\<mu> ^ (j - i)) ^ n

goal (1 subgoal):
 1. (1 - \<mu> ^ (j - i)) * sum ((^) (\<mu> ^ (j - i))) {0..<n} = 1 - (\<mu> ^ (j - i)) ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 - \<mu> ^ (j - i)) * sum ((^) (\<mu> ^ (j - i))) {0..<n} = 1 - (\<mu> ^ (j - i)) ^ n

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 - \<mu> ^ (j - i)) * sum ((^) (\<mu> ^ (j - i))) {0..<n} = 1 - (\<mu> ^ (j - i)) ^ n

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have "(\<mu>^(j-i))^n = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<mu> ^ (j - i)) ^ n = 1
[PROOF STEP]
by (metis (no_types) left_right_inverse_power mult.commute mult.right_neutral mu_properties(1) omega_properties(1) power_mult power_one)
[PROOF STATE]
proof (state)
this:
(\<mu> ^ (j - i)) ^ n = 1

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 - \<mu> ^ (j - i)) * sum ((^) (\<mu> ^ (j - i))) {0..<n} = 1 - (\<mu> ^ (j - i)) ^ n
(\<mu> ^ (j - i)) ^ n = 1
[PROOF STEP]
have "(\<Sum>l = 0..<n. ((\<mu>^(j-i))^l)) = 0"
[PROOF STATE]
proof (prove)
using this:
(1 - \<mu> ^ (j - i)) * sum ((^) (\<mu> ^ (j - i))) {0..<n} = 1 - (\<mu> ^ (j - i)) ^ n
(\<mu> ^ (j - i)) ^ n = 1

goal (1 subgoal):
 1. sum ((^) (\<mu> ^ (j - i))) {0..<n} = 0
[PROOF STEP]
by (metis \<open>\<mu> ^ (j - i) \<noteq> 1\<close> eq_iff_diff_eq_0 no_zero_divisors)
[PROOF STATE]
proof (state)
this:
sum ((^) (\<mu> ^ (j - i))) {0..<n} = 0

goal (1 subgoal):
 1. \<And>j. i < j \<and> j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
thus "(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0"
[PROOF STATE]
proof (prove)
using this:
sum ((^) (\<mu> ^ (j - i))) {0..<n} = 0

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
using  01 02 03
[PROOF STATE]
proof (prove)
using this:
sum ((^) (\<mu> ^ (j - i))) {0..<n} = 0
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i))
(\<Sum>l = 0..<n. numbers ! j * (\<mu> ^ l) ^ (j - i)) = numbers ! j * (\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i))
(\<Sum>l = 0..<n. (\<mu> ^ l) ^ (j - i)) = sum ((^) (\<mu> ^ (j - i))) {0..<n}

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i < ?j \<and> ?j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! ?j * \<mu> ^ (l * ?j) * \<omega> ^ (i * l)) = 0

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
have " (\<Sum>j = 0..<i. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<i. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
using jlsi
[PROOF STATE]
proof (prove)
using this:
?j < i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! ?j * \<mu> ^ (l * ?j) * \<omega> ^ (i * l)) = 0

goal (1 subgoal):
 1. (\<Sum>j = 0..<i. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<i. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<i. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
have " (\<Sum>j = i..<i+1. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) =  numbers ! i * (of_int_mod_ring n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = i..<i + 1. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)
[PROOF STEP]
using iisj
[PROOF STATE]
proof (prove)
using this:
?j = i \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! ?j * \<mu> ^ (l * ?j) * \<omega> ^ (i * l)) = numbers ! ?j * of_int_mod_ring (int n)

goal (1 subgoal):
 1. (\<Sum>j = i..<i + 1. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j = i..<i + 1. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>j = i..<i + 1. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
have " (\<Sum>j = (i+1)..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = i + 1..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
using ilsj
[PROOF STATE]
proof (prove)
using this:
i < ?j \<and> ?j < n \<Longrightarrow> (\<Sum>l = 0..<n. numbers ! ?j * \<mu> ^ (l * ?j) * \<omega> ^ (i * l)) = 0

goal (1 subgoal):
 1. (\<Sum>j = i + 1..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j = i + 1..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j = 0..<i. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
(\<Sum>j = i..<i + 1. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)
(\<Sum>j = i + 1..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
[PROOF STEP]
have " (\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) =
                        numbers ! i * (of_int_mod_ring n)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j = 0..<i. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
(\<Sum>j = i..<i + 1. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)
(\<Sum>j = i + 1..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0

goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)
[PROOF STEP]
using i_assms sum_split
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j = 0..<i. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
(\<Sum>j = i..<i + 1. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)
(\<Sum>j = i + 1..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = 0
i < n
?r1.0 < ?r2.0 \<Longrightarrow> sum ?f {0..<?r1.0} + sum ?f {?r1.0..<?r2.0} = sum ?f {0..<?r2.0}

goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)
[PROOF STEP]
by (smt (z3) add.commute add.left_neutral int_ops(2) less_imp_of_nat_less of_nat_add of_nat_eq_iff of_nat_less_imp_less)
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
thus "ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)

goal (1 subgoal):
 1. local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
using 1 2 3
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = numbers ! i * of_int_mod_ring (int n)
local.ntt (INTT numbers) i = (\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l))
(\<Sum>l = 0..<n. (\<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j)) * \<omega> ^ (i * l)) = (\<Sum>l = 0..<n. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))
(\<Sum>l = 0..<n. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l)) = (\<Sum>j = 0..<n. \<Sum>l = 0..<n. numbers ! j * \<mu> ^ (l * j) * \<omega> ^ (i * l))

goal (1 subgoal):
 1. local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
by (metis mult.commute)
[PROOF STATE]
proof (state)
this:
local.ntt (INTT numbers) i = of_int_mod_ring (int n) * numbers ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> local.ntt (INTT numbers) ?i = of_int_mod_ring (int n) * numbers ! ?i

goal (1 subgoal):
 1. NTT (INTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers
[PROOF STEP]
have 2: "\<And> i. i < n \<Longrightarrow> (map ((*) (of_int_mod_ring (int n))) numbers ) ! i = (of_int_mod_ring (int n)) * (numbers ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> map ((*) (of_int_mod_ring (int n))) numbers ! i = of_int_mod_ring (int n) * numbers ! i
[PROOF STEP]
by (simp add: n_def)
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> map ((*) (of_int_mod_ring (int n))) numbers ! ?i = of_int_mod_ring (int n) * numbers ! ?i

goal (1 subgoal):
 1. NTT (INTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NTT (INTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers
[PROOF STEP]
apply(rule nth_equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (NTT (INTT numbers)) = length (map ((*) (of_int_mod_ring (int n))) numbers)
 2. \<And>i. i < length (NTT (INTT numbers)) \<Longrightarrow> NTT (INTT numbers) ! i = map ((*) (of_int_mod_ring (int n))) numbers ! i
[PROOF STEP]
subgoal my_little_subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (NTT (INTT numbers)) = length (map ((*) (of_int_mod_ring (int n))) numbers)
[PROOF STEP]
unfolding INTT_def NTT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map (local.ntt (map (intt numbers) [0..<n])) [0..<n]) = length (map ((*) (of_int_mod_ring (int n))) numbers)
[PROOF STEP]
apply (simp add: n_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length (NTT (INTT numbers)) \<Longrightarrow> NTT (INTT numbers) ! i = map ((*) (of_int_mod_ring (int n))) numbers ! i
[PROOF STEP]
subgoal for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length (NTT (INTT numbers)) \<Longrightarrow> NTT (INTT numbers) ! i = map ((*) (of_int_mod_ring (int n))) numbers ! i
[PROOF STEP]
using 0 1 2 n_def algebra_simps  my_little_subgoal length_map
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> NTT (INTT numbers) ! ?i = local.ntt (INTT numbers) ?i
?i < n \<Longrightarrow> local.ntt (INTT numbers) ?i = of_int_mod_ring (int n) * numbers ! ?i
?i < n \<Longrightarrow> map ((*) (of_int_mod_ring (int n))) numbers ! ?i = of_int_mod_ring (int n) * numbers ! ?i
length numbers = n
?a + ?b + ?c = ?a + (?b + ?c)
?a + ?b = ?b + ?a
?b + (?a + ?c) = ?a + (?b + ?c)
?a * ?b * ?c = ?a * (?b * ?c)
?a * ?b = ?b * ?a
?b * (?a * ?c) = ?a * (?b * ?c)
?a - ?b - ?c = ?a - (?b + ?c)
?a + (?b - ?c) = ?a + ?b - ?c
(?a - ?b = ?c) = (?a = ?c + ?b)
(?a = ?c - ?b) = (?a + ?b = ?c)
?a - (?b - ?c) = ?a + ?c - ?b
?a - ?b + ?c = ?a + ?c - ?b
(?a - ?b < ?c) = (?a < ?c + ?b)
(?a < ?c - ?b) = (?a + ?b < ?c)
(?a - ?b \<le> ?c) = (?a \<le> ?c + ?b)
(?a \<le> ?c - ?b) = (?a + ?b \<le> ?c)
(?a + ?b) * ?c = ?a * ?c + ?b * ?c
?a * (?b + ?c) = ?a * ?b + ?a * ?c
?a * (?b - ?c) = ?a * ?b - ?a * ?c
(?b - ?c) * ?a = ?b * ?a - ?c * ?a
?a * (?b - ?c) = ?a * ?b - ?a * ?c
(?a - ?b) * ?c = ?a * ?c - ?b * ?c
(?a * ?b) ^ ?n = ?a ^ ?n * ?b ^ ?n
?a *\<^sub>R (?x + ?y) = ?a *\<^sub>R ?x + ?a *\<^sub>R ?y
(?a + ?b) *\<^sub>R ?x = ?a *\<^sub>R ?x + ?b *\<^sub>R ?x
(?a - ?b) *\<^sub>R ?x = ?a *\<^sub>R ?x - ?b *\<^sub>R ?x
?a *\<^sub>R (?x - ?y) = ?a *\<^sub>R ?x - ?a *\<^sub>R ?y
length (NTT (INTT numbers)) = length (map ((*) (of_int_mod_ring (int n))) numbers)
length (map ?f ?xs) = length ?xs

goal (1 subgoal):
 1. i < length (NTT (INTT numbers)) \<Longrightarrow> NTT (INTT numbers) ! i = map ((*) (of_int_mod_ring (int n))) numbers ! i
[PROOF STEP]
apply  auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
NTT (INTT numbers) = map ((*) (of_int_mod_ring (int n))) numbers

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma star_decompose_1:
  "(x \<squnion> y)\<^sup>\<star> = (x\<^sup>\<star> * y\<^sup>\<star>)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<squnion> y)\<^sup>\<star> = (x\<^sup>\<star> * y\<^sup>\<star>)\<^sup>\<star>
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (x \<squnion> y)\<^sup>\<star> \<le> (x\<^sup>\<star> * y\<^sup>\<star>)\<^sup>\<star>
 2. (x\<^sup>\<star> * y\<^sup>\<star>)\<^sup>\<star> \<le> (x \<squnion> y)\<^sup>\<star>
[PROOF STEP]
apply (simp add: star.circ_sup_2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x\<^sup>\<star> * y\<^sup>\<star>)\<^sup>\<star> \<le> (x \<squnion> y)\<^sup>\<star>
[PROOF STEP]
using star.circ_sub_dist_3 star_isotone star_involutive
[PROOF STATE]
proof (prove)
using this:
?x\<^sup>\<star> * ?y\<^sup>\<star> \<le> (?x \<squnion> ?y)\<^sup>\<star>
?x \<le> ?y \<Longrightarrow> ?x\<^sup>\<star> \<le> ?y\<^sup>\<star>
?x\<^sup>\<star> = ?x\<^sup>\<star>\<^sup>\<star>

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


[STATEMENT]
lemma bdd_below_image_antimono:
  assumes "antimono\<^sub>a\<^sub>b f" and "ord\<^sub>a.bdd_above A"
  shows "ord\<^sub>b.bdd_below (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord\<^sub>b.bdd_below (f ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
antimono\<^sub>a\<^sub>b f
ord\<^sub>a.bdd_above A

goal (1 subgoal):
 1. ord\<^sub>b.bdd_below (f ` A)
[PROOF STEP]
by (auto simp: bdd_def mono_def)


[STATEMENT]
lemma sparse_row_add_spmat: "sparse_row_matrix (add_spmat A B) = (sparse_row_matrix A) + (sparse_row_matrix B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sparse_row_matrix (add_spmat A B) = sparse_row_matrix A + sparse_row_matrix B
[PROOF STEP]
apply (induct A B rule: add_spmat.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>bs. sparse_row_matrix (add_spmat [] bs) = sparse_row_matrix [] + sparse_row_matrix bs
 2. \<And>v va. sparse_row_matrix (add_spmat (v # va) []) = sparse_row_matrix (v # va) + sparse_row_matrix []
 3. \<And>i a as j b bs. \<lbrakk>i < j \<Longrightarrow> sparse_row_matrix (add_spmat as ((j, b) # bs)) = sparse_row_matrix as + sparse_row_matrix ((j, b) # bs); \<lbrakk>\<not> i < j; j < i\<rbrakk> \<Longrightarrow> sparse_row_matrix (add_spmat ((i, a) # as) bs) = sparse_row_matrix ((i, a) # as) + sparse_row_matrix bs; \<lbrakk>\<not> i < j; \<not> j < i\<rbrakk> \<Longrightarrow> sparse_row_matrix (add_spmat as bs) = sparse_row_matrix as + sparse_row_matrix bs\<rbrakk> \<Longrightarrow> sparse_row_matrix (add_spmat ((i, a) # as) ((j, b) # bs)) = sparse_row_matrix ((i, a) # as) + sparse_row_matrix ((j, b) # bs)
[PROOF STEP]
apply (auto simp add: sparse_row_matrix_cons sparse_row_vector_add move_matrix_add)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cmult_2:
  assumes "Card n" shows "ord_of_nat 2 \<otimes> n = n \<oplus> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord_of_nat 2 \<otimes> n = n \<oplus> n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ord_of_nat 2 \<otimes> n = n \<oplus> n
[PROOF STEP]
have "ord_of_nat 2 = succ (succ 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord_of_nat 2 = ZFC_in_HOL.succ (ZFC_in_HOL.succ 0)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
ord_of_nat 2 = ZFC_in_HOL.succ (ZFC_in_HOL.succ 0)

goal (1 subgoal):
 1. ord_of_nat 2 \<otimes> n = n \<oplus> n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ord_of_nat 2 = ZFC_in_HOL.succ (ZFC_in_HOL.succ 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ord_of_nat 2 = ZFC_in_HOL.succ (ZFC_in_HOL.succ 0)

goal (1 subgoal):
 1. ord_of_nat 2 \<otimes> n = n \<oplus> n
[PROOF STEP]
by (simp add: cmult_succ assms)
[PROOF STATE]
proof (state)
this:
ord_of_nat 2 \<otimes> n = n \<oplus> n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finiteSetinterleavingList: "finite (set (setinterleavingList(s, X, t)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set (setinterleavingList (s, X, t)))
[PROOF STEP]
by auto


[STATEMENT]
lemma divide_inverse': "(a::_::{division_ring,ab_semigroup_mult}) / b = inverse b * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a / b = inverse b * a
[PROOF STEP]
by (simp add: divide_inverse mult.commute)


[STATEMENT]
lemma quot_of_fract_add:
  "quot_of_fract (x + y) =
     (let (a,b) = quot_of_fract x; (c,d) = quot_of_fract y
      in  normalize_quot (a * d + b * c, b * d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quot_of_fract (x + y) = (let (a, b) = quot_of_fract x; (c, d) = quot_of_fract y in normalize_quot (a * d + b * c, b * d))
[PROOF STEP]
by transfer (insert quot_of_fract_add_aux,
               simp_all add: Let_def case_prod_unfold normalize_quot_eq_iff)


[STATEMENT]
lemma psubset_fset:
  shows "xs |\<subset>| ys \<longleftrightarrow> fset xs \<subset> fset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs |\<subset>| ys) = (fset xs \<subset> fset ys)
[PROOF STEP]
unfolding less_fset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs |\<subseteq>| ys \<and> xs \<noteq> ys) = (fset xs \<subset> fset ys)
[PROOF STEP]
by (descending) (auto)


[STATEMENT]
lemma starlike_imp_contractible:
  fixes S :: "'a::real_normed_vector set"
  shows "starlike S \<Longrightarrow> contractible S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. starlike S \<Longrightarrow> contractible S
[PROOF STEP]
using starlike_imp_contractible_gen contractible_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>starlike ?S; \<And>a T. \<lbrakk>a \<in> ?S; 0 \<le> T; T \<le> 1\<rbrakk> \<Longrightarrow> ?P (\<lambda>x. (1 - T) *\<^sub>R x + T *\<^sub>R a); \<And>a. homotopic_with_canon ?P ?S ?S (\<lambda>x. x) (\<lambda>x. a) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
contractible ?S \<equiv> \<exists>a. homotopic_with_canon (\<lambda>x. True) ?S ?S id (\<lambda>x. a)

goal (1 subgoal):
 1. starlike S \<Longrightarrow> contractible S
[PROOF STEP]
by (fastforce simp: id_def)


[STATEMENT]
lemma union_subseteqIl: "\<lbrakk>A \<union> B \<subseteq> C; A' \<subseteq> A\<rbrakk>  \<Longrightarrow>   A' \<union> B \<subseteq> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<union> B \<subseteq> C; A' \<subseteq> A\<rbrakk> \<Longrightarrow> A' \<union> B \<subseteq> C
[PROOF STEP]
by blast


[STATEMENT]
lemma pt_open_onD:
  "pt_open_on Q A \<Longrightarrow> Q f \<Longrightarrow> f \<in> A \<Longrightarrow> (\<exists>n. (\<forall>g\<in>A. (\<forall>i<n. g i = f i) \<longrightarrow> Q g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pt_open_on Q A; Q f; f \<in> A\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>g\<in>A. (\<forall>i<n. g i = f i) \<longrightarrow> Q g
[PROOF STEP]
unfolding pt_open_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>f\<in>A. Q f = (\<exists>n. \<forall>g\<in>A. (\<forall>i<n. g i = f i) \<longrightarrow> Q g); Q f; f \<in> A\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>g\<in>A. (\<forall>i<n. g i = f i) \<longrightarrow> Q g
[PROOF STEP]
by blast


[STATEMENT]
lemma fair_if_finite:
  assumes fin: "lfinite Sts"
  shows "fair_state_seq (lmap state_of_wstate Sts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fair_state_seq (lmap state_of_wstate Sts)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
assume unfair: "\<not> fair_state_seq (lmap state_of_wstate Sts)"
[PROOF STATE]
proof (state)
this:
\<not> fair_state_seq (lmap state_of_wstate Sts)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
have no_inf_from_last: "\<forall>y. \<not> llast Sts \<leadsto>\<^sub>w y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. \<not> llast Sts \<leadsto>\<^sub>w y
[PROOF STEP]
using fin full_chain_iff_chain[of "(\<leadsto>\<^sub>w)" Sts] full_deriv
[PROOF STATE]
proof (prove)
using this:
lfinite Sts
full_chain (\<leadsto>\<^sub>w) Sts = (chain (\<leadsto>\<^sub>w) Sts \<and> (lfinite Sts \<longrightarrow> (\<forall>y. \<not> llast Sts \<leadsto>\<^sub>w y)))
full_chain (\<leadsto>\<^sub>w) Sts

goal (1 subgoal):
 1. \<forall>y. \<not> llast Sts \<leadsto>\<^sub>w y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y. \<not> llast Sts \<leadsto>\<^sub>w y

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
from unfair
[PROOF STATE]
proof (chain)
picking this:
\<not> fair_state_seq (lmap state_of_wstate Sts)
[PROOF STEP]
obtain C where
    "C \<in> Liminf_llist (lmap N_of_state (lmap state_of_wstate Sts))
       \<union> Liminf_llist (lmap P_of_state (lmap state_of_wstate Sts))"
[PROOF STATE]
proof (prove)
using this:
\<not> fair_state_seq (lmap state_of_wstate Sts)

goal (1 subgoal):
 1. (\<And>C. C \<in> Liminf_llist (lmap N_of_state (lmap state_of_wstate Sts)) \<union> Liminf_llist (lmap P_of_state (lmap state_of_wstate Sts)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding fair_state_seq_def Liminf_state_def
[PROOF STATE]
proof (prove)
using this:
\<not> (N_of_state (Liminf_llist (lmap N_of_state (lmap state_of_wstate Sts)), Liminf_llist (lmap P_of_state (lmap state_of_wstate Sts)), Liminf_llist (lmap Q_of_state (lmap state_of_wstate Sts))) = {} \<and> P_of_state (Liminf_llist (lmap N_of_state (lmap state_of_wstate Sts)), Liminf_llist (lmap P_of_state (lmap state_of_wstate Sts)), Liminf_llist (lmap Q_of_state (lmap state_of_wstate Sts))) = {})

goal (1 subgoal):
 1. (\<And>C. C \<in> Liminf_llist (lmap N_of_state (lmap state_of_wstate Sts)) \<union> Liminf_llist (lmap P_of_state (lmap state_of_wstate Sts)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<in> Liminf_llist (lmap N_of_state (lmap state_of_wstate Sts)) \<union> Liminf_llist (lmap P_of_state (lmap state_of_wstate Sts))

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C \<in> Liminf_llist (lmap N_of_state (lmap state_of_wstate Sts)) \<union> Liminf_llist (lmap P_of_state (lmap state_of_wstate Sts))
[PROOF STEP]
obtain i where i_p:
    "enat i < llength Sts"
    "\<And>j. i \<le> j \<Longrightarrow> enat j < llength Sts \<Longrightarrow>
     C \<in> N_of_state (state_of_wstate (lnth Sts j)) \<union> P_of_state (state_of_wstate (lnth Sts j))"
[PROOF STATE]
proof (prove)
using this:
C \<in> Liminf_llist (lmap N_of_state (lmap state_of_wstate Sts)) \<union> Liminf_llist (lmap P_of_state (lmap state_of_wstate Sts))

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>enat i < llength Sts; \<And>j. \<lbrakk>i \<le> j; enat j < llength Sts\<rbrakk> \<Longrightarrow> C \<in> N_of_wstate (lnth Sts j) \<union> P_of_wstate (lnth Sts j)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Liminf_llist_def
[PROOF STATE]
proof (prove)
using this:
C \<in> (\<Union>i\<in>{i. enat i < llength (lmap N_of_state (lmap state_of_wstate Sts))}. \<Inter> (lnth (lmap N_of_state (lmap state_of_wstate Sts)) ` {j. i \<le> j \<and> enat j < llength (lmap N_of_state (lmap state_of_wstate Sts))})) \<union> (\<Union>i\<in>{i. enat i < llength (lmap P_of_state (lmap state_of_wstate Sts))}. \<Inter> (lnth (lmap P_of_state (lmap state_of_wstate Sts)) ` {j. i \<le> j \<and> enat j < llength (lmap P_of_state (lmap state_of_wstate Sts))}))

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>enat i < llength Sts; \<And>j. \<lbrakk>i \<le> j; enat j < llength Sts\<rbrakk> \<Longrightarrow> C \<in> N_of_wstate (lnth Sts j) \<union> P_of_wstate (lnth Sts j)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
enat i < llength Sts
\<lbrakk>i \<le> ?j; enat ?j < llength Sts\<rbrakk> \<Longrightarrow> C \<in> N_of_wstate (lnth Sts ?j) \<union> P_of_wstate (lnth Sts ?j)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
have C_in_llast:
    "C \<in> N_of_state (state_of_wstate (llast Sts)) \<union> P_of_state (state_of_wstate (llast Sts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)
[PROOF STEP]
obtain l where
      l_p: "enat l < llength Sts \<and> lnth Sts l = llast Sts \<and> (\<forall>j < llength Sts. j \<le> enat l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l. enat l < llength Sts \<and> lnth Sts l = llast Sts \<and> (\<forall>j<llength Sts. j \<le> enat l) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using fin lfinite_not_LNil_nth_llast i_p(1)
[PROOF STATE]
proof (prove)
using this:
lfinite Sts
\<lbrakk>lfinite Sts; Sts \<noteq> LNil\<rbrakk> \<Longrightarrow> \<exists>i. enat i < llength Sts \<and> lnth Sts i = llast Sts \<and> (\<forall>j<llength Sts. j \<le> enat i)
enat i < llength Sts

goal (1 subgoal):
 1. (\<And>l. enat l < llength Sts \<and> lnth Sts l = llast Sts \<and> (\<forall>j<llength Sts. j \<le> enat l) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
enat l < llength Sts \<and> lnth Sts l = llast Sts \<and> (\<forall>j<llength Sts. j \<le> enat l)

goal (1 subgoal):
 1. C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
enat l < llength Sts \<and> lnth Sts l = llast Sts \<and> (\<forall>j<llength Sts. j \<le> enat l)
[PROOF STEP]
have
      "C \<in> N_of_state (state_of_wstate (lnth Sts l)) \<union> P_of_state (state_of_wstate (lnth Sts l))"
[PROOF STATE]
proof (prove)
using this:
enat l < llength Sts \<and> lnth Sts l = llast Sts \<and> (\<forall>j<llength Sts. j \<le> enat l)

goal (1 subgoal):
 1. C \<in> N_of_wstate (lnth Sts l) \<union> P_of_wstate (lnth Sts l)
[PROOF STEP]
using i_p(1) i_p(2)[of l]
[PROOF STATE]
proof (prove)
using this:
enat l < llength Sts \<and> lnth Sts l = llast Sts \<and> (\<forall>j<llength Sts. j \<le> enat l)
enat i < llength Sts
\<lbrakk>i \<le> l; enat l < llength Sts\<rbrakk> \<Longrightarrow> C \<in> N_of_wstate (lnth Sts l) \<union> P_of_wstate (lnth Sts l)

goal (1 subgoal):
 1. C \<in> N_of_wstate (lnth Sts l) \<union> P_of_wstate (lnth Sts l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<in> N_of_wstate (lnth Sts l) \<union> P_of_wstate (lnth Sts l)

goal (1 subgoal):
 1. C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C \<in> N_of_wstate (lnth Sts l) \<union> P_of_wstate (lnth Sts l)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
C \<in> N_of_wstate (lnth Sts l) \<union> P_of_wstate (lnth Sts l)

goal (1 subgoal):
 1. C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)
[PROOF STEP]
using l_p
[PROOF STATE]
proof (prove)
using this:
C \<in> N_of_wstate (lnth Sts l) \<union> P_of_wstate (lnth Sts l)
enat l < llength Sts \<and> lnth Sts l = llast Sts \<and> (\<forall>j<llength Sts. j \<le> enat l)

goal (1 subgoal):
 1. C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
define N :: "'a wclause multiset" where "N = wN_of_wstate (llast Sts)"
[PROOF STATE]
proof (state)
this:
N = wN_of_wstate (llast Sts)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
define P :: "'a wclause multiset" where "P = wP_of_wstate (llast Sts)"
[PROOF STATE]
proof (state)
this:
P = wP_of_wstate (llast Sts)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
define Q :: "'a wclause multiset" where "Q = wQ_of_wstate (llast Sts)"
[PROOF STATE]
proof (state)
this:
Q = wQ_of_wstate (llast Sts)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
define n :: nat where "n = n_of_wstate (llast Sts)"
[PROOF STATE]
proof (state)
this:
n = n_of_wstate (llast Sts)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
n = n_of_wstate (llast Sts)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
assume "N_of_state (state_of_wstate (llast Sts)) \<noteq> {}"
[PROOF STATE]
proof (state)
this:
N_of_wstate (llast Sts) \<noteq> {}

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N_of_wstate (llast Sts) \<noteq> {}
[PROOF STEP]
obtain D j where "(D, j) \<in># N"
[PROOF STATE]
proof (prove)
using this:
N_of_wstate (llast Sts) \<noteq> {}

goal (1 subgoal):
 1. (\<And>D j. (D, j) \<in># N \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding N_def
[PROOF STATE]
proof (prove)
using this:
N_of_wstate (llast Sts) \<noteq> {}

goal (1 subgoal):
 1. (\<And>D j. (D, j) \<in># wN_of_wstate (llast Sts) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "llast Sts") auto
[PROOF STATE]
proof (state)
this:
(D, j) \<in># N

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(D, j) \<in># N
[PROOF STEP]
have "llast Sts \<leadsto>\<^sub>w (N - {#(D, j)#}, P + {#(D, j)#}, Q, n)"
[PROOF STATE]
proof (prove)
using this:
(D, j) \<in># N

goal (1 subgoal):
 1. llast Sts \<leadsto>\<^sub>w (remove1_mset (D, j) N, P + {#(D, j)#}, Q, n)
[PROOF STEP]
using weighted_RP.clause_processing[of "N - {#(D, j)#}" D j P Q n]
[PROOF STATE]
proof (prove)
using this:
(D, j) \<in># N
(remove1_mset (D, j) N + {#(D, j)#}, P, Q, n) \<leadsto>\<^sub>w (remove1_mset (D, j) N, P + {#(D, j)#}, Q, n)

goal (1 subgoal):
 1. llast Sts \<leadsto>\<^sub>w (remove1_mset (D, j) N, P + {#(D, j)#}, Q, n)
[PROOF STEP]
unfolding N_def P_def Q_def n_def
[PROOF STATE]
proof (prove)
using this:
(D, j) \<in># wN_of_wstate (llast Sts)
(remove1_mset (D, j) (wN_of_wstate (llast Sts)) + {#(D, j)#}, wP_of_wstate (llast Sts), wQ_of_wstate (llast Sts), n_of_wstate (llast Sts)) \<leadsto>\<^sub>w (remove1_mset (D, j) (wN_of_wstate (llast Sts)), wP_of_wstate (llast Sts) + {#(D, j)#}, wQ_of_wstate (llast Sts), n_of_wstate (llast Sts))

goal (1 subgoal):
 1. llast Sts \<leadsto>\<^sub>w (remove1_mset (D, j) (wN_of_wstate (llast Sts)), wP_of_wstate (llast Sts) + {#(D, j)#}, wQ_of_wstate (llast Sts), n_of_wstate (llast Sts))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
llast Sts \<leadsto>\<^sub>w (remove1_mset (D, j) N, P + {#(D, j)#}, Q, n)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
llast Sts \<leadsto>\<^sub>w (remove1_mset (D, j) N, P + {#(D, j)#}, Q, n)
[PROOF STEP]
have "\<exists>St'. llast Sts \<leadsto>\<^sub>w St'"
[PROOF STATE]
proof (prove)
using this:
llast Sts \<leadsto>\<^sub>w (remove1_mset (D, j) N, P + {#(D, j)#}, Q, n)

goal (1 subgoal):
 1. \<exists>St'. llast Sts \<leadsto>\<^sub>w St'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
N_of_wstate (llast Sts) \<noteq> {} \<Longrightarrow> \<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
N_of_wstate (llast Sts) \<noteq> {} \<Longrightarrow> \<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
N_of_wstate (llast Sts) \<noteq> {} \<Longrightarrow> \<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
assume a: "N_of_state (state_of_wstate (llast Sts)) = {}"
[PROOF STATE]
proof (state)
this:
N_of_wstate (llast Sts) = {}

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N_of_wstate (llast Sts) = {}
[PROOF STEP]
have b: "N = {#}"
[PROOF STATE]
proof (prove)
using this:
N_of_wstate (llast Sts) = {}

goal (1 subgoal):
 1. N = {#}
[PROOF STEP]
unfolding N_def
[PROOF STATE]
proof (prove)
using this:
N_of_wstate (llast Sts) = {}

goal (1 subgoal):
 1. wN_of_wstate (llast Sts) = {#}
[PROOF STEP]
by (cases "llast Sts") auto
[PROOF STATE]
proof (state)
this:
N = {#}

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
N_of_wstate (llast Sts) = {}
[PROOF STEP]
have "C \<in> P_of_state (state_of_wstate (llast Sts))"
[PROOF STATE]
proof (prove)
using this:
N_of_wstate (llast Sts) = {}

goal (1 subgoal):
 1. C \<in> P_of_wstate (llast Sts)
[PROOF STEP]
using C_in_llast
[PROOF STATE]
proof (prove)
using this:
N_of_wstate (llast Sts) = {}
C \<in> N_of_wstate (llast Sts) \<union> P_of_wstate (llast Sts)

goal (1 subgoal):
 1. C \<in> P_of_wstate (llast Sts)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<in> P_of_wstate (llast Sts)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C \<in> P_of_wstate (llast Sts)
[PROOF STEP]
obtain D j where "(D, j) \<in># P"
[PROOF STATE]
proof (prove)
using this:
C \<in> P_of_wstate (llast Sts)

goal (1 subgoal):
 1. (\<And>D j. (D, j) \<in># P \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
using this:
C \<in> P_of_wstate (llast Sts)

goal (1 subgoal):
 1. (\<And>D j. (D, j) \<in># wP_of_wstate (llast Sts) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "llast Sts") auto
[PROOF STATE]
proof (state)
this:
(D, j) \<in># P

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(D, j) \<in># P
[PROOF STEP]
have "weight (D, j) \<in> weight ` set_mset P"
[PROOF STATE]
proof (prove)
using this:
(D, j) \<in># P

goal (1 subgoal):
 1. weight (D, j) \<in> weight ` set_mset P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
weight (D, j) \<in> weight ` set_mset P

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
weight (D, j) \<in> weight ` set_mset P
[PROOF STEP]
have "\<exists>w. is_least (\<lambda>w. w \<in> (weight ` set_mset P)) w"
[PROOF STATE]
proof (prove)
using this:
weight (D, j) \<in> weight ` set_mset P

goal (1 subgoal):
 1. \<exists>w. is_least (\<lambda>w. w \<in> weight ` set_mset P) w
[PROOF STEP]
using least_exists
[PROOF STATE]
proof (prove)
using this:
weight (D, j) \<in> weight ` set_mset P
?P ?n \<Longrightarrow> \<exists>n. is_least ?P n

goal (1 subgoal):
 1. \<exists>w. is_least (\<lambda>w. w \<in> weight ` set_mset P) w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>w. is_least (\<lambda>w. w \<in> weight ` set_mset P) w

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>w. is_least (\<lambda>w. w \<in> weight ` set_mset P) w
[PROOF STEP]
have "\<exists>D j. (\<forall>(D', j') \<in># P. weight (D, j) \<le> weight (D', j')) \<and> (D, j) \<in># P"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. is_least (\<lambda>w. w \<in> weight ` set_mset P) w

goal (1 subgoal):
 1. \<exists>D j. (\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')) \<and> (D, j) \<in># P
[PROOF STEP]
using assms linorder_not_less
[PROOF STATE]
proof (prove)
using this:
\<exists>w. is_least (\<lambda>w. w \<in> weight ` set_mset P) w
lfinite Sts
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. \<exists>D j. (\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')) \<and> (D, j) \<in># P
[PROOF STEP]
unfolding is_least_def
[PROOF STATE]
proof (prove)
using this:
\<exists>w. w \<in> weight ` set_mset P \<and> (\<forall>n'<w. n' \<notin> weight ` set_mset P)
lfinite Sts
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. \<exists>D j. (\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')) \<and> (D, j) \<in># P
[PROOF STEP]
by (auto 6 0)
[PROOF STATE]
proof (state)
this:
\<exists>D j. (\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')) \<and> (D, j) \<in># P

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>D j. (\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')) \<and> (D, j) \<in># P
[PROOF STEP]
obtain D j where
      min: "(\<forall>(D', j') \<in># P. weight (D, j) \<le> weight (D', j'))" and
      Dj_in_p: "(D, j) \<in># P"
[PROOF STATE]
proof (prove)
using this:
\<exists>D j. (\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')) \<and> (D, j) \<in># P

goal (1 subgoal):
 1. (\<And>D j. \<lbrakk>\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j'); (D, j) \<in># P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')
(D, j) \<in># P

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
from min
[PROOF STATE]
proof (chain)
picking this:
\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')
[PROOF STEP]
have min: "(\<forall>(D', j') \<in># P - {#(D, j)#}. weight (D, j) \<le> weight (D', j'))"
[PROOF STATE]
proof (prove)
using this:
\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')

goal (1 subgoal):
 1. \<forall>(D', j')\<in>#remove1_mset (D, j) P. weight (D, j) \<le> weight (D', j')
[PROOF STEP]
using mset_subset_diff_self[OF Dj_in_p]
[PROOF STATE]
proof (prove)
using this:
\<forall>(D', j')\<in>#P. weight (D, j) \<le> weight (D', j')
remove1_mset (D, j) P \<subset># P

goal (1 subgoal):
 1. \<forall>(D', j')\<in>#remove1_mset (D, j) P. weight (D, j) \<le> weight (D', j')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>(D', j')\<in>#remove1_mset (D, j) P. weight (D, j) \<le> weight (D', j')

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
define N' where
      "N' = mset_set ((\<lambda>D'. (D', n)) ` concls_of (inference_system.inferences_between (ord_FO_\<Gamma> S)
         (set_mset (image_mset fst Q)) D))"
[PROOF STATE]
proof (state)
this:
N' = mset_set ((\<lambda>D'. (D', n)) ` concls_of (inference_system.inferences_between (ord_FO_\<Gamma> S) (set_mset (image_mset fst Q)) D))

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
have "llast Sts \<leadsto>\<^sub>w (N', {#(D', j') \<in># P - {#(D, j)#}. D' \<noteq> D#}, Q + {#(D,j)#}, Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llast Sts \<leadsto>\<^sub>w (N', {#(D', j') \<in># remove1_mset (D, j) P. D' \<noteq> D#}, Q + {#(D, j)#}, Suc n)
[PROOF STEP]
using weighted_RP.inference_computation[of "P - {#(D, j)#}" D j N' n Q, OF min N'_def]
        of_wstate_split[symmetric, of "llast Sts"] Dj_in_p
[PROOF STATE]
proof (prove)
using this:
({#}, remove1_mset (D, j) P + {#(D, j)#}, Q, n) \<leadsto>\<^sub>w (N', {#(D, j) \<in># remove1_mset (D, j) P. D \<noteq> D#}, Q + {#(D, j)#}, Suc n)
llast Sts = (wN_of_wstate (llast Sts), wP_of_wstate (llast Sts), wQ_of_wstate (llast Sts), n_of_wstate (llast Sts))
(D, j) \<in># P

goal (1 subgoal):
 1. llast Sts \<leadsto>\<^sub>w (N', {#(D', j') \<in># remove1_mset (D, j) P. D' \<noteq> D#}, Q + {#(D, j)#}, Suc n)
[PROOF STEP]
unfolding N_def[symmetric] P_def[symmetric] Q_def[symmetric] n_def[symmetric] b
[PROOF STATE]
proof (prove)
using this:
({#}, remove1_mset (D, j) P + {#(D, j)#}, Q, n) \<leadsto>\<^sub>w (N', {#(D, j) \<in># remove1_mset (D, j) P. D \<noteq> D#}, Q + {#(D, j)#}, Suc n)
llast Sts = ({#}, P, Q, n)
(D, j) \<in># P

goal (1 subgoal):
 1. llast Sts \<leadsto>\<^sub>w (N', {#(D', j') \<in># remove1_mset (D, j) P. D' \<noteq> D#}, Q + {#(D, j)#}, Suc n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
llast Sts \<leadsto>\<^sub>w (N', {#(D', j') \<in># remove1_mset (D, j) P. D' \<noteq> D#}, Q + {#(D, j)#}, Suc n)

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
llast Sts \<leadsto>\<^sub>w (N', {#(D', j') \<in># remove1_mset (D, j) P. D' \<noteq> D#}, Q + {#(D, j)#}, Suc n)
[PROOF STEP]
have "\<exists>St'. llast Sts \<leadsto>\<^sub>w St'"
[PROOF STATE]
proof (prove)
using this:
llast Sts \<leadsto>\<^sub>w (N', {#(D', j') \<in># remove1_mset (D, j) P. D' \<noteq> D#}, Q + {#(D, j)#}, Suc n)

goal (1 subgoal):
 1. \<exists>St'. llast Sts \<leadsto>\<^sub>w St'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
N_of_wstate (llast Sts) = {} \<Longrightarrow> \<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
N_of_wstate (llast Sts) \<noteq> {} \<Longrightarrow> \<exists>St'. llast Sts \<leadsto>\<^sub>w St'
N_of_wstate (llast Sts) = {} \<Longrightarrow> \<exists>St'. llast Sts \<leadsto>\<^sub>w St'
[PROOF STEP]
have "\<exists>St'. llast Sts \<leadsto>\<^sub>w St'"
[PROOF STATE]
proof (prove)
using this:
N_of_wstate (llast Sts) \<noteq> {} \<Longrightarrow> \<exists>St'. llast Sts \<leadsto>\<^sub>w St'
N_of_wstate (llast Sts) = {} \<Longrightarrow> \<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. \<exists>St'. llast Sts \<leadsto>\<^sub>w St'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. \<not> fair_state_seq (lmap state_of_wstate Sts) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>St'. llast Sts \<leadsto>\<^sub>w St'
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<exists>St'. llast Sts \<leadsto>\<^sub>w St'

goal (1 subgoal):
 1. False
[PROOF STEP]
using no_inf_from_last
[PROOF STATE]
proof (prove)
using this:
\<exists>St'. llast Sts \<leadsto>\<^sub>w St'
\<forall>y. \<not> llast Sts \<leadsto>\<^sub>w y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm036:
  assumes "a \<in> allAllocations N G"
  shows "a \<in> injections (Domain a) (Range a) &
         Range a \<in> all_partitions G &
         Domain a \<subseteq> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> injections (Domain a) (Range a) \<and> Range a \<in> all_partitions G \<and> Domain a \<subseteq> N
[PROOF STEP]
using assms mem_Collect_eq injections_def posssibleAllocationsRelCharacterization order_refl
[PROOF STATE]
proof (prove)
using this:
a \<in> allAllocations N G
(?a \<in> Collect ?P) = ?P ?a
injections ?X ?Y = {R. Domain R = ?X \<and> Range R \<subseteq> ?Y \<and> runiq R \<and> runiq (R\<inverse>)}
(?a \<in> allAllocations ?N ?G) = (?a \<in> injectionsUniverse \<and> Domain ?a \<subseteq> ?N \<and> Range ?a \<in> all_partitions ?G)
?x \<le> ?x

goal (1 subgoal):
 1. a \<in> injections (Domain a) (Range a) \<and> Range a \<in> all_partitions G \<and> Domain a \<subseteq> N
[PROOF STEP]
by (metis (mono_tags, lifting))


[STATEMENT]
lemma less_multiset\<^sub>D\<^sub>M:
  "M < N \<longleftrightarrow> (\<exists>X Y. X \<noteq> {#} \<and> X \<subseteq># N \<and> M = N - X + Y \<and> (\<forall>k. k \<in># Y \<longrightarrow> (\<exists>a. a \<in># X \<and> k < a)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M < N) = (\<exists>X Y. X \<noteq> {#} \<and> X \<subseteq># N \<and> M = N - X + Y \<and> (\<forall>k. k \<in># Y \<longrightarrow> (\<exists>a. a \<in># X \<and> k < a)))
[PROOF STEP]
by (rule mult\<^sub>D\<^sub>M[folded multp_def less_multiset_def])


[STATEMENT]
theorem closest_pair_dist:
  assumes "1 < length ps" "distinct ps" "(c\<^sub>0, c\<^sub>1) = closest_pair ps"
  shows "sparse (dist c\<^sub>0 c\<^sub>1) (set ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sparse (dist (case c\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case c\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y))) (set ps)
[PROOF STEP]
using assms closest_pair_rec_dist[of "mergesort fst ps"] closest_pair_rec_c0_c1[of "mergesort fst ps"]
[PROOF STATE]
proof (prove)
using this:
1 < length ps
distinct ps
(c\<^sub>0, c\<^sub>1) = closest_pair ps
\<lbrakk>1 < length (mergesort fst ps); distinct (mergesort fst ps); sorted_fst (mergesort fst ps); (?ys, ?c\<^sub>0, ?c\<^sub>1) = closest_pair_rec (mergesort fst ps)\<rbrakk> \<Longrightarrow> sparse (dist (case ?c\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case ?c\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y))) (set (mergesort fst ps))
\<lbrakk>1 < length (mergesort fst ps); distinct (mergesort fst ps); (?ys, ?c\<^sub>0, ?c\<^sub>1) = closest_pair_rec (mergesort fst ps)\<rbrakk> \<Longrightarrow> ?c\<^sub>0 \<in> set (mergesort fst ps) \<and> ?c\<^sub>1 \<in> set (mergesort fst ps) \<and> ?c\<^sub>0 \<noteq> ?c\<^sub>1

goal (1 subgoal):
 1. sparse (dist (case c\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case c\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y))) (set ps)
[PROOF STEP]
by (auto simp: sorted_fst_def mergesort closest_pair_simps split: prod.splits)


[STATEMENT]
lemma extreme_point_of_translation_eq:
   "(a + x) extreme_point_of (image (\<lambda>x. a + x) S) \<longleftrightarrow> x extreme_point_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + x extreme_point_of (+) a ` S) = (x extreme_point_of S)
[PROOF STEP]
by (auto simp: extreme_point_of_def)


[STATEMENT]
lemma prime_elem_primitive_part_fract:
  fixes p :: "'a :: {idom_divide, ring_gcd, factorial_semiring, semiring_Gcd,semiring_gcd_mult_normalize} fract poly"
  shows "irreducible p \<Longrightarrow> prime_elem (primitive_part_fract p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible p \<Longrightarrow> prime_elem (primitive_part_fract p)
[PROOF STEP]
by (intro irreducible_imp_prime_poly irreducible_primitive_part_fract)


[STATEMENT]
lemma abs_of_rat [simp]:
  "\<bar>of_rat r\<bar> = (of_rat \<bar>r\<bar> :: 'a :: linordered_field)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>of_rat r\<bar> = of_rat \<bar>r\<bar>
[PROOF STEP]
by (cases "r \<ge> 0") (simp_all add: not_le of_rat_minus)


[STATEMENT]
lemma E_sup_mult_right:
  assumes [measurable]: "f \<in> borel_measurable St" and [simp]: "0 \<le> c"
  shows "E_sup s (\<lambda>x. c * f x) = c * E_sup s f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E_sup s (\<lambda>x. c * f x) = c * E_sup s f
[PROOF STEP]
by (simp add: nn_integral_cmult E_sup_def SUP_mult_left_ennreal)


[STATEMENT]
lemma similar_mat_wit_pow_id: "similar_mat_wit A B P Q \<Longrightarrow> A ^\<^sub>m k = P * B ^\<^sub>m k * Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat_wit A B P Q \<Longrightarrow> A ^\<^sub>m k = P * B ^\<^sub>m k * Q
[PROOF STEP]
using similar_mat_wit_pow[of A B P Q k]
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A B P Q \<Longrightarrow> similar_mat_wit (A ^\<^sub>m k) (B ^\<^sub>m k) P Q

goal (1 subgoal):
 1. similar_mat_wit A B P Q \<Longrightarrow> A ^\<^sub>m k = P * B ^\<^sub>m k * Q
[PROOF STEP]
unfolding similar_mat_wit_def Let_def
[PROOF STATE]
proof (prove)
using this:
{A, B, P, Q} \<subseteq> carrier_mat (dim_row A) (dim_row A) \<and> P * Q = 1\<^sub>m (dim_row A) \<and> Q * P = 1\<^sub>m (dim_row A) \<and> A = P * B * Q \<Longrightarrow> {A ^\<^sub>m k, B ^\<^sub>m k, P, Q} \<subseteq> carrier_mat (dim_row (A ^\<^sub>m k)) (dim_row (A ^\<^sub>m k)) \<and> P * Q = 1\<^sub>m (dim_row (A ^\<^sub>m k)) \<and> Q * P = 1\<^sub>m (dim_row (A ^\<^sub>m k)) \<and> A ^\<^sub>m k = P * B ^\<^sub>m k * Q

goal (1 subgoal):
 1. {A, B, P, Q} \<subseteq> carrier_mat (dim_row A) (dim_row A) \<and> P * Q = 1\<^sub>m (dim_row A) \<and> Q * P = 1\<^sub>m (dim_row A) \<and> A = P * B * Q \<Longrightarrow> A ^\<^sub>m k = P * B ^\<^sub>m k * Q
[PROOF STEP]
by blast


[STATEMENT]
lemma powreal_inverse:
     "inverse (a pow\<^sub>\<real> x) = (inverse a) pow\<^sub>\<real> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (a pow\<^sub>\<real> x) = inverse a pow\<^sub>\<real> x
[PROOF STEP]
using powreal_minus powreal_minus_base_ge_one
[PROOF STATE]
proof (prove)
using this:
?a pow\<^sub>\<real> - ?x = inverse (?a pow\<^sub>\<real> ?x)
?a pow\<^sub>\<real> - ?x = inverse ?a pow\<^sub>\<real> ?x

goal (1 subgoal):
 1. inverse (a pow\<^sub>\<real> x) = inverse a pow\<^sub>\<real> x
[PROOF STEP]
by presburger


[STATEMENT]
lemma mult_mat_vec_scalar: "A *v v = mk_vec (\<lambda> i. scalar_product (row i A) v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v v = HMA_Connect.mk_vec (\<lambda>i. scalar_product (row i A) v)
[PROOF STEP]
unfolding vec_eq_iff matrix_vector_mult_def scalar_product_def mk_mat_def mk_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. (\<chi>i. \<Sum>j\<in>UNIV. A $h i $h j * v $h j) $h i = (\<chi>i. \<Sum>ia\<in>UNIV. row i A $h ia * v $h ia) $h i
[PROOF STEP]
by (auto simp: row_def column_def)


[STATEMENT]
lemma negligible_poly_times:
  "\<lbrakk> f \<in> O(\<lambda>x. x powr n); negligible g \<rbrakk> \<Longrightarrow> negligible (\<lambda>x. f x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> O(\<lambda>x. real x powr n); negligible g\<rbrakk> \<Longrightarrow> negligible (\<lambda>x. f x * g x)
[PROOF STEP]
by(subst mult.commute)(rule negligible_times_poly)


[STATEMENT]
lemma split_comb_seq: "P (comb_seq i \<omega> \<omega>' j) \<longleftrightarrow> (j < i \<longrightarrow> P (\<omega> j)) \<and> (\<forall>k. j = i + k \<longrightarrow> P (\<omega>' k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (comb_seq i \<omega> \<omega>' j) = ((j < i \<longrightarrow> P (\<omega> j)) \<and> (\<forall>k. j = i + k \<longrightarrow> P (\<omega>' k)))
[PROOF STEP]
by (auto simp: comb_seq_def not_less)


[STATEMENT]
lemma tendsto_eexp[tendsto_intros]: "(f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. eexp (f x)) \<longlongrightarrow> eexp x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. eexp (f x)) \<longlongrightarrow> eexp x) F
[PROOF STEP]
by (rule continuous_on_tendsto_compose[OF continuous_on_eexp']) auto


[STATEMENT]
lemma tendsto_componentwise1:
  fixes a::"'a::euclidean_space \<Rightarrow>\<^sub>L 'b::real_normed_vector"
    and b::"'c \<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b"
  assumes "(\<And>j. j \<in> Basis \<Longrightarrow> ((\<lambda>n. b n j) \<longlongrightarrow> a j) F)"
  shows "(b \<longlongrightarrow> a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<longlongrightarrow> a) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (b \<longlongrightarrow> a) F
[PROOF STEP]
have "\<And>j. j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. norm (b x j - a j)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. norm (blinfun_apply (b x) j - blinfun_apply a j)) F
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?j \<in> Basis \<Longrightarrow> ((\<lambda>n. blinfun_apply (b n) ?j) \<longlongrightarrow> blinfun_apply a ?j) F

goal (1 subgoal):
 1. \<And>j. j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. norm (blinfun_apply (b x) j - blinfun_apply a j)) F
[PROOF STEP]
unfolding tendsto_Zfun_iff Zfun_norm_iff
[PROOF STATE]
proof (prove)
using this:
?j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. blinfun_apply (b x) ?j - blinfun_apply a ?j) F

goal (1 subgoal):
 1. \<And>j. j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. blinfun_apply (b x) j - blinfun_apply a j) F
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
?j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. norm (blinfun_apply (b x) ?j - blinfun_apply a ?j)) F

goal (1 subgoal):
 1. (b \<longlongrightarrow> a) F
[PROOF STEP]
hence "Zfun (\<lambda>x. \<Sum>j\<in>Basis. norm (b x j - a j)) F"
[PROOF STATE]
proof (prove)
using this:
?j \<in> Basis \<Longrightarrow> Zfun (\<lambda>x. norm (blinfun_apply (b x) ?j - blinfun_apply a ?j)) F

goal (1 subgoal):
 1. Zfun (\<lambda>x. \<Sum>j\<in>Basis. norm (blinfun_apply (b x) j - blinfun_apply a j)) F
[PROOF STEP]
by (auto intro!: Zfun_sum)
[PROOF STATE]
proof (state)
this:
Zfun (\<lambda>x. \<Sum>j\<in>Basis. norm (blinfun_apply (b x) j - blinfun_apply a j)) F

goal (1 subgoal):
 1. (b \<longlongrightarrow> a) F
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Zfun (\<lambda>x. \<Sum>j\<in>Basis. norm (blinfun_apply (b x) j - blinfun_apply a j)) F

goal (1 subgoal):
 1. (b \<longlongrightarrow> a) F
[PROOF STEP]
unfolding tendsto_Zfun_iff
[PROOF STATE]
proof (prove)
using this:
Zfun (\<lambda>x. \<Sum>j\<in>Basis. norm (blinfun_apply (b x) j - blinfun_apply a j)) F

goal (1 subgoal):
 1. Zfun (\<lambda>x. b x - a) F
[PROOF STEP]
by (rule Zfun_le)
      (auto intro!: order_trans[OF norm_blinfun_euclidean_le] simp: blinfun.bilinear_simps)
[PROOF STATE]
proof (state)
this:
(b \<longlongrightarrow> a) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wcount_union: "wcount f (M + N) a = wcount f M a + wcount f N a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wcount f (M + N) a = wcount f M a + wcount f N a
[PROOF STEP]
by (auto simp: wcount_def add_mult_distrib)


[STATEMENT]
lemma of_int_complex_interval_0[simp]: "of_int_complex_interval 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_complex_interval 0 = 0
[PROOF STEP]
by (simp add: of_int_complex_interval_def zero_complex_interval_def to_interval_def zero_interval_def)


[STATEMENT]
lemma takeWhile_filter:
  "sorted (map fst xs) \<Longrightarrow> \<forall>t \<in> fst ` set xs. t \<le> nt \<Longrightarrow>
  takeWhile (\<lambda>(t, X). enat (nt - t) > c) xs = filter (\<lambda>(t, X). enat (nt - t) > c) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted (map fst xs); \<forall>t\<in>fst ` set xs. t \<le> nt\<rbrakk> \<Longrightarrow> takeWhile (\<lambda>(t, X). c < enat (nt - t)) xs = filter (\<lambda>(t, X). c < enat (nt - t)) xs
[PROOF STEP]
by (induction xs) (auto 0 3 simp: less_enat_iff intro!: filter_empty_conv[THEN iffD2, symmetric])


[STATEMENT]
lemma length_Cons: "length (x # xs) = Suc (length xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (x # xs) = Suc (length xs)
[PROOF STEP]
by simp


[STATEMENT]
lemma fin_bipartite_sym: "fin_bipartite_graph V E Y X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fin_bipartite_graph V E Y X
[PROOF STEP]
by (intro_locales) (simp add: bipartite_sym bipartite_graph.axioms(2))


[STATEMENT]
theorem F'set4_natural: "F'set4 o F'map f1 f2 f3 f4 = image f4 o F'set4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F'set4 \<circ> Fmap f3 f4 = (`) f4 \<circ> F'set4
[PROOF STEP]
by (rule F.set_map0(2))


[STATEMENT]
lemma iterate_add_less_eq_iff2:
  "i \<le> (j::nat) \<Longrightarrow> (iterate_add i (u:: 'a :: {cancel_comm_monoid_add, ordered_ab_semigroup_add_imp_le}) + m \<le> iterate_add j u + n) = (m \<le> iterate_add (j - i) u + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> (iterate_add i u + m \<le> iterate_add j u + n) = (m \<le> iterate_add (j - i) u + n)
[PROOF STEP]
by (auto dest!: le_Suc_ex add_right_imp_eq simp: ab_semigroup_add_class.add_ac(1))


[STATEMENT]
lemma real_v_integral_eq:
  assumes cfg[simp]: "cfg \<in> valid_cfg"
  shows "enn2real (\<integral>\<^sup>+ s. v (cont cfg s) \<partial>action cfg) = \<integral> s. enn2real (v (cont cfg s)) \<partial>action cfg"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (\<integral>\<^sup>+ s. v (cont cfg s) \<partial>measure_pmf (action cfg)) = measure_pmf.expectation (action cfg) (\<lambda>s. enn2real (v (cont cfg s)))
[PROOF STEP]
by (subst integral_eq_nn_integral)
    (auto simp: AE_measure_pmf_iff v_eq T.emeasure_eq_measure valid_cfg_cont
          intro!: arg_cong[where f=enn2real] nn_integral_cong_AE)


[STATEMENT]
lemma abs_of_rat [simp]:
  "\<bar>of_rat r\<bar> = (of_rat \<bar>r\<bar> :: 'a :: linordered_field)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>of_rat r\<bar> = of_rat \<bar>r\<bar>
[PROOF STEP]
by (cases "r \<ge> 0") (simp_all add: not_le of_rat_minus)


[STATEMENT]
lemma max_input_Plus:
  "max_input (Plus a1 a2) = max (max_input a1) (max_input a2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_input (Plus a1 a2) = max (max_input a1) (max_input a2)
[PROOF STEP]
apply (simp add: max_input_def Let_def max.commute max_absorb2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enumerate_aexp_inputs a1 \<noteq> {} \<longrightarrow> enumerate_aexp_inputs a2 \<noteq> {} \<longrightarrow> Some (Max (enumerate_aexp_inputs a1 \<union> enumerate_aexp_inputs a2)) = max (Some (Max (enumerate_aexp_inputs a1))) (Some (Max (enumerate_aexp_inputs a2)))
[PROOF STEP]
by (metis List.finite_set Max.union enumerate_aexp_inputs_list sup_Some sup_max)


[STATEMENT]
lemma member_Id_on[iff]: "(x, y) \<in> Id_on A \<longleftrightarrow> x = y \<and> y \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in> Id_on A) = (x = y \<and> y \<in> A)
[PROOF STEP]
unfolding Id_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, y) \<in> (\<Union>x\<in>A. {(x, x)})) = (x = y \<and> y \<in> A)
[PROOF STEP]
by auto


[STATEMENT]
lemma bit_double_iff [bit_simps]:
  \<open>bit (2 * a) n \<longleftrightarrow> bit a (n - 1) \<and> n \<noteq> 0 \<and> possible_bit TYPE('a) n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit ((2::'a) * a) n = (bit a (n - 1) \<and> n \<noteq> 0 \<and> possible_bit TYPE('a) n)
[PROOF STEP]
using even_mult_exp_div_exp_iff [of a 1 n]
[PROOF STATE]
proof (prove)
using this:
even (a * (2::'a) ^ 1 div (2::'a) ^ n) = (n < 1 \<or> (2::'a) ^ n = (0::'a) \<or> 1 \<le> n \<and> even (a div (2::'a) ^ (n - 1)))

goal (1 subgoal):
 1. bit ((2::'a) * a) n = (bit a (n - 1) \<and> n \<noteq> 0 \<and> possible_bit TYPE('a) n)
[PROOF STEP]
by (cases n, auto simp add: bit_iff_odd ac_simps possible_bit_def)


[STATEMENT]
lemma imgTr9:"\<lbrakk>Group F; Group G; f \<in> gHom F G; F \<guillemotright> H; u \<in> f ` H\<rbrakk> \<Longrightarrow>
                    \<rho>\<^bsub>G\<^esub> u \<in> f ` H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; F \<guillemotright> H ; u \<in> f ` H\<rbrakk> \<Longrightarrow> \<rho>\<^bsub>G\<^esub> u \<in> f ` H
[PROOF STEP]
apply (simp add:image_def, erule bexE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Group F; Group G; f \<in> gHom F G; F \<guillemotright> H ; x \<in> H; u = f x\<rbrakk> \<Longrightarrow> \<exists>xa\<in>H. \<rho>\<^bsub>G\<^esub> f x = f xa
[PROOF STEP]
apply (frule_tac h = x in Group.sg_subset_elem[of "F" "H"], assumption+,
       simp add:ghom_inv_inv[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Group F; Group G; f \<in> gHom F G; F \<guillemotright> H ; x \<in> H; u = f x; x \<in> carrier F\<rbrakk> \<Longrightarrow> \<exists>xa\<in>H. f (\<rho>\<^bsub>F\<^esub> x) = f xa
[PROOF STEP]
apply (frule_tac x = x in Group.sg_i_closed [of "F" "H"], assumption+,
       blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_merge: "set_tree (merge t1 t2) = set_tree t1 \<union> set_tree t2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_tree (merge t1 t2) = set_tree t1 \<union> set_tree t2
[PROOF STEP]
by (metis mset_merge set_mset_tree set_mset_union)


[STATEMENT]
lemma transitive_asymmetric_irreflexive_inf:
  "transitive x \<Longrightarrow> asymmetric x \<longleftrightarrow> irreflexive_inf x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transitive x \<Longrightarrow> asymmetric x = irreflexive_inf x
[PROOF STEP]
by (smt asymmetric_inf asymmetric_irreflexive_inf inf.absorb2 inf.cobounded1 inf.sup_monoid.add_commute inf_assoc le_bot)


[STATEMENT]
lemma pell_valuation_pos_neg:
  assumes "x > 0" "y < 0" "solution (x, y)"
  shows   "pell_valuation (x, y) \<in> {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pell_valuation (x, y) \<in> {0<..<1}
[PROOF STEP]
using pell_valuation_pos_neg_aux[of x "-y"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < x; 0 < - y; solution (x, - y)\<rbrakk> \<Longrightarrow> pell_valuation (x, - (- y)) \<in> {0<..<1}
0 < x
y < 0
solution (x, y)

goal (1 subgoal):
 1. pell_valuation (x, y) \<in> {0<..<1}
[PROOF STEP]
by simp


[STATEMENT]
lemma derivation_shift_right_left_subtract:
  "right \<ge> left \<Longrightarrow> derivation_shift (derivation_shift L 0 right) left 0 =
  derivation_shift L 0 (right - left)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. left \<le> right \<Longrightarrow> derivation_shift (derivation_shift L 0 right) left 0 = derivation_shift L 0 (right - left)
[PROOF STEP]
by (induct L, simp+)