[STATEMENT]
lemma split_four_block_dual_fst_lst:
  assumes "split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (U, X, Y, V)"
  shows "U = A" "V = D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U = A &&& V = D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
define nr where nr: "nr = dim_row (four_block_mat A B C D)"
[PROOF STATE]
proof (state)
this:
nr = dim_row (four_block_mat A B C D)

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
define nc where nc: "nc = dim_col (four_block_mat A B C D)"
[PROOF STATE]
proof (state)
this:
nc = dim_col (four_block_mat A B C D)

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
define nr2 where nr2: "nr2 = nr - dim_row A"
[PROOF STATE]
proof (state)
this:
nr2 = nr - dim_row A

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
define nc2 where nc2: "nc2 = nc - dim_col A"
[PROOF STATE]
proof (state)
this:
nc2 = nc - dim_col A

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
define A1 where A1: "A1 = mat (dim_row A) (dim_col A) (($$) (four_block_mat A B C D))"
[PROOF STATE]
proof (state)
this:
A1 = mat (dim_row A) (dim_col A) (($$) (four_block_mat A B C D))

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
define A2 where A2: "A2 = mat (dim_row A) nc2 (\<lambda>(i, j). (four_block_mat A B C D) $$ (i, j + dim_col A))"
[PROOF STATE]
proof (state)
this:
A2 = mat (dim_row A) nc2 (\<lambda>(i, j). four_block_mat A B C D $$ (i, j + dim_col A))

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
define A3 where A3: "A3 = mat nr2 (dim_col A) (\<lambda>(i, j). (four_block_mat A B C D) $$ (i + dim_row A, j))"
[PROOF STATE]
proof (state)
this:
A3 = mat nr2 (dim_col A) (\<lambda>(i, j). four_block_mat A B C D $$ (i + dim_row A, j))

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
define A4 where A4: "A4 = mat nr2 nc2 (\<lambda>(i, j). (four_block_mat A B C D) $$ (i + dim_row A, j + dim_col A))"
[PROOF STATE]
proof (state)
this:
A4 = mat nr2 nc2 (\<lambda>(i, j). four_block_mat A B C D $$ (i + dim_row A, j + dim_col A))

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
have g: "split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A1, A2, A3, A4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A1, A2, A3, A4)
[PROOF STEP]
using split_block_def[of "(four_block_mat A B C D)" "(dim_row A)" "(dim_col A)"]
[PROOF STATE]
proof (prove)
using this:
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (let nr = dim_row (four_block_mat A B C D); nc = dim_col (four_block_mat A B C D); nr2 = nr - dim_row A; nc2 = nc - dim_col A; A1 = mat (dim_row A) (dim_col A) (($$) (four_block_mat A B C D)); A2 = mat (dim_row A) nc2 (\<lambda>(i, j). four_block_mat A B C D $$ (i, j + dim_col A)); A3 = mat nr2 (dim_col A) (\<lambda>(i, j). four_block_mat A B C D $$ (i + dim_row A, j)); A4 = mat nr2 nc2 (\<lambda>(i, j). four_block_mat A B C D $$ (i + dim_row A, j + dim_col A)) in (A1, A2, A3, A4))

goal (1 subgoal):
 1. split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A1, A2, A3, A4)
[PROOF STEP]
by (metis A1 A2 A3 A4 nc nc2 nr nr2)
[PROOF STATE]
proof (state)
this:
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A1, A2, A3, A4)

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
have D: "D = A4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D = A4
[PROOF STEP]
using A4
[PROOF STATE]
proof (prove)
using this:
A4 = mat nr2 nc2 (\<lambda>(i, j). four_block_mat A B C D $$ (i + dim_row A, j + dim_col A))

goal (1 subgoal):
 1. D = A4
[PROOF STEP]
by (auto) (standard, (simp add:  nr nr2 nc nc2)+)
[PROOF STATE]
proof (state)
this:
D = A4

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
have "A = A1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = A1
[PROOF STEP]
using A1
[PROOF STATE]
proof (prove)
using this:
A1 = mat (dim_row A) (dim_col A) (($$) (four_block_mat A B C D))

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

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = A1
[PROOF STEP]
have "split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)"
[PROOF STATE]
proof (prove)
using this:
A = A1

goal (1 subgoal):
 1. split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)
[PROOF STEP]
using D g
[PROOF STATE]
proof (prove)
using this:
A = A1
D = A4
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A1, A2, A3, A4)

goal (1 subgoal):
 1. split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)

goal (2 subgoals):
 1. U = A
 2. V = D
[PROOF STEP]
show "U = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U = A
[PROOF STEP]
using assms calculation
[PROOF STATE]
proof (prove)
using this:
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (U, X, Y, V)
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)

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

goal (1 subgoal):
 1. V = D
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)
U = A
[PROOF STEP]
show "V = D"
[PROOF STATE]
proof (prove)
using this:
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)
U = A

goal (1 subgoal):
 1. V = D
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (A, A2, A3, D)
U = A
split_block (four_block_mat A B C D) (dim_row A) (dim_col A) = (U, X, Y, V)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_lset_ltlD: "x \<in> lset (ltl xs) \<Longrightarrow> x \<in> lset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> lset (ltl xs) \<Longrightarrow> x \<in> lset xs
[PROOF STEP]
using lset_ltl[of xs]
[PROOF STATE]
proof (prove)
using this:
lset (ltl xs) \<subseteq> lset xs

goal (1 subgoal):
 1. x \<in> lset (ltl xs) \<Longrightarrow> x \<in> lset xs
[PROOF STEP]
by auto


[STATEMENT]
lemma in_spanE:
  assumes "v \<in> span W"
  shows "\<exists> a A. v = lincomb a A \<and> finite A \<and> A \<subseteq> W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a A. v = lincomb a A \<and> finite A \<and> A \<subseteq> W
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> local.span W

goal (1 subgoal):
 1. \<exists>a A. v = lincomb a A \<and> finite A \<and> A \<subseteq> W
[PROOF STEP]
unfolding span_def
[PROOF STATE]
proof (prove)
using this:
v \<in> {lincomb a A |a A. finite A \<and> A \<subseteq> W}

goal (1 subgoal):
 1. \<exists>a A. v = lincomb a A \<and> finite A \<and> A \<subseteq> W
[PROOF STEP]
by auto


[STATEMENT]
lemma bin_rsplitl_aux_append: "bin_rsplitl_aux n m c (bs @ cs) = bin_rsplitl_aux n m c bs @ cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_rsplitl_aux n m c (bs @ cs) = bin_rsplitl_aux n m c bs @ cs
[PROOF STEP]
apply (induct n m c bs rule: bin_rsplitl_aux.induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m c bs. (\<And>x xa y. \<lbrakk>\<not> (m = 0 \<or> n = 0); x = bin_split (min m n) c; (xa, y) = x\<rbrakk> \<Longrightarrow> bin_rsplitl_aux n (m - n) xa ((y # bs) @ cs) = bin_rsplitl_aux n (m - n) xa (y # bs) @ cs) \<Longrightarrow> bin_rsplitl_aux n m c (bs @ cs) = bin_rsplitl_aux n m c bs @ cs
[PROOF STEP]
apply (subst bin_rsplitl_aux.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m c bs. (\<And>x xa y. \<lbrakk>\<not> (m = 0 \<or> n = 0); x = bin_split (min m n) c; (xa, y) = x\<rbrakk> \<Longrightarrow> bin_rsplitl_aux n (m - n) xa ((y # bs) @ cs) = bin_rsplitl_aux n (m - n) xa (y # bs) @ cs) \<Longrightarrow> (if m = 0 \<or> n = 0 then bs @ cs else let (a, b) = bin_split (min m n) c in bin_rsplitl_aux n (m - n) a (b # bs @ cs)) = bin_rsplitl_aux n m c bs @ cs
[PROOF STEP]
apply (subst bin_rsplitl_aux.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m c bs. (\<And>x xa y. \<lbrakk>\<not> (m = 0 \<or> n = 0); x = bin_split (min m n) c; (xa, y) = x\<rbrakk> \<Longrightarrow> bin_rsplitl_aux n (m - n) xa ((y # bs) @ cs) = bin_rsplitl_aux n (m - n) xa (y # bs) @ cs) \<Longrightarrow> (if m = 0 \<or> n = 0 then bs @ cs else let (a, b) = bin_split (min m n) c in if m - n = 0 \<or> n = 0 then b # bs @ cs else let (a, ba) = bin_split (min (m - n) n) a in bin_rsplitl_aux n (m - n - n) a (ba # b # bs @ cs)) = bin_rsplitl_aux n m c bs @ cs
[PROOF STEP]
apply (clarsimp split: prod.split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma G_upper:
  assumes x: "x > 0" "x \<le> 1" and n: "n \<ge> 2"
  shows  "G x \<le> Gamma_series x n * (1 + x / real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
have "(ln \<circ> G) (real n + x) \<le> ((ln \<circ> G) (real n + 1) -
          (ln \<circ> G) (real n)) / (real n + 1 - (real n)) *
           ((real n + x) - real n) + (ln \<circ> G) (real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ln \<circ> G) (real n + x) \<le> ((ln \<circ> G) (real n + 1) - (ln \<circ> G) (real n)) / (real n + 1 - real n) * (real n + x - real n) + (ln \<circ> G) (real n)
[PROOF STEP]
using x n
[PROOF STATE]
proof (prove)
using this:
0 < x
x \<le> 1
2 \<le> n

goal (1 subgoal):
 1. (ln \<circ> G) (real n + x) \<le> ((ln \<circ> G) (real n + 1) - (ln \<circ> G) (real n)) / (real n + 1 - real n) * (real n + x - real n) + (ln \<circ> G) (real n)
[PROOF STEP]
by (intro convex_onD_Icc' convex_on_subset[OF log_convex_G]) auto
[PROOF STATE]
proof (state)
this:
(ln \<circ> G) (real n + x) \<le> ((ln \<circ> G) (real n + 1) - (ln \<circ> G) (real n)) / (real n + 1 - real n) * (real n + x - real n) + (ln \<circ> G) (real n)

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
hence "S (of_nat n) (of_nat n + x) \<le> S (of_nat n) (of_nat n + 1)"
[PROOF STATE]
proof (prove)
using this:
(ln \<circ> G) (real n + x) \<le> ((ln \<circ> G) (real n + 1) - (ln \<circ> G) (real n)) / (real n + 1 - real n) * (real n + x - real n) + (ln \<circ> G) (real n)

goal (1 subgoal):
 1. S (real n) (real n + x) \<le> S (real n) (real n + 1)
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
using this:
(ln \<circ> G) (real n + x) \<le> ((ln \<circ> G) (real n + 1) - (ln \<circ> G) (real n)) / (real n + 1 - real n) * (real n + x - real n) + (ln \<circ> G) (real n)

goal (1 subgoal):
 1. (ln (G (real n + x)) - ln (G (real n))) / (real n + x - real n) \<le> (ln (G (real n + 1)) - ln (G (real n))) / (real n + 1 - real n)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
(ln \<circ> G) (real n + x) \<le> ((ln \<circ> G) (real n + 1) - (ln \<circ> G) (real n)) / (real n + 1 - real n) * (real n + x - real n) + (ln \<circ> G) (real n)
0 < x
x \<le> 1

goal (1 subgoal):
 1. (ln (G (real n + x)) - ln (G (real n))) / (real n + x - real n) \<le> (ln (G (real n + 1)) - ln (G (real n))) / (real n + 1 - real n)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
S (real n) (real n + x) \<le> S (real n) (real n + 1)

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S (real n) (real n + x) \<le> S (real n) (real n + 1)

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
2 \<le> n
[PROOF STEP]
have "S (of_nat n) (of_nat n + 1) = ln (fact n) - ln (fact (n-1))"
[PROOF STATE]
proof (prove)
using this:
2 \<le> n

goal (1 subgoal):
 1. S (real n) (real n + 1) = ln (fact n) - ln (fact (n - 1))
[PROOF STEP]
by (subst (1 2) G_fact [symmetric]) (simp add: S_def add_ac of_nat_diff)
[PROOF STATE]
proof (state)
this:
S (real n) (real n + 1) = ln (fact n) - ln (fact (n - 1))

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S (real n) (real n + 1) = ln (fact n) - ln (fact (n - 1))

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
have "\<dots> = ln (fact n / (fact (n-1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact n) - ln (fact (n - 1)) = ln (fact n / fact (n - 1))
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
2 \<le> n

goal (1 subgoal):
 1. ln (fact n) - ln (fact (n - 1)) = ln (fact n / fact (n - 1))
[PROOF STEP]
by (subst ln_div) simp_all
[PROOF STATE]
proof (state)
this:
ln (fact n) - ln (fact (n - 1)) = ln (fact n / fact (n - 1))

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (fact n) - ln (fact (n - 1)) = ln (fact n / fact (n - 1))

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
2 \<le> n
[PROOF STEP]
have "fact n / fact (n - 1) = n"
[PROOF STATE]
proof (prove)
using this:
2 \<le> n

goal (1 subgoal):
 1. fact n / fact (n - 1) = real n
[PROOF STEP]
by (cases n) simp_all
[PROOF STATE]
proof (state)
this:
fact n / fact (n - 1) = real n

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
S (real n) (real n + x) \<le> ln (real n)
[PROOF STEP]
have "ln (G (real n + x)) \<le> x * ln (real n) + ln (fact (n - 1))"
[PROOF STATE]
proof (prove)
using this:
S (real n) (real n + x) \<le> ln (real n)

goal (1 subgoal):
 1. ln (G (real n + x)) \<le> x * ln (real n) + ln (fact (n - 1))
[PROOF STEP]
using x n
[PROOF STATE]
proof (prove)
using this:
S (real n) (real n + x) \<le> ln (real n)
0 < x
x \<le> 1
2 \<le> n

goal (1 subgoal):
 1. ln (G (real n + x)) \<le> x * ln (real n) + ln (fact (n - 1))
[PROOF STEP]
by (subst (asm) S_eq) (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
ln (G (real n + x)) \<le> x * ln (real n) + ln (fact (n - 1))

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (G (real n + x)) \<le> x * ln (real n) + ln (fact (n - 1))

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
have "\<dots> = ln (exp (x * ln (real n)) * fact (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * ln (real n) + ln (fact (n - 1)) = ln (exp (x * ln (real n)) * fact (n - 1))
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
0 < x
x \<le> 1

goal (1 subgoal):
 1. x * ln (real n) + ln (fact (n - 1)) = ln (exp (x * ln (real n)) * fact (n - 1))
[PROOF STEP]
by (simp add: ln_mult)
[PROOF STATE]
proof (state)
this:
x * ln (real n) + ln (fact (n - 1)) = ln (exp (x * ln (real n)) * fact (n - 1))

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (G (real n + x)) \<le> ln (exp (x * ln (real n)) * fact (n - 1))
[PROOF STEP]
have "G (real n + x) \<le> exp (x * ln (real n)) * fact (n - 1)"
[PROOF STATE]
proof (prove)
using this:
ln (G (real n + x)) \<le> ln (exp (x * ln (real n)) * fact (n - 1))

goal (1 subgoal):
 1. G (real n + x) \<le> exp (x * ln (real n)) * fact (n - 1)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
ln (G (real n + x)) \<le> ln (exp (x * ln (real n)) * fact (n - 1))
0 < x
x \<le> 1

goal (1 subgoal):
 1. G (real n + x) \<le> exp (x * ln (real n)) * fact (n - 1)
[PROOF STEP]
by (subst (asm) ln_le_cancel_iff) (simp_all add: G_pos)
[PROOF STATE]
proof (state)
this:
G (real n + x) \<le> exp (x * ln (real n)) * fact (n - 1)

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
G (real n + x) \<le> exp (x * ln (real n)) * fact (n - 1)

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
have "G (real n + x) = pochhammer x n * G x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G (real n + x) = pochhammer x n * G x
[PROOF STEP]
using G_plus1[of "real n + x" for n] x
[PROOF STATE]
proof (prove)
using this:
0 < real ?na2 + x \<Longrightarrow> G (real ?na2 + x + 1) = (real ?na2 + x) * G (real ?na2 + x)
0 < x
x \<le> 1

goal (1 subgoal):
 1. G (real n + x) = pochhammer x n * G x
[PROOF STEP]
by (induction n) (simp_all add: pochhammer_Suc add_ac)
[PROOF STATE]
proof (state)
this:
G (real n + x) = pochhammer x n * G x

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pochhammer x n * G x \<le> exp (x * ln (real n)) * fact (n - 1)
[PROOF STEP]
have "G x \<le> exp (x * ln (real n)) * fact (n- 1) / pochhammer x n"
[PROOF STATE]
proof (prove)
using this:
pochhammer x n * G x \<le> exp (x * ln (real n)) * fact (n - 1)

goal (1 subgoal):
 1. G x \<le> exp (x * ln (real n)) * fact (n - 1) / pochhammer x n
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
pochhammer x n * G x \<le> exp (x * ln (real n)) * fact (n - 1)
0 < x
x \<le> 1

goal (1 subgoal):
 1. G x \<le> exp (x * ln (real n)) * fact (n - 1) / pochhammer x n
[PROOF STEP]
by (simp add: field_simps pochhammer_pos)
[PROOF STATE]
proof (state)
this:
G x \<le> exp (x * ln (real n)) * fact (n - 1) / pochhammer x n

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
G x \<le> exp (x * ln (real n)) * fact (n - 1) / pochhammer x n

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
2 \<le> n
[PROOF STEP]
have "fact (n - 1) = fact n / n"
[PROOF STATE]
proof (prove)
using this:
2 \<le> n

goal (1 subgoal):
 1. fact (n - 1) = fact n / real n
[PROOF STEP]
by (cases n) simp_all
[PROOF STATE]
proof (state)
this:
fact (n - 1) = fact n / real n

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (n - 1) = fact n / real n

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
have "exp (x * ln (real n)) * \<dots> / pochhammer x n =
               Gamma_series x n * (1 + x / real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (x * ln (real n)) * (fact n / real n) / pochhammer x n = Gamma_series x n * (1 + x / real n)
[PROOF STEP]
using n x
[PROOF STATE]
proof (prove)
using this:
2 \<le> n
0 < x
x \<le> 1

goal (1 subgoal):
 1. exp (x * ln (real n)) * (fact n / real n) / pochhammer x n = Gamma_series x n * (1 + x / real n)
[PROOF STEP]
by (simp add: Gamma_series_def divide_simps pochhammer_Suc)
[PROOF STATE]
proof (state)
this:
exp (x * ln (real n)) * (fact n / real n) / pochhammer x n = Gamma_series x n * (1 + x / real n)

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
G x \<le> Gamma_series x n * (1 + x / real n)

goal (1 subgoal):
 1. G x \<le> Gamma_series x n * (1 + x / real n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
G x \<le> Gamma_series x n * (1 + x / real n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma substituitionslemma:
  fixes E :: "nat rexp"
  shows "L (substL ( lang(E) ) \<sigma>) = lang (subst E \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>)
[PROOF STEP]
proof (induct E)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
case (Star e)
[PROOF STATE]
proof (state)
this:
L (substL (lang e) \<sigma>) = lang (subst e \<sigma>)

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
have "L (substL (lang (Star e)) \<sigma>) = L (substL (star (lang e)) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang (Star e)) \<sigma>) = L (substL (star (lang e)) \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
L (substL (lang (Star e)) \<sigma>) = L (substL (star (lang e)) \<sigma>)

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (lang (Star e)) \<sigma>) = L (substL (star (lang e)) \<sigma>)

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
have "\<dots> = L (starS (substL (lang e) \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (star (lang e)) \<sigma>) = L (starS (substL (lang e) \<sigma>))
[PROOF STEP]
by(simp only: substL_star)
[PROOF STATE]
proof (state)
this:
L (substL (star (lang e)) \<sigma>) = L (starS (substL (lang e) \<sigma>))

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (star (lang e)) \<sigma>) = L (starS (substL (lang e) \<sigma>))

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
have "\<dots> = star ( L (substL (lang e) \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (starS (substL (lang e) \<sigma>)) = star (L (substL (lang e) \<sigma>))
[PROOF STEP]
by(simp only: Lstar)
[PROOF STATE]
proof (state)
this:
L (starS (substL (lang e) \<sigma>)) = star (L (substL (lang e) \<sigma>))

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (starS (substL (lang e) \<sigma>)) = star (L (substL (lang e) \<sigma>))

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
have "\<dots> = star (lang (subst e \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. star (L (substL (lang e) \<sigma>)) = star (lang (subst e \<sigma>))
[PROOF STEP]
by(simp only: Star)
[PROOF STATE]
proof (state)
this:
star (L (substL (lang e) \<sigma>)) = star (lang (subst e \<sigma>))

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
star (L (substL (lang e) \<sigma>)) = star (lang (subst e \<sigma>))

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
have "\<dots> = lang ((subst (Star e) \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. star (lang (subst e \<sigma>)) = lang (subst (Star e) \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
star (lang (subst e \<sigma>)) = lang (subst (Star e) \<sigma>)

goal (6 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
 6. \<And>E. L (substL (lang E) \<sigma>) = lang (subst E \<sigma>) \<Longrightarrow> L (substL (lang (Star E)) \<sigma>) = lang (subst (Star E) \<sigma>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
L (substL (lang (Star e)) \<sigma>) = lang (subst (Star e) \<sigma>)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
L (substL (lang (Star e)) \<sigma>) = lang (subst (Star e) \<sigma>)

goal (1 subgoal):
 1. L (substL (lang (Star e)) \<sigma>) = lang (subst (Star e) \<sigma>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
L (substL (lang (Star e)) \<sigma>) = lang (subst (Star e) \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
case (Plus e1 e2)
[PROOF STATE]
proof (state)
this:
L (substL (lang e1) \<sigma>) = lang (subst e1 \<sigma>)
L (substL (lang e2) \<sigma>) = lang (subst e2 \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "L (substL (lang (Plus e1 e2)) \<sigma>) = L (substL (lang e1 \<union> lang e2) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang (Plus e1 e2)) \<sigma>) = L (substL (lang e1 \<union> lang e2) \<sigma>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
L (substL (lang (Plus e1 e2)) \<sigma>) = L (substL (lang e1 \<union> lang e2) \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (lang (Plus e1 e2)) \<sigma>) = L (substL (lang e1 \<union> lang e2) \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> =  L ( substL (lang e1) \<sigma> \<union> substL (lang e2) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang e1 \<union> lang e2) \<sigma>) = L (substL (lang e1) \<sigma> \<union> substL (lang e2) \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
L (substL (lang e1 \<union> lang e2) \<sigma>) = L (substL (lang e1) \<sigma> \<union> substL (lang e2) \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (lang e1 \<union> lang e2) \<sigma>) = L (substL (lang e1) \<sigma> \<union> substL (lang e2) \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> = L (substL (lang e1) \<sigma>) \<union> L (substL (lang e2) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang e1) \<sigma> \<union> substL (lang e2) \<sigma>) = L (substL (lang e1) \<sigma>) \<union> L (substL (lang e2) \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
L (substL (lang e1) \<sigma> \<union> substL (lang e2) \<sigma>) = L (substL (lang e1) \<sigma>) \<union> L (substL (lang e2) \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (lang e1) \<sigma> \<union> substL (lang e2) \<sigma>) = L (substL (lang e1) \<sigma>) \<union> L (substL (lang e2) \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> = lang (subst e1 \<sigma>) \<union> lang (subst e2 \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang e1) \<sigma>) \<union> L (substL (lang e2) \<sigma>) = lang (subst e1 \<sigma>) \<union> lang (subst e2 \<sigma>)
[PROOF STEP]
by(simp only: Plus)
[PROOF STATE]
proof (state)
this:
L (substL (lang e1) \<sigma>) \<union> L (substL (lang e2) \<sigma>) = lang (subst e1 \<sigma>) \<union> lang (subst e2 \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (lang e1) \<sigma>) \<union> L (substL (lang e2) \<sigma>) = lang (subst e1 \<sigma>) \<union> lang (subst e2 \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> = lang (subst (Plus e1 e2) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang (subst e1 \<sigma>) \<union> lang (subst e2 \<sigma>) = lang (subst (Plus e1 e2) \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang (subst e1 \<sigma>) \<union> lang (subst e2 \<sigma>) = lang (subst (Plus e1 e2) \<sigma>)

goal (5 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Plus E1 E2)) \<sigma>) = lang (subst (Plus E1 E2) \<sigma>)
 5. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
L (substL (lang (Plus e1 e2)) \<sigma>) = lang (subst (Plus e1 e2) \<sigma>)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
L (substL (lang (Plus e1 e2)) \<sigma>) = lang (subst (Plus e1 e2) \<sigma>)

goal (1 subgoal):
 1. L (substL (lang (Plus e1 e2)) \<sigma>) = lang (subst (Plus e1 e2) \<sigma>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
L (substL (lang (Plus e1 e2)) \<sigma>) = lang (subst (Plus e1 e2) \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
case (Times e1 e2)
[PROOF STATE]
proof (state)
this:
L (substL (lang e1) \<sigma>) = lang (subst e1 \<sigma>)
L (substL (lang e2) \<sigma>) = lang (subst e2 \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "L (substL (lang (Times e1 e2)) \<sigma>) = L (substL (lang e1 @@ lang e2) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang (Times e1 e2)) \<sigma>) = L (substL (lang e1 @@ lang e2) \<sigma>)
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
L (substL (lang (Times e1 e2)) \<sigma>) = L (substL (lang e1 @@ lang e2) \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (lang (Times e1 e2)) \<sigma>) = L (substL (lang e1 @@ lang e2) \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> =  L (concS (substL (lang e1) \<sigma>) (substL (lang e2) \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang e1 @@ lang e2) \<sigma>) = L (concS (substL (lang e1) \<sigma>) (substL (lang e2) \<sigma>))
[PROOF STEP]
by(simp only: substL_conc)
[PROOF STATE]
proof (state)
this:
L (substL (lang e1 @@ lang e2) \<sigma>) = L (concS (substL (lang e1) \<sigma>) (substL (lang e2) \<sigma>))

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
thm L_conc
[PROOF STATE]
proof (state)
this:
L (substL (lang e1 @@ lang e2) \<sigma>) = L (concS (substL (lang e1) \<sigma>) (substL (lang e2) \<sigma>))

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (lang e1 @@ lang e2) \<sigma>) = L (concS (substL (lang e1) \<sigma>) (substL (lang e2) \<sigma>))

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> = L (substL (lang e1) \<sigma>) @@ L (substL (lang e2) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (concS (substL (lang e1) \<sigma>) (substL (lang e2) \<sigma>)) = L (substL (lang e1) \<sigma>) @@ L (substL (lang e2) \<sigma>)
[PROOF STEP]
by(simp only: L_conc)
[PROOF STATE]
proof (state)
this:
L (concS (substL (lang e1) \<sigma>) (substL (lang e2) \<sigma>)) = L (substL (lang e1) \<sigma>) @@ L (substL (lang e2) \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (concS (substL (lang e1) \<sigma>) (substL (lang e2) \<sigma>)) = L (substL (lang e1) \<sigma>) @@ L (substL (lang e2) \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> = lang (subst e1 \<sigma>) @@ lang (subst e2 \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (substL (lang e1) \<sigma>) @@ L (substL (lang e2) \<sigma>) = lang (subst e1 \<sigma>) @@ lang (subst e2 \<sigma>)
[PROOF STEP]
by(simp only: Times)
[PROOF STATE]
proof (state)
this:
L (substL (lang e1) \<sigma>) @@ L (substL (lang e2) \<sigma>) = lang (subst e1 \<sigma>) @@ lang (subst e2 \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
L (substL (lang e1) \<sigma>) @@ L (substL (lang e2) \<sigma>) = lang (subst e1 \<sigma>) @@ lang (subst e2 \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> = lang (Times (subst e1 \<sigma>) (subst e2 \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang (subst e1 \<sigma>) @@ lang (subst e2 \<sigma>) = lang (Times (subst e1 \<sigma>) (subst e2 \<sigma>))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang (subst e1 \<sigma>) @@ lang (subst e2 \<sigma>) = lang (Times (subst e1 \<sigma>) (subst e2 \<sigma>))

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lang (subst e1 \<sigma>) @@ lang (subst e2 \<sigma>) = lang (Times (subst e1 \<sigma>) (subst e2 \<sigma>))

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
have "\<dots> = lang (subst (Times e1 e2) \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lang (Times (subst e1 \<sigma>) (subst e2 \<sigma>)) = lang (subst (Times e1 e2) \<sigma>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang (Times (subst e1 \<sigma>) (subst e2 \<sigma>)) = lang (subst (Times e1 e2) \<sigma>)

goal (4 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
 4. \<And>E1 E2. \<lbrakk>L (substL (lang E1) \<sigma>) = lang (subst E1 \<sigma>); L (substL (lang E2) \<sigma>) = lang (subst E2 \<sigma>)\<rbrakk> \<Longrightarrow> L (substL (lang (Times E1 E2)) \<sigma>) = lang (subst (Times E1 E2) \<sigma>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
L (substL (lang (Times e1 e2)) \<sigma>) = lang (subst (Times e1 e2) \<sigma>)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
L (substL (lang (Times e1 e2)) \<sigma>) = lang (subst (Times e1 e2) \<sigma>)

goal (1 subgoal):
 1. L (substL (lang (Times e1 e2)) \<sigma>) = lang (subst (Times e1 e2) \<sigma>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
L (substL (lang (Times e1 e2)) \<sigma>) = lang (subst (Times e1 e2) \<sigma>)

goal (3 subgoals):
 1. L (substL (lang Zero) \<sigma>) = lang (subst Zero \<sigma>)
 2. L (substL (lang One) \<sigma>) = lang (subst One \<sigma>)
 3. \<And>x. L (substL (lang (Atom x)) \<sigma>) = lang (subst (Atom x) \<sigma>)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma graph_domD: "x \<in> graph m \<Longrightarrow> fst x \<in> dom m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> graph m \<Longrightarrow> fst x \<in> dom m
[PROOF STEP]
using fst_graph_eq_dom
[PROOF STATE]
proof (prove)
using this:
fst ` graph ?m = dom ?m

goal (1 subgoal):
 1. x \<in> graph m \<Longrightarrow> fst x \<in> dom m
[PROOF STEP]
by (metis imageI)


[STATEMENT]
lemma Bpow_empty[simp]:
assumes "Card_order r"
shows "Bpow r {} = {{}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bpow r {} = {{}}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Card_order r

goal (1 subgoal):
 1. Bpow r {} = {{}}
[PROOF STEP]
unfolding Bpow_def
[PROOF STATE]
proof (prove)
using this:
Card_order r

goal (1 subgoal):
 1. {X. X \<subseteq> {} \<and> |X| \<le>o r} = {{}}
[PROOF STEP]
by auto


[STATEMENT]
lemma filter_mset_cong0:
  assumes "\<And>x. x \<in># M \<Longrightarrow> f x \<longleftrightarrow> g x"
  shows "filter_mset f M = filter_mset g M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset f M = filter_mset g M
[PROOF STEP]
proof (rule subset_mset.antisym; unfold subseteq_mset_def; rule allI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. count (filter_mset f M) a \<le> count (filter_mset g M) a
 2. \<And>a. count (filter_mset g M) a \<le> count (filter_mset f M) a
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. count (filter_mset f M) a \<le> count (filter_mset g M) a
 2. \<And>a. count (filter_mset g M) a \<le> count (filter_mset f M) a
[PROOF STEP]
show "count (filter_mset f M) x \<le> count (filter_mset g M) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (filter_mset f M) x \<le> count (filter_mset g M) x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in># M \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. count (filter_mset f M) x \<le> count (filter_mset g M) x
[PROOF STEP]
by (cases "x \<in># M") (simp_all add: not_in_iff)
[PROOF STATE]
proof (state)
this:
count (filter_mset f M) x \<le> count (filter_mset g M) x

goal (1 subgoal):
 1. \<And>a. count (filter_mset g M) a \<le> count (filter_mset f M) a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. count (filter_mset g M) a \<le> count (filter_mset f M) a
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. count (filter_mset g M) a \<le> count (filter_mset f M) a
[PROOF STEP]
show "count (filter_mset g M) x \<le> count (filter_mset f M) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (filter_mset g M) x \<le> count (filter_mset f M) x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in># M \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. count (filter_mset g M) x \<le> count (filter_mset f M) x
[PROOF STEP]
by (cases "x \<in># M") (simp_all add: not_in_iff)
[PROOF STATE]
proof (state)
this:
count (filter_mset g M) x \<le> count (filter_mset f M) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_ge_zero [simp]: "1 \<le> x \<Longrightarrow> 0 \<le> ln x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> x \<Longrightarrow> 0 \<le> ln x
[PROOF STEP]
using ln_le_cancel_iff [of 1 x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 1; 0 < x\<rbrakk> \<Longrightarrow> (ln 1 \<le> ln x) = (1 \<le> x)

goal (1 subgoal):
 1. 1 \<le> x \<Longrightarrow> 0 \<le> ln x
[PROOF STEP]
by simp


[STATEMENT]
lemma complex_cnj_neg_numeral [simp]: "cnj (- numeral w) = - numeral w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (- numeral w) = - numeral w
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma AE_eq_trans[trans]:
  assumes "AE x in M. A x = B x"
  and "AE x in M. B x = C x"
  shows "AE x in M. A x = C x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. A x = C x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
AE x in M. A x = B x
AE x in M. B x = C x

goal (1 subgoal):
 1. AE x in M. A x = C x
[PROOF STEP]
by auto


[STATEMENT]
lemma takeWhile_eq_filter:
  assumes "\<And> x. x \<in> set (dropWhile P xs) \<Longrightarrow> \<not> P x"
  shows "takeWhile P xs = filter P xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. takeWhile P xs = filter P xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. takeWhile P xs = filter P xs
[PROOF STEP]
have A: "filter P xs = filter P (takeWhile P xs @ dropWhile P xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P xs = filter P (takeWhile P xs @ dropWhile P xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
filter P xs = filter P (takeWhile P xs @ dropWhile P xs)

goal (1 subgoal):
 1. takeWhile P xs = filter P xs
[PROOF STEP]
have B: "filter P (dropWhile P xs) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P (dropWhile P xs) = []
[PROOF STEP]
unfolding filter_empty_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set (dropWhile P xs). \<not> P x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> set (dropWhile P xs) \<Longrightarrow> \<not> P ?x

goal (1 subgoal):
 1. \<forall>x\<in>set (dropWhile P xs). \<not> P x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
filter P (dropWhile P xs) = []

goal (1 subgoal):
 1. takeWhile P xs = filter P xs
[PROOF STEP]
have "filter P xs = takeWhile P xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P xs = takeWhile P xs
[PROOF STEP]
unfolding A filter_append B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter P (takeWhile P xs) @ [] = takeWhile P xs
[PROOF STEP]
by (auto simp add: filter_id_conv dest: set_takeWhileD)
[PROOF STATE]
proof (state)
this:
filter P xs = takeWhile P xs

goal (1 subgoal):
 1. takeWhile P xs = filter P xs
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
filter P xs = takeWhile P xs

goal (1 subgoal):
 1. takeWhile P xs = filter P xs
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
takeWhile P xs = filter P xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inj_power_mod:
  assumes "coprime n (a :: nat)"
  shows   "inj_on (\<lambda>k. a ^ k mod n) {..<ord n a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>k. a ^ k mod n) {..<ord n a}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<ord n a}; y \<in> {..<ord n a}; a ^ x mod n = a ^ y mod n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix k l
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<ord n a}; y \<in> {..<ord n a}; a ^ x mod n = a ^ y mod n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume *: "k \<in> {..<ord n a}" "l \<in> {..<ord n a}" "a ^ k mod n = a ^ l mod n"
[PROOF STATE]
proof (state)
this:
k \<in> {..<ord n a}
l \<in> {..<ord n a}
a ^ k mod n = a ^ l mod n

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<ord n a}; y \<in> {..<ord n a}; a ^ x mod n = a ^ y mod n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "k = l" if "k < l" "l < ord n a" "[a ^ k = a ^ l] (mod n)" for k l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = l
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k = l
[PROOF STEP]
have "l = k + (l - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = k + (l - k)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
k < l
l < ord n a
[a ^ k = a ^ l] (mod n)

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

goal (1 subgoal):
 1. k = l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
l = k + (l - k)

goal (1 subgoal):
 1. k = l
[PROOF STEP]
have "a ^ \<dots> = a ^ k * a ^ (l - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ (k + (l - k)) = a ^ k * a ^ (l - k)
[PROOF STEP]
by (simp add: power_add)
[PROOF STATE]
proof (state)
this:
a ^ (k + (l - k)) = a ^ k * a ^ (l - k)

goal (1 subgoal):
 1. k = l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a ^ (k + (l - k)) = a ^ k * a ^ (l - k)

goal (1 subgoal):
 1. k = l
[PROOF STEP]
have "[\<dots> = a ^ l * a ^ (l - k)] (mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ k * a ^ (l - k) = a ^ l * a ^ (l - k)] (mod n)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
k < l
l < ord n a
[a ^ k = a ^ l] (mod n)

goal (1 subgoal):
 1. [a ^ k * a ^ (l - k) = a ^ l * a ^ (l - k)] (mod n)
[PROOF STEP]
by (intro cong_mult) auto
[PROOF STATE]
proof (state)
this:
[a ^ k * a ^ (l - k) = a ^ l * a ^ (l - k)] (mod n)

goal (1 subgoal):
 1. k = l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[a ^ l = a ^ l * a ^ (l - k)] (mod n)
[PROOF STEP]
have "[a ^ l * a ^ (l - k) = a ^ l * 1] (mod n)"
[PROOF STATE]
proof (prove)
using this:
[a ^ l = a ^ l * a ^ (l - k)] (mod n)

goal (1 subgoal):
 1. [a ^ l * a ^ (l - k) = a ^ l * 1] (mod n)
[PROOF STEP]
by (simp add: cong_sym_eq)
[PROOF STATE]
proof (state)
this:
[a ^ l * a ^ (l - k) = a ^ l * 1] (mod n)

goal (1 subgoal):
 1. k = l
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
coprime n a
[a ^ l * a ^ (l - k) = a ^ l * 1] (mod n)
[PROOF STEP]
have "[a ^ (l - k) = 1] (mod n)"
[PROOF STATE]
proof (prove)
using this:
coprime n a
[a ^ l * a ^ (l - k) = a ^ l * 1] (mod n)

goal (1 subgoal):
 1. [a ^ (l - k) = 1] (mod n)
[PROOF STEP]
by (subst (asm) cong_mult_lcancel_nat) (auto simp: coprime_commute)
[PROOF STATE]
proof (state)
this:
[a ^ (l - k) = 1] (mod n)

goal (1 subgoal):
 1. k = l
[PROOF STEP]
hence "ord n a dvd l - k"
[PROOF STATE]
proof (prove)
using this:
[a ^ (l - k) = 1] (mod n)

goal (1 subgoal):
 1. ord n a dvd l - k
[PROOF STEP]
by (simp add: ord_divides')
[PROOF STATE]
proof (state)
this:
ord n a dvd l - k

goal (1 subgoal):
 1. k = l
[PROOF STEP]
from dvd_imp_le[OF this] and \<open>l < ord n a\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < l - k \<Longrightarrow> ord n a \<le> l - k
l < ord n a
[PROOF STEP]
have "l - k = 0"
[PROOF STATE]
proof (prove)
using this:
0 < l - k \<Longrightarrow> ord n a \<le> l - k
l < ord n a

goal (1 subgoal):
 1. l - k = 0
[PROOF STEP]
by (cases "l - k = 0") auto
[PROOF STATE]
proof (state)
this:
l - k = 0

goal (1 subgoal):
 1. k = l
[PROOF STEP]
with \<open>k < l\<close>
[PROOF STATE]
proof (chain)
picking this:
k < l
l - k = 0
[PROOF STEP]
show "k = l"
[PROOF STATE]
proof (prove)
using this:
k < l
l - k = 0

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?k < ?l; ?l < ord n a; [a ^ ?k = a ^ ?l] (mod n)\<rbrakk> \<Longrightarrow> ?k = ?l

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<ord n a}; y \<in> {..<ord n a}; a ^ x mod n = a ^ y mod n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from this[of k l] and this[of l k] and *
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>k < l; l < ord n a; [a ^ k = a ^ l] (mod n)\<rbrakk> \<Longrightarrow> k = l
\<lbrakk>l < k; k < ord n a; [a ^ l = a ^ k] (mod n)\<rbrakk> \<Longrightarrow> l = k
k \<in> {..<ord n a}
l \<in> {..<ord n a}
a ^ k mod n = a ^ l mod n
[PROOF STEP]
show "k = l"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>k < l; l < ord n a; [a ^ k = a ^ l] (mod n)\<rbrakk> \<Longrightarrow> k = l
\<lbrakk>l < k; k < ord n a; [a ^ l = a ^ k] (mod n)\<rbrakk> \<Longrightarrow> l = k
k \<in> {..<ord n a}
l \<in> {..<ord n a}
a ^ k mod n = a ^ l mod n

goal (1 subgoal):
 1. k = l
[PROOF STEP]
by (cases k l rule: linorder_cases) (auto simp: cong_def)
[PROOF STATE]
proof (state)
this:
k = l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma liftablep_rtranclp:
    assumes "liftablep r f"
    shows "liftablep r\<^sup>*\<^sup>* f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liftablep r\<^sup>*\<^sup>* f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. r\<^sup>*\<^sup>* x y \<Longrightarrow> r\<^sup>*\<^sup>* (f x) (f y)
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. r\<^sup>*\<^sup>* x y \<Longrightarrow> r\<^sup>*\<^sup>* (f x) (f y)
[PROOF STEP]
assume "r\<^sup>*\<^sup>* x y"
[PROOF STATE]
proof (state)
this:
r\<^sup>*\<^sup>* x y

goal (1 subgoal):
 1. \<And>x y. r\<^sup>*\<^sup>* x y \<Longrightarrow> r\<^sup>*\<^sup>* (f x) (f y)
[PROOF STEP]
thus "r\<^sup>*\<^sup>* (f x) (f y)"
[PROOF STATE]
proof (prove)
using this:
r\<^sup>*\<^sup>* x y

goal (1 subgoal):
 1. r\<^sup>*\<^sup>* (f x) (f y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r\<^sup>*\<^sup>* x y
liftablep r f

goal (1 subgoal):
 1. r\<^sup>*\<^sup>* (f x) (f y)
[PROOF STEP]
by (induct rule: rtranclp_induct, force+)
[PROOF STATE]
proof (state)
this:
r\<^sup>*\<^sup>* (f x) (f y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma image_nat_induct: "
  \<lbrakk> P (f 0); \<And>n. P (f n) \<Longrightarrow> P (f (Suc n)); surj_on f UNIV I; a \<in> I \<rbrakk> \<Longrightarrow> P a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P (f 0); \<And>n. P (f n) \<Longrightarrow> P (f (Suc n)); surj_on f UNIV I; a \<in> I\<rbrakk> \<Longrightarrow> P a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>P (f 0); \<And>n. P (f n) \<Longrightarrow> P (f (Suc n)); surj_on f UNIV I; a \<in> I\<rbrakk> \<Longrightarrow> P a
[PROOF STEP]
assume as_P0: "P (f 0)"
    and  as_IA: "\<And>n. P (f n) \<Longrightarrow> P (f (Suc n))"
    and  as_surj_f: "surj_on f UNIV I"
    and  as_a: "a \<in> I"
[PROOF STATE]
proof (state)
this:
P (f 0)
P (f ?n) \<Longrightarrow> P (f (Suc ?n))
surj_on f UNIV I
a \<in> I

goal (1 subgoal):
 1. \<lbrakk>P (f 0); \<And>n. P (f n) \<Longrightarrow> P (f (Suc n)); surj_on f UNIV I; a \<in> I\<rbrakk> \<Longrightarrow> P a
[PROOF STEP]
have P_n:"\<And>n. P (f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. P (f n)
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. P (f 0)
 2. \<And>n na. P (f na) \<Longrightarrow> P (f (Suc na))
[PROOF STEP]
apply (simp only: as_P0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. P (f na) \<Longrightarrow> P (f (Suc na))
[PROOF STEP]
apply (simp only: as_IA)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
P (f ?n)

goal (1 subgoal):
 1. \<lbrakk>P (f 0); \<And>n. P (f n) \<Longrightarrow> P (f (Suc n)); surj_on f UNIV I; a \<in> I\<rbrakk> \<Longrightarrow> P a
[PROOF STEP]
have "\<forall>x\<in>I. \<exists>n. x = f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>I. \<exists>n. x = f n
[PROOF STEP]
using as_surj_f
[PROOF STATE]
proof (prove)
using this:
surj_on f UNIV I

goal (1 subgoal):
 1. \<forall>x\<in>I. \<exists>n. x = f n
[PROOF STEP]
by (unfold surj_on_conv, blast)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>I. \<exists>n. x = f n

goal (1 subgoal):
 1. \<lbrakk>P (f 0); \<And>n. P (f n) \<Longrightarrow> P (f (Suc n)); surj_on f UNIV I; a \<in> I\<rbrakk> \<Longrightarrow> P a
[PROOF STEP]
hence "\<exists>n. a = f n"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>I. \<exists>n. x = f n

goal (1 subgoal):
 1. \<exists>n. a = f n
[PROOF STEP]
using as_a
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>I. \<exists>n. x = f n
a \<in> I

goal (1 subgoal):
 1. \<exists>n. a = f n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>n. a = f n

goal (1 subgoal):
 1. \<lbrakk>P (f 0); \<And>n. P (f n) \<Longrightarrow> P (f (Suc n)); surj_on f UNIV I; a \<in> I\<rbrakk> \<Longrightarrow> P a
[PROOF STEP]
thus "P a"
[PROOF STATE]
proof (prove)
using this:
\<exists>n. a = f n

goal (1 subgoal):
 1. P a
[PROOF STEP]
using P_n
[PROOF STATE]
proof (prove)
using this:
\<exists>n. a = f n
P (f ?n)

goal (1 subgoal):
 1. P a
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma extreme_bound_mono:
  assumes XY: "X \<subseteq> Y"
    and sX: "extreme_bound X sX"
    and sY: "extreme_bound Y sY"
  shows "sX \<sqsubseteq> sY"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sX \<sqsubseteq> sY
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sX \<sqsubseteq> sY
[PROOF STEP]
have "bound X (\<sqsubseteq>) sY"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bound X (\<sqsubseteq>) sY
[PROOF STEP]
using XY sY
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> Y
local.extreme_bound Y sY

goal (1 subgoal):
 1. bound X (\<sqsubseteq>) sY
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
bound X (\<sqsubseteq>) sY

goal (1 subgoal):
 1. sX \<sqsubseteq> sY
[PROOF STEP]
with sX sY
[PROOF STATE]
proof (chain)
picking this:
local.extreme_bound X sX
local.extreme_bound Y sY
bound X (\<sqsubseteq>) sY
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.extreme_bound X sX
local.extreme_bound Y sY
bound X (\<sqsubseteq>) sY

goal (1 subgoal):
 1. sX \<sqsubseteq> sY
[PROOF STEP]
by (auto 0 4)
[PROOF STATE]
proof (state)
this:
sX \<sqsubseteq> sY

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ladder_cut_prefix_n:
  assumes index_bound: "index < length L"
  assumes length_L: "length L > 0"
  shows "ladder_n (ladder_cut_prefix d L) index = ladder_n L index"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ladder_n (ladder_cut_prefix d L) index = ladder_n L index
[PROOF STEP]
apply (simp add: ladder_cut_prefix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ladder_n ((ladder_shift_j d L)[0 := (ladder_n L 0, ladder_j L 0 - d, ladder_i L 0 - d)]) index = ladder_n L index
[PROOF STEP]
apply (cases index)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. index = 0 \<Longrightarrow> ladder_n ((ladder_shift_j d L)[0 := (ladder_n L 0, ladder_j L 0 - d, ladder_i L 0 - d)]) index = ladder_n L index
 2. \<And>nat. index = Suc nat \<Longrightarrow> ladder_n ((ladder_shift_j d L)[0 := (ladder_n L 0, ladder_j L 0 - d, ladder_i L 0 - d)]) index = ladder_n L index
[PROOF STEP]
apply (auto simp add: ladder_n_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. index = 0 \<Longrightarrow> deriv_n ((ladder_shift_j d L)[0 := (deriv_n (L ! 0), ladder_j L 0 - d, ladder_i L 0 - d)] ! 0) = deriv_n (L ! 0)
 2. \<And>nat. index = Suc nat \<Longrightarrow> deriv_n (ladder_shift_j d L ! Suc nat) = deriv_n (L ! Suc nat)
[PROOF STEP]
apply (subst nth_list_update_eq)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. index = 0 \<Longrightarrow> 0 < length (ladder_shift_j d L)
 2. index = 0 \<Longrightarrow> deriv_n (deriv_n (L ! 0), ladder_j L 0 - d, ladder_i L 0 - d) = deriv_n (L ! 0)
 3. \<And>nat. index = Suc nat \<Longrightarrow> deriv_n (ladder_shift_j d L ! Suc nat) = deriv_n (L ! Suc nat)
[PROOF STEP]
apply (simp add: ladder_shift_j_length)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. index = 0 \<Longrightarrow> L \<noteq> []
 2. index = 0 \<Longrightarrow> deriv_n (deriv_n (L ! 0), ladder_j L 0 - d, ladder_i L 0 - d) = deriv_n (L ! 0)
 3. \<And>nat. index = Suc nat \<Longrightarrow> deriv_n (ladder_shift_j d L ! Suc nat) = deriv_n (L ! Suc nat)
[PROOF STEP]
using length_L
[PROOF STATE]
proof (prove)
using this:
0 < length L

goal (3 subgoals):
 1. index = 0 \<Longrightarrow> L \<noteq> []
 2. index = 0 \<Longrightarrow> deriv_n (deriv_n (L ! 0), ladder_j L 0 - d, ladder_i L 0 - d) = deriv_n (L ! 0)
 3. \<And>nat. index = Suc nat \<Longrightarrow> deriv_n (ladder_shift_j d L ! Suc nat) = deriv_n (L ! Suc nat)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. index = 0 \<Longrightarrow> deriv_n (deriv_n (L ! 0), ladder_j L 0 - d, ladder_i L 0 - d) = deriv_n (L ! 0)
 2. \<And>nat. index = Suc nat \<Longrightarrow> deriv_n (ladder_shift_j d L ! Suc nat) = deriv_n (L ! Suc nat)
[PROOF STEP]
apply (simp add: deriv_n_def )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. index = Suc nat \<Longrightarrow> deriv_n (ladder_shift_j d L ! Suc nat) = deriv_n (L ! Suc nat)
[PROOF STEP]
apply (rule_tac deriv_n_ladder_shift_j)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. index = Suc nat \<Longrightarrow> Suc nat < length L
[PROOF STEP]
using index_bound
[PROOF STATE]
proof (prove)
using this:
index < length L

goal (1 subgoal):
 1. \<And>nat. index = Suc nat \<Longrightarrow> Suc nat < length L
[PROOF STEP]
by arith


[STATEMENT]
lemma AE_point_measure:
  "(AE x in point_measure A f. P x) \<longleftrightarrow> (\<forall>x\<in>A. 0 < f x \<longrightarrow> P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_everywhere (point_measure A f) P = (\<forall>x\<in>A. 0 < f x \<longrightarrow> P x)
[PROOF STEP]
unfolding point_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_everywhere (density (count_space A) f) P = (\<forall>x\<in>A. 0 < f x \<longrightarrow> P x)
[PROOF STEP]
by (subst AE_density) (auto simp: AE_density AE_count_space point_measure_def)


[STATEMENT]
lemma add_col_to_multiple_index_change_bounds:
  assumes "i < dim_row A" and "j < dim_col A" and "j \<ge> low" and "j < up"  and "l < low \<or> l \<ge> up"
    and "l < dim_col A"
  shows "add_col_to_multiple a [low..<up] l A $$ (i,j) = (a * A$$(i, l)) + A$$(i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_col_to_multiple a [low..<up] l A $$ (i, j) = a * A $$ (i, l) + A $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. add_col_to_multiple a [low..<up] l A $$ (i, j) = a * A $$ (i, l) + A $$ (i, j)
[PROOF STEP]
have d: "distinct [low..<up]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct [low..<up]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct [low..<up]

goal (1 subgoal):
 1. add_col_to_multiple a [low..<up] l A $$ (i, j) = a * A $$ (i, l) + A $$ (i, j)
[PROOF STEP]
have jin: "j \<in> set [low..<up]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<in> set [low..<up]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row A
j < dim_col A
low \<le> j
j < up
l < low \<or> up \<le> l
l < dim_col A

goal (1 subgoal):
 1. j \<in> set [low..<up]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j \<in> set [low..<up]

goal (1 subgoal):
 1. add_col_to_multiple a [low..<up] l A $$ (i, j) = a * A $$ (i, l) + A $$ (i, j)
[PROOF STEP]
have lnin: "l \<notin> set [low..<up]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<notin> set [low..<up]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row A
j < dim_col A
low \<le> j
j < up
l < low \<or> up \<le> l
l < dim_col A

goal (1 subgoal):
 1. l \<notin> set [low..<up]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l \<notin> set [low..<up]

goal (1 subgoal):
 1. add_col_to_multiple a [low..<up] l A $$ (i, j) = a * A $$ (i, l) + A $$ (i, j)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
l \<notin> set [low..<up]

goal (1 subgoal):
 1. add_col_to_multiple a [low..<up] l A $$ (i, j) = a * A $$ (i, l) + A $$ (i, j)
[PROOF STEP]
using add_col_to_multiple_index_change d jin assms
[PROOF STATE]
proof (prove)
using this:
l \<notin> set [low..<up]
\<lbrakk>?i < dim_row ?A; ?j < dim_col ?A; ?j \<in> set ?ks; distinct ?ks; ?l \<notin> set ?ks; ?l < dim_col ?A\<rbrakk> \<Longrightarrow> add_col_to_multiple ?a ?ks ?l ?A $$ (?i, ?j) = ?a * ?A $$ (?i, ?l) + ?A $$ (?i, ?j)
distinct [low..<up]
j \<in> set [low..<up]
i < dim_row A
j < dim_col A
low \<le> j
j < up
l < low \<or> up \<le> l
l < dim_col A

goal (1 subgoal):
 1. add_col_to_multiple a [low..<up] l A $$ (i, j) = a * A $$ (i, l) + A $$ (i, j)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
add_col_to_multiple a [low..<up] l A $$ (i, j) = a * A $$ (i, l) + A $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nfoldli_nfoldli_prod_conv:
  "nfoldli l2 ctd (\<lambda>i. nfoldli l1 ctd (f i)) s = nfoldli (List.product l2 l1) ctd (\<lambda>(i,j). f i j) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli l2 ctd (\<lambda>i. nfoldli l1 ctd (f i)) s = nfoldli (List.product l2 l1) ctd (\<lambda>(i, j). f i j) s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nfoldli l2 ctd (\<lambda>i. nfoldli l1 ctd (f i)) s = nfoldli (List.product l2 l1) ctd (\<lambda>(i, j). f i j) s
[PROOF STEP]
have [simp]: "nfoldli (map (Pair a) l) ctd (\<lambda>(x, y). f x y) s = nfoldli l ctd (f a) s"
    for a l s
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli (map (Pair a) l) ctd (\<lambda>(x, y). f x y) s = nfoldli l ctd (f a) s
[PROOF STEP]
apply (induction l arbitrary: s)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s. nfoldli (map (Pair a) []) ctd (\<lambda>(x, y). f x y) s = nfoldli [] ctd (f a) s
 2. \<And>aa l s. (\<And>s. nfoldli (map (Pair a) l) ctd (\<lambda>(x, y). f x y) s = nfoldli l ctd (f a) s) \<Longrightarrow> nfoldli (map (Pair a) (aa # l)) ctd (\<lambda>(x, y). f x y) s = nfoldli (aa # l) ctd (f a) s
[PROOF STEP]
by (auto simp: pw_eq_iff refine_pw_simps)
[PROOF STATE]
proof (state)
this:
nfoldli (map (Pair ?a) ?l) ctd (\<lambda>(x, y). f x y) ?s = nfoldli ?l ctd (f ?a) ?s

goal (1 subgoal):
 1. nfoldli l2 ctd (\<lambda>i. nfoldli l1 ctd (f i)) s = nfoldli (List.product l2 l1) ctd (\<lambda>(i, j). f i j) s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli l2 ctd (\<lambda>i. nfoldli l1 ctd (f i)) s = nfoldli (List.product l2 l1) ctd (\<lambda>(i, j). f i j) s
[PROOF STEP]
by (induction l2 arbitrary: l1 s) auto
[PROOF STATE]
proof (state)
this:
nfoldli l2 ctd (\<lambda>i. nfoldli l1 ctd (f i)) s = nfoldli (List.product l2 l1) ctd (\<lambda>(i, j). f i j) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PrimReplace_iff:
  assumes sv: "\<forall>u v v'. u \<^bold>\<in> A \<longrightarrow> R u v \<longrightarrow> R u v' \<longrightarrow> v'=v"
  shows "v \<^bold>\<in> (PrimReplace A R) \<longleftrightarrow> (\<exists>u. u \<^bold>\<in> A \<and> R u v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<^bold>\<in> PrimReplace A R) = (\<exists>u. u \<^bold>\<in> A \<and> R u v)
[PROOF STEP]
apply (insert replacement [OF sv], clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. \<forall>v. (v \<^bold>\<in> z) = (\<exists>u. u \<^bold>\<in> A \<and> R u v) \<Longrightarrow> (v \<^bold>\<in> PrimReplace A R) = (\<exists>u. u \<^bold>\<in> A \<and> R u v)
[PROOF STEP]
apply (simp add: PrimReplace_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. \<forall>v. (v \<^bold>\<in> z) = (\<exists>u. u \<^bold>\<in> A \<and> R u v) \<Longrightarrow> (v \<^bold>\<in> (THE z. \<forall>v. (v \<^bold>\<in> z) = (\<exists>u. u \<^bold>\<in> A \<and> R u v))) = (\<exists>u. u \<^bold>\<in> A \<and> R u v)
[PROOF STEP]
apply (rule theI2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>z. \<forall>v. (v \<^bold>\<in> z) = (\<exists>u. u \<^bold>\<in> A \<and> R u v) \<Longrightarrow> \<forall>v. (v \<^bold>\<in> ?a3 z) = (\<exists>u. u \<^bold>\<in> A \<and> R u v)
 2. \<And>z u. \<lbrakk>\<forall>v. (v \<^bold>\<in> z) = (\<exists>u. u \<^bold>\<in> A \<and> R u v); \<forall>v. (v \<^bold>\<in> u) = (\<exists>u. u \<^bold>\<in> A \<and> R u v)\<rbrakk> \<Longrightarrow> u = ?a3 z
 3. \<And>z u. \<lbrakk>\<forall>v. (v \<^bold>\<in> z) = (\<exists>u. u \<^bold>\<in> A \<and> R u v); \<forall>v. (v \<^bold>\<in> u) = (\<exists>u. u \<^bold>\<in> A \<and> R u v)\<rbrakk> \<Longrightarrow> (v \<^bold>\<in> u) = (\<exists>u. u \<^bold>\<in> A \<and> R u v)
[PROOF STEP]
apply (auto simp: hf_ext)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done