[STATEMENT]
lemma carry_digit_impl: "bin_carry a b k \<noteq> 0 \<Longrightarrow> \<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_carry a b k \<noteq> 0 \<Longrightarrow> \<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)

goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence bound: "\<forall>r<k. a \<exclamdown> r + b \<exclamdown> r \<le> 1"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)

goal (1 subgoal):
 1. \<forall>r<k. a \<exclamdown> r + b \<exclamdown> r \<le> 1
[PROOF STEP]
using nth_bit_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2

goal (1 subgoal):
 1. \<forall>r<k. a \<exclamdown> r + b \<exclamdown> r \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>r<k. a \<exclamdown> r + b \<exclamdown> r \<le> 1

goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume bk:"bin_carry a b k \<noteq> 0"
[PROOF STATE]
proof (state)
this:
bin_carry a b k \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence base: "bin_carry a b k = 1"
[PROOF STATE]
proof (prove)
using this:
bin_carry a b k \<noteq> 0

goal (1 subgoal):
 1. bin_carry a b k = 1
[PROOF STEP]
using carry_bounded le_less[of "bin_carry a b k" 1]
[PROOF STATE]
proof (prove)
using this:
bin_carry a b k \<noteq> 0
bin_carry ?a ?b ?k \<le> 1
(bin_carry a b k \<le> 1) = (bin_carry a b k < 1 \<or> bin_carry a b k = 1)

goal (1 subgoal):
 1. bin_carry a b k = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bin_carry a b k = 1

goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have step: "i \<le> k \<Longrightarrow> bin_carry a b i = 1 \<Longrightarrow> bin_carry a b (i - 1) = 1" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> k; bin_carry a b i = 1\<rbrakk> \<Longrightarrow> bin_carry a b (i - 1) = 1
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>i \<le> k; bin_carry a b i = 1; bin_carry a b (i - 1) \<noteq> 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume ik: "i \<le> k"
[PROOF STATE]
proof (state)
this:
i \<le> k

goal (1 subgoal):
 1. \<lbrakk>i \<le> k; bin_carry a b i = 1; bin_carry a b (i - 1) \<noteq> 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume carry: "bin_carry a b i = 1"
[PROOF STATE]
proof (state)
this:
bin_carry a b i = 1

goal (1 subgoal):
 1. \<lbrakk>i \<le> k; bin_carry a b i = 1; bin_carry a b (i - 1) \<noteq> 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "bin_carry a b (i- 1) \<noteq> 1"
[PROOF STATE]
proof (state)
this:
bin_carry a b (i - 1) \<noteq> 1

goal (1 subgoal):
 1. \<lbrakk>i \<le> k; bin_carry a b i = 1; bin_carry a b (i - 1) \<noteq> 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "bin_carry a b (i - 1) = 0"
[PROOF STATE]
proof (prove)
using this:
bin_carry a b (i - 1) \<noteq> 1

goal (1 subgoal):
 1. bin_carry a b (i - 1) = 0
[PROOF STEP]
using bin_carry_bounded not_mod_2_eq_1_eq_0[of "bin_carry a b (i - 1)"]
[PROOF STATE]
proof (prove)
using this:
bin_carry a b (i - 1) \<noteq> 1
bin_carry ?a ?b ?k = bin_carry ?a ?b ?k mod 2
(bin_carry a b (i - 1) mod 2 \<noteq> 1) = (bin_carry a b (i - 1) mod 2 = 0)

goal (1 subgoal):
 1. bin_carry a b (i - 1) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bin_carry a b (i - 1) = 0

goal (1 subgoal):
 1. \<lbrakk>i \<le> k; bin_carry a b i = 1; bin_carry a b (i - 1) \<noteq> 1\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bin_carry a b (i - 1) = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
bin_carry a b (i - 1) = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using ik carry bound sum_carry_formula[of a b "i-1"]
[PROOF STATE]
proof (prove)
using this:
bin_carry a b (i - 1) = 0
i \<le> k
bin_carry a b i = 1
\<forall>r<k. a \<exclamdown> r + b \<exclamdown> r \<le> 1
bin_carry a b (i - 1 + 1) = (a \<exclamdown> (i - 1) + b \<exclamdown> (i - 1) + bin_carry a b (i - 1)) div 2

goal (1 subgoal):
 1. False
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bin_carry a b (i - Suc 0) = 0; i \<le> k; bin_carry a b i = Suc 0; \<forall>r<k. a \<exclamdown> r + b \<exclamdown> r \<le> Suc 0; bin_carry a b (Suc (i - Suc 0)) = (a \<exclamdown> (i - Suc 0) + b \<exclamdown> (i - Suc 0)) div 2\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis Suc_eq_plus1 Suc_pred add_lessD1 bot_nat_0.not_eq_extremum carry diff_is_0_eq' div_le_mono le_eq_less_or_eq less_add_one one_div_two_eq_zero)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i \<le> k; bin_carry a b ?i = 1\<rbrakk> \<Longrightarrow> bin_carry a b (?i - 1) = 1

goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "\<forall>i\<le>k. bin_carry a b i = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<le>k. bin_carry a b i = 1
[PROOF STEP]
using rev_induct[where ?P="\<lambda>c.(bin_carry a b c = 1)"] step base
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i \<le> ?k; bin_carry a b ?k = 1; \<And>i. \<lbrakk>i \<le> ?k; bin_carry a b i = 1\<rbrakk> \<Longrightarrow> bin_carry a b (i - 1) = 1\<rbrakk> \<Longrightarrow> bin_carry a b ?i = 1
\<lbrakk>?i \<le> k; bin_carry a b ?i = 1\<rbrakk> \<Longrightarrow> bin_carry a b (?i - 1) = 1
bin_carry a b k = 1

goal (1 subgoal):
 1. \<forall>i\<le>k. bin_carry a b i = 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>k. bin_carry a b i = 1

goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>k. bin_carry a b i = 1

goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "bin_carry a b 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_carry a b 0 = 0
[PROOF STEP]
using bin_carry_def
[PROOF STATE]
proof (prove)
using this:
bin_carry ?a ?b ?k = (?a mod 2 ^ ?k + ?b mod 2 ^ ?k) div 2 ^ ?k

goal (1 subgoal):
 1. bin_carry a b 0 = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bin_carry a b 0 = 0

goal (1 subgoal):
 1. \<lbrakk>bin_carry a b k \<noteq> 0; \<not> (\<exists>r<k. a \<exclamdown> r + b \<exclamdown> r = 2)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>i\<le>k. bin_carry a b i = 1
bin_carry a b 0 = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<le>k. bin_carry a b i = 1
bin_carry a b 0 = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fv_fo_fmla_list_exists: "fv_fo_fmla_list (Exists n \<phi>) = filter ((\<noteq>) n) (fv_fo_fmla_list \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv_fo_fmla_list (Exists n \<phi>) = filter ((\<noteq>) n) (fv_fo_fmla_list \<phi>)
[PROOF STEP]
by (auto simp: fv_fo_fmla_list_def)
     (metis (mono_tags, lifting) distinct_filter distinct_remdups_adj_sort
      distinct_remdups_id filter_set filter_sort remdups_adj_set sorted_list_of_set_sort_remdups
      sorted_remdups_adj sorted_sort sorted_sort_id)


[STATEMENT]
lemma perm_vars_inv_nth:
  assumes "perm_vars n vs"
      and "i < n"
    shows "perm_vars_inv n vs (vs ! i) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perm_vars_inv n vs (vs ! i) = i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
perm_vars n vs
i < n

goal (1 subgoal):
 1. perm_vars_inv n vs (vs ! i) = i
[PROOF STEP]
by (auto intro: the_inv_into_f_f perm_vars_inj_on_nth)


[STATEMENT]
lemma add_neg_pos_is_real: "a < 0 \<Longrightarrow> b > 0 \<Longrightarrow> is_real (a + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < (0::'a); (0::'a) < b\<rbrakk> \<Longrightarrow> is_real (a + b)
[PROOF STEP]
using add_pos_neg_is_real[of b a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(0::'a) < b; a < (0::'a)\<rbrakk> \<Longrightarrow> is_real (b + a)

goal (1 subgoal):
 1. \<lbrakk>a < (0::'a); (0::'a) < b\<rbrakk> \<Longrightarrow> is_real (a + b)
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma Qp_poly_Qp_x_eval:
  assumes "P \<in> carrier (Q\<^sub>p[\<X>\<^bsub>1\<^esub>])"
  assumes "a \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)"
  shows "Qp_ev P a = (to_Qp_x P)\<bullet>(Qp.to_R a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
have 0: "(IP_to_UP 0 P) \<bullet> (a ! 0) = ((IP_to_UP 0 P) \<bullet> (if 0 < length a then a ! 0 else \<zero>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IP_to_UP 0 P \<bullet> a ! 0 = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier (Q\<^sub>p [\<X>\<^bsub>1\<^esub>])
a \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)

goal (1 subgoal):
 1. IP_to_UP 0 P \<bullet> a ! 0 = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)
[PROOF STEP]
by (metis (mono_tags, lifting) cartesian_power_car_memE gr0I zero_neq_one)
[PROOF STATE]
proof (state)
this:
IP_to_UP 0 P \<bullet> a ! 0 = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)

goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
have 1: "closed_fun Q\<^sub>p (\<lambda>n. if n < length a then a ! n else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n < length a then a ! n else \<zero>) \<in> UNIV \<rightarrow> carrier Q\<^sub>p
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> (if x < length a then a ! x else \<zero>) \<in> carrier Q\<^sub>p
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> (if x < length a then a ! x else \<zero>) \<in> carrier Q\<^sub>p
[PROOF STEP]
show "(if n < length a then a ! n else \<zero>) \<in> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if n < length a then a ! n else \<zero>) \<in> carrier Q\<^sub>p
[PROOF STEP]
apply(cases "n < length a")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. n < length a \<Longrightarrow> (if n < length a then a ! n else \<zero>) \<in> carrier Q\<^sub>p
 2. \<not> n < length a \<Longrightarrow> (if n < length a then a ! n else \<zero>) \<in> carrier Q\<^sub>p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier (Q\<^sub>p [\<X>\<^bsub>1\<^esub>])
a \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)

goal (2 subgoals):
 1. n < length a \<Longrightarrow> (if n < length a then a ! n else \<zero>) \<in> carrier Q\<^sub>p
 2. \<not> n < length a \<Longrightarrow> (if n < length a then a ! n else \<zero>) \<in> carrier Q\<^sub>p
[PROOF STEP]
apply (metis cartesian_power_car_memE cartesian_power_car_memE')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> n < length a \<Longrightarrow> (if n < length a then a ! n else \<zero>) \<in> carrier Q\<^sub>p
[PROOF STEP]
by (meson Qp.cring_axioms cring.cring_simprules(2))
[PROOF STATE]
proof (state)
this:
(if n < length a then a ! n else \<zero>) \<in> carrier Q\<^sub>p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n < length a then a ! n else \<zero>) \<in> UNIV \<rightarrow> carrier Q\<^sub>p

goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
have 2: " P \<in> Pring_set Q\<^sub>p {0::nat}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> Qp.indexed_pset {0} (carrier Q\<^sub>p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier (Q\<^sub>p [\<X>\<^bsub>1\<^esub>])
a \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)

goal (1 subgoal):
 1. P \<in> Qp.indexed_pset {0} (carrier Q\<^sub>p)
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
using this:
P \<in> carrier (Pring Q\<^sub>p {..<1})
a \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)

goal (1 subgoal):
 1. P \<in> Qp.indexed_pset {0} (carrier Q\<^sub>p)
[PROOF STEP]
by (metis Qp.Pring_car UPQ.UP_to_IP_closed assms(1) to_Qp_x_closed to_Qp_x_from_Qp_x)
[PROOF STATE]
proof (state)
this:
P \<in> Qp.indexed_pset {0} (carrier Q\<^sub>p)

goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
have 3: "total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)
[PROOF STEP]
using 1 2 assms IP_to_UP_poly_eval[of P "0::nat" "(\<lambda>i. if i < length a then a ! i else \<zero>)" ]
          UPQ.to_fun_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. if n < length a then a ! n else \<zero>) \<in> UNIV \<rightarrow> carrier Q\<^sub>p
P \<in> Qp.indexed_pset {0} (carrier Q\<^sub>p)
P \<in> carrier (Q\<^sub>p [\<X>\<^bsub>1\<^esub>])
a \<in> carrier (Q\<^sub>p\<^bsup>1\<^esup>)
\<lbrakk>P \<in> Qp.indexed_pset {0} (carrier Q\<^sub>p); (\<lambda>i. if i < length a then a ! i else \<zero>) \<in> UNIV \<rightarrow> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = to_function Q\<^sub>p (IP_to_UP 0 P) (if 0 < length a then a ! 0 else \<zero>)
(\<bullet>) ?f \<equiv> to_function Q\<^sub>p ?f

goal (1 subgoal):
 1. total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)

goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)

goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)
IP_to_UP 0 P \<bullet> a ! 0 = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)

goal (1 subgoal):
 1. eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
unfolding eval_at_point_def
[PROOF STATE]
proof (prove)
using this:
total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)
IP_to_UP 0 P \<bullet> a ! 0 = IP_to_UP 0 P \<bullet> (if 0 < length a then a ! 0 else \<zero>)

goal (1 subgoal):
 1. total_eval Q\<^sub>p (\<lambda>i. if i < length a then a ! i else \<zero>) P = IP_to_UP 0 P \<bullet> a ! 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
eval_at_point Q\<^sub>p a P = IP_to_UP 0 P \<bullet> a ! 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sym_mod_diff_right_eq: "(a - b symmod c) symmod c = (a - b) symmod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b symmod c) symmod c = (a - b) symmod c
[PROOF STEP]
using sym_mod_diff_eq
[PROOF STATE]
proof (prove)
using this:
(?a symmod ?c - ?b symmod ?c) symmod ?c = (?a - ?b) symmod ?c

goal (1 subgoal):
 1. (a - b symmod c) symmod c = (a - b) symmod c
[PROOF STEP]
by (metis sym_mod_sym_mod)


[STATEMENT]
lemma tuple_encode_decode [simp]:
  "tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
proof (induction "length xs - 1" arbitrary: xs i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs i. 0 = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
 2. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = length xs - 1

goal (2 subgoals):
 1. \<And>xs i. 0 = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
 2. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = length xs - 1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 = length xs - 1

goal (1 subgoal):
 1. tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1
[PROOF STEP]
have "length xs - 1 > 0"
[PROOF STATE]
proof (prove)
using this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1

goal (1 subgoal):
 1. 0 < length xs - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < length xs - 1

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
with Suc
[PROOF STATE]
proof (chain)
picking this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1
0 < length xs - 1
[PROOF STEP]
have *: "tuple_encode n (tuple_decode n j) = j" for j
[PROOF STATE]
proof (prove)
using this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1
0 < length xs - 1

goal (1 subgoal):
 1. tuple_encode n (tuple_decode n j) = j
[PROOF STEP]
by (metis diff_Suc_1 length_tl)
[PROOF STATE]
proof (state)
this:
tuple_encode n (tuple_decode n ?j) = ?j

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1
[PROOF STEP]
have "tuple_decode (Suc n) i = pdec1 i # tuple_decode n (pdec2 i)"
[PROOF STATE]
proof (prove)
using this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1

goal (1 subgoal):
 1. tuple_decode (Suc n) i = pdec1 i # tuple_decode n (pdec2 i)
[PROOF STEP]
using tuple_decode.simps(2)
[PROOF STATE]
proof (prove)
using this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1
tuple_decode (Suc ?n) ?i = pdec1 ?i # tuple_decode ?n (pdec2 ?i)

goal (1 subgoal):
 1. tuple_decode (Suc n) i = pdec1 i # tuple_decode n (pdec2 i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
tuple_decode (Suc n) i = pdec1 i # tuple_decode n (pdec2 i)

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
tuple_decode (Suc n) i = pdec1 i # tuple_decode n (pdec2 i)
[PROOF STEP]
have "tuple_encode (Suc n) (tuple_decode (Suc n) i) =
      tuple_encode (Suc n) (pdec1 i # tuple_decode n (pdec2 i))"
[PROOF STATE]
proof (prove)
using this:
tuple_decode (Suc n) i = pdec1 i # tuple_decode n (pdec2 i)

goal (1 subgoal):
 1. tuple_encode (Suc n) (tuple_decode (Suc n) i) = tuple_encode (Suc n) (pdec1 i # tuple_decode n (pdec2 i))
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
tuple_decode (Suc n) i = pdec1 i # tuple_decode n (pdec2 i)
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1

goal (1 subgoal):
 1. tuple_encode (Suc n) (tuple_decode (Suc n) i) = tuple_encode (Suc n) (pdec1 i # tuple_decode n (pdec2 i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
tuple_encode (Suc n) (tuple_decode (Suc n) i) = tuple_encode (Suc n) (pdec1 i # tuple_decode n (pdec2 i))

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
tuple_encode (Suc n) (tuple_decode (Suc n) i) = tuple_encode (Suc n) (pdec1 i # tuple_decode n (pdec2 i))

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
have "... = prod_encode (pdec1 i, tuple_encode n (tuple_decode n (pdec2 i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tuple_encode (Suc n) (pdec1 i # tuple_decode n (pdec2 i)) = prod_encode (pdec1 i, tuple_encode n (tuple_decode n (pdec2 i)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
tuple_encode (Suc n) (pdec1 i # tuple_decode n (pdec2 i)) = prod_encode (pdec1 i, tuple_encode n (tuple_decode n (pdec2 i)))

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
tuple_encode (Suc n) (pdec1 i # tuple_decode n (pdec2 i)) = prod_encode (pdec1 i, tuple_encode n (tuple_decode n (pdec2 i)))

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
have "... = prod_encode (pdec1 i, pdec2 i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_encode (pdec1 i, tuple_encode n (tuple_decode n (pdec2 i))) = prod_encode (pdec1 i, pdec2 i)
[PROOF STEP]
using Suc *
[PROOF STATE]
proof (prove)
using this:
n = length ?xs - 1 \<Longrightarrow> tuple_encode (length ?xs - 1) (tuple_decode (length ?xs - 1) ?i) = ?i
Suc n = length xs - 1
tuple_encode n (tuple_decode n ?j) = ?j

goal (1 subgoal):
 1. prod_encode (pdec1 i, tuple_encode n (tuple_decode n (pdec2 i))) = prod_encode (pdec1 i, pdec2 i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_encode (pdec1 i, tuple_encode n (tuple_decode n (pdec2 i))) = prod_encode (pdec1 i, pdec2 i)

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod_encode (pdec1 i, tuple_encode n (tuple_decode n (pdec2 i))) = prod_encode (pdec1 i, pdec2 i)

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
have "... = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_encode (pdec1 i, pdec2 i) = i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_encode (pdec1 i, pdec2 i) = i

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
tuple_encode (Suc n) (tuple_decode (Suc n) i) = i
[PROOF STEP]
have "tuple_encode (Suc n) (tuple_decode (Suc n) i) = i"
[PROOF STATE]
proof (prove)
using this:
tuple_encode (Suc n) (tuple_decode (Suc n) i) = i

goal (1 subgoal):
 1. tuple_encode (Suc n) (tuple_decode (Suc n) i) = i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
tuple_encode (Suc n) (tuple_decode (Suc n) i) = i

goal (1 subgoal):
 1. \<And>x xs i. \<lbrakk>\<And>xs i. x = length xs - 1 \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i; Suc x = length xs - 1\<rbrakk> \<Longrightarrow> tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
tuple_encode (Suc n) (tuple_decode (Suc n) i) = i
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
tuple_encode (Suc n) (tuple_decode (Suc n) i) = i

goal (1 subgoal):
 1. tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i
[PROOF STEP]
by (simp add: Suc.hyps(2))
[PROOF STATE]
proof (state)
this:
tuple_encode (length xs - 1) (tuple_decode (length xs - 1) i) = i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_Diff:
  assumes finite: "emeasure M B \<noteq> \<infinity>"
  and [measurable]: "A \<in> sets M" "B \<in> sets M" and "B \<subseteq> A"
  shows "emeasure M (A - B) = emeasure M A - emeasure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (A - B) = emeasure M A - emeasure M B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure M (A - B) = emeasure M A - emeasure M B
[PROOF STEP]
have "(A - B) \<union> B = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - B \<union> B = A
[PROOF STEP]
using \<open>B \<subseteq> A\<close>
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A

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

goal (1 subgoal):
 1. emeasure M (A - B) = emeasure M A - emeasure M B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A - B \<union> B = A
[PROOF STEP]
have "emeasure M A = emeasure M ((A - B) \<union> B)"
[PROOF STATE]
proof (prove)
using this:
A - B \<union> B = A

goal (1 subgoal):
 1. emeasure M A = emeasure M (A - B \<union> B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure M A = emeasure M (A - B \<union> B)

goal (1 subgoal):
 1. emeasure M (A - B) = emeasure M A - emeasure M B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M A = emeasure M (A - B \<union> B)

goal (1 subgoal):
 1. emeasure M (A - B) = emeasure M A - emeasure M B
[PROOF STEP]
have "\<dots> = emeasure M (A - B) + emeasure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (A - B \<union> B) = emeasure M (A - B) + emeasure M B
[PROOF STEP]
by (subst plus_emeasure[symmetric]) auto
[PROOF STATE]
proof (state)
this:
emeasure M (A - B \<union> B) = emeasure M (A - B) + emeasure M B

goal (1 subgoal):
 1. emeasure M (A - B) = emeasure M A - emeasure M B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M A = emeasure M (A - B) + emeasure M B
[PROOF STEP]
show "emeasure M (A - B) = emeasure M A - emeasure M B"
[PROOF STATE]
proof (prove)
using this:
emeasure M A = emeasure M (A - B) + emeasure M B

goal (1 subgoal):
 1. emeasure M (A - B) = emeasure M A - emeasure M B
[PROOF STEP]
using finite
[PROOF STATE]
proof (prove)
using this:
emeasure M A = emeasure M (A - B) + emeasure M B
emeasure M B \<noteq> \<infinity>

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subgraph_imp_subverts:
  assumes "subgraph H G"
  shows "verts H \<subseteq> verts G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. verts H \<subseteq> verts G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subgraph H G

goal (1 subgoal):
 1. verts H \<subseteq> verts G
[PROOF STEP]
by (simp add: subgraph_def)


[STATEMENT]
lemma lesss_Cons:
  "lesss R x (y # ys) =
     (if (y, x) \<in> R \<and> (x, y) \<notin> R then y # lesss R x ys else lesss R x ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lesss R x (y # ys) = (if (y, x) \<in> R \<and> (x, y) \<notin> R then y # lesss R x ys else lesss R x ys)
[PROOF STEP]
by (simp add: lesss_def)


[STATEMENT]
theorem apartments_are_coxeter:
  "A\<in>\<A> \<Longrightarrow> \<exists>S::'a permutation set. (
    CoxeterComplex S \<and>
    (\<exists>\<psi>. ChamberComplexIsomorphism A (CoxeterComplex.TheComplex S) \<psi>)
  )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> \<A> \<Longrightarrow> \<exists>S. CoxeterComplex S \<and> (\<exists>\<psi>. ChamberComplexIsomorphism A (CoxeterComplex.TheComplex S) \<psi>)
[PROOF STEP]
using no_trivial_apartments apartment_simplex_in_max[of A]
        apartment_chamberD_simplex[of A] apartment_chamber[of A]
        apartments_have_many_foldings[of A]
        ThinChamberComplexManyFoldings.ex_iso_to_coxeter_complex[of A]
[PROOF STATE]
proof (prove)
using this:
{} \<notin> \<A>
\<lbrakk>A \<in> \<A>; ?y \<in> A\<rbrakk> \<Longrightarrow> \<exists>x. SimplicialComplex.maxsimp A x \<and> ?y \<subseteq> x
\<lbrakk>A \<in> \<A>; SimplicialComplex.maxsimp A ?x\<rbrakk> \<Longrightarrow> ?x \<in> A
\<lbrakk>A \<in> \<A>; SimplicialComplex.maxsimp A ?C\<rbrakk> \<Longrightarrow> chamber ?C
\<lbrakk>A \<in> \<A>; ?C \<in> A; chamber ?C\<rbrakk> \<Longrightarrow> ThinChamberComplexManyFoldings A ?C
ThinChamberComplexManyFoldings A ?C0.0 \<Longrightarrow> \<exists>S. CoxeterComplex S \<and> (\<exists>\<psi>. ChamberComplexIsomorphism A (CoxeterComplex.TheComplex S) \<psi>)

goal (1 subgoal):
 1. A \<in> \<A> \<Longrightarrow> \<exists>S. CoxeterComplex S \<and> (\<exists>\<psi>. ChamberComplexIsomorphism A (CoxeterComplex.TheComplex S) \<psi>)
[PROOF STEP]
by    fastforce


[STATEMENT]
lemma crev: "t \<in> {1/8 .. 1/8} \<longrightarrow> (x, y) \<in> {(2, 0) .. (2, 0)} \<longrightarrow>
   t \<in> c.rev.existence_ivl0 (x, y) \<and> c.rev.flow0 (x, y) t \<in> {(5.15, -0.651)..(5.18, -0.647)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> point_ivl (1 / 8) \<longrightarrow> (x, y) \<in> point_ivl (2, 0) \<longrightarrow> t \<in> c.rev.existence_ivl0 (x, y) \<and> c.rev.flow0 (x, y) t \<in> {(515 / 10\<^sup>2, - (651 / 10 ^ 3))..(518 / 10\<^sup>2, - (647 / 10 ^ 3))}
[PROOF STEP]
by (tactic \<open>ode_bnds_tac @{thms c_fas_def} 30 20 7 12 [(0, 1, "0x000000")] (* "crev.out" *) "" @{context} 1\<close>)


[STATEMENT]
lemma open_closed_segment: "u \<in> open_segment w z \<Longrightarrow> u \<in> closed_segment w z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> open_segment w z \<Longrightarrow> u \<in> closed_segment w z
[PROOF STEP]
by (auto simp add: closed_segment_def open_segment_def)


[STATEMENT]
lemma transpose_max_length:
  "foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)"
  (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
proof (cases "transpose xs = []")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
 2. transpose xs \<noteq> [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
transpose xs \<noteq> []

goal (2 subgoals):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
 2. transpose xs \<noteq> [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
have "?L = foldr max (map length (transpose xs)) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = foldr max (map length (transpose xs)) 0
[PROOF STEP]
by (simp add: foldr_map comp_def)
[PROOF STATE]
proof (state)
this:
foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = foldr max (map length (transpose xs)) 0

goal (2 subgoals):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
 2. transpose xs \<noteq> [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = foldr max (map length (transpose xs)) 0

goal (2 subgoals):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
 2. transpose xs \<noteq> [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
have "... = length (transpose xs ! 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr max (map length (transpose xs)) 0 = length (transpose xs ! 0)
[PROOF STEP]
using False sorted_transpose
[PROOF STATE]
proof (prove)
using this:
transpose xs \<noteq> []
sorted (rev (map length (transpose ?xs)))

goal (1 subgoal):
 1. foldr max (map length (transpose xs)) 0 = length (transpose xs ! 0)
[PROOF STEP]
by (simp add: foldr_max_sorted)
[PROOF STATE]
proof (state)
this:
foldr max (map length (transpose xs)) 0 = length (transpose xs ! 0)

goal (2 subgoals):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
 2. transpose xs \<noteq> [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (transpose xs ! 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (transpose xs ! 0)

goal (1 subgoal):
 1. foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (transpose xs ! 0)
transpose xs \<noteq> []

goal (1 subgoal):
 1. foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
by (simp add: nth_transpose)
[PROOF STATE]
proof (state)
this:
foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)

goal (1 subgoal):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
transpose xs = []

goal (1 subgoal):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
hence "filter (\<lambda>x. x \<noteq> []) xs = []"
[PROOF STATE]
proof (prove)
using this:
transpose xs = []

goal (1 subgoal):
 1. filter (\<lambda>x. x \<noteq> []) xs = []
[PROOF STEP]
by (auto intro!: filter_False simp: transpose_empty)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>x. x \<noteq> []) xs = []

goal (1 subgoal):
 1. transpose xs = [] \<Longrightarrow> foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>x. x \<noteq> []) xs = []

goal (1 subgoal):
 1. foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
by (simp add: transpose_empty True)
[PROOF STATE]
proof (state)
this:
foldr (\<lambda>xs. max (length xs)) (transpose xs) 0 = length (filter (\<lambda>x. x \<noteq> []) xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filtersI [intro]:
  fixes T (structure)
  assumes a1: "{} \<notin> F"
  and a2: "\<Union>F \<subseteq> carrier"
  and a3: "\<And> A B. \<lbrakk> A \<in> F; B \<in> F \<rbrakk> \<Longrightarrow> A \<inter> B \<in> F"
  and a4: "\<And> A B. \<lbrakk> A \<in> F; A \<subseteq> B; B \<subseteq> carrier \<rbrakk> \<Longrightarrow> B \<in> F"
  shows "F \<in> Filters"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<in> Filters
[PROOF STEP]
using a1 a2
[PROOF STATE]
proof (prove)
using this:
{} \<notin> F
\<Union> F \<subseteq> carrier

goal (1 subgoal):
 1. F \<in> Filters
[PROOF STEP]
by (auto simp add: filters_def intro: a3 a4)


[STATEMENT]
lemma powrat_mult:
  assumes "0 < x" shows "x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
fix q::rat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
assume "q = 0"
[PROOF STATE]
proof (state)
this:
q = 0

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q = 0
[PROOF STEP]
have "x pow\<^sub>\<rat> (q * s) = (x pow\<^sub>\<rat> q) pow\<^sub>\<rat> s"
[PROOF STATE]
proof (prove)
using this:
q = 0

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (q * s) = (x pow\<^sub>\<rat> q) pow\<^sub>\<rat> s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (q * s) = (x pow\<^sub>\<rat> q) pow\<^sub>\<rat> s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?q2 = 0 \<Longrightarrow> x pow\<^sub>\<rat> (?q2 * s) = (x pow\<^sub>\<rat> ?q2) pow\<^sub>\<rat> s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?q2 = 0 \<Longrightarrow> x pow\<^sub>\<rat> (?q2 * s) = (x pow\<^sub>\<rat> ?q2) pow\<^sub>\<rat> s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?q2 = 0 \<Longrightarrow> x pow\<^sub>\<rat> (?q2 * s) = (x pow\<^sub>\<rat> ?q2) pow\<^sub>\<rat> s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
by (metis assms linorder_neqE_linordered_idom mult_zero_right
         powrat_mult_neg powrat_mult_neg_pos powrat_mult_pos
         powrat_mult_pos_neg powrat_zero_eq_one)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma region_coregion_Id:
  "idem_scene X \<Longrightarrow> region X \<inter> coregion X = Id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. idem_scene X \<Longrightarrow> region X \<inter> coregion X = Id
[PROOF STEP]
by (transfer, auto, metis idem_overrider.ovr_idem)


[STATEMENT]
lemma big_prod_in_1:
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> L F (\<lambda>_. 1)"
  shows   "(\<lambda>y. \<Prod>x\<in>A. f x y) \<in> L F (\<lambda>_. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. \<Prod>x\<in>A. f x y) \<in> L F (\<lambda>_. 1::'b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> f ?x \<in> L F (\<lambda>_. 1::'b)

goal (1 subgoal):
 1. (\<lambda>y. \<Prod>x\<in>A. f x y) \<in> L F (\<lambda>_. 1::'b)
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto intro!: big.mult_in_1)


[STATEMENT]
lemma tt_map_scale: "c \<noteq> (0::'b::semiring_no_zero_divisors) \<Longrightarrow> tt (c \<cdot> p) = tt p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> tt (c \<cdot> p) = tt p
[PROOF STEP]
by (cases "p = 0") (simp_all add: map_scale_eq_monom_mult tt_monom_mult term_simps)


[STATEMENT]
lemma csucc_le_Card_iff: "\<lbrakk>Card \<kappa>'; Card \<kappa>\<rbrakk> \<Longrightarrow> csucc \<kappa>' \<le> \<kappa> \<longleftrightarrow> \<kappa>' < \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Card \<kappa>'; Card \<kappa>\<rbrakk> \<Longrightarrow> (csucc \<kappa>' \<le> \<kappa>) = (\<kappa>' < \<kappa>)
[PROOF STEP]
by (metis Card_csucc Card_is_Ord Card_lt_csucc_iff Ord_not_le)


[STATEMENT]
lemma inorder_upd:
  "sorted1(inorder t) \<Longrightarrow> inorder(upd x y t) = upd_list x y (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted1 (Tree2.inorder t) \<Longrightarrow> Tree2.inorder (upd x y t) = upd_list x y (Tree2.inorder t)
[PROOF STEP]
by(induction x y t rule: upd.induct)
  (auto simp: upd_list_simps)