[STATEMENT]
lemma (in group)
  assumes "x \<in> carrier G"
  shows finite_cyclic_subgroup:
        "finite(carrier(subgroup_generated G {x})) \<longleftrightarrow> (\<exists>n::nat. n \<noteq> 0 \<and> x [^] n = \<one>)" (is "?fin \<longleftrightarrow> ?nat1")
    and infinite_cyclic_subgroup:
        "infinite(carrier(subgroup_generated G {x})) \<longleftrightarrow> (\<forall>m n::nat. x [^] m = x [^] n \<longrightarrow> m = n)" (is "\<not> ?fin \<longleftrightarrow> ?nateq")
    and finite_cyclic_subgroup_int:
        "finite(carrier(subgroup_generated G {x})) \<longleftrightarrow> (\<exists>i::int. i \<noteq> 0 \<and> x [^] i = \<one>)" (is "?fin \<longleftrightarrow> ?int1")
    and infinite_cyclic_subgroup_int:
        "infinite(carrier(subgroup_generated G {x})) \<longleftrightarrow> (\<forall>i j::int. x [^] i = x [^] j \<longrightarrow> i = j)" (is "\<not> ?fin \<longleftrightarrow> ?inteq")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>) &&& infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)) &&& finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>) &&& infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>)
 2. infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)
 3. finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>)
 4. infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
have 1: "\<not> ?fin" if ?nateq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (carrier (subgroup_generated G {x}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite (carrier (subgroup_generated G {x}))
[PROOF STEP]
have "infinite (range (\<lambda>n::nat. x [^] n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (range (([^]) x))
[PROOF STEP]
using that range_inj_infinite [of "(\<lambda>n::nat. x [^] n)"]
[PROOF STATE]
proof (prove)
using this:
\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n
inj (([^]) x) \<Longrightarrow> infinite (range (([^]) x))

goal (1 subgoal):
 1. infinite (range (([^]) x))
[PROOF STEP]
by (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
infinite (range (([^]) x))

goal (1 subgoal):
 1. infinite (carrier (subgroup_generated G {x}))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
infinite (range (([^]) x))

goal (1 subgoal):
 1. infinite (carrier (subgroup_generated G {x}))
[PROOF STEP]
have "range (\<lambda>n::nat. x [^] n) \<subseteq> range (\<lambda>i::int. x [^] i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (([^]) x) \<subseteq> range (([^]) x)
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa n. n \<in> UNIV \<Longrightarrow> x [^] n \<in> range (([^]) x)
[PROOF STEP]
by (metis assms group.int_pow_neg int_pow_closed int_pow_neg_int is_group local.inv_equality nat_pow_closed r_inv rangeI)
[PROOF STATE]
proof (state)
this:
range (([^]) x) \<subseteq> range (([^]) x)

goal (1 subgoal):
 1. infinite (carrier (subgroup_generated G {x}))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
infinite (range (([^]) x))
range (([^]) x) \<subseteq> range (([^]) x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite (range (([^]) x))
range (([^]) x) \<subseteq> range (([^]) x)

goal (1 subgoal):
 1. infinite (carrier (subgroup_generated G {x}))
[PROOF STEP]
using carrier_subgroup_generated_by_singleton [OF assms] finite_subset
[PROOF STATE]
proof (prove)
using this:
infinite (range (([^]) x))
range (([^]) x) \<subseteq> range (([^]) x)
carrier (subgroup_generated G {x}) = range (([^]) x)
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. infinite (carrier (subgroup_generated G {x}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
infinite (carrier (subgroup_generated G {x}))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n \<Longrightarrow> infinite (carrier (subgroup_generated G {x}))

goal (4 subgoals):
 1. finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>)
 2. infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)
 3. finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>)
 4. infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
have 2: "m = n" if mn: "x [^] m = x [^] n" and eq [rule_format]: "?inteq" for m n::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = n
[PROOF STEP]
using eq [of "int m" "int n"]
[PROOF STATE]
proof (prove)
using this:
x [^] int m = x [^] int n \<Longrightarrow> int m = int n

goal (1 subgoal):
 1. m = n
[PROOF STEP]
by (simp add: int_pow_int mn)
[PROOF STATE]
proof (state)
this:
\<lbrakk>x [^] ?m = x [^] ?n; \<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j\<rbrakk> \<Longrightarrow> ?m = ?n

goal (4 subgoals):
 1. finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>)
 2. infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)
 3. finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>)
 4. infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
have 3: ?nat1 if non: "\<not> ?inteq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
obtain i j::int where eq: "x [^] i = x [^] j" and "i \<noteq> j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>x [^] i = x [^] j; i \<noteq> j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using non
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)

goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>x [^] i = x [^] j; i \<noteq> j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x [^] i = x [^] j
i \<noteq> j

goal (1 subgoal):
 1. \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
proof (cases i j rule: linorder_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. i < j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 2. i = j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 3. j < i \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
case less
[PROOF STATE]
proof (state)
this:
i < j

goal (3 subgoals):
 1. i < j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 2. i = j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 3. j < i \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < j
[PROOF STEP]
have [simp]: "x [^] (j - i) = \<one>"
[PROOF STATE]
proof (prove)
using this:
i < j

goal (1 subgoal):
 1. x [^] (j - i) = \<one>
[PROOF STEP]
by (simp add: eq assms int_pow_diff)
[PROOF STATE]
proof (state)
this:
x [^] (j - i) = \<one>

goal (3 subgoals):
 1. i < j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 2. i = j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 3. j < i \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
using less
[PROOF STATE]
proof (prove)
using this:
i < j

goal (1 subgoal):
 1. \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
by (rule_tac x="nat (j-i)" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>

goal (2 subgoals):
 1. i = j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 2. j < i \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 2. j < i \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
case greater
[PROOF STATE]
proof (state)
this:
j < i

goal (2 subgoals):
 1. i = j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 2. j < i \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j < i
[PROOF STEP]
have [simp]: "x [^] (i - j) = \<one>"
[PROOF STATE]
proof (prove)
using this:
j < i

goal (1 subgoal):
 1. x [^] (i - j) = \<one>
[PROOF STEP]
by (simp add: eq assms int_pow_diff)
[PROOF STATE]
proof (state)
this:
x [^] (i - j) = \<one>

goal (2 subgoals):
 1. i = j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
 2. j < i \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x [^] (i - j) = \<one>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x [^] (i - j) = \<one>

goal (1 subgoal):
 1. \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
using greater
[PROOF STATE]
proof (prove)
using this:
x [^] (i - j) = \<one>
j < i

goal (1 subgoal):
 1. \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
by (rule_tac x="nat (i-j)" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>

goal (1 subgoal):
 1. i = j \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
[PROOF STEP]
qed (use \<open>i \<noteq> j\<close> in auto)
[PROOF STATE]
proof (state)
this:
\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j) \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>

goal (4 subgoals):
 1. finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>)
 2. infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)
 3. finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>)
 4. infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
have 4: "\<exists>i::int. (i \<noteq> 0) \<and> x [^] i = \<one>" if "n \<noteq> 0" "x [^] n = \<one>" for n::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>
[PROOF STEP]
apply (rule_tac x="int n" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int n \<noteq> 0 \<and> x [^] int n = \<one>
[PROOF STEP]
by (simp add: int_pow_int that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?n \<noteq> 0; x [^] ?n = \<one>\<rbrakk> \<Longrightarrow> \<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>

goal (4 subgoals):
 1. finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>)
 2. infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)
 3. finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>)
 4. infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
have 5: "finite (carrier (subgroup_generated G {x}))" if "i \<noteq> 0" and 1: "x [^] i = \<one>" for i::int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier (subgroup_generated G {x}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (carrier (subgroup_generated G {x}))
[PROOF STEP]
obtain n::nat where n: "n > 0" "x [^] n = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. \<lbrakk>0 < n; x [^] n = \<one>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using "1" "3" \<open>i \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
x [^] i = \<one>
\<not> (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j) \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
i \<noteq> 0

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>0 < n; x [^] n = \<one>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < n
x [^] n = \<one>

goal (1 subgoal):
 1. finite (carrier (subgroup_generated G {x}))
[PROOF STEP]
have "x [^] a \<in> ([^]) x ` {0..<n}" for a::int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] a \<in> ([^]) x ` {0..<n}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x [^] a = x [^] ?x
 2. ?x \<in> {0..<n}
[PROOF STEP]
show "x [^] a = x [^] nat (a mod int n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] a = x [^] nat (a mod int n)
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n
x [^] n = \<one>

goal (1 subgoal):
 1. x [^] a = x [^] nat (a mod int n)
[PROOF STEP]
by simp (metis (no_types, lifting) assms dvd_minus_mod dvd_trans int_pow_eq int_pow_eq_id int_pow_int)
[PROOF STATE]
proof (state)
this:
x [^] a = x [^] nat (a mod int n)

goal (1 subgoal):
 1. nat (a mod int n) \<in> {0..<n}
[PROOF STEP]
show "nat (a mod int n) \<in> {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (a mod int n) \<in> {0..<n}
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n
x [^] n = \<one>

goal (1 subgoal):
 1. nat (a mod int n) \<in> {0..<n}
[PROOF STEP]
apply (simp add:  split: split_nat)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; x [^] n = \<one>\<rbrakk> \<Longrightarrow> \<forall>na. a mod int n = int na \<longrightarrow> na < n
[PROOF STEP]
using Euclidean_Division.pos_mod_bound
[PROOF STATE]
proof (prove)
using this:
0 < ?l \<Longrightarrow> ?k mod ?l < ?l

goal (1 subgoal):
 1. \<lbrakk>0 < n; x [^] n = \<one>\<rbrakk> \<Longrightarrow> \<forall>na. a mod int n = int na \<longrightarrow> na < n
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
nat (a mod int n) \<in> {0..<n}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x [^] ?a \<in> ([^]) x ` {0..<n}

goal (1 subgoal):
 1. finite (carrier (subgroup_generated G {x}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x [^] ?a \<in> ([^]) x ` {0..<n}
[PROOF STEP]
have "carrier (subgroup_generated G {x}) \<subseteq> ([^]) x ` {0..<n}"
[PROOF STATE]
proof (prove)
using this:
x [^] ?a \<in> ([^]) x ` {0..<n}

goal (1 subgoal):
 1. carrier (subgroup_generated G {x}) \<subseteq> ([^]) x ` {0..<n}
[PROOF STEP]
using carrier_subgroup_generated_by_singleton [OF assms]
[PROOF STATE]
proof (prove)
using this:
x [^] ?a \<in> ([^]) x ` {0..<n}
carrier (subgroup_generated G {x}) = range (([^]) x)

goal (1 subgoal):
 1. carrier (subgroup_generated G {x}) \<subseteq> ([^]) x ` {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
carrier (subgroup_generated G {x}) \<subseteq> ([^]) x ` {0..<n}

goal (1 subgoal):
 1. finite (carrier (subgroup_generated G {x}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
carrier (subgroup_generated G {x}) \<subseteq> ([^]) x ` {0..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
carrier (subgroup_generated G {x}) \<subseteq> ([^]) x ` {0..<n}

goal (1 subgoal):
 1. finite (carrier (subgroup_generated G {x}))
[PROOF STEP]
using finite_surj
[PROOF STATE]
proof (prove)
using this:
carrier (subgroup_generated G {x}) \<subseteq> ([^]) x ` {0..<n}
\<lbrakk>finite ?A; ?B \<subseteq> ?f ` ?A\<rbrakk> \<Longrightarrow> finite ?B

goal (1 subgoal):
 1. finite (carrier (subgroup_generated G {x}))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (carrier (subgroup_generated G {x}))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i \<noteq> 0; x [^] ?i = \<one>\<rbrakk> \<Longrightarrow> finite (carrier (subgroup_generated G {x}))

goal (4 subgoals):
 1. finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>)
 2. infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)
 3. finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>)
 4. infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
show "?fin \<longleftrightarrow> ?nat1" "\<not> ?fin \<longleftrightarrow> ?nateq" "?fin \<longleftrightarrow> ?int1" "\<not> ?fin \<longleftrightarrow> ?inteq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>) &&& infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)) &&& finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>) &&& infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
using 1 2 3 4 5
[PROOF STATE]
proof (prove)
using this:
\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n \<Longrightarrow> infinite (carrier (subgroup_generated G {x}))
\<lbrakk>x [^] ?m = x [^] ?n; \<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j\<rbrakk> \<Longrightarrow> ?m = ?n
\<not> (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j) \<Longrightarrow> \<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>
\<lbrakk>?n \<noteq> 0; x [^] ?n = \<one>\<rbrakk> \<Longrightarrow> \<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>
\<lbrakk>?i \<noteq> 0; x [^] ?i = \<one>\<rbrakk> \<Longrightarrow> finite (carrier (subgroup_generated G {x}))

goal (1 subgoal):
 1. (finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>) &&& infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)) &&& finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>) &&& infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)
[PROOF STEP]
by meson+
[PROOF STATE]
proof (state)
this:
finite (carrier (subgroup_generated G {x})) = (\<exists>n. n \<noteq> 0 \<and> x [^] n = \<one>)
infinite (carrier (subgroup_generated G {x})) = (\<forall>m n. x [^] m = x [^] n \<longrightarrow> m = n)
finite (carrier (subgroup_generated G {x})) = (\<exists>i. i \<noteq> 0 \<and> x [^] i = \<one>)
infinite (carrier (subgroup_generated G {x})) = (\<forall>i j. x [^] i = x [^] j \<longrightarrow> i = j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iMOD_cut_greater1: "
  t \<in> [r, mod m] \<Longrightarrow>
  [r, mod m] \<down>> t = (
    if m = 0 then {}
    else [t + m, mod m])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> [ r, mod m ] \<Longrightarrow> [ r, mod m ] \<down>> t = (if m = 0 then {} else [ t + m, mod m ])
[PROOF STEP]
by (simp add: iMOD_cut_greater iT_iff mod_eq_imp_diff_mod_0)


[STATEMENT]
lemma suminf_multr: "summable f \<Longrightarrow> (\<Sum>n. f n * c) = (\<Sum>n. f n) * c" for c::"'a::real_normed_algebra"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<Sum>n. f n * c) = (\<Sum>n. f n) * c
[PROOF STEP]
by (rule bounded_linear.suminf [OF bounded_linear_mult_left, symmetric])


[STATEMENT]
lemma line_integral_exists_point_path:
  assumes "finite basis" "point_path \<gamma>"
  shows "line_integral_exists F basis \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists F basis \<gamma>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite basis
point_path \<gamma>

goal (1 subgoal):
 1. line_integral_exists F basis \<gamma>
[PROOF STEP]
apply(simp add: point_path_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite basis; \<exists>c. \<gamma> = (\<lambda>x. c)\<rbrakk> \<Longrightarrow> line_integral_exists F basis \<gamma>
[PROOF STEP]
using line_integral_exists_on_degenerate_path
[PROOF STATE]
proof (prove)
using this:
finite ?basis \<Longrightarrow> line_integral_exists ?F ?basis (\<lambda>x. ?c)

goal (1 subgoal):
 1. \<lbrakk>finite basis; \<exists>c. \<gamma> = (\<lambda>x. c)\<rbrakk> \<Longrightarrow> line_integral_exists F basis \<gamma>
[PROOF STEP]
by auto


[STATEMENT]
lemma range_binary_eq: "range(binary a b) = {a,b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (binary a b) = {a, b}
[PROOF STEP]
by (auto simp add: binary_def)


[STATEMENT]
lemma rGamma_real_altdef: "rGamma x = lim (rGamma_series (x :: real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma x = lim (rGamma_series x)
[PROOF STEP]
by (rule sym, rule limI, rule tendsto_intros)


[STATEMENT]
lemma  poly_compose_ring_hom:
  assumes "is_poly_tuple m fs"
  assumes "length fs = n"
  shows  "(ring_hom_ring (Q\<^sub>p[\<X>\<^bsub>n\<^esub>]) (Q\<^sub>p[\<X>\<^bsub>m\<^esub>]) (Qp_poly_comp m fs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_ring (Q\<^sub>p [\<X>\<^bsub>n\<^esub>]) (Q\<^sub>p [\<X>\<^bsub>m\<^esub>]) (Qp_poly_comp m fs)
[PROOF STEP]
unfolding Qp_poly_comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_ring (Q\<^sub>p [\<X>\<^bsub>n\<^esub>]) (Q\<^sub>p [\<X>\<^bsub>m\<^esub>]) (poly_compose (length fs) m fs)
[PROOF STEP]
by (simp add: assms(1) assms(2)  poly_compose_ring_hom)


[STATEMENT]
lemma impl_prop_var [simp]: "rdom \<lceil>P\<rceil> \<subseteq> rdom \<lceil>Q\<rceil> \<longleftrightarrow> (\<forall>s. P s \<longrightarrow>  Q s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rdom \<lceil>P\<rceil> \<subseteq> rdom \<lceil>Q\<rceil>) = (\<forall>s. P s \<longrightarrow> Q s)
[PROOF STEP]
by simp


[STATEMENT]
theorem msort_sort:
  "sort = msort"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sort = msort
[PROOF STEP]
by (rule ext, rule properties_for_sort) (fact mset_msort sorted_msort)+


[STATEMENT]
lemma ex_iff_abs: "(\<exists>x::'a. P x) \<longleftrightarrow> (\<exists>n::nat. P (abs_nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x) = (\<exists>n. P (abs_nat n))
[PROOF STEP]
by (metis rep_inverse)


[STATEMENT]
lemma setOfPairs:
  "{(fst pair, {y})| y. y \<in>  snd pair} =
   {fst pair} \<times> {{y}| y. y \<in> snd pair}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(fst pair, {y}) |y. y \<in> snd pair} = {fst pair} \<times> {{y} |y. y \<in> snd pair}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma "(\<lambda>x::real. inverse (x - 1)^2) \<in> \<omega>[at 1](\<lambda>x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (inverse (x - 1))\<^sup>2) \<in> \<omega>[at 1](\<lambda>x. x)
[PROOF STEP]
by real_asymp


[STATEMENT]
theorem ll_001:
  "t \<in> {20 .. 20} \<longrightarrow>
  (s, x1, x2, x3, x4, x5, x6, x7) \<in>
      {(0, 1.19, 1.04, 1.49, 2.39, 0.99, 0.09, 0.44) ..
       (0, 1.21, 1.06, 1.51, 2.41, 1.01, 0.11, 0.46)} \<longrightarrow>
  t \<in> ll.existence_ivl0 (s, x1, x2, x3, x4, x5, x6, x7) \<and>
  ll.flow0 (s, x1, x2, x3, x4, x5, x6, x7) t \<in>
    {(19.99, 0.8, 0.3, 0.5, 2.5, 0.1, 0.0, 0.25) ..
     (20, 1.0, 0.5, 0.7, 3.0, 0.3, 0.1, 0.35)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> point_ivl 20 \<longrightarrow> (s, x1, x2, x3, x4, x5, x6, x7) \<in> {(0, 119 / 10\<^sup>2, 104 / 10\<^sup>2, 149 / 10\<^sup>2, 239 / 10\<^sup>2, 99 / 10\<^sup>2, 9 / 10\<^sup>2, 44 / 10\<^sup>2)..(0, 121 / 10\<^sup>2, 106 / 10\<^sup>2, 151 / 10\<^sup>2, 241 / 10\<^sup>2, 101 / 10\<^sup>2, 11 / 10\<^sup>2, 46 / 10\<^sup>2)} \<longrightarrow> t \<in> ll.existence_ivl0 (s, x1, x2, x3, x4, x5, x6, x7) \<and> ll.flow0 (s, x1, x2, x3, x4, x5, x6, x7) t \<in> {(1999 / 10\<^sup>2, 8 / 10, 3 / 10, 5 / 10, 25 / 10, 1 / 10, 0 / 10, 25 / 10\<^sup>2)..(20, 10 / 10, 5 / 10, 7 / 10, 30 / 10, 3 / 10, 1 / 10, 35 / 10\<^sup>2)}
[PROOF STEP]
by (tactic \<open>ode_bnds_tac @{thms laub_fas_def} 30 60 30 13 [(0, 4, "0x7f7f7f")] (* "out_ll_001.out" *) ""  @{context} 1\<close>)


[STATEMENT]
lemma "a < 3 \<Longrightarrow> (7::nat) > 2 * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < 3 \<Longrightarrow> 2 * a < 7
[PROOF STEP]
by (smt (verit))


[STATEMENT]
lemma fds_subseries_add [simp]: "fds_subseries P (f + g) = fds_subseries P f + fds_subseries P g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_subseries P (f + g) = fds_subseries P f + fds_subseries P g
[PROOF STEP]
by (simp add: fds_subseries_def fds_eq_iff plus_fds_def)


[STATEMENT]
theorem "l_sorted (l_sort xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
let ?X = "(xs, [], [])"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
have "l_sort_aux ?X \<in> l_sort_set ?X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l_sort_aux (xs, [], []) \<in> l_sort_set (xs, [], [])
[PROOF STEP]
by (rule l_sort_aux_set)
[PROOF STATE]
proof (state)
this:
l_sort_aux (xs, [], []) \<in> l_sort_set (xs, [], [])

goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
l_sort_aux (xs, [], []) \<in> l_sort_set (xs, [], [])

goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
have "l_sort_inv_1 ?X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l_sort_inv_1 (xs, [], [])
[PROOF STEP]
by (rule l_sort_input_1)
[PROOF STATE]
proof (state)
this:
l_sort_inv_1 (xs, [], [])

goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
l_sort_aux (xs, [], []) \<in> l_sort_set (xs, [], [])
l_sort_inv_1 (xs, [], [])
[PROOF STEP]
have "l_sort_inv_1 (l_sort_aux ?X)"
[PROOF STATE]
proof (prove)
using this:
l_sort_aux (xs, [], []) \<in> l_sort_set (xs, [], [])
l_sort_inv_1 (xs, [], [])

goal (1 subgoal):
 1. l_sort_inv_1 (l_sort_aux (xs, [], []))
[PROOF STEP]
by (rule l_sort_invariance_1)
[PROOF STATE]
proof (state)
this:
l_sort_inv_1 (l_sort_aux (xs, [], []))

goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
hence "l_sorted (l_sort_out (l_sort_aux ?X))"
[PROOF STATE]
proof (prove)
using this:
l_sort_inv_1 (l_sort_aux (xs, [], []))

goal (1 subgoal):
 1. l_sorted (l_sort_out (l_sort_aux (xs, [], [])))
[PROOF STEP]
by (rule l_sort_intro_1)
[PROOF STATE]
proof (state)
this:
l_sorted (l_sort_out (l_sort_aux (xs, [], [])))

goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
l_sorted (l_sort_out (l_sort_aux (xs, [], [])))

goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
have "?X = l_sort_in xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs, [], []) = l_sort_in xs
[PROOF STEP]
by (simp add: l_sort_in_def)
[PROOF STATE]
proof (state)
this:
(xs, [], []) = l_sort_in xs

goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
l_sorted (l_sort_out (l_sort_aux (xs, [], [])))
(xs, [], []) = l_sort_in xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
l_sorted (l_sort_out (l_sort_aux (xs, [], [])))
(xs, [], []) = l_sort_in xs

goal (1 subgoal):
 1. l_sorted (l_sort xs)
[PROOF STEP]
by (simp add: l_sort_def)
[PROOF STATE]
proof (state)
this:
l_sorted (l_sort xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ideal_generated_empty: "ideal_generated {} = {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal_generated {} = {0::'a}
[PROOF STEP]
unfolding ideal_generated_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> {I. ideal I \<and> {} \<subseteq> I} = {0::'a}
[PROOF STEP]
using ideal_generated_0
[PROOF STATE]
proof (prove)
using this:
ideal_generated {0::?'a} = {0::?'a}

goal (1 subgoal):
 1. \<Inter> {I. ideal I \<and> {} \<subseteq> I} = {0::'a}
[PROOF STEP]
by (metis empty_subsetI ideal_generated_def ideal_generated_subset ideal_ideal_generated
      ideal_not_empty subset_singletonD)


[STATEMENT]
lemma (in group) coset_mult_assoc:
  assumes "M \<subseteq> carrier G" "g \<in> carrier G" "h \<in> carrier G"
  shows "(M #> g) #> h = M #> (g \<otimes> h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M #> g #> h = M #> g \<otimes> h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M \<subseteq> carrier G
g \<in> carrier G
h \<in> carrier G

goal (1 subgoal):
 1. M #> g #> h = M #> g \<otimes> h
[PROOF STEP]
by (force simp add: r_coset_def m_assoc)


[STATEMENT]
lemma times_two_div_two[intro]:
  assumes "enat n < x" shows "2 * enat (n div 2) < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * enat (n div 2) < x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * enat (n div 2) < x
[PROOF STEP]
have "2 * n div 2 \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * n div 2 \<le> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * n div 2 \<le> n

goal (1 subgoal):
 1. 2 * enat (n div 2) < x
[PROOF STEP]
hence "2 * enat (n div 2) \<le> enat n"
[PROOF STATE]
proof (prove)
using this:
2 * n div 2 \<le> n

goal (1 subgoal):
 1. 2 * enat (n div 2) \<le> enat n
[PROOF STEP]
using enat_numeral enat_ord_simps(2) linorder_not_less mult.commute times_enat_simps(1)
[PROOF STATE]
proof (prove)
using this:
2 * n div 2 \<le> n
enat (numeral ?k) = numeral ?k
(enat ?m < enat ?n) = (?m < ?n)
(\<not> ?x < ?y) = (?y \<le> ?x)
?a * ?b = ?b * ?a
enat ?m * enat ?n = enat (?m * ?n)

goal (1 subgoal):
 1. 2 * enat (n div 2) \<le> enat n
[PROOF STEP]
by (metis div_times_less_eq_dividend)
[PROOF STATE]
proof (state)
this:
2 * enat (n div 2) \<le> enat n

goal (1 subgoal):
 1. 2 * enat (n div 2) < x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
enat n < x
2 * enat (n div 2) \<le> enat n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
enat n < x
2 * enat (n div 2) \<le> enat n

goal (1 subgoal):
 1. 2 * enat (n div 2) < x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * enat (n div 2) < x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fact_div_fact_ffact_nat:
  "fact n div fact (n - k) = ffact k n" if "k \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact n div fact (n - k) = ffact k n
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. fact n div fact (n - k) = ffact k n
[PROOF STEP]
by (simp add: fact_div_fact_ffact)


[STATEMENT]
lemma iprev_neq_Max: "\<lbrakk> finite I; \<exists>x\<in>I. x < n \<rbrakk>  \<Longrightarrow> iprev n I \<noteq> Max I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<exists>x\<in>I. x < n\<rbrakk> \<Longrightarrow> iprev n I \<noteq> Max I
[PROOF STEP]
apply (case_tac "n \<in> I")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; \<exists>x\<in>I. x < n; n \<in> I\<rbrakk> \<Longrightarrow> iprev n I \<noteq> Max I
 2. \<lbrakk>finite I; \<exists>x\<in>I. x < n; n \<notin> I\<rbrakk> \<Longrightarrow> iprev n I \<noteq> Max I
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; \<exists>x\<in>I. x < n; n \<notin> I\<rbrakk> \<Longrightarrow> iprev n I \<noteq> Max I
 2. \<lbrakk>finite I; \<exists>x\<in>I. x < n; n \<in> I\<rbrakk> \<Longrightarrow> iprev n I \<noteq> Max I
[PROOF STEP]
apply (simp add: not_in_iprev_fix)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite I; \<exists>x\<in>I. x < n; n \<notin> I\<rbrakk> \<Longrightarrow> n \<noteq> Max I
 2. \<lbrakk>finite I; \<exists>x\<in>I. x < n; n \<in> I\<rbrakk> \<Longrightarrow> iprev n I \<noteq> Max I
[PROOF STEP]
apply (blast dest: Max_in)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<exists>x\<in>I. x < n; n \<in> I\<rbrakk> \<Longrightarrow> iprev n I \<noteq> Max I
[PROOF STEP]
apply (rule less_imp_neq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<exists>x\<in>I. x < n; n \<in> I\<rbrakk> \<Longrightarrow> iprev n I < Max I
[PROOF STEP]
by (rule less_le_trans[OF iprev_mono2 Max_ge])


[STATEMENT]
lemma degree_add_eq_right: assumes "degree p < degree q" shows "degree (p + q) = degree q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p + q) = degree q
[PROOF STEP]
proof (cases "q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q = 0 \<Longrightarrow> degree (p + q) = degree q
 2. q \<noteq> 0 \<Longrightarrow> degree (p + q) = degree q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
q \<noteq> 0

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> degree (p + q) = degree q
 2. q \<noteq> 0 \<Longrightarrow> degree (p + q) = degree q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p + q) = degree q
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree (p + q) \<le> degree q
 2. degree q \<le> degree (p + q)
[PROOF STEP]
show "degree (p + q) \<le> degree q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p + q) \<le> degree q
[PROOF STEP]
by (simp add: assms degree_add_le order.strict_implies_order)
[PROOF STATE]
proof (state)
this:
degree (p + q) \<le> degree q

goal (1 subgoal):
 1. degree q \<le> degree (p + q)
[PROOF STEP]
show "degree q \<le> degree (p + q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree q \<le> degree (p + q)
[PROOF STEP]
by (simp add: False assms coeff_eq_0 le_degree)
[PROOF STATE]
proof (state)
this:
degree q \<le> degree (p + q)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (p + q) = degree q

goal (1 subgoal):
 1. q = 0 \<Longrightarrow> degree (p + q) = degree q
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma coplanar_perm_13:
  assumes "Coplanar A B C D"
  shows "Coplanar C A D B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar C A D B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar C A D B
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar C A D B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar C A D B
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar C A D B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar C A D B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_diagonal:
  "closed {y. \<exists> x::('a::t2_space). y = (x,x)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
have "{y. \<exists> x::'a. y = (x,x)} = UNIV - {(x,y) | x y. x \<noteq> y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}

goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}

goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
using open_diagonal_complement closed_Diff
[PROOF STATE]
proof (prove)
using this:
{y. \<exists>x. y = (x, x)} = UNIV - {(x, y) |x y. x \<noteq> y}
open {(x, y) |x y. x \<noteq> y}
\<lbrakk>closed ?S; open ?T\<rbrakk> \<Longrightarrow> closed (?S - ?T)

goal (1 subgoal):
 1. closed {y. \<exists>x. y = (x, x)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed {y. \<exists>x. y = (x, x)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma residue_simple_pole_limit:
  assumes "isolated_singularity_at f z0"
  assumes "is_pole f z0" "zorder f z0 = - 1"
  assumes "((\<lambda>x. f (g x) * (g x - z0)) \<longlongrightarrow> c) F"
  assumes "filterlim g (at z0) F" "F \<noteq> bot"
  shows   "residue f z0 = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue f z0 = c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. residue f z0 = c
[PROOF STEP]
have "residue f z0 = zor_poly f z0 z0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue f z0 = zor_poly f z0 z0
[PROOF STEP]
by (rule residue_simple_pole assms)+
[PROOF STATE]
proof (state)
this:
residue f z0 = zor_poly f z0 z0

goal (1 subgoal):
 1. residue f z0 = c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
residue f z0 = zor_poly f z0 z0

goal (1 subgoal):
 1. residue f z0 = c
[PROOF STEP]
have "\<dots> = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zor_poly f z0 z0 = c
[PROOF STEP]
apply (rule zor_poly_pole_eqI)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. isolated_singularity_at f z0
 2. is_pole f z0
 3. ((\<lambda>x. f (?g x) * (?g x - z0) ^ nat (- zorder f z0)) \<longlongrightarrow> c) ?F
 4. filterlim ?g (at z0) ?F
 5. ?F \<noteq> bot
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isolated_singularity_at f z0
is_pole f z0
zorder f z0 = - 1
((\<lambda>x. f (g x) * (g x - z0)) \<longlongrightarrow> c) F
filterlim g (at z0) F
F \<noteq> bot

goal (5 subgoals):
 1. isolated_singularity_at f z0
 2. is_pole f z0
 3. ((\<lambda>x. f (?g x) * (?g x - z0) ^ nat (- zorder f z0)) \<longlongrightarrow> c) ?F
 4. filterlim ?g (at z0) ?F
 5. ?F \<noteq> bot
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
zor_poly f z0 z0 = c

goal (1 subgoal):
 1. residue f z0 = c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
residue f z0 = c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
residue f z0 = c

goal (1 subgoal):
 1. residue f z0 = c
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
residue f z0 = c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cot_pfd_complex_minus [simp]: "cot_pfd (-x :: complex) = -cot_pfd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
have "(\<lambda>n. 2 * (-x) / ((-x) ^ 2 - of_nat (Suc n) ^ 2)) =
        (\<lambda>n. - (2 * x / (x ^ 2 - of_nat (Suc n) ^ 2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * - x / ((- x)\<^sup>2 - (of_nat (Suc n))\<^sup>2)) = (\<lambda>n. - (2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * - x / ((- x)\<^sup>2 - (of_nat (Suc n))\<^sup>2)) = (\<lambda>n. - (2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)))

goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * - x / ((- x)\<^sup>2 - (of_nat (Suc n))\<^sup>2)) = (\<lambda>n. - (2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)))

goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
have "\<dots> sums -cot_pfd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - (2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))) sums - cot_pfd x
[PROOF STEP]
by (intro sums_minus sums_cot_pfd_complex)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - (2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))) sums - cot_pfd x

goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. 2 * - x / ((- x)\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums - cot_pfd x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. 2 * - x / ((- x)\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums - cot_pfd x

goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
using sums_cot_pfd_complex[of "-x"] sums_unique2
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. 2 * - x / ((- x)\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums - cot_pfd x
(\<lambda>n. 2 * - x / ((- x)\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums cot_pfd (- x)
\<lbrakk>?f sums ?a; ?f sums ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cot_pfd (- x) = - cot_pfd x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma basis_reduction_add_rows_loop: assumes
  inv: "LLL_invariant True i fs"
  and mu_small: "\<mu>_small_row i fs j"
  and res: "basis_reduction_add_rows_loop i fs j = fs'"
  and i: "i < m"
  and j: "j \<le> i"
shows "LLL_invariant False i fs'" "LLL_measure i fs' = LLL_measure i fs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LLL_invariant False i fs' &&& LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
proof (atomize(full), insert assms, induct j arbitrary: fs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs 0; basis_reduction_add_rows_loop i fs 0 = fs'; i < m; 0 \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
 2. \<And>j fs. \<lbrakk>\<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs j; basis_reduction_add_rows_loop i fs j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs; LLL_invariant True i fs; \<mu>_small_row i fs (Suc j); basis_reduction_add_rows_loop i fs (Suc j) = fs'; i < m; Suc j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
case (0 fs)
[PROOF STATE]
proof (state)
this:
LLL_invariant True i fs
\<mu>_small_row i fs 0
basis_reduction_add_rows_loop i fs 0 = fs'
i < m
0 \<le> i

goal (2 subgoals):
 1. \<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs 0; basis_reduction_add_rows_loop i fs 0 = fs'; i < m; 0 \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
 2. \<And>j fs. \<lbrakk>\<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs j; basis_reduction_add_rows_loop i fs j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs; LLL_invariant True i fs; \<mu>_small_row i fs (Suc j); basis_reduction_add_rows_loop i fs (Suc j) = fs'; i < m; Suc j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
LLL_invariant True i fs
\<mu>_small_row i fs 0
basis_reduction_add_rows_loop i fs 0 = fs'
i < m
0 \<le> i

goal (1 subgoal):
 1. LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
using basis_reduction_add_row_done[of i fs]
[PROOF STATE]
proof (prove)
using this:
LLL_invariant True i fs
\<mu>_small_row i fs 0
basis_reduction_add_rows_loop i fs 0 = fs'
i < m
0 \<le> i
\<lbrakk>LLL_invariant True i fs; i < m; \<mu>_small_row i fs 0\<rbrakk> \<Longrightarrow> LLL_invariant False i fs

goal (1 subgoal):
 1. LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs

goal (1 subgoal):
 1. \<And>j fs. \<lbrakk>\<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs j; basis_reduction_add_rows_loop i fs j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs; LLL_invariant True i fs; \<mu>_small_row i fs (Suc j); basis_reduction_add_rows_loop i fs (Suc j) = fs'; i < m; Suc j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j fs. \<lbrakk>\<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs j; basis_reduction_add_rows_loop i fs j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs; LLL_invariant True i fs; \<mu>_small_row i fs (Suc j); basis_reduction_add_rows_loop i fs (Suc j) = fs'; i < m; Suc j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
case (Suc j fs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>LLL_invariant True i ?fs1; \<mu>_small_row i ?fs1 j; basis_reduction_add_rows_loop i ?fs1 j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i ?fs1
LLL_invariant True i fs
\<mu>_small_row i fs (Suc j)
basis_reduction_add_rows_loop i fs (Suc j) = fs'
i < m
Suc j \<le> i

goal (1 subgoal):
 1. \<And>j fs. \<lbrakk>\<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs j; basis_reduction_add_rows_loop i fs j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs; LLL_invariant True i fs; \<mu>_small_row i fs (Suc j); basis_reduction_add_rows_loop i fs (Suc j) = fs'; i < m; Suc j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
hence j: "j < i"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>LLL_invariant True i ?fs1; \<mu>_small_row i ?fs1 j; basis_reduction_add_rows_loop i ?fs1 j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i ?fs1
LLL_invariant True i fs
\<mu>_small_row i fs (Suc j)
basis_reduction_add_rows_loop i fs (Suc j) = fs'
i < m
Suc j \<le> i

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

goal (1 subgoal):
 1. \<And>j fs. \<lbrakk>\<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs j; basis_reduction_add_rows_loop i fs j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs; LLL_invariant True i fs; \<mu>_small_row i fs (Suc j); basis_reduction_add_rows_loop i fs (Suc j) = fs'; i < m; Suc j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
let ?c = "round (\<mu> fs i j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j fs. \<lbrakk>\<And>fs. \<lbrakk>LLL_invariant True i fs; \<mu>_small_row i fs j; basis_reduction_add_rows_loop i fs j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs; LLL_invariant True i fs; \<mu>_small_row i fs (Suc j); basis_reduction_add_rows_loop i fs (Suc j) = fs'; i < m; Suc j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
proof (cases "?c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) = 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
 2. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) = 0

goal (2 subgoals):
 1. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) = 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
 2. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) = 0

goal (1 subgoal):
 1. LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
using Suc(1)[OF Suc(2) basis_reduction_add_row_main_0[OF LLL_inv_imp_w[OF Suc(2)] i j True Suc(3)]]
      Suc(2-)
[PROOF STATE]
proof (prove)
using this:
round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) = 0
\<lbrakk>basis_reduction_add_rows_loop i fs j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
LLL_invariant True i fs
\<mu>_small_row i fs (Suc j)
basis_reduction_add_rows_loop i fs (Suc j) = fs'
i < m
Suc j \<le> i

goal (1 subgoal):
 1. LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs

goal (1 subgoal):
 1. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0

goal (1 subgoal):
 1. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
note step = basis_reduction_add_row_main(2-)[OF LLL_inv_imp_w[OF Suc(2)] i j refl]
[PROOF STATE]
proof (state)
this:
LLL_invariant True i fs \<Longrightarrow> LLL_invariant True i (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j])
\<lbrakk>?c = round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j); \<mu>_small_row i fs (Suc j)\<rbrakk> \<Longrightarrow> \<mu>_small_row i (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j]) j
?c = round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<Longrightarrow> \<bar>gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j])) i j\<bar> \<le> 1 / 2
LLL_measure i (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j]) = LLL_measure i fs
?i < m \<Longrightarrow> gram_schmidt_fs.gso n (map of_int_hom.vec_hom (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j])) ?i = gram_schmidt_fs.gso n (map of_int_hom.vec_hom fs) ?i
\<lbrakk>?i' < m; ?j' < m\<rbrakk> \<Longrightarrow> gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j])) ?i' ?j' = (if ?i' = i \<and> ?j' \<le> j then gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i ?j' - rat_of_int ?c * gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) j ?j' else gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) ?i' ?j')
?ii \<le> m \<Longrightarrow> d (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j]) ?ii = d fs ?ii

goal (1 subgoal):
 1. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
note step = step(1)[OF Suc(2)] step(2-)
[PROOF STATE]
proof (state)
this:
LLL_invariant True i (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j])
\<lbrakk>?c = round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j); \<mu>_small_row i fs (Suc j)\<rbrakk> \<Longrightarrow> \<mu>_small_row i (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j]) j
?c = round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<Longrightarrow> \<bar>gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j])) i j\<bar> \<le> 1 / 2
LLL_measure i (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j]) = LLL_measure i fs
?i < m \<Longrightarrow> gram_schmidt_fs.gso n (map of_int_hom.vec_hom (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j])) ?i = gram_schmidt_fs.gso n (map of_int_hom.vec_hom fs) ?i
\<lbrakk>?i' < m; ?j' < m\<rbrakk> \<Longrightarrow> gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j])) ?i' ?j' = (if ?i' = i \<and> ?j' \<le> j then gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i ?j' - rat_of_int ?c * gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) j ?j' else gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) ?i' ?j')
?ii \<le> m \<Longrightarrow> d (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j]) ?ii = d fs ?ii

goal (1 subgoal):
 1. round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0 \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
using Suc(1)[OF step(1-2)] False Suc(2-) step(4)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?c2 = round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j); \<mu>_small_row i fs (Suc j); basis_reduction_add_rows_loop i (fs[i := fs ! i - ?c2 \<cdot>\<^sub>v fs ! j]) j = fs'; i < m; j \<le> i\<rbrakk> \<Longrightarrow> LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i (fs[i := fs ! i - ?c2 \<cdot>\<^sub>v fs ! j])
round (gram_schmidt_fs.\<mu> n (map of_int_hom.vec_hom fs) i j) \<noteq> 0
LLL_invariant True i fs
\<mu>_small_row i fs (Suc j)
basis_reduction_add_rows_loop i fs (Suc j) = fs'
i < m
Suc j \<le> i
LLL_measure i (fs[i := fs ! i - ?c \<cdot>\<^sub>v fs ! j]) = LLL_measure i fs

goal (1 subgoal):
 1. LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LLL_invariant False i fs' \<and> LLL_measure i fs' = LLL_measure i fs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quasi_isometry_on_infdist:
  assumes "lambda C-quasi_isometry_on X f"
          "w \<in> X"
          "S \<subseteq> X"
  shows "infdist (f w) (f`S) \<le> lambda * infdist w S + C"
        "infdist (f w) (f`S) \<ge> (1/lambda) * infdist w S - C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infdist (f w) (f ` S) \<le> lambda * infdist w S + C &&& 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. infdist (f w) (f ` S) \<le> lambda * infdist w S + C
 2. 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
have "lambda \<ge> 1" "C \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> lambda &&& 0 \<le> C
[PROOF STEP]
using quasi_isometry_onD[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> dist (f ?x) (f ?y) \<le> lambda * dist ?x ?y + C
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> 1 / lambda * dist ?x ?y - C \<le> dist (f ?x) (f ?y)
1 \<le> lambda
0 \<le> C

goal (1 subgoal):
 1. 1 \<le> lambda &&& 0 \<le> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 \<le> lambda
0 \<le> C

goal (2 subgoals):
 1. infdist (f w) (f ` S) \<le> lambda * infdist w S + C
 2. 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
show "infdist (f w) (f`S) \<le> lambda * infdist w S + C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
 2. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
 2. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

goal (1 subgoal):
 1. infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
using \<open>C \<ge> 0\<close>
[PROOF STATE]
proof (prove)
using this:
S = {}
0 \<le> C

goal (1 subgoal):
 1. infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
unfolding infdist_def
[PROOF STATE]
proof (prove)
using this:
S = {}
0 \<le> C

goal (1 subgoal):
 1. (if f ` S = {} then 0 else Inf (dist (f w) ` f ` S)) \<le> lambda * (if S = {} then 0 else Inf (dist w ` S)) + C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
infdist (f w) (f ` S) \<le> lambda * infdist w S + C

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
have "(INF x\<in>S. dist (f w) (f x)) \<le> (INF x\<in>S. lambda * dist w x + C)"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. (INF x\<in>S. dist (f w) (f x)) \<le> (INF x\<in>S. lambda * dist w x + C)
[PROOF STEP]
apply (rule cINF_superset_mono)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. bdd_below ((\<lambda>x. dist (f w) (f x)) ` S)
 2. S \<subseteq> S
 3. \<And>x. x \<in> S \<Longrightarrow> dist (f w) (f x) \<le> lambda * dist w x + C
[PROOF STEP]
apply (meson bdd_belowI2 zero_le_dist)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S \<subseteq> S
 2. \<And>x. x \<in> S \<Longrightarrow> dist (f w) (f x) \<le> lambda * dist w x + C
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lambda C -quasi_isometry_on X f
w \<in> X
S \<subseteq> X

goal (2 subgoals):
 1. S \<subseteq> S
 2. \<And>x. x \<in> S \<Longrightarrow> dist (f w) (f x) \<le> lambda * dist w x + C
[PROOF STEP]
by (auto intro!: quasi_isometry_onD(1)[OF assms(1)])
[PROOF STATE]
proof (state)
this:
(INF x\<in>S. dist (f w) (f x)) \<le> (INF x\<in>S. lambda * dist w x + C)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(INF x\<in>S. dist (f w) (f x)) \<le> (INF x\<in>S. lambda * dist w x + C)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
have "... = (INF t\<in>(dist w)`S. lambda * t + C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF x\<in>S. lambda * dist w x + C) = (INF t\<in>dist w ` S. lambda * t + C)
[PROOF STEP]
by (auto simp add: image_comp)
[PROOF STATE]
proof (state)
this:
(INF x\<in>S. lambda * dist w x + C) = (INF t\<in>dist w ` S. lambda * t + C)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(INF x\<in>S. lambda * dist w x + C) = (INF t\<in>dist w ` S. lambda * t + C)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
have "... = lambda * Inf ((dist w)`S) + C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF t\<in>dist w ` S. lambda * t + C) = lambda * Inf (dist w ` S) + C
[PROOF STEP]
apply (rule continuous_at_Inf_mono[symmetric])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. mono (\<lambda>s. lambda * s + C)
 2. continuous (at_right (Inf (dist w ` S))) (\<lambda>s. lambda * s + C)
 3. dist w ` S \<noteq> {}
 4. bdd_below (dist w ` S)
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<forall>x y. x \<le> y \<longrightarrow> lambda * x + C \<le> lambda * y + C
 2. continuous (at_right (Inf (dist w ` S))) (\<lambda>s. lambda * s + C)
 3. dist w ` S \<noteq> {}
 4. bdd_below (dist w ` S)
[PROOF STEP]
using \<open>lambda \<ge> 1\<close> False
[PROOF STATE]
proof (prove)
using this:
1 \<le> lambda
S \<noteq> {}

goal (4 subgoals):
 1. \<forall>x y. x \<le> y \<longrightarrow> lambda * x + C \<le> lambda * y + C
 2. continuous (at_right (Inf (dist w ` S))) (\<lambda>s. lambda * s + C)
 3. dist w ` S \<noteq> {}
 4. bdd_below (dist w ` S)
[PROOF STEP]
by (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
(INF t\<in>dist w ` S. lambda * t + C) = lambda * Inf (dist w ` S) + C

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(INF x\<in>S. dist (f w) (f x)) \<le> lambda * Inf (dist w ` S) + C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(INF x\<in>S. dist (f w) (f x)) \<le> lambda * Inf (dist w ` S) + C

goal (1 subgoal):
 1. infdist (f w) (f ` S) \<le> lambda * infdist w S + C
[PROOF STEP]
unfolding infdist_def
[PROOF STATE]
proof (prove)
using this:
(INF x\<in>S. dist (f w) (f x)) \<le> lambda * Inf (dist w ` S) + C

goal (1 subgoal):
 1. (if f ` S = {} then 0 else Inf (dist (f w) ` f ` S)) \<le> lambda * (if S = {} then 0 else Inf (dist w ` S)) + C
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
(INF x\<in>S. dist (f w) (f x)) \<le> lambda * Inf (dist w ` S) + C
S \<noteq> {}

goal (1 subgoal):
 1. (if f ` S = {} then 0 else Inf (dist (f w) ` f ` S)) \<le> lambda * (if S = {} then 0 else Inf (dist w ` S)) + C
[PROOF STEP]
by (auto simp add: image_comp)
[PROOF STATE]
proof (state)
this:
infdist (f w) (f ` S) \<le> lambda * infdist w S + C

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
infdist (f w) (f ` S) \<le> lambda * infdist w S + C

goal (1 subgoal):
 1. 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
show "1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
 2. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
 2. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

goal (1 subgoal):
 1. 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
using \<open>C \<ge> 0\<close>
[PROOF STATE]
proof (prove)
using this:
S = {}
0 \<le> C

goal (1 subgoal):
 1. 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
unfolding infdist_def
[PROOF STATE]
proof (prove)
using this:
S = {}
0 \<le> C

goal (1 subgoal):
 1. 1 / lambda * (if S = {} then 0 else Inf (dist w ` S)) - C \<le> (if f ` S = {} then 0 else Inf (dist (f w) ` f ` S))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
have "(1/lambda) * infdist w S - C = (1/lambda) * Inf ((dist w)`S) - C"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. 1 / lambda * infdist w S - C = 1 / lambda * Inf (dist w ` S) - C
[PROOF STEP]
unfolding infdist_def
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. 1 / lambda * (if S = {} then 0 else Inf (dist w ` S)) - C = 1 / lambda * Inf (dist w ` S) - C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / lambda * infdist w S - C = 1 / lambda * Inf (dist w ` S) - C

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / lambda * infdist w S - C = 1 / lambda * Inf (dist w ` S) - C

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
have "... = (INF t\<in>(dist w)`S. (1/lambda) * t - C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / lambda * Inf (dist w ` S) - C = (INF t\<in>dist w ` S. 1 / lambda * t - C)
[PROOF STEP]
apply (rule continuous_at_Inf_mono)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. mono (\<lambda>s. 1 / lambda * s - C)
 2. continuous (at_right (Inf (dist w ` S))) (\<lambda>s. 1 / lambda * s - C)
 3. dist w ` S \<noteq> {}
 4. bdd_below (dist w ` S)
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<forall>x y. x \<le> y \<longrightarrow> 1 / lambda * x - C \<le> 1 / lambda * y - C
 2. continuous (at_right (Inf (dist w ` S))) (\<lambda>s. 1 / lambda * s - C)
 3. dist w ` S \<noteq> {}
 4. bdd_below (dist w ` S)
[PROOF STEP]
using \<open>lambda \<ge> 1\<close> False
[PROOF STATE]
proof (prove)
using this:
1 \<le> lambda
S \<noteq> {}

goal (4 subgoals):
 1. \<forall>x y. x \<le> y \<longrightarrow> 1 / lambda * x - C \<le> 1 / lambda * y - C
 2. continuous (at_right (Inf (dist w ` S))) (\<lambda>s. 1 / lambda * s - C)
 3. dist w ` S \<noteq> {}
 4. bdd_below (dist w ` S)
[PROOF STEP]
by (auto simp add: divide_simps intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
1 / lambda * Inf (dist w ` S) - C = (INF t\<in>dist w ` S. 1 / lambda * t - C)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / lambda * Inf (dist w ` S) - C = (INF t\<in>dist w ` S. 1 / lambda * t - C)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
have "... = (INF x\<in>S. (1/lambda) * dist w x - C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF t\<in>dist w ` S. 1 / lambda * t - C) = (INF x\<in>S. 1 / lambda * dist w x - C)
[PROOF STEP]
by (auto simp add: image_comp)
[PROOF STATE]
proof (state)
this:
(INF t\<in>dist w ` S. 1 / lambda * t - C) = (INF x\<in>S. 1 / lambda * dist w x - C)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(INF t\<in>dist w ` S. 1 / lambda * t - C) = (INF x\<in>S. 1 / lambda * dist w x - C)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
have "... \<le> (INF x\<in>S. dist (f w) (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF x\<in>S. 1 / lambda * dist w x - C) \<le> (INF x\<in>S. dist (f w) (f x))
[PROOF STEP]
apply (rule cINF_superset_mono[OF False])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. bdd_below ((\<lambda>x. 1 / lambda * dist w x - C) ` S)
 2. S \<subseteq> S
 3. \<And>x. x \<in> S \<Longrightarrow> 1 / lambda * dist w x - C \<le> dist (f w) (f x)
[PROOF STEP]
apply (rule bdd_belowI2[of _ "-C"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. x \<in> S \<Longrightarrow> - C \<le> 1 / lambda * dist w x - C
 2. S \<subseteq> S
 3. \<And>x. x \<in> S \<Longrightarrow> 1 / lambda * dist w x - C \<le> dist (f w) (f x)
[PROOF STEP]
using assms \<open>lambda \<ge> 1\<close>
[PROOF STATE]
proof (prove)
using this:
lambda C -quasi_isometry_on X f
w \<in> X
S \<subseteq> X
1 \<le> lambda

goal (3 subgoals):
 1. \<And>x. x \<in> S \<Longrightarrow> - C \<le> 1 / lambda * dist w x - C
 2. S \<subseteq> S
 3. \<And>x. x \<in> S \<Longrightarrow> 1 / lambda * dist w x - C \<le> dist (f w) (f x)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S \<subseteq> S
 2. \<And>x. x \<in> S \<Longrightarrow> 1 / lambda * dist w x - C \<le> dist (f w) (f x)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> 1 / lambda * dist w x - C \<le> dist (f w) (f x)
[PROOF STEP]
apply (rule quasi_isometry_onD(2)[OF assms(1)])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> S \<Longrightarrow> w \<in> X
 2. \<And>x. x \<in> S \<Longrightarrow> x \<in> X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lambda C -quasi_isometry_on X f
w \<in> X
S \<subseteq> X

goal (2 subgoals):
 1. \<And>x. x \<in> S \<Longrightarrow> w \<in> X
 2. \<And>x. x \<in> S \<Longrightarrow> x \<in> X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(INF x\<in>S. 1 / lambda * dist w x - C) \<le> (INF x\<in>S. dist (f w) (f x))

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 / lambda * infdist w S - C \<le> (INF x\<in>S. dist (f w) (f x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / lambda * infdist w S - C \<le> (INF x\<in>S. dist (f w) (f x))

goal (1 subgoal):
 1. 1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)
[PROOF STEP]
unfolding infdist_def
[PROOF STATE]
proof (prove)
using this:
1 / lambda * (if S = {} then 0 else Inf (dist w ` S)) - C \<le> (INF x\<in>S. dist (f w) (f x))

goal (1 subgoal):
 1. 1 / lambda * (if S = {} then 0 else Inf (dist w ` S)) - C \<le> (if f ` S = {} then 0 else Inf (dist (f w) ` f ` S))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
1 / lambda * (if S = {} then 0 else Inf (dist w ` S)) - C \<le> (INF x\<in>S. dist (f w) (f x))
S \<noteq> {}

goal (1 subgoal):
 1. 1 / lambda * (if S = {} then 0 else Inf (dist w ` S)) - C \<le> (if f ` S = {} then 0 else Inf (dist (f w) ` f ` S))
[PROOF STEP]
by (auto simp add: image_comp)
[PROOF STATE]
proof (state)
this:
1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 / lambda * infdist w S - C \<le> infdist (f w) (f ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_field_derivative_cong_ev:
  assumes "x = y"
    and *: "eventually (\<lambda>x. x \<in> S \<longrightarrow> f x = g x) (nhds x)"
    and "u = v" "S = t" "x \<in> S"
  shows "(f has_field_derivative u) (at x within S) = (g has_field_derivative v) (at y within t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative u) (at x within S) = (g has_field_derivative v) (at y within t)
[PROOF STEP]
unfolding has_field_derivative_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. (f y - f x) / (y - x)) \<longlongrightarrow> u) (at x within S) = ((\<lambda>ya. (g ya - g y) / (ya - y)) \<longlongrightarrow> v) (at y within t)
[PROOF STEP]
proof (rule filterlim_cong)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. nhds u = nhds v
 2. at x within S = at y within t
 3. \<forall>\<^sub>F xa in at x within S. (f xa - f x) / (xa - x) = (g xa - g y) / (xa - y)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x = y
\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x
u = v
S = t
x \<in> S
[PROOF STEP]
have "f y = g y"
[PROOF STATE]
proof (prove)
using this:
x = y
\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x
u = v
S = t
x \<in> S

goal (1 subgoal):
 1. f y = g y
[PROOF STEP]
by (auto simp: eventually_nhds)
[PROOF STATE]
proof (state)
this:
f y = g y

goal (3 subgoals):
 1. nhds u = nhds v
 2. at x within S = at y within t
 3. \<forall>\<^sub>F xa in at x within S. (f xa - f x) / (xa - x) = (g xa - g y) / (xa - y)
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x
f y = g y
[PROOF STEP]
show "\<forall>\<^sub>F z in at x within S. (f z - f x) / (z - x) = (g z - g y) / (z - y)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x
f y = g y

goal (1 subgoal):
 1. \<forall>\<^sub>F z in at x within S. (f z - f x) / (z - x) = (g z - g y) / (z - y)
[PROOF STEP]
unfolding eventually_at_filter
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds x. x \<in> S \<longrightarrow> f x = g x
f y = g y

goal (1 subgoal):
 1. \<forall>\<^sub>F xa in nhds x. xa \<noteq> x \<longrightarrow> xa \<in> S \<longrightarrow> (f xa - f x) / (xa - x) = (g xa - g y) / (xa - y)
[PROOF STEP]
by eventually_elim (auto simp: assms \<open>f y = g y\<close>)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F z in at x within S. (f z - f x) / (z - x) = (g z - g y) / (z - y)

goal (2 subgoals):
 1. nhds u = nhds v
 2. at x within S = at y within t
[PROOF STEP]
qed (simp_all add: assms)


[STATEMENT]
lemma card_length_sum_list_rec:
  assumes "m \<ge> 1"
  shows "card {l::nat list. length l = m \<and> sum_list l = N} =
      card {l. length l = (m - 1) \<and> sum_list l = N} +
      card {l. length l = m \<and> sum_list l + 1 = N}"
    (is "card ?C = card ?A + card ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
let ?A' = "{l. length l = m \<and> sum_list l = N \<and> hd l = 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
let ?B' = "{l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
let ?f = "\<lambda>l. 0 # l"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
let ?g = "\<lambda>l. (hd l + 1) # tl l"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have 1: "xs \<noteq> [] \<Longrightarrow> x = hd xs \<Longrightarrow> x # tl xs = xs" for x :: nat and xs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; x = hd xs\<rbrakk> \<Longrightarrow> x # tl xs = xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?xs2 \<noteq> []; ?x2 = hd ?xs2\<rbrakk> \<Longrightarrow> ?x2 # tl ?xs2 = ?xs2

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have 2: "xs \<noteq> [] \<Longrightarrow> sum_list(tl xs) = sum_list xs - hd xs" for xs :: "nat list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> sum_list (tl xs) = sum_list xs - hd xs
[PROOF STEP]
by (auto simp add: neq_Nil_conv)
[PROOF STATE]
proof (state)
this:
?xs2 \<noteq> [] \<Longrightarrow> sum_list (tl ?xs2) = sum_list ?xs2 - hd ?xs2

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have f: "bij_betw ?f ?A ?A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((#) 0) {l. length l = m - 1 \<and> sum_list l = N} {l. length l = m \<and> sum_list l = N \<and> hd l = 0}
[PROOF STEP]
by (rule bij_betw_byWitness[where f' = tl]) (use assms in \<open>auto simp: 2 1 simp flip: length_0_conv\<close>)
[PROOF STATE]
proof (state)
this:
bij_betw ((#) 0) {l. length l = m - 1 \<and> sum_list l = N} {l. length l = m \<and> sum_list l = N \<and> hd l = 0}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have 3: "xs \<noteq> [] \<Longrightarrow> hd xs + (sum_list xs - hd xs) = sum_list xs" for xs :: "nat list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> hd xs + (sum_list xs - hd xs) = sum_list xs
[PROOF STEP]
by (metis 1 sum_list_simps(2) 2)
[PROOF STATE]
proof (state)
this:
?xs2 \<noteq> [] \<Longrightarrow> hd ?xs2 + (sum_list ?xs2 - hd ?xs2) = sum_list ?xs2

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have g: "bij_betw ?g ?B ?B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>l. (hd l + 1) # tl l) {l. length l = m \<and> sum_list l + 1 = N} {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}
[PROOF STEP]
apply (rule bij_betw_byWitness[where f' = "\<lambda>l. (hd l - 1) # tl l"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<forall>a\<in>{l. length l = m \<and> sum_list l + 1 = N}. (hd ((hd a + 1) # tl a) - 1) # tl ((hd a + 1) # tl a) = a
 2. \<forall>a'\<in>{l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}. (hd ((hd a' - 1) # tl a') + 1) # tl ((hd a' - 1) # tl a') = a'
 3. (\<lambda>l. (hd l + 1) # tl l) ` {l. length l = m \<and> sum_list l + 1 = N} \<subseteq> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}
 4. (\<lambda>l. (hd l - 1) # tl l) ` {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0} \<subseteq> {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> m

goal (4 subgoals):
 1. \<forall>a\<in>{l. length l = m \<and> sum_list l + 1 = N}. (hd ((hd a + 1) # tl a) - 1) # tl ((hd a + 1) # tl a) = a
 2. \<forall>a'\<in>{l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}. (hd ((hd a' - 1) # tl a') + 1) # tl ((hd a' - 1) # tl a') = a'
 3. (\<lambda>l. (hd l + 1) # tl l) ` {l. length l = m \<and> sum_list l + 1 = N} \<subseteq> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}
 4. (\<lambda>l. (hd l - 1) # tl l) ` {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0} \<subseteq> {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
by (auto simp: 2 simp flip: length_0_conv intro!: 3)
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>l. (hd l + 1) # tl l) {l. length l = m \<and> sum_list l + 1 = N} {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have fin: "finite {xs. size xs = M \<and> set xs \<subseteq> {0..<N}}" for M N :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {xs. length xs = M \<and> set xs \<subseteq> {0..<N}}
[PROOF STEP]
using finite_lists_length_eq[OF finite_atLeastLessThan] conj_commute
[PROOF STATE]
proof (prove)
using this:
finite {xs. set xs \<subseteq> {?l1..<?u1} \<and> length xs = ?n}
(?P \<and> ?Q) = (?Q \<and> ?P)

goal (1 subgoal):
 1. finite {xs. length xs = M \<and> set xs \<subseteq> {0..<N}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {xs. length xs = ?M2 \<and> set xs \<subseteq> {0..<?N2}}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have fin_A: "finite ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {l. length l = m - 1 \<and> sum_list l = N}
[PROOF STEP]
using fin[of _ "N+1"]
[PROOF STATE]
proof (prove)
using this:
finite {xs. length xs = ?M2 \<and> set xs \<subseteq> {0..<N + 1}}

goal (1 subgoal):
 1. finite {l. length l = m - 1 \<and> sum_list l = N}
[PROOF STEP]
by (intro finite_subset[where ?A = "?A" and ?B = "{xs. size xs = m - 1 \<and> set xs \<subseteq> {0..<N+1}}"])
      (auto simp: member_le_sum_list less_Suc_eq_le)
[PROOF STATE]
proof (state)
this:
finite {l. length l = m - 1 \<and> sum_list l = N}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have fin_B: "finite ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
by (intro finite_subset[where ?A = "?B" and ?B = "{xs. size xs = m \<and> set xs \<subseteq> {0..<N}}"])
      (auto simp: member_le_sum_list less_Suc_eq_le fin)
[PROOF STATE]
proof (state)
this:
finite {l. length l = m \<and> sum_list l + 1 = N}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have uni: "?C = ?A' \<union> ?B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l. length l = m \<and> sum_list l = N} = {l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{l. length l = m \<and> sum_list l = N} = {l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have disj: "?A' \<inter> ?B' = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<inter> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0} = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<inter> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0} = {}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have "card ?C = card(?A' \<union> ?B')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card ({l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0})
[PROOF STEP]
using uni
[PROOF STATE]
proof (prove)
using this:
{l. length l = m \<and> sum_list l = N} = {l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card ({l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l = N} = card ({l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0})

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l = N} = card ({l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0})

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
have "\<dots> = card ?A + card ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}) = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
using card_Un_disjoint[OF _ _ disj] bij_betw_finite[OF f] bij_betw_finite[OF g]
      bij_betw_same_card[OF f] bij_betw_same_card[OF g] fin_A fin_B
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {l. length l = m \<and> sum_list l = N \<and> hd l = 0}; finite {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}\<rbrakk> \<Longrightarrow> card ({l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}) = card {l. length l = m \<and> sum_list l = N \<and> hd l = 0} + card {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}
finite {l. length l = m - 1 \<and> sum_list l = N} = finite {l. length l = m \<and> sum_list l = N \<and> hd l = 0}
finite {l. length l = m \<and> sum_list l + 1 = N} = finite {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}
card {l. length l = m - 1 \<and> sum_list l = N} = card {l. length l = m \<and> sum_list l = N \<and> hd l = 0}
card {l. length l = m \<and> sum_list l + 1 = N} = card {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}
finite {l. length l = m - 1 \<and> sum_list l = N}
finite {l. length l = m \<and> sum_list l + 1 = N}

goal (1 subgoal):
 1. card ({l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}) = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
card ({l. length l = m \<and> sum_list l = N \<and> hd l = 0} \<union> {l. length l = m \<and> sum_list l = N \<and> hd l \<noteq> 0}) = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}

goal (1 subgoal):
 1. card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {l. length l = m \<and> sum_list l = N} = card {l. length l = m - 1 \<and> sum_list l = N} + card {l. length l = m \<and> sum_list l + 1 = N}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_smallest_prime_beyond [iff]: "prime (smallest_prime_beyond n)" (is ?P)
  and smallest_prime_beyond_le [iff]: "smallest_prime_beyond n \<ge> n" (is ?Q)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (smallest_prime_beyond n) &&& n \<le> smallest_prime_beyond n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prime (smallest_prime_beyond n)
 2. n \<le> smallest_prime_beyond n
[PROOF STEP]
let ?least = "LEAST p. prime p \<and> p \<ge> n"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prime (smallest_prime_beyond n)
 2. n \<le> smallest_prime_beyond n
[PROOF STEP]
from primes_infinite
[PROOF STATE]
proof (chain)
picking this:
infinite {p. prime p}
[PROOF STEP]
obtain q where "prime q \<and> q \<ge> n"
[PROOF STATE]
proof (prove)
using this:
infinite {p. prime p}

goal (1 subgoal):
 1. (\<And>q. prime q \<and> n \<le> q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis finite_nat_set_iff_bounded_le mem_Collect_eq nat_le_linear)
[PROOF STATE]
proof (state)
this:
prime q \<and> n \<le> q

goal (2 subgoals):
 1. prime (smallest_prime_beyond n)
 2. n \<le> smallest_prime_beyond n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime q \<and> n \<le> q
[PROOF STEP]
have "prime ?least \<and> ?least \<ge> n"
[PROOF STATE]
proof (prove)
using this:
prime q \<and> n \<le> q

goal (1 subgoal):
 1. prime (LEAST p. prime p \<and> n \<le> p) \<and> n \<le> (LEAST p. prime p \<and> n \<le> p)
[PROOF STEP]
by (rule LeastI)
[PROOF STATE]
proof (state)
this:
prime (LEAST p. prime p \<and> n \<le> p) \<and> n \<le> (LEAST p. prime p \<and> n \<le> p)

goal (2 subgoals):
 1. prime (smallest_prime_beyond n)
 2. n \<le> smallest_prime_beyond n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime (LEAST p. prime p \<and> n \<le> p) \<and> n \<le> (LEAST p. prime p \<and> n \<le> p)
[PROOF STEP]
show ?P and ?Q
[PROOF STATE]
proof (prove)
using this:
prime (LEAST p. prime p \<and> n \<le> p) \<and> n \<le> (LEAST p. prime p \<and> n \<le> p)

goal (1 subgoal):
 1. prime (smallest_prime_beyond n) &&& n \<le> smallest_prime_beyond n
[PROOF STEP]
by (simp_all add: smallest_prime_beyond_def)
[PROOF STATE]
proof (state)
this:
prime (smallest_prime_beyond n)
n \<le> smallest_prime_beyond n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma image_Set [code]:
  "image f (Set t) = fold_keys (\<lambda>k A. Set.insert (f k) A) t {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` Set t = fold_keys (\<lambda>k. insert (f k)) t {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` Set t = fold_keys (\<lambda>k. insert (f k)) t {}
[PROOF STEP]
have "comp_fun_commute (\<lambda>k. Set.insert (f k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>k. insert (f k))
[PROOF STEP]
by standard auto
[PROOF STATE]
proof (state)
this:
comp_fun_commute (\<lambda>k. insert (f k))

goal (1 subgoal):
 1. f ` Set t = fold_keys (\<lambda>k. insert (f k)) t {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
comp_fun_commute (\<lambda>k. insert (f k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
comp_fun_commute (\<lambda>k. insert (f k))

goal (1 subgoal):
 1. f ` Set t = fold_keys (\<lambda>k. insert (f k)) t {}
[PROOF STEP]
by (auto simp add: image_fold_insert intro!: finite_fold_fold_keys)
[PROOF STATE]
proof (state)
this:
f ` Set t = fold_keys (\<lambda>k. insert (f k)) t {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma algebraic_int_cnj_iff [simp]: "algebraic_int (cnj x) \<longleftrightarrow> algebraic_int x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_int (cnj x) = algebraic_int x
[PROOF STEP]
using algebraic_int_cnj[of x] algebraic_int_cnj[of "cnj x"]
[PROOF STATE]
proof (prove)
using this:
algebraic_int x \<Longrightarrow> algebraic_int (cnj x)
algebraic_int (cnj x) \<Longrightarrow> algebraic_int (cnj (cnj x))

goal (1 subgoal):
 1. algebraic_int (cnj x) = algebraic_int x
[PROOF STEP]
by auto


[STATEMENT]
lemma set_ass_list_to_single_list [simp]:
  "set (ass_list_to_single_list xs) = {x. \<exists>n. (x, n) \<in> set xs \<and> n > 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (ass_list_to_single_list xs) = {x. \<exists>n. (x, n) \<in> set xs \<and> 0 < n}
[PROOF STEP]
by (induct xs rule: ass_list_to_single_list.induct) auto


[STATEMENT]
lemma check_poly_weak_mono_all_pos:
  assumes "check_poly_weak_mono_all p" shows  "p \<ge>p zero_poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<ge>p zero_poly
[PROOF STEP]
unfolding zero_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<ge>p []
[PROOF STEP]
proof (rule check_poly_ge)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. check_poly_ge p []
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
check_poly_weak_mono_all p
[PROOF STEP]
have "\<And> m c. (m,c) \<in> set p \<Longrightarrow> c \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
check_poly_weak_mono_all p

goal (1 subgoal):
 1. \<And>m c. (m, c) \<in> set p \<Longrightarrow> (0::'b) \<le> c
[PROOF STEP]
unfolding check_poly_weak_mono_all_def
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>(m, c). (0::'b) \<le> c) p

goal (1 subgoal):
 1. \<And>m c. (m, c) \<in> set p \<Longrightarrow> (0::'b) \<le> c
[PROOF STEP]
by (auto simp: list_all_iff)
[PROOF STATE]
proof (state)
this:
(?m, ?c) \<in> set p \<Longrightarrow> (0::'b) \<le> ?c

goal (1 subgoal):
 1. check_poly_ge p []
[PROOF STEP]
thus "check_poly_ge p []"
[PROOF STATE]
proof (prove)
using this:
(?m, ?c) \<in> set p \<Longrightarrow> (0::'b) \<le> ?c

goal (1 subgoal):
 1. check_poly_ge p []
[PROOF STEP]
by (induct p, simp add: check_poly_ge.simps,  clarify, auto simp: check_poly_ge.simps extract_Nil_code)
[PROOF STATE]
proof (state)
this:
check_poly_ge p []

goal:
No subgoals!
[PROOF STEP]
qed