[STATEMENT]
theorem states_of_se_assume :
  assumes "se c (Assume e) c'"
  shows   "states c' = {\<sigma> \<in> states c. e \<sigma>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. states c' = {\<sigma> \<in> states c. e \<sigma>}
[PROOF STEP]
using assms se_Assume_eq[of c e c']
[PROOF STATE]
proof (prove)
using this:
se c (Assume e) c'
se c (Assume e) c' = (c' = \<lparr>store = store c, pred = pred c \<union> {adapt_bexp e (store c)}\<rparr>)

goal (1 subgoal):
 1. states c' = {\<sigma> \<in> states c. e \<sigma>}
[PROOF STEP]
by (auto simp add : adapt_bexp_is_subst states_def conjunct_def)


[STATEMENT]
lemma analz_subset_iff [simp]: "analz G \<subseteq> analz H \<longleftrightarrow> G \<subseteq> analz H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (analz G \<subseteq> analz H) = (G \<subseteq> analz H)
[PROOF STEP]
by (blast dest: analz_mono)


[STATEMENT]
lemma continuous_map_prod [continuous_intros]:
   "\<lbrakk>finite I;
         \<And>i. i \<in> I \<Longrightarrow> continuous_map X euclideanreal (\<lambda>x. f x i)\<rbrakk>
        \<Longrightarrow> continuous_map X euclideanreal (\<lambda>x. prod (f x) I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> continuous_map X euclideanreal (\<lambda>x. f x i)\<rbrakk> \<Longrightarrow> continuous_map X euclideanreal (\<lambda>x. prod (f x) I)
[PROOF STEP]
by (simp add: continuous_map_atin tendsto_prod)


[STATEMENT]
lemma gcd_dvd_1[simp]: "gcd a b dvd 1 \<longleftrightarrow> coprime a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (gcd a b dvd (1::'a)) = coprime a b
[PROOF STEP]
using dvd_trans[OF gcd_greatest[of _ a b], of _ 1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a dvd a; ?a dvd b; gcd a b dvd (1::'a)\<rbrakk> \<Longrightarrow> ?a dvd (1::'a)

goal (1 subgoal):
 1. (gcd a b dvd (1::'a)) = coprime a b
[PROOF STEP]
by (cases "a = 0 \<and> b = 0") (auto intro!: coprimeI elim: coprimeE)


[STATEMENT]
lemma ln_ln_nonneg: "x \<ge> (3::real) \<Longrightarrow> ln (ln x) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 \<le> x \<Longrightarrow> 0 \<le> ln (ln x)
[PROOF STEP]
using ln_ln_pos[of "x"]
[PROOF STATE]
proof (prove)
using this:
3 \<le> x \<Longrightarrow> 0 < ln (ln x)

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


[STATEMENT]
lemma (in CRR_market) risky_asset_martingale_only_if:
  assumes "N = bernoulli_stream q"
  and "0 < q"
  and "q < 1"
  and  "martingale N G (discounted_value r (prices Mkt stk))"
shows "q = (1 + r - d) / (u - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
have "AE w in N. real_cond_exp N (G 0)
       (discounted_value r (prices Mkt stk) (Suc 0)) w =  discounted_value r (prices Mkt stk) 0 w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (prices Mkt stk) 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
N = bernoulli_stream q
0 < q
q < 1
martingale N G (discounted_value r (prices Mkt stk))

goal (1 subgoal):
 1. AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (prices Mkt stk) 0)
[PROOF STEP]
unfolding martingale_def
[PROOF STATE]
proof (prove)
using this:
N = bernoulli_stream q
0 < q
q < 1
Filtration.filtration N G \<and> (\<forall>t. integrable N (discounted_value r (prices Mkt stk) t)) \<and> borel_adapt_stoch_proc G (discounted_value r (prices Mkt stk)) \<and> (\<forall>t s. t \<le> s \<longrightarrow> AEeq N (real_cond_exp N (G t) (discounted_value r (prices Mkt stk) s)) (discounted_value r (prices Mkt stk) t))

goal (1 subgoal):
 1. AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (prices Mkt stk) 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (prices Mkt stk) 0)

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "AE w in N. real_cond_exp N (G 0)
       (discounted_value r (prices Mkt stk) (Suc 0)) w =  prices Mkt stk 0 w"
[PROOF STATE]
proof (prove)
using this:
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (prices Mkt stk) 0)

goal (1 subgoal):
 1. AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (prices Mkt stk 0)
[PROOF STEP]
by (simp add: discounted_init)
[PROOF STATE]
proof (state)
this:
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (prices Mkt stk 0)

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (prices Mkt stk 0)

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
have "AE w in N. real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0)) w =
    discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0))
[PROOF STEP]
using assms real_cond_exp_discount_stock
[PROOF STATE]
proof (prove)
using this:
N = bernoulli_stream q
0 < q
q < 1
martingale N G (discounted_value r (prices Mkt stk))
\<lbrakk>?N = bernoulli_stream ?q; 0 < ?q; ?q < 1\<rbrakk> \<Longrightarrow> AEeq ?N (real_cond_exp ?N (G ?n) (discounted_value r (prices Mkt stk) (Suc ?n))) (discounted_value r (\<lambda>m w. (?q * u + (1 - ?q) * d) * prices Mkt stk ?n w) (Suc ?n))

goal (1 subgoal):
 1. AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0))

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (prices Mkt stk 0)
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0))
[PROOF STEP]
have "AE w in N. discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0) w =
    prices Mkt stk 0 w"
[PROOF STATE]
proof (prove)
using this:
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (prices Mkt stk 0)
AEeq N (real_cond_exp N (G 0) (discounted_value r (prices Mkt stk) (Suc 0))) (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0))

goal (1 subgoal):
 1. AEeq N (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0)) (prices Mkt stk 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AEeq N (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0)) (prices Mkt stk 0)

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "AE w in N. discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * init) (Suc 0) w =
    (\<lambda>w. init) w"
[PROOF STATE]
proof (prove)
using this:
AEeq N (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0)) (prices Mkt stk 0)

goal (1 subgoal):
 1. AEeq N (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * init) (Suc 0)) (\<lambda>w. init)
[PROOF STEP]
using stk_price geometric_process
[PROOF STATE]
proof (prove)
using this:
AEeq N (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * prices Mkt stk 0 w) (Suc 0)) (prices Mkt stk 0)
prices Mkt stk = geom_proc
geom_proc = geom_rand_walk u d init

goal (1 subgoal):
 1. AEeq N (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * init) (Suc 0)) (\<lambda>w. init)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AEeq N (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * init) (Suc 0)) (\<lambda>w. init)

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "AE w in N. discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init =
    (\<lambda>w. init) w"
[PROOF STATE]
proof (prove)
using this:
AEeq N (discounted_value r (\<lambda>m w. (q * u + (1 - q) * d) * init) (Suc 0)) (\<lambda>w. init)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. init)
[PROOF STEP]
unfolding discounted_value_def
[PROOF STATE]
proof (prove)
using this:
AEeq N (\<lambda>w. discount_factor r (Suc 0) w * ((q * u + (1 - q) * d) * init)) (\<lambda>w. init)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. init)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
AEeq N (\<lambda>w. discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. init)

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "AE w in N. (1+r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init =
    (1+r) * (\<lambda>w. init) w"
[PROOF STATE]
proof (prove)
using this:
AEeq N (\<lambda>w. discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. init)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. (1 + r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AEeq N (\<lambda>w. (1 + r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence prev: "AE w in N. discount_factor r 0 w * (q * u + (1 - q) * d) * init =
    (1+r) * (\<lambda>w. init) w"
[PROOF STATE]
proof (prove)
using this:
AEeq N (\<lambda>w. (1 + r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
[PROOF STEP]
using discount_factor_times_rfr[of r 0] acceptable_rate
[PROOF STATE]
proof (prove)
using this:
AEeq N (\<lambda>w. (1 + r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
- 1 < r \<Longrightarrow> (1 + r) * discount_factor r (Suc 0) ?w = discount_factor r 0 ?w
- 1 < r

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>AEeq N (\<lambda>w. (1 + r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init); \<And>w. - 1 < r \<Longrightarrow> (1 + r) * discount_factor r (Suc 0) w = discount_factor r 0 w; - 1 < r\<rbrakk> \<Longrightarrow> AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
[PROOF STEP]
have "\<forall>s. (1 + r) * discount_factor r (Suc 0) (s::bool stream) = discount_factor r 0 s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s. (1 + r) * discount_factor r (Suc 0) s = discount_factor r 0 s
[PROOF STEP]
by (metis (no_types) \<open>\<And>w. - 1 < r \<Longrightarrow> (1 + r) * discount_factor r (Suc 0) w = discount_factor r 0 w\<close> acceptable_rate)
[PROOF STATE]
proof (state)
this:
\<forall>s. (1 + r) * discount_factor r (Suc 0) s = discount_factor r 0 s

goal (1 subgoal):
 1. \<lbrakk>AEeq N (\<lambda>w. (1 + r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init); \<And>w. - 1 < r \<Longrightarrow> (1 + r) * discount_factor r (Suc 0) w = discount_factor r 0 w; - 1 < r\<rbrakk> \<Longrightarrow> AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>s. (1 + r) * discount_factor r (Suc 0) s = discount_factor r 0 s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>s. (1 + r) * discount_factor r (Suc 0) s = discount_factor r 0 s

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
[PROOF STEP]
using \<open>AEeq N (\<lambda>w. (1 + r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>s. (1 + r) * discount_factor r (Suc 0) s = discount_factor r 0 s
AEeq N (\<lambda>w. (1 + r) * discount_factor r (Suc 0) w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "\<forall>w. (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) w =
    (\<lambda>w. (1+r) * init) w"
[PROOF STATE]
proof (prove)
using this:
AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)

goal (1 subgoal):
 1. \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init) \<Longrightarrow> \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
have "(\<lambda>w. discount_factor r 0 w *  (q * u + (1 - q) * d) * init)
      \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
proof (rule borel_measurable_times)+
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. discount_factor r 0 \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
 2. (\<lambda>x. q * u + (1 - q) * d) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
 3. (\<lambda>x. init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
show "(\<lambda>x. init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)

goal (2 subgoals):
 1. discount_factor r 0 \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
 2. (\<lambda>x. q * u + (1 - q) * d) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
show "(\<lambda>x. q * u + (1 - q) * d) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. q * u + (1 - q) * d) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. q * u + (1 - q) * d) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)

goal (1 subgoal):
 1. discount_factor r 0 \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
show "discount_factor r 0 \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discount_factor r 0 \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
using discount_factor_nonrandom[of r 0 "infinite_coin_toss_space.nat_filtration N 0"]
[PROOF STATE]
proof (prove)
using this:
discount_factor r 0 \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)

goal (1 subgoal):
 1. discount_factor r 0 \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
discount_factor r 0 \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init) \<Longrightarrow> \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init) \<Longrightarrow> \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
have "(\<lambda>w. (1 + r) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. (1 + r) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (1 + r) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init) \<Longrightarrow> \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (1 + r) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init) \<Longrightarrow> \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
have "infinite_coin_toss_space q N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite_coin_toss_space q N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
N = bernoulli_stream q
0 < q
q < 1
martingale N G (discounted_value r (prices Mkt stk))

goal (1 subgoal):
 1. infinite_coin_toss_space q N
[PROOF STEP]
by (simp add: infinite_coin_toss_space_def)
[PROOF STATE]
proof (state)
this:
infinite_coin_toss_space q N

goal (1 subgoal):
 1. AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init) \<Longrightarrow> \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
(\<lambda>w. (1 + r) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
infinite_coin_toss_space q N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
(\<lambda>w. (1 + r) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
infinite_coin_toss_space q N

goal (1 subgoal):
 1. \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
using  prev infinite_coin_toss_space.nat_filtration_AE_eq[of q N
        "(\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init)" "(\<lambda>w. (1 + r) * init)" 0] assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
(\<lambda>w. (1 + r) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)
infinite_coin_toss_space q N
AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init)
\<lbrakk>infinite_coin_toss_space q N; AEeq N (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) (\<lambda>w. (1 + r) * init); 0 < q; q < 1; (\<lambda>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0); (\<lambda>w. (1 + r) * init) \<in> borel_measurable (infinite_coin_toss_space.nat_filtration N 0)\<rbrakk> \<Longrightarrow> discount_factor r 0 ?w * (q * u + (1 - q) * d) * init = (1 + r) * init
N = bernoulli_stream q
0 < q
q < 1
martingale N G (discounted_value r (prices Mkt stk))

goal (1 subgoal):
 1. \<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
by (simp add: discount_factor_init)
[PROOF STATE]
proof (state)
this:
\<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "(q * u + (1 - q) * d) * init = (1+r) * init"
[PROOF STATE]
proof (prove)
using this:
\<forall>w. discount_factor r 0 w * (q * u + (1 - q) * d) * init = (1 + r) * init

goal (1 subgoal):
 1. (q * u + (1 - q) * d) * init = (1 + r) * init
[PROOF STEP]
by (simp add: discount_factor_init)
[PROOF STATE]
proof (state)
this:
(q * u + (1 - q) * d) * init = (1 + r) * init

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "q * u + (1 - q) * d = 1+r"
[PROOF STATE]
proof (prove)
using this:
(q * u + (1 - q) * d) * init = (1 + r) * init

goal (1 subgoal):
 1. q * u + (1 - q) * d = 1 + r
[PROOF STEP]
using S0_positive
[PROOF STATE]
proof (prove)
using this:
(q * u + (1 - q) * d) * init = (1 + r) * init
0 < init

goal (1 subgoal):
 1. q * u + (1 - q) * d = 1 + r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
q * u + (1 - q) * d = 1 + r

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "q * u + d - q * d = 1+r"
[PROOF STATE]
proof (prove)
using this:
q * u + (1 - q) * d = 1 + r

goal (1 subgoal):
 1. q * u + d - q * d = 1 + r
[PROOF STEP]
by (simp add: left_diff_distrib)
[PROOF STATE]
proof (state)
this:
q * u + d - q * d = 1 + r

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
hence "q * (u - d) = 1 + r - d"
[PROOF STATE]
proof (prove)
using this:
q * u + d - q * d = 1 + r

goal (1 subgoal):
 1. q * (u - d) = 1 + r - d
[PROOF STEP]
by (metis (no_types, opaque_lifting) add.commute add.left_commute add_diff_cancel_left' add_uminus_conv_diff left_diff_distrib mult.commute)
[PROOF STATE]
proof (state)
this:
q * (u - d) = 1 + r - d

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
thus "q = (1 + r - d) / (u - d)"
[PROOF STATE]
proof (prove)
using this:
q * (u - d) = 1 + r - d

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
using down_lt_up
[PROOF STATE]
proof (prove)
using this:
q * (u - d) = 1 + r - d
d < u

goal (1 subgoal):
 1. q = (1 + r - d) / (u - d)
[PROOF STEP]
by (metis add.commute add.right_neutral diff_add_cancel nonzero_eq_divide_eq order_less_irrefl)
[PROOF STATE]
proof (state)
this:
q = (1 + r - d) / (u - d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutations_of_set_image_permutes:
  "\<sigma> permutes A \<Longrightarrow> map \<sigma> ` permutations_of_set A = permutations_of_set A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> permutes A \<Longrightarrow> map \<sigma> ` permutations_of_set A = permutations_of_set A
[PROOF STEP]
by (subst permutations_of_set_image_inj [symmetric])
     (simp_all add: permutes_inj_on permutes_image)


[STATEMENT]
lemma prv_imp_neg_imp_cnjL:
  assumes "\<phi> \<in> fmla" "\<phi>1 \<in> fmla" "\<phi>2 \<in> fmla"
    and "prv (imp \<phi> (neg \<phi>1))"
  shows "prv (imp \<phi> (neg (cnj \<phi>1 \<phi>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<phi> (neg (cnj \<phi>1 \<phi>2)))
[PROOF STEP]
unfolding neg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<phi> (imp (cnj \<phi>1 \<phi>2) fls))
[PROOF STEP]
by (metis assms cnj fls neg neg_def prv_imp_cnj3L prv_prv_imp_trans)


[STATEMENT]
lemma plus_float_interval:
  "set_of (real_interval A) + set_of (real_interval B) \<subseteq>
    set_of (real_interval (plus_float_interval prec A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
have "set_of (real_interval A) + set_of (real_interval B) \<subseteq>
          set_of (real_interval A + real_interval B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval A + real_interval B)
[PROOF STEP]
by (simp add: set_of_plus)
[PROOF STATE]
proof (state)
this:
set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval A + real_interval B)

goal (1 subgoal):
 1. set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval A + real_interval B)

goal (1 subgoal):
 1. set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
have "\<dots> \<subseteq> set_of (real_interval (plus_float_interval prec A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (real_interval A + real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
using mult_float_interval_ge[of A B prec]
[PROOF STATE]
proof (prove)
using this:
real_interval A + real_interval B \<le> real_interval (plus_float_interval prec A B)

goal (1 subgoal):
 1. set_of (real_interval A + real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
by (simp add: set_of_subset_iff')
[PROOF STATE]
proof (state)
this:
set_of (real_interval A + real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))

goal (1 subgoal):
 1. set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))

goal (1 subgoal):
 1. set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set_of (real_interval A) + set_of (real_interval B) \<subseteq> set_of (real_interval (plus_float_interval prec A B))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem wordinterval_CIDR_split_prefixmatch:
  "wordinterval_to_set r = (\<Union>x\<in>set (wordinterval_CIDR_split_prefixmatch r). prefix_to_wordset x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set r = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch r))
[PROOF STEP]
proof(induction r rule: wordinterval_CIDR_split_prefixmatch.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>rs. (\<And>x y x2. \<lbrakk>\<not> wordinterval_empty rs; (x, y) = wordinterval_CIDR_split1 rs; x = Some x2\<rbrakk> \<Longrightarrow> wordinterval_to_set y = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y))) \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
case (1 rs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> wordinterval_empty rs; (?x, ?y) = wordinterval_CIDR_split1 rs; ?x = Some ?x2.0\<rbrakk> \<Longrightarrow> wordinterval_to_set ?y = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch ?y))

goal (1 subgoal):
 1. \<And>rs. (\<And>x y x2. \<lbrakk>\<not> wordinterval_empty rs; (x, y) = wordinterval_CIDR_split1 rs; x = Some x2\<rbrakk> \<Longrightarrow> wordinterval_to_set y = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y))) \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
proof(cases "wordinterval_empty rs")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
 2. \<not> wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
wordinterval_empty rs

goal (2 subgoals):
 1. wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
 2. \<not> wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
wordinterval_empty rs

goal (1 subgoal):
 1. wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
by(simp add: wordinterval_CIDR_split_prefixmatch.simps)
[PROOF STATE]
proof (state)
this:
wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))

goal (1 subgoal):
 1. \<not> wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> wordinterval_empty rs

goal (1 subgoal):
 1. \<not> wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
obtain x y where s1: "wordinterval_CIDR_split1 rs = (Some x, y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. wordinterval_CIDR_split1 rs = (Some x, y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using r_split1_not_none[OF False]
[PROOF STATE]
proof (prove)
using this:
fst (wordinterval_CIDR_split1 rs) \<noteq> None

goal (1 subgoal):
 1. (\<And>x y. wordinterval_CIDR_split1 rs = (Some x, y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(auto simp add: fst_def split: prod.splits)
[PROOF STATE]
proof (state)
this:
wordinterval_CIDR_split1 rs = (Some x, y)

goal (1 subgoal):
 1. \<not> wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
have mIH: "wordinterval_to_set y = (\<Union>x\<in>set (wordinterval_CIDR_split_prefixmatch y). prefix_to_wordset x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set y = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y))
[PROOF STEP]
using 1[OF False s1[symmetric] refl]
[PROOF STATE]
proof (prove)
using this:
wordinterval_to_set y = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y))

goal (1 subgoal):
 1. wordinterval_to_set y = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
wordinterval_to_set y = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y))

goal (1 subgoal):
 1. \<not> wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
have *: "wordinterval_to_set rs = prefix_to_wordset x \<union> (\<Union>x\<in>set (wordinterval_CIDR_split_prefixmatch y). prefix_to_wordset x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set rs = prefix_to_wordset x \<union> \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y))
[PROOF STEP]
unfolding mIH[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set y
[PROOF STEP]
have ud: "y = wordinterval_setminus rs (prefix_to_wordinterval x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = wordinterval_setminus rs (prefix_to_wordinterval x)
[PROOF STEP]
using wordinterval_CIDR_split1_snd[OF s1]
[PROOF STATE]
proof (prove)
using this:
y = wordinterval_setminus rs (prefix_to_wordinterval x)

goal (1 subgoal):
 1. y = wordinterval_setminus rs (prefix_to_wordinterval x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
y = wordinterval_setminus rs (prefix_to_wordinterval x)

goal (1 subgoal):
 1. wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set y
[PROOF STEP]
have ss: "prefix_to_wordset x \<subseteq> wordinterval_to_set rs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix_to_wordset x \<subseteq> wordinterval_to_set rs
[PROOF STEP]
using largest_contained_prefix_subset_s1D[OF s1]
[PROOF STATE]
proof (prove)
using this:
wordinterval_to_set (prefix_to_wordinterval x) \<subseteq> wordinterval_to_set rs

goal (1 subgoal):
 1. prefix_to_wordset x \<subseteq> wordinterval_to_set rs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prefix_to_wordset x \<subseteq> wordinterval_to_set rs

goal (1 subgoal):
 1. wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set y
[PROOF STEP]
show "wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set y
[PROOF STEP]
unfolding ud
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set (wordinterval_setminus rs (prefix_to_wordinterval x))
[PROOF STEP]
using ss
[PROOF STATE]
proof (prove)
using this:
prefix_to_wordset x \<subseteq> wordinterval_to_set rs

goal (1 subgoal):
 1. wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set (wordinterval_setminus rs (prefix_to_wordinterval x))
[PROOF STEP]
by simp blast
[PROOF STATE]
proof (state)
this:
wordinterval_to_set rs = prefix_to_wordset x \<union> wordinterval_to_set y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
wordinterval_to_set rs = prefix_to_wordset x \<union> \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y))

goal (1 subgoal):
 1. \<not> wordinterval_empty rs \<Longrightarrow> wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))
[PROOF STEP]
apply(subst wordinterval_CIDR_split_prefixmatch.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (if \<not> wordinterval_empty rs then case wordinterval_CIDR_split1 rs of (None, u) \<Rightarrow> [] | (Some s, u) \<Rightarrow> s # wordinterval_CIDR_split_prefixmatch u else []))
[PROOF STEP]
apply(unfold if_P[OF False] s1 prod.simps option.simps *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix_to_wordset x \<union> \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y)) = \<Union> (prefix_to_wordset ` set (x # wordinterval_CIDR_split_prefixmatch y))
[PROOF STEP]
(* WOOOOO simplifier bug (* try making this a simp add: *) *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix_to_wordset x \<union> \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch y)) = \<Union> (prefix_to_wordset ` set (x # wordinterval_CIDR_split_prefixmatch y))
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
wordinterval_to_set rs = \<Union> (prefix_to_wordset ` set (wordinterval_CIDR_split_prefixmatch rs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SA_poly_to_SA_fun_formula:
  assumes "P \<in> carrier (UP (SA n))"
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "t \<in> carrier Q\<^sub>p"
  shows "SA_poly_to_SA_fun n P (t#x) = (SA_poly_to_Qp_poly n x P)\<bullet>t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SA_poly_to_SA_fun n P (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. SA_poly_to_SA_fun n P (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t
[PROOF STEP]
have 0: "hd (t#x) = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (t # x) = t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lead_coeff (t # x) = t

goal (1 subgoal):
 1. SA_poly_to_SA_fun n P (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t
[PROOF STEP]
have 1: "tl (t#x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tl (t # x) = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
tl (t # x) = x

goal (1 subgoal):
 1. SA_poly_to_SA_fun n P (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t
[PROOF STEP]
have 2: "(t#x) \<in> carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t # x \<in> carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>)
[PROOF STEP]
by (metis add.commute assms cartesian_power_cons plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
t # x \<in> carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>)

goal (1 subgoal):
 1. SA_poly_to_SA_fun n P (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SA_poly_to_SA_fun n P (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t
[PROOF STEP]
unfolding SA_poly_to_SA_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a\<in>carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>). SA_poly_to_Qp_poly n (tl a) P \<bullet> lead_coeff a) (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t
[PROOF STEP]
using 0 1 2 assms
[PROOF STATE]
proof (prove)
using this:
lead_coeff (t # x) = t
tl (t # x) = x
t # x \<in> carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>)
P \<in> carrier (UP (SA n))
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
t \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. (\<lambda>a\<in>carrier (Q\<^sub>p\<^bsup>Suc n\<^esup>). SA_poly_to_Qp_poly n (tl a) P \<bullet> lead_coeff a) (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t
[PROOF STEP]
by (metis (no_types, lifting) restrict_apply')
[PROOF STATE]
proof (state)
this:
SA_poly_to_SA_fun n P (t # x) = SA_poly_to_Qp_poly n x P \<bullet> t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma first_to_last_eq:
  assumes "as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "a \<in> carrier Q\<^sub>p"
  shows "permute_list (first_to_last (n+1)) (as@[a])  = (a#as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list (first_to_last (n + 1)) (as @ [a]) = a # as
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. permute_list (first_to_last (n + 1)) (as @ [a]) = a # as
[PROOF STEP]
have "length as = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length as = n
[PROOF STEP]
using assms(1) cartesian_power_car_memE
[PROOF STATE]
proof (prove)
using this:
as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
?as \<in> carrier (?R\<^bsup>?n\<^esup>) \<Longrightarrow> length ?as = ?n

goal (1 subgoal):
 1. length as = n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length as = n

goal (1 subgoal):
 1. permute_list (first_to_last (n + 1)) (as @ [a]) = a # as
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length as = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length as = n

goal (1 subgoal):
 1. permute_list (first_to_last (n + 1)) (as @ [a]) = a # as
[PROOF STEP]
using last_to_first_eq last_to_first_permutes[of n]
        permute_list_compose_inv(2)[of  "(last_to_first (n + 1))" n "a # as"]
[PROOF STATE]
proof (prove)
using this:
length as = n
length ?as = ?n \<Longrightarrow> permute_list (last_to_first (?n + 1)) (?a # ?as) = ?as @ [?a]
0 < n \<Longrightarrow> last_to_first n permutes {..<n}
\<lbrakk>last_to_first (n + 1) permutes {..<n}; a # as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> permute_list (fun_inv (last_to_first (n + 1))) (permute_list (last_to_first (n + 1)) (a # as)) = a # as

goal (1 subgoal):
 1. permute_list (first_to_last (n + 1)) (as @ [a]) = a # as
[PROOF STEP]
unfolding first_to_last_def
[PROOF STATE]
proof (prove)
using this:
length as = n
length ?as = ?n \<Longrightarrow> permute_list (last_to_first (?n + 1)) (?a # ?as) = ?as @ [?a]
0 < n \<Longrightarrow> last_to_first n permutes {..<n}
\<lbrakk>last_to_first (n + 1) permutes {..<n}; a # as \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> permute_list (fun_inv (last_to_first (n + 1))) (permute_list (last_to_first (n + 1)) (a # as)) = a # as

goal (1 subgoal):
 1. permute_list (fun_inv (last_to_first (n + 1))) (as @ [a]) = a # as
[PROOF STEP]
by (metis add_gr_0 assms(1) assms(2) cartesian_power_append last_to_first_permutes
      less_one permute_list_closed' permute_list_compose_inv(2))
[PROOF STATE]
proof (state)
this:
permute_list (first_to_last (n + 1)) (as @ [a]) = a # as

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma incr_correct: "\<not> idx < l \<Longrightarrow> idx < l + iam_increment l idx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> idx < l \<Longrightarrow> idx < l + iam_increment l idx
[PROOF STEP]
unfolding iam_increment_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> idx < l \<Longrightarrow> idx < l + max (idx + 1 - l) (2 * l + 3)
[PROOF STEP]
by auto


[STATEMENT]
lemma one_strongly_connected_iff_3_eq:
  "one_strongly_connected x \<longleftrightarrow> x;1;x = x\<^sup>T\<^sup>+"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. one_strongly_connected x = (x ; 1 ; x = x\<^sup>T\<^sup>+)
[PROOF STEP]
by (metis conv_invol one_strongly_connected_iff_1_eq one_strongly_connected_iff_2)


[STATEMENT]
lemma cos_periodic_pi2 [simp]: "cos (pi + x) = - cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (pi + x) = - cos x
[PROOF STEP]
by (simp add: cos_add)


[STATEMENT]
lemma project_at_indices_closed:
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "S \<subseteq> indices_of a"
  shows "\<pi>\<^bsub>S\<^esub> a \<in> carrier (R\<^bsup>card S\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths a S \<in> carrier (R\<^bsup>card S\<^esup>)
[PROOF STEP]
apply(rule cartesian_power_car_memI')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (nths a S) = card S
 2. \<And>i. i < card S \<Longrightarrow> nths a S ! i \<in> carrier R
[PROOF STEP]
using assms proj_at_index_list_length
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
S \<subseteq> indices_of a
?S \<subseteq> indices_of ?as \<Longrightarrow> length (nths ?as ?S) = card ?S

goal (2 subgoals):
 1. length (nths a S) = card S
 2. \<And>i. i < card S \<Longrightarrow> nths a S ! i \<in> carrier R
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < card S \<Longrightarrow> nths a S ! i \<in> carrier R
[PROOF STEP]
using assms project_at_indices_nth[of S]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
S \<subseteq> indices_of a
\<lbrakk>S \<subseteq> indices_of ?as; ?i < card S\<rbrakk> \<Longrightarrow> nths ?as S ! ?i = ?as ! nth_elem S ?i

goal (1 subgoal):
 1. \<And>i. i < card S \<Longrightarrow> nths a S ! i \<in> carrier R
[PROOF STEP]
by (smt cartesian_power_car_memE cartesian_power_car_memE' indices_of_def lessThan_iff nth_elem_closed subsetD)


[STATEMENT]
lemma subst_USUP [usubst]: "\<sigma> \<dagger> (\<Squnion> i | P(i) \<bullet> Q(i)) = (\<Squnion> i | (\<sigma> \<dagger> P(i)) \<bullet> (\<sigma> \<dagger> Q(i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> \<dagger> USUP P Q = (\<Squnion> i | \<sigma> \<dagger> P i \<bullet> \<sigma> \<dagger> Q i)
[PROOF STEP]
by (pred_auto)


[STATEMENT]
lemma eventually_imp_distrib:
  "(\<diamond>(P \<^bold>\<longrightarrow> Q)) = (\<box>P \<^bold>\<longrightarrow> \<diamond>Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<diamond>(\<lambda>s. P s \<longrightarrow> Q s) = (\<lambda>s. (\<box>P) s \<longrightarrow> (\<diamond>Q) s)
[PROOF STEP]
unfolding defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>\<sigma>. \<exists>i. (P (\<sigma> |\<^sub>s i) \<longrightarrow> Q (\<sigma> |\<^sub>s i)) \<and> (\<forall>k<i. True)) = (\<lambda>s. (\<forall>i. P (s |\<^sub>s i)) \<longrightarrow> (\<exists>i. Q (s |\<^sub>s i) \<and> (\<forall>k<i. True)))
[PROOF STEP]
by auto


[STATEMENT]
lemma transitively_orientable_2:
  "transitively_orientable x \<longleftrightarrow> irreflexive_inf x \<and> (\<exists>y . y \<squnion> y\<^sup>T = x \<and> transitive y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transitively_orientable x = (irreflexive_inf x \<and> (\<exists>y. y \<squnion> y\<^sup>T = x \<and> transitive y))
[PROOF STEP]
by (metis irreflexive_transitive_orientation_asymmetric coreflexive_bot_closed loop_orientation_split transitively_orientable_def)


[STATEMENT]
lemma fvi_Suc: "x \<in> fvi (Suc b) \<phi> \<longleftrightarrow> Suc x \<in> fvi b \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> fvi (Suc b) \<phi>) = (Suc x \<in> fvi b \<phi>)
[PROOF STEP]
by (induction \<phi> arbitrary: b) (simp_all add: fvi_trm_Suc)


[STATEMENT]
lemma vdunion_def: "(\<Coprod>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i) = (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. \<Union>\<^sub>\<circ>x\<in>\<^sub>\<circ>A i. set {\<langle>i, x\<rangle>})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VSigma I A = \<Union>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. \<Union>\<^sub>\<circ> ((\<lambda>aa\<in>\<^sub>\<circ>A a. set {\<langle>a, aa\<rangle>}) `\<^sub>\<circ> A a)) `\<^sub>\<circ> I)
[PROOF STEP]
by (auto simp: vrange_VLambda vimage_VLambda_vrange_rep)


[STATEMENT]
lemma takeWhile_dropWhile_real_prefix:
  "\<lbrakk>x \<in> set xs; \<not> P x\<rbrakk> \<Longrightarrow> \<exists>y ys. xs=takeWhile P xs @ y#ys \<and> \<not> P y \<and> dropWhile P xs = y#ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> set xs; \<not> P x\<rbrakk> \<Longrightarrow> \<exists>y ys. xs = takeWhile P xs @ y # ys \<and> \<not> P y \<and> dropWhile P xs = y # ys
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma iT_Plus_iUntil_conv: "(P t1. t1 \<U> t2 (I \<oplus> k). Q t2) = (P (t1 + k). t1 \<U> t2 I. Q (t2 + k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P t1. t1 \<U> t2 I \<oplus> k. Q t2) = (P (t1 + k). t1 \<U> t2 I. Q (t2 + k))
[PROOF STEP]
by (simp add: iUntil_def iT_Plus_iAll_conv iT_Plus_iEx_conv iT_Plus_cut_less2)


[STATEMENT]
lemma fresh_star_finite_insert:
  fixes S :: "('a::fs) set"  shows "finite S \<Longrightarrow> a \<sharp>* insert x S \<longleftrightarrow> a \<sharp>* x \<and> a \<sharp>* S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> a \<sharp>* insert x S = (a \<sharp>* x \<and> a \<sharp>* S)
[PROOF STEP]
by (auto simp: fresh_star_def fresh_finite_insert)


[STATEMENT]
lemma ideal_points_x_axis
  [simp]: "ideal_points x_axis = {of_complex (-1), of_complex 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal_points x_axis = {of_complex (- 1), of_complex 1}
[PROOF STEP]
proof (subst ideal_points_unique, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. calc_ideal_points x_axis = {of_complex (- 1), of_complex 1}
[PROOF STEP]
have "calc_ideal_points_clmat_hcoords x_axis_clmat = {of_complex_hcoords (- 1), of_complex_hcoords 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. calc_ideal_points_clmat_hcoords x_axis_clmat = {of_complex_hcoords (- 1), of_complex_hcoords 1}
[PROOF STEP]
by transfer auto
[PROOF STATE]
proof (state)
this:
calc_ideal_points_clmat_hcoords x_axis_clmat = {of_complex_hcoords (- 1), of_complex_hcoords 1}

goal (1 subgoal):
 1. calc_ideal_points x_axis = {of_complex (- 1), of_complex 1}
[PROOF STEP]
thus "calc_ideal_points x_axis = {of_complex (- 1), of_complex 1}"
[PROOF STATE]
proof (prove)
using this:
calc_ideal_points_clmat_hcoords x_axis_clmat = {of_complex_hcoords (- 1), of_complex_hcoords 1}

goal (1 subgoal):
 1. calc_ideal_points x_axis = {of_complex (- 1), of_complex 1}
[PROOF STEP]
by (simp add: calc_ideal_points.abs_eq of_complex.abs_eq x_axis_def)
[PROOF STATE]
proof (state)
this:
calc_ideal_points x_axis = {of_complex (- 1), of_complex 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tllist_all2_trans:
  "\<lbrakk> tllist_all2 P Q xs ys; tllist_all2 P Q ys zs; transp P; transp Q \<rbrakk>
  \<Longrightarrow> tllist_all2 P Q xs zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>tllist_all2 P Q xs ys; tllist_all2 P Q ys zs; transp P; transp Q\<rbrakk> \<Longrightarrow> tllist_all2 P Q xs zs
[PROOF STEP]
by transfer(auto elim: llist_all2_trans dest: llist_all2_lfiniteD transpD)


[STATEMENT]
lemma SimpleLevi:
  shows "(p @ s = a # list) =
             ( p = [] \<and> s = a # list \<or>
              (\<exists> t. p = a # t \<and> t @ s = list))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p @ s = a # list) = (p = [] \<and> s = a # list \<or> (\<exists>t. p = a # t \<and> t @ s = list))
[PROOF STEP]
by (induct p) auto


[STATEMENT]
lemma sorted_from_Suc2:
  "\<lbrakk> cols xss n; i < n;
    sorted_col i xss;
    \<And>x. sorted_from (i+1) [ys \<leftarrow> xss. ys!i = x] \<rbrakk>
  \<Longrightarrow> sorted_from i xss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cols xss n; i < n; sorted (map (\<lambda>xs. xs ! i) xss); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) xss))\<rbrakk> \<Longrightarrow> sorted (map (drop i) xss)
[PROOF STEP]
proof(induction xss rule: induct_list012)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>cols [] n; i < n; sorted (map (\<lambda>xs. xs ! i) []); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) []))\<rbrakk> \<Longrightarrow> sorted (map (drop i) [])
 2. \<And>x. \<lbrakk>cols [x] n; i < n; sorted (map (\<lambda>xs. xs ! i) [x]); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) [x]))\<rbrakk> \<Longrightarrow> sorted (map (drop i) [x])
 3. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
cols [] n
i < n
sorted (map (\<lambda>xs. xs ! i) [])
sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = ?x) []))

goal (3 subgoals):
 1. \<lbrakk>cols [] n; i < n; sorted (map (\<lambda>xs. xs ! i) []); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) []))\<rbrakk> \<Longrightarrow> sorted (map (drop i) [])
 2. \<And>x. \<lbrakk>cols [x] n; i < n; sorted (map (\<lambda>xs. xs ! i) [x]); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) [x]))\<rbrakk> \<Longrightarrow> sorted (map (drop i) [x])
 3. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map (drop i) [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (map (drop i) [])

goal (2 subgoals):
 1. \<And>x. \<lbrakk>cols [x] n; i < n; sorted (map (\<lambda>xs. xs ! i) [x]); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) [x]))\<rbrakk> \<Longrightarrow> sorted (map (drop i) [x])
 2. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>cols [x] n; i < n; sorted (map (\<lambda>xs. xs ! i) [x]); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) [x]))\<rbrakk> \<Longrightarrow> sorted (map (drop i) [x])
 2. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
cols [x_] n
i < n
sorted (map (\<lambda>xs. xs ! i) [x_])
sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = ?x) [x_]))

goal (2 subgoals):
 1. \<And>x. \<lbrakk>cols [x] n; i < n; sorted (map (\<lambda>xs. xs ! i) [x]); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) [x]))\<rbrakk> \<Longrightarrow> sorted (map (drop i) [x])
 2. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map (drop i) [x_])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (map (drop i) [x_])

goal (1 subgoal):
 1. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
case (3 xs1 xs2 xss)
[PROOF STATE]
proof (state)
this:
\<lbrakk>cols xss n; i < n; sorted (map (\<lambda>xs. xs ! i) xss); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) xss))\<rbrakk> \<Longrightarrow> sorted (map (drop i) xss)
\<lbrakk>cols (xs2 # xss) n; i < n; sorted (map (\<lambda>xs. xs ! i) (xs2 # xss)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (xs2 # xss)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (xs2 # xss))
cols (xs1 # xs2 # xss) n
i < n
sorted (map (\<lambda>xs. xs ! i) (xs1 # xs2 # xss))
sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = ?x) (xs1 # xs2 # xss)))

goal (1 subgoal):
 1. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
have lxs1: "length xs1 = n" and lxs2: "length xs2 = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs1 = n &&& length xs2 = n
[PROOF STEP]
using "3.prems"(1)
[PROOF STATE]
proof (prove)
using this:
cols (xs1 # xs2 # xss) n

goal (1 subgoal):
 1. length xs1 = n &&& length xs2 = n
[PROOF STEP]
by(auto simp: cols_def)
[PROOF STATE]
proof (state)
this:
length xs1 = n
length xs2 = n

goal (1 subgoal):
 1. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
have *: "drop i xs1 \<le> drop i xs2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop i xs1 \<le> drop i xs2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. drop i xs1 \<le> drop i xs2
[PROOF STEP]
have "drop i xs1 = xs1!i # drop (i+1) xs1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop i xs1 = xs1 ! i # drop (i + 1) xs1
[PROOF STEP]
using \<open>i < n\<close>
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. drop i xs1 = xs1 ! i # drop (i + 1) xs1
[PROOF STEP]
by (simp add: Cons_nth_drop_Suc lxs1)
[PROOF STATE]
proof (state)
this:
drop i xs1 = xs1 ! i # drop (i + 1) xs1

goal (1 subgoal):
 1. drop i xs1 \<le> drop i xs2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
drop i xs1 = xs1 ! i # drop (i + 1) xs1

goal (1 subgoal):
 1. drop i xs1 \<le> drop i xs2
[PROOF STEP]
have "\<dots> \<le> xs2!i # drop (i+1) xs2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs1 ! i # drop (i + 1) xs1 \<le> xs2 ! i # drop (i + 1) xs2
[PROOF STEP]
using "3.prems"(3) "3.prems"(4)[of "xs2!i"]
[PROOF STATE]
proof (prove)
using this:
sorted (map (\<lambda>xs. xs ! i) (xs1 # xs2 # xss))
sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xs2 ! i) (xs1 # xs2 # xss)))

goal (1 subgoal):
 1. xs1 ! i # drop (i + 1) xs1 \<le> xs2 ! i # drop (i + 1) xs2
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
xs1 ! i # drop (i + 1) xs1 \<le> xs2 ! i # drop (i + 1) xs2

goal (1 subgoal):
 1. drop i xs1 \<le> drop i xs2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
xs1 ! i # drop (i + 1) xs1 \<le> xs2 ! i # drop (i + 1) xs2

goal (1 subgoal):
 1. drop i xs1 \<le> drop i xs2
[PROOF STEP]
have "\<dots> = drop i xs2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs2 ! i # drop (i + 1) xs2 = drop i xs2
[PROOF STEP]
using \<open>i < n\<close>
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. xs2 ! i # drop (i + 1) xs2 = drop i xs2
[PROOF STEP]
by (simp add: Cons_nth_drop_Suc lxs2)
[PROOF STATE]
proof (state)
this:
xs2 ! i # drop (i + 1) xs2 = drop i xs2

goal (1 subgoal):
 1. drop i xs1 \<le> drop i xs2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
drop i xs1 \<le> drop i xs2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
drop i xs1 \<le> drop i xs2

goal (1 subgoal):
 1. drop i xs1 \<le> drop i xs2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
drop i xs1 \<le> drop i xs2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
drop i xs1 \<le> drop i xs2

goal (1 subgoal):
 1. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
have "sorted_from i (xs2 # xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map (drop i) (xs2 # xss))
[PROOF STEP]
proof(rule "3.IH"[OF _ "3.prems"(2)])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. cols (xs2 # xss) n
 2. sorted (map (\<lambda>xs. xs ! i) (xs2 # xss))
 3. \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (xs2 # xss)))
[PROOF STEP]
show "cols (xs2 # xss) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cols (xs2 # xss) n
[PROOF STEP]
using "3.prems"(1)
[PROOF STATE]
proof (prove)
using this:
cols (xs1 # xs2 # xss) n

goal (1 subgoal):
 1. cols (xs2 # xss) n
[PROOF STEP]
by(simp add: cols_def)
[PROOF STATE]
proof (state)
this:
cols (xs2 # xss) n

goal (2 subgoals):
 1. sorted (map (\<lambda>xs. xs ! i) (xs2 # xss))
 2. \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (xs2 # xss)))
[PROOF STEP]
show "sorted_col i (xs2 # xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map (\<lambda>xs. xs ! i) (xs2 # xss))
[PROOF STEP]
using "3.prems"(3)
[PROOF STATE]
proof (prove)
using this:
sorted (map (\<lambda>xs. xs ! i) (xs1 # xs2 # xss))

goal (1 subgoal):
 1. sorted (map (\<lambda>xs. xs ! i) (xs2 # xss))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (map (\<lambda>xs. xs ! i) (xs2 # xss))

goal (1 subgoal):
 1. \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (xs2 # xss)))
[PROOF STEP]
show "\<And>x. sorted_from (i+1) [ys\<leftarrow>xs2 # xss . ys ! i = x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (xs2 # xss)))
[PROOF STEP]
using "3.prems"(4)
        sorted_antimono_suffix[OF map_mono_suffix[OF filter_mono_suffix[OF suffix_ConsI[OF suffix_order.refl]]]]
[PROOF STATE]
proof (prove)
using this:
sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = ?x) (xs1 # xs2 # xss)))
sorted (map ?f1 (filter ?P2 (?y3 # ?xs2))) \<Longrightarrow> sorted (map ?f1 (filter ?P2 ?xs2))

goal (1 subgoal):
 1. \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (xs2 # xss)))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = ?x) (xs2 # xss)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted (map (drop i) (xs2 # xss))

goal (1 subgoal):
 1. \<And>x y zs. \<lbrakk>\<lbrakk>cols zs n; i < n; sorted (map (\<lambda>xs. xs ! i) zs); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) zs))\<rbrakk> \<Longrightarrow> sorted (map (drop i) zs); \<lbrakk>cols (y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (y # zs)); \<And>x. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = x) (y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (y # zs)); cols (x # y # zs) n; i < n; sorted (map (\<lambda>xs. xs ! i) (x # y # zs)); \<And>xa. sorted (map (drop (i + 1)) (filter (\<lambda>ys. ys ! i = xa) (x # y # zs)))\<rbrakk> \<Longrightarrow> sorted (map (drop i) (x # y # zs))
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
drop i xs1 \<le> drop i xs2
sorted (map (drop i) (xs2 # xss))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
drop i xs1 \<le> drop i xs2
sorted (map (drop i) (xs2 # xss))

goal (1 subgoal):
 1. sorted (map (drop i) (xs1 # xs2 # xss))
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
sorted (map (drop i) (xs1 # xs2 # xss))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iMODb_singleton_eq_conv: "
  ([r, mod m, c] = {a}) = (r = a \<and> (m = 0 \<or> c = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([ r, mod m, c ] = {a}) = (r = a \<and> (m = 0 \<or> c = 0))
[PROOF STEP]
apply (rule_tac t="[r, mod m, c] = {a}" and s="[r, mod m, c] \<subseteq> {a}" in subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ([ r, mod m, c ] \<subseteq> {a}) = ([ r, mod m, c ] = {a})
 2. ([ r, mod m, c ] \<subseteq> {a}) = (r = a \<and> (m = 0 \<or> c = 0))
[PROOF STEP]
apply (simp add:  subset_singleton_conv iMODb_not_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([ r, mod m, c ] \<subseteq> {a}) = (r = a \<and> (m = 0 \<or> c = 0))
[PROOF STEP]
apply (simp add: iMODb_singleton_subset_conv)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma in_set_inits_self: "(ys, z) \<in> set (inits_self xs) \<longleftrightarrow> (\<exists>zs. xs = ys @ z # zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((ys, z) \<in> set (inits_self xs)) = (\<exists>zs. xs = ys @ z # zs)
[PROOF STEP]
by(induction xs arbitrary: ys z)(auto simp add: Cons_eq_append_conv apfst_def map_prod_def)


[STATEMENT]
theorem finite_2sat_iff:
  assumes FIN: "finite (vars_of_cnf cnf)"
  assumes TSAT: "is_2sat cnf"
  shows "satisfiable cnf
    \<longleftrightarrow> (\<forall>x\<in>vars_of_cnf cnf.
          \<not> ((Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<and> (Neg x, Pos x) \<in> (imp_graph cnf)\<^sup>* ))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satisfiable cnf = (\<forall>x\<in>vars_of_cnf cnf. \<not> ((Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<and> (Neg x, Pos x) \<in> (imp_graph cnf)\<^sup>*))
[PROOF STEP]
apply (safe;clarsimp?; (auto dest: loop_imp_unsat;fail)?)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> satisfiable cnf
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> satisfiable cnf
[PROOF STEP]
assume " \<forall>x\<in>vars_of_cnf cnf.
     (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>*"
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>*

goal (1 subgoal):
 1. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> satisfiable cnf
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>*
[PROOF STEP]
interpret construct_sa cnf
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>*

goal (1 subgoal):
 1. construct_sa cnf
[PROOF STEP]
apply (unfold_locales)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> finite (vars_of_cnf cnf)
 2. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> \<nexists>x. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<and> (Neg x, Pos x) \<in> (imp_graph cnf)\<^sup>*
 3. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> is_2sat cnf
[PROOF STEP]
using FIN TSAT
[PROOF STATE]
proof (prove)
using this:
finite (vars_of_cnf cnf)
is_2sat cnf

goal (3 subgoals):
 1. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> finite (vars_of_cnf cnf)
 2. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> \<nexists>x. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<and> (Neg x, Pos x) \<in> (imp_graph cnf)\<^sup>*
 3. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>* \<Longrightarrow> is_2sat cnf
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> (imp_graph cnf)\<^sup>*; finite (vars_of_cnf cnf); is_2sat cnf; (Pos x, Neg x) \<in> (imp_graph cnf)\<^sup>*; (Neg x, Pos x) \<in> (imp_graph cnf)\<^sup>*\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis converse_rtranclE imp_graph_vars lit.inject lit.sel(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x\<in>vars_of_cnf cnf. (Pos x, Neg x) \<in> G\<^sup>* \<longrightarrow> (Neg x, Pos x) \<notin> G\<^sup>* \<Longrightarrow> satisfiable cnf
[PROOF STEP]
from sat
[PROOF STATE]
proof (chain)
picking this:
satisfiable cnf
[PROOF STEP]
show "satisfiable cnf"
[PROOF STATE]
proof (prove)
using this:
satisfiable cnf

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma A_authenticates_B:
     "\<lbrakk> Outpts (Card A) A \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs;
         \<not>illegalUse(Card B);
         evs \<in> sr \<rbrakk>
     \<Longrightarrow> \<exists> Na.
            Outpts (Card B) B \<lbrace>Nonce Nb, Key K,
                Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>,
                Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Outpts (Card A) A \<lbrace>Key K, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs; \<not> illegalUse (Card B); evs \<in> sr\<rbrakk> \<Longrightarrow> \<exists>Na. Outpts (Card B) B \<lbrace>Nonce Nb, Key K, Crypt (pairK (A, B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, Crypt (pairK (A, B)) (Nonce Nb)\<rbrace> \<in> set evs
[PROOF STEP]
apply (blast dest: Na_Nb_certificate_authentic Outpts_A_Card_form_10 Outpts_A_Card_imp_pairK_parts)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "\<exists>(x::'a::linordered_field) y z w. 5 * x + 3 * z - 17 * w + \<bar>y - 8 * x + z\<bar> \<le> 89"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y z w. (5::'a) * x + (3::'a) * z - (17::'a) * w + \<bar>y - (8::'a) * x + z\<bar> \<le> (89::'a)
[PROOF STEP]
by ferrack


[STATEMENT]
theorem turing_decidable_empty_set: "turing_decidable {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. turing_decidable {}
[PROOF STEP]
by (rule turing_decidable_empty_set_iff[THEN iffD2])
     (blast intro: tm_onestroke_total_correctness)


[STATEMENT]
lemma Suc_Suc_less:"Suc 0 < a \<Longrightarrow> Suc (a - Suc (Suc 0)) < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 < a \<Longrightarrow> Suc (a - Suc (Suc 0)) < a
[PROOF STEP]
by arith


[STATEMENT]
lemma bounded_nat_bit_count:
  "bit_count (Nb\<^sub>e l y) = (if y < l then floorlog 2 (l-1) else \<infinity>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_count (Nb\<^sub>e l y) = ereal_of_enat (if y < l then enat (floorlog 2 (l - 1)) else \<infinity>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bit_count (Nb\<^sub>e l y) = ereal_of_enat (if y < l then enat (floorlog 2 (l - 1)) else \<infinity>)
[PROOF STEP]
have a:"length (encode_bounded_nat h m) = h" for h m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (encode_bounded_nat h m) = h
[PROOF STEP]
by (induction h arbitrary: m, simp, simp add:Let_def)
[PROOF STATE]
proof (state)
this:
length (encode_bounded_nat ?h ?m) = ?h

goal (1 subgoal):
 1. bit_count (Nb\<^sub>e l y) = ereal_of_enat (if y < l then enat (floorlog 2 (l - 1)) else \<infinity>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_count (Nb\<^sub>e l y) = ereal_of_enat (if y < l then enat (floorlog 2 (l - 1)) else \<infinity>)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
length (encode_bounded_nat ?h ?m) = ?h

goal (1 subgoal):
 1. bit_count (Nb\<^sub>e l y) = ereal_of_enat (if y < l then enat (floorlog 2 (l - 1)) else \<infinity>)
[PROOF STEP]
by (simp add:Nb\<^sub>e_def)
[PROOF STATE]
proof (state)
this:
bit_count (Nb\<^sub>e l y) = ereal_of_enat (if y < l then enat (floorlog 2 (l - 1)) else \<infinity>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma im_jointfun:"\<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B\<rbrakk> \<Longrightarrow>
    (jointfun n f m g) `({j. j \<le> (Suc (n + m))}) =
                           f `{j. j \<le> n} \<union> g `{j. j \<le>  m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B\<rbrakk> \<Longrightarrow> jointfun n f m g ` {j. j \<le> Suc (n + m)} = f ` {j. j \<le> n} \<union> g ` {j. j \<le> m}
[PROOF STEP]
apply (cut_tac im_set_un1 [of "{j. j \<le> (Suc (n + m))}" "jointfun n f m g"
        "A \<union> B"  "{i. i \<le> n}" "nset (Suc n) (Suc (n + m))"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B; jointfun n f m g ` ({i. i \<le> n} \<union> nset (Suc n) (Suc (n + m))) = jointfun n f m g ` {i. i \<le> n} \<union> jointfun n f m g ` nset (Suc n) (Suc (n + m))\<rbrakk> \<Longrightarrow> jointfun n f m g ` {j. j \<le> Suc (n + m)} = f ` {j. j \<le> n} \<union> g ` {j. j \<le> m}
 2. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B\<rbrakk> \<Longrightarrow> \<forall>l\<in>{j. j \<le> Suc (n + m)}. jointfun n f m g l \<in> A \<union> B
 3. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B\<rbrakk> \<Longrightarrow> {j. j \<le> Suc (n + m)} = {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m))
[PROOF STEP]
apply (simp add:Nset_nset[THEN sym, of n m],
        simp add:im_jointfunTr1[of n f m g],
        simp add:im_jointfunTr2[of n f m g])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B\<rbrakk> \<Longrightarrow> \<forall>l\<in>{j. j \<le> Suc (n + m)}. jointfun n f m g l \<in> A \<union> B
 2. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B\<rbrakk> \<Longrightarrow> {j. j \<le> Suc (n + m)} = {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m))
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>l. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B; l \<in> {j. j \<le> Suc (n + m)}\<rbrakk> \<Longrightarrow> jointfun n f m g l \<in> A \<union> B
 2. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B\<rbrakk> \<Longrightarrow> {j. j \<le> Suc (n + m)} = {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m))
[PROOF STEP]
apply (simp add:jointfun_def,
        case_tac "l \<le> n", simp add:Pi_def,
        simp add:sliden_def,
        simp add:nat_not_le_less,
        frule_tac m = n and n = l in Suc_leI,
        frule_tac m = l and n = "Suc (n + m)" and l = "Suc n" in diff_le_mono,
        thin_tac "l \<le> Suc (n + m)", simp,
        simp add:Pi_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> m} \<rightarrow> B\<rbrakk> \<Longrightarrow> {j. j \<le> Suc (n + m)} = {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m))
[PROOF STEP]
apply (simp add:Nset_nset[of n m])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in monoid_add) length_concat:
  "length (concat xss) = sum_list (map length xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (concat xss) = sum_list (map length xss)
[PROOF STEP]
by (induct xss) simp_all


[STATEMENT]
lemma tendsto_0_le:
  "(f \<longlongrightarrow> 0) F \<Longrightarrow> eventually (\<lambda>x. norm (g x) \<le> norm (f x) * K) F \<Longrightarrow> (g \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> (0::'b)) F; \<forall>\<^sub>F x in F. norm (g x) \<le> norm (f x) * K\<rbrakk> \<Longrightarrow> (g \<longlongrightarrow> (0::'c)) F
[PROOF STEP]
by (simp add: Zfun_imp_Zfun tendsto_Zfun_iff)


[STATEMENT]
lemma "- (65745::real) = -65745"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 65745 = - 65745
[PROOF STEP]
by simp


[STATEMENT]
lemma NSCLIM_NSCRLIM_iff: "f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S L \<longleftrightarrow> (\<lambda>y. cmod (f y - L)) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S L = (\<lambda>y. cmod (f y - L)) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S 0
[PROOF STEP]
by (simp add: NSLIM_def starfun_norm
      approx_approx_zero_iff [symmetric] approx_minus_iff [symmetric])


[STATEMENT]
lemma moebius_dilatation_comp [simp]:
  assumes "a1 > 0" and "a2 > 0"
  shows "moebius_comp (moebius_dilatation a1) (moebius_dilatation a2) = moebius_dilatation (a1 * a2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_comp (moebius_dilatation a1) (moebius_dilatation a2) = moebius_dilatation (a1 * a2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a1
0 < a2

goal (1 subgoal):
 1. moebius_comp (moebius_dilatation a1) (moebius_dilatation a2) = moebius_dilatation (a1 * a2)
[PROOF STEP]
unfolding moebius_dilatation_def
[PROOF STATE]
proof (prove)
using this:
0 < a1
0 < a2

goal (1 subgoal):
 1. moebius_comp (moebius_similarity (cor a1) 0) (moebius_similarity (cor a2) 0) = moebius_similarity (cor (a1 * a2)) 0
[PROOF STEP]
by simp


[STATEMENT]
lemma max_list_Cons: "max_list (x#xs) = (if xs = [] then x else max x (max_list xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Missing_Lemmas.max_list (x # xs) = (if xs = [] then x else max x (Missing_Lemmas.max_list xs))
[PROOF STEP]
by (cases xs, auto)


[STATEMENT]
lemma [code_abbrev]:
 "(of_rat (- 1) :: real) = - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (- 1) = - 1
[PROOF STEP]
by simp


[STATEMENT]
lemma qbs_prob_integral_indep2:
  assumes "qbs_integrable q g"
  shows "(\<integral>\<^sub>Q z. g (snd z) \<partial>(p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)) = (\<integral>\<^sub>Q y. g y \<partial>q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sub>Q z. g (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_integral q g
[PROOF STEP]
using qbs_prob_integral_Fubini_fst[OF qbs_integrable_indep2[OF assms],of p]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sub>Q x. \<integral>\<^sub>Q y. g (snd (x, y)) \<partial>q \<partial>p = \<integral>\<^sub>Q z. g (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q

goal (1 subgoal):
 1. \<integral>\<^sub>Q z. g (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_integral q g
[PROOF STEP]
by(simp add: qbs_prob_integral_const)


[STATEMENT]
lemma aux: "prod id A * (- 1) ^ card E * a ^ card A * (- 1) ^ card E = prod id A * a ^ card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id A * (- 1) ^ card E * a ^ card A * (- 1) ^ card E = prod id A * a ^ card A
[PROOF STEP]
by auto


[STATEMENT]
lemma Suc_less_pred_conv: "(Suc m < n) = (m < n - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc m < n) = (m < n - Suc 0)
[PROOF STEP]
by (safe, simp_all)


[STATEMENT]
lemma finite_all_edges_between:
  assumes "finite X" "finite Y"
  shows "finite (all_edges_between X Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (all_edges_between X Y)
[PROOF STEP]
by (meson all_edges_between_subset assms finite_cartesian_product finite_subset)


[STATEMENT]
lemma Gmult_distrib_left :
  "\<lbrakk> g \<in> G; v \<in> V; v' \<in> V \<rbrakk> \<Longrightarrow> g *\<cdot> (v + v') = g *\<cdot> v + g *\<cdot> v'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> G; v \<in> V; v' \<in> V\<rbrakk> \<Longrightarrow> g *\<cdot> (v + v') = g *\<cdot> v + g *\<cdot> v'
[PROOF STEP]
using GmultD FG_fddg_closed
[PROOF STATE]
proof (prove)
using this:
?g *\<cdot> ?v = ((1::'f) \<delta>\<delta> ?g) \<cdot> ?v
?g \<in> G \<Longrightarrow> ?a \<delta>\<delta> ?g \<in> FG

goal (1 subgoal):
 1. \<lbrakk>g \<in> G; v \<in> V; v' \<in> V\<rbrakk> \<Longrightarrow> g *\<cdot> (v + v') = g *\<cdot> v + g *\<cdot> v'
[PROOF STEP]
by simp


[STATEMENT]
lemma Qp_p_nat_int_pow_pow:
  fixes n::nat
  fixes m::int
  shows "(\<pp> [^] (n*m)) = ((\<pp>[^]n)[^]m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pp> [^] (int n * m) = (\<pp> [^] n) [^] m
[PROOF STEP]
by (simp add: Qp_nat_int_pow_pow p_nonzero)


[STATEMENT]
lemma "(\<not> x < y) = (y \<le> (x::real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> x < y) = (y \<le> x)
[PROOF STEP]
by arith


[STATEMENT]
lemma enn2real_mult: "enn2real (a * b) = enn2real a * enn2real b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2real (a * b) = enn2real a * enn2real b
[PROOF STEP]
unfolding enn2real_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_ereal (enn2ereal (a * b)) = real_of_ereal (enn2ereal a) * real_of_ereal (enn2ereal b)
[PROOF STEP]
by (simp del: real_of_ereal_enn2ereal add: times_ennreal.rep_eq)


[STATEMENT]
lemma connected_space_connected_component_set:
   "connected_space X \<longleftrightarrow> (\<forall>x \<in> topspace X. connected_component_of_set X x = topspace X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected_space X = (\<forall>x\<in>topspace X. connected_component_of_set X x = topspace X)
[PROOF STEP]
using connected_component_of_subset_topspace connected_space_iff_connected_component
[PROOF STATE]
proof (prove)
using this:
connected_component_of_set ?X ?x \<subseteq> topspace ?X
connected_space ?X = (\<forall>x\<in>topspace ?X. \<forall>y\<in>topspace ?X. connected_component_of ?X x y)

goal (1 subgoal):
 1. connected_space X = (\<forall>x\<in>topspace X. connected_component_of_set X x = topspace X)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma word_mult_less_dest:
  fixes i :: "'a :: len word"
  assumes ij: "i * k < j * k"
  and    uik: "unat i * unat k < 2 ^ len_of TYPE ('a)"
  and    ujk: "unat j * unat k < 2 ^ len_of TYPE ('a)"
  shows  "i < j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < j
[PROOF STEP]
using uik ujk ij
[PROOF STATE]
proof (prove)
using this:
unat i * unat k < 2 ^ LENGTH('a)
unat j * unat k < 2 ^ LENGTH('a)
i * k < j * k

goal (1 subgoal):
 1. i < j
[PROOF STEP]
by (auto simp: word_less_nat_alt iffD1 [OF unat_mult_lem] elim: mult_less_mono1)


[STATEMENT]
lemma affine_imp_polyhedron:
  fixes S :: "'a :: euclidean_space set"
  shows "affine S \<Longrightarrow> polyhedron S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine S \<Longrightarrow> polyhedron S
[PROOF STEP]
by (metis affine_hull_eq polyhedron_Inter polyhedron_hyperplane affine_hull_finite_intersection_hyperplanes [of S])


[STATEMENT]
lemma repeat_mset_distrib2[simp]:
  "repeat_mset n (A + B) = repeat_mset n A + repeat_mset n B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. repeat_mset n (A + B) = repeat_mset n A + repeat_mset n B
[PROOF STEP]
by (auto simp: multiset_eq_iff add_mult_distrib2)


[STATEMENT]
lemma coeff_eq_zero_iff: "MPoly_Type.coeff c p = 0 \<longleftrightarrow> p \<notin> monomials c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MPoly_Type.coeff c p = (0::'a)) = (p \<notin> monomials c)
[PROOF STEP]
by transfer (simp add: not_in_keys_iff_lookup_eq_zero)


[STATEMENT]
lemma LE[import_const "<=" : less_eq]:
  "(\<forall>m :: nat. m \<le> (id 0) = (m = id 0)) \<and> (\<forall>m n. m \<le> (Suc n) = (m = Suc n \<or> m \<le> n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>m. (m \<le> id 0) = (m = id 0)) \<and> (\<forall>m n. (m \<le> Suc n) = (m = Suc n \<or> m \<le> n))
[PROOF STEP]
by auto


[STATEMENT]
lemma mod_ring_inverse64: "(mod_ring_rel64 ===> mod_ring_rel64) (inverse_p64 pp) inverse"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mod_ring_rel64 ===> mod_ring_rel64) (inverse_p64 pp) inverse
[PROOF STEP]
using urel64_inverse[OF *] mod_ring_inverse
[PROOF STATE]
proof (prove)
using this:
urel64 ?x ?x' \<Longrightarrow> urel64 (inverse_p64 pp ?x) (inverse_p p ?x')
(mod_ring_rel ===> mod_ring_rel) (inverse_p p) inverse

goal (1 subgoal):
 1. (mod_ring_rel64 ===> mod_ring_rel64) (inverse_p64 pp) inverse
[PROOF STEP]
unfolding mod_ring_rel64_def[OF *] rel_fun_def
[PROOF STATE]
proof (prove)
using this:
urel64 ?x ?x' \<Longrightarrow> urel64 (inverse_p64 pp ?x) (inverse_p p ?x')
\<forall>x y. mod_ring_rel x y \<longrightarrow> mod_ring_rel (inverse_p p x) (inverse y)

goal (1 subgoal):
 1. \<forall>x y. (\<exists>z. urel64 x z \<and> mod_ring_rel z y) \<longrightarrow> (\<exists>z. urel64 (inverse_p64 pp x) z \<and> mod_ring_rel z (inverse y))
[PROOF STEP]
by blast


[STATEMENT]
lemma poincare_distance_I:
  assumes "u \<in> unit_disc" and "v \<in> unit_disc" and "u \<noteq> v" and "ideal_points (poincare_line u v) = {i1, i2}"
  shows "poincare_distance u v = calc_poincare_distance u i1 v i2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance u v = calc_poincare_distance u i1 v i2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
u \<noteq> v
ideal_points (poincare_line u v) = {i1, i2}

goal (1 subgoal):
 1. poincare_distance u v = calc_poincare_distance u i1 v i2
[PROOF STEP]
using poincare_distance_satisfies_pred[OF assms(1-2)]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
u \<noteq> v
ideal_points (poincare_line u v) = {i1, i2}
poincare_distance_pred u v (poincare_distance u v)

goal (1 subgoal):
 1. poincare_distance u v = calc_poincare_distance u i1 v i2
[PROOF STEP]
by simp


[STATEMENT]
lemma finite_UNIV_finfun:
  "finite (UNIV :: ('a \<Rightarrow>f 'b) set) \<longleftrightarrow>
  (finite (UNIV :: 'a set) \<and> finite (UNIV :: 'b set) \<or> CARD('b) = 1)"
  (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
have "?lhs \<longleftrightarrow> CARD('a \<Rightarrow>f 'b) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV = (0 < CARD('a \<Rightarrow>f 'b))
[PROOF STEP]
by(simp add: card_gt_0_iff)
[PROOF STATE]
proof (state)
this:
finite UNIV = (0 < CARD('a \<Rightarrow>f 'b))

goal (1 subgoal):
 1. finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finite UNIV = (0 < CARD('a \<Rightarrow>f 'b))

goal (1 subgoal):
 1. finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> CARD('a) > 0 \<and> CARD('b) > 0 \<or> CARD('b) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < CARD('a \<Rightarrow>f 'b)) = (0 < CARD('a) \<and> 0 < CARD('b) \<or> CARD('b) = 1)
[PROOF STEP]
by(simp add: card_UNIV_finfun)
[PROOF STATE]
proof (state)
this:
(0 < CARD('a \<Rightarrow>f 'b)) = (0 < CARD('a) \<and> 0 < CARD('b) \<or> CARD('b) = 1)

goal (1 subgoal):
 1. finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0 < CARD('a \<Rightarrow>f 'b)) = (0 < CARD('a) \<and> 0 < CARD('b) \<or> CARD('b) = 1)

goal (1 subgoal):
 1. finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < CARD('a) \<and> 0 < CARD('b) \<or> CARD('b) = 1) = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
by(simp add: card_gt_0_iff)
[PROOF STATE]
proof (state)
this:
(0 < CARD('a) \<and> 0 < CARD('b) \<or> CARD('b) = 1) = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)

goal (1 subgoal):
 1. finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)

goal (1 subgoal):
 1. finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite UNIV = (finite UNIV \<and> finite UNIV \<or> CARD('b) = 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennreal_of_enat_eSuc[simp]: "ennreal_of_enat (eSuc x) = 1 + ennreal_of_enat x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal_of_enat (eSuc x) = 1 + ennreal_of_enat x
[PROOF STEP]
by (cases x) (auto simp: eSuc_enat)


[STATEMENT]
lemma bounded_linear_mult_left: "bounded_linear (\<lambda>x::'a::real_normed_algebra. x * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear (\<lambda>x. x * y)
[PROOF STEP]
using bounded_bilinear_mult
[PROOF STATE]
proof (prove)
using this:
bounded_bilinear (*)

goal (1 subgoal):
 1. bounded_linear (\<lambda>x. x * y)
[PROOF STEP]
by (rule bounded_bilinear.bounded_linear_left)


[STATEMENT]
lemma Nats_subset_Rats: "\<nat> \<subseteq> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nat> \<subseteq> \<rat>
[PROOF STEP]
using Ints_subset_Rats Nats_subset_Ints
[PROOF STATE]
proof (prove)
using this:
\<int> \<subseteq> \<rat>
\<nat> \<subseteq> \<int>

goal (1 subgoal):
 1. \<nat> \<subseteq> \<rat>
[PROOF STEP]
by blast


[STATEMENT]
lemma LLL_inv_wI: assumes
  "set fs \<subseteq> carrier_vec n"
  "length fs = m"
  "lattice_of fs = L"
  "lin_indep fs"
shows "LLL_invariant_weak fs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LLL_invariant_weak fs
[PROOF STEP]
unfolding LLL_invariant_weak_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gs.lin_indpt_list (map of_int_hom.vec_hom fs) \<and> lattice_of fs = L \<and> length fs = m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set fs \<subseteq> carrier_vec n
length fs = m
lattice_of fs = L
gs.lin_indpt_list (map of_int_hom.vec_hom fs)

goal (1 subgoal):
 1. gs.lin_indpt_list (map of_int_hom.vec_hom fs) \<and> lattice_of fs = L \<and> length fs = m
[PROOF STEP]
by auto


[STATEMENT]
lemma ballpI: "(\<And>x y. (x, y) \<in> A \<Longrightarrow> P x y) \<Longrightarrow> \<forall>(x, y) \<in> A. P x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. (x, y) \<in> A \<Longrightarrow> P x y) \<Longrightarrow> \<forall>(x, y)\<in>A. P x y
[PROOF STEP]
by blast


[STATEMENT]
lemma in_closed_segment_iff_line: "x \<in> {a -- b} \<longleftrightarrow> (\<exists>c\<in>{0..1}. x = line a b c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> {a--b}) = (\<exists>c\<in>{0..1}. x = {a -- b}\<^bsub>c\<^esub>)
[PROOF STEP]
by (auto simp: in_segment line_def algebra_simps)


[STATEMENT]
lemma d_delta_arctan_upper_14_neg: "diff_delta_arctan_upper_14 x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diff_delta_arctan_upper_14 x < 0
[PROOF STEP]
unfolding diff_delta_arctan_upper_14_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 4 / ((1 + 3 * x\<^sup>2)\<^sup>2 * (1 + x\<^sup>2)) < 0
[PROOF STEP]
apply (auto simp: divide_simps add_nonneg_eq_0_iff zero_less_mult_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 + x\<^sup>2
[PROOF STEP]
using power2_less_0 [of x]
[PROOF STATE]
proof (prove)
using this:
\<not> x\<^sup>2 < 0

goal (1 subgoal):
 1. 0 < 1 + x\<^sup>2
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in prob_space) indep_varsD:
  assumes X: "indep_vars M' X I"
  assumes I: "J \<noteq> {}" "finite J" "J \<subseteq> I" "\<And>i. i \<in> J \<Longrightarrow> A i \<in> sets (M' i)"
  shows "prob (\<Inter>i\<in>J. X i -` A i \<inter> space M) = (\<Prod>i\<in>J. prob (X i -` A i \<inter> space M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (\<Inter>i\<in>J. X i -` A i \<inter> space M) = (\<Prod>i\<in>J. prob (X i -` A i \<inter> space M))
[PROOF STEP]
proof (rule indep_setsD)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. indep_sets ?F ?I
 2. J \<subseteq> ?I
 3. J \<noteq> {}
 4. finite J
 5. \<forall>i\<in>J. X i -` A i \<inter> space M \<in> ?F i
[PROOF STEP]
show "indep_sets (\<lambda>i. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets (\<lambda>i. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) I
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
indep_vars M' X I

goal (1 subgoal):
 1. indep_sets (\<lambda>i. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) I
[PROOF STEP]
by (auto simp: indep_vars_def)
[PROOF STATE]
proof (state)
this:
indep_sets (\<lambda>i. sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) I

goal (4 subgoals):
 1. J \<subseteq> I
 2. J \<noteq> {}
 3. finite J
 4. \<forall>i\<in>J. X i -` A i \<inter> space M \<in> sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}
[PROOF STEP]
show "\<forall>i\<in>J. X i -` A i \<inter> space M \<in> sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>J. X i -` A i \<inter> space M \<in> sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}
[PROOF STEP]
using I
[PROOF STATE]
proof (prove)
using this:
J \<noteq> {}
finite J
J \<subseteq> I
?i8 \<in> J \<Longrightarrow> A ?i8 \<in> sets (M' ?i8)

goal (1 subgoal):
 1. \<forall>i\<in>J. X i -` A i \<inter> space M \<in> sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>J. X i -` A i \<inter> space M \<in> sigma_sets (space M) {X i -` A \<inter> space M |A. A \<in> sets (M' i)}

goal (3 subgoals):
 1. J \<subseteq> I
 2. J \<noteq> {}
 3. finite J
[PROOF STEP]
qed fact+


[STATEMENT]
lemma parts_list_set (*[simp]*):
  "parts (L`ls) =  (L`ls) \<union> (\<Union>l \<in> ls. parts (set l)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parts (L ` ls) = L ` ls \<union> (\<Union>l\<in>ls. parts (set l))
[PROOF STEP]
apply (rule equalityI, rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> parts (L ` ls) \<Longrightarrow> x \<in> L ` ls \<union> (\<Union>l\<in>ls. parts (set l))
 2. L ` ls \<union> (\<Union>l\<in>ls. parts (set l)) \<subseteq> parts (L ` ls)
[PROOF STEP]
apply (erule parts.induct, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x l. \<lbrakk>l \<in> ls; x \<in> parts (set l)\<rbrakk> \<Longrightarrow> x \<in> parts (L ` ls)
[PROOF STEP]
by (meson L_parts image_subset_iff parts_increasing parts_trans)


[STATEMENT]
lemma ltl_ltake: "ltl (ltake n xs) = ltake (epred n) (ltl xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltl (ltake n xs) = ltake (epred n) (ltl xs)
[PROOF STEP]
by(cases n xs rule: enat_coexhaust[case_product llist.exhaust]) simp_all