[STATEMENT]
lemma Farkas'_Lemma_indexed: fixes c :: "nat \<Rightarrow> rat le_constraint"
  assumes only_non_strict: "lec_rel ` c ` Is \<subseteq> {Leq_Rel}"
  and fin: "finite Is"
  shows "(\<nexists> v. \<forall> i \<in> Is. v \<Turnstile>\<^sub>l\<^sub>e c i) \<longleftrightarrow>
       (\<exists> C const. (\<forall> i \<in> Is. C i \<ge> 0)
         \<and> (\<Sum> i \<in> Is. Leqc ((C i) *R lec_poly (c i)) ((C i) *R lec_const (c i))) = Leqc 0 const
         \<and> const < 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
let ?C = "c ` Is"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
have fin: "finite ?C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (c ` Is)
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
finite Is

goal (1 subgoal):
 1. finite (c ` Is)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (c ` Is)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
have "(\<nexists> v. \<forall> i \<in> Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<nexists> v. \<forall> cc \<in> ?C. v \<Turnstile>\<^sub>l\<^sub>e cc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
have "\<dots> = (\<exists> C const. (\<forall> i \<in> Is. C i \<ge> 0)
         \<and> (\<Sum> i \<in> Is. Leqc ((C i) *R lec_poly (c i)) ((C i) *R lec_const (c i))) = Leqc 0 const
         \<and> const < 0)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
 2. \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0 \<Longrightarrow> \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc
[PROOF STEP]
assume ?r
[PROOF STATE]
proof (state)
this:
\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0

goal (2 subgoals):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
 2. \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0 \<Longrightarrow> \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
obtain C const where r: "(\<forall> i \<in> Is. C i \<ge> 0)"
         and eq: "(\<Sum> i \<in> Is. Leqc ((C i) *R lec_poly (c i)) ((C i) *R lec_const (c i))) = Leqc 0 const"
         and "const < 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0

goal (1 subgoal):
 1. (\<And>C const. \<lbrakk>\<forall>i\<in>Is. 0 \<le> C i; (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const; const < 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>Is. 0 \<le> C i
(\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const
const < 0

goal (2 subgoals):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
 2. \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0 \<Longrightarrow> \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc
[PROOF STEP]
from finite_distinct_list[OF \<open>finite Is\<close>]
[PROOF STATE]
proof (chain)
picking this:
\<exists>xs. set xs = Is \<and> distinct xs
[PROOF STEP]
obtain Isl where isl: "set Isl = Is" and dist: "distinct Isl"
[PROOF STATE]
proof (prove)
using this:
\<exists>xs. set xs = Is \<and> distinct xs

goal (1 subgoal):
 1. (\<And>Isl. \<lbrakk>set Isl = Is; distinct Isl\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Isl = Is
distinct Isl

goal (2 subgoals):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
 2. \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0 \<Longrightarrow> \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc
[PROOF STEP]
let ?CC = "filter (\<lambda> rc. fst rc \<noteq> 0) (map (\<lambda> i. (C i, c i)) Isl)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
 2. \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0 \<Longrightarrow> \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc
[PROOF STEP]
unfolding Farkas'_Lemma[OF only_non_strict fin]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C const. (\<forall>(r, ca)\<in>set C. 0 < r \<and> ca \<in> c ` Is) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint Leq_Rel (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
proof (intro exI[of _ ?CC] exI[of _ const] conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>(r, ca)\<in>set (filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl)). 0 < r \<and> ca \<in> c ` Is
 2. (\<Sum>(r, c)\<leftarrow>filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl). Le_Constraint Leq_Rel (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint Leq_Rel 0 const
 3. const < 0
[PROOF STEP]
show "const < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. const < 0
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
const < 0

goal (2 subgoals):
 1. \<forall>(r, ca)\<in>set (filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl)). 0 < r \<and> ca \<in> c ` Is
 2. (\<Sum>(r, c)\<leftarrow>filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl). Le_Constraint Leq_Rel (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint Leq_Rel 0 const
[PROOF STEP]
show "\<forall> (r, ca) \<in> set ?CC. 0 < r \<and> ca \<in> ?C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(r, ca)\<in>set (filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl)). 0 < r \<and> ca \<in> c ` Is
[PROOF STEP]
using r(1) isl
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>Is. 0 \<le> C i
set Isl = Is

goal (1 subgoal):
 1. \<forall>(r, ca)\<in>set (filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl)). 0 < r \<and> ca \<in> c ` Is
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>(r, ca)\<in>set (filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl)). 0 < r \<and> ca \<in> c ` Is

goal (1 subgoal):
 1. (\<Sum>(r, c)\<leftarrow>filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl). Le_Constraint Leq_Rel (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint Leq_Rel 0 const
[PROOF STEP]
show "(\<Sum>(r, c)\<leftarrow>?CC. Le_Constraint Leq_Rel (r *R lec_poly c) (r *R lec_const c)) =
        Le_Constraint Leq_Rel 0 const"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(r, c)\<leftarrow>filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl). Le_Constraint Leq_Rel (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint Leq_Rel 0 const
[PROOF STEP]
unfolding eq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(r, c)\<leftarrow>filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl). Le_Constraint Leq_Rel (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i)))
[PROOF STEP]
by (subst sum_list_map_filter, force simp: zero_le_constraint_def,
          unfold map_map o_def, subst sum_list_distinct_conv_sum_set[OF dist], rule sum.cong, auto simp: isl)
[PROOF STATE]
proof (state)
this:
(\<Sum>(r, c)\<leftarrow>filter (\<lambda>rc. fst rc \<noteq> 0) (map (\<lambda>i. (C i, c i)) Isl). Le_Constraint Leq_Rel (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint Leq_Rel 0 const

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc

goal (1 subgoal):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
assume ?l
[PROOF STATE]
proof (state)
this:
\<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc

goal (1 subgoal):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
from this[unfolded Farkas'_Lemma_set_sum[OF only_non_strict fin]]
[PROOF STATE]
proof (chain)
picking this:
\<exists>C const. (\<forall>c\<in>c ` Is. 0 \<le> C c) \<and> (\<Sum>c\<in>c ` Is. Le_Constraint Leq_Rel (C c *R lec_poly c) (C c *R lec_const c)) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
obtain C const where nonneg: "(\<forall>c\<in> ?C. 0 \<le> C c)"
     and sum: "(\<Sum>c\<in> ?C. Le_Constraint Leq_Rel (C c *R lec_poly c) (C c *R lec_const c)) =
        Le_Constraint Leq_Rel 0 const"
     and const: "const < 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>C const. (\<forall>c\<in>c ` Is. 0 \<le> C c) \<and> (\<Sum>c\<in>c ` Is. Le_Constraint Leq_Rel (C c *R lec_poly c) (C c *R lec_const c)) = Le_Constraint Leq_Rel 0 const \<and> const < 0

goal (1 subgoal):
 1. (\<And>C const. \<lbrakk>\<forall>c\<in>c ` Is. 0 \<le> C c; (\<Sum>c\<in>c ` Is. Le_Constraint Leq_Rel (C c *R lec_poly c) (C c *R lec_const c)) = Le_Constraint Leq_Rel 0 const; const < 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>c\<in>c ` Is. 0 \<le> C c
(\<Sum>c\<in>c ` Is. Le_Constraint Leq_Rel (C c *R lec_poly c) (C c *R lec_const c)) = Le_Constraint Leq_Rel 0 const
const < 0

goal (1 subgoal):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
define I where "I = (\<lambda> i. (C (c i) / rat_of_nat (card (Is \<inter> { j. c i = c j}))))"
[PROOF STATE]
proof (state)
this:
I = (\<lambda>i. C (c i) / rat_of_nat (card (Is \<inter> {j. c i = c j})))

goal (1 subgoal):
 1. \<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc \<Longrightarrow> \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
show ?r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0
[PROOF STEP]
proof (intro exI[of _ I] exI[of _ const] conjI const)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i\<in>Is. 0 \<le> I i
 2. (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const
[PROOF STEP]
show "\<forall>i \<in> Is. 0 \<le> I i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>Is. 0 \<le> I i
[PROOF STEP]
using nonneg
[PROOF STATE]
proof (prove)
using this:
\<forall>c\<in>c ` Is. 0 \<le> C c

goal (1 subgoal):
 1. \<forall>i\<in>Is. 0 \<le> I i
[PROOF STEP]
unfolding I_def
[PROOF STATE]
proof (prove)
using this:
\<forall>c\<in>c ` Is. 0 \<le> C c

goal (1 subgoal):
 1. \<forall>i\<in>Is. 0 \<le> C (c i) / rat_of_nat (card (Is \<inter> {j. c i = c j}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>Is. 0 \<le> I i

goal (1 subgoal):
 1. (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const
[PROOF STEP]
show "(\<Sum> i \<in> Is. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) =
        Le_Constraint Leq_Rel 0 const"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const
[PROOF STEP]
unfolding sum[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = (\<Sum>c\<in>c ` Is. Le_Constraint Leq_Rel (C c *R lec_poly c) (C c *R lec_const c))
[PROOF STEP]
unfolding sum.image_gen[OF \<open>finite Is\<close>, of _ c]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>y\<in>c ` Is. \<Sum>i\<in>{x \<in> Is. c x = y}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = (\<Sum>c\<in>c ` Is. Le_Constraint Leq_Rel (C c *R lec_poly c) (C c *R lec_const c))
[PROOF STEP]
proof (rule sum.cong[OF refl], goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
case (1 cc)
[PROOF STATE]
proof (state)
this:
cc \<in> c ` Is

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
define II where "II = (Is \<inter> {j. cc = c j})"
[PROOF STATE]
proof (state)
this:
II = Is \<inter> {j. cc = c j}

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
cc \<in> c ` Is
[PROOF STEP]
have "II \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
cc \<in> c ` Is

goal (1 subgoal):
 1. II \<noteq> {}
[PROOF STEP]
unfolding II_def
[PROOF STATE]
proof (prove)
using this:
cc \<in> c ` Is

goal (1 subgoal):
 1. Is \<inter> {j. cc = c j} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
II \<noteq> {}

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
II \<noteq> {}

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
have finII: "finite II"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite II
[PROOF STEP]
using \<open>finite Is\<close>
[PROOF STATE]
proof (prove)
using this:
finite Is

goal (1 subgoal):
 1. finite II
[PROOF STEP]
unfolding II_def
[PROOF STATE]
proof (prove)
using this:
finite Is

goal (1 subgoal):
 1. finite (Is \<inter> {j. cc = c j})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite II

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
II \<noteq> {}
finite II
[PROOF STEP]
have card: "card II \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
II \<noteq> {}
finite II

goal (1 subgoal):
 1. card II \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card II \<noteq> 0

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
let ?C = "\<lambda> II. rat_of_nat (card II)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
define ii where "ii = C cc / rat_of_nat (card II)"
[PROOF STATE]
proof (state)
this:
ii = C cc / rat_of_nat (card II)

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
have "(\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i)))
          = (\<Sum> i\<in> II. Le_Constraint Leq_Rel (ii *R lec_poly cc) (ii *R lec_const cc))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = (\<Sum>i\<in>II. Le_Constraint Leq_Rel (ii *R lec_poly cc) (ii *R lec_const cc))
[PROOF STEP]
unfolding I_def ii_def II_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel ((C (c i) / rat_of_nat (card (Is \<inter> {j. c i = c j}))) *R lec_poly (c i)) ((C (c i) / rat_of_nat (card (Is \<inter> {j. c i = c j}))) *R lec_const (c i))) = (\<Sum>i\<in>Is \<inter> {j. cc = c j}. Le_Constraint Leq_Rel ((C cc / rat_of_nat (card (Is \<inter> {j. cc = c j}))) *R lec_poly cc) ((C cc / rat_of_nat (card (Is \<inter> {j. cc = c j}))) *R lec_const cc))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = (\<Sum>i\<in>II. Le_Constraint Leq_Rel (ii *R lec_poly cc) (ii *R lec_const cc))

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = (\<Sum>i\<in>II. Le_Constraint Leq_Rel (ii *R lec_poly cc) (ii *R lec_const cc))

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
have "\<dots> = Le_Constraint Leq_Rel ((?C II * ii) *R lec_poly cc) ((?C II * ii) *R lec_const cc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>II. Le_Constraint Leq_Rel (ii *R lec_poly cc) (ii *R lec_const cc)) = Le_Constraint Leq_Rel ((rat_of_nat (card II) * ii) *R lec_poly cc) ((rat_of_nat (card II) * ii) *R lec_const cc)
[PROOF STEP]
using finII
[PROOF STATE]
proof (prove)
using this:
finite II

goal (1 subgoal):
 1. (\<Sum>i\<in>II. Le_Constraint Leq_Rel (ii *R lec_poly cc) (ii *R lec_const cc)) = Le_Constraint Leq_Rel ((rat_of_nat (card II) * ii) *R lec_poly cc) ((rat_of_nat (card II) * ii) *R lec_const cc)
[PROOF STEP]
by (induct II rule: finite_induct, auto simp: zero_le_constraint_def field_simps
            scaleRat_left_distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>II. Le_Constraint Leq_Rel (ii *R lec_poly cc) (ii *R lec_const cc)) = Le_Constraint Leq_Rel ((rat_of_nat (card II) * ii) *R lec_poly cc) ((rat_of_nat (card II) * ii) *R lec_const cc)

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>II. Le_Constraint Leq_Rel (ii *R lec_poly cc) (ii *R lec_const cc)) = Le_Constraint Leq_Rel ((rat_of_nat (card II) * ii) *R lec_poly cc) ((rat_of_nat (card II) * ii) *R lec_const cc)

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
have "?C II * ii = C cc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_nat (card II) * ii = C cc
[PROOF STEP]
unfolding ii_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_nat (card II) * (C cc / rat_of_nat (card II)) = C cc
[PROOF STEP]
using card
[PROOF STATE]
proof (prove)
using this:
card II \<noteq> 0

goal (1 subgoal):
 1. rat_of_nat (card II) * (C cc / rat_of_nat (card II)) = C cc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_of_nat (card II) * ii = C cc

goal (1 subgoal):
 1. \<And>x. x \<in> c ` Is \<Longrightarrow> (\<Sum>i\<in>{xa \<in> Is. c xa = x}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C x *R lec_poly x) (C x *R lec_const x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C cc *R lec_poly cc) (C cc *R lec_const cc)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C cc *R lec_poly cc) (C cc *R lec_const cc)

goal (1 subgoal):
 1. (\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C cc *R lec_poly cc) (C cc *R lec_const cc)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{x \<in> Is. c x = cc}. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel (C cc *R lec_poly cc) (C cc *R lec_const cc)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>Is. Le_Constraint Leq_Rel (I i *R lec_poly (c i)) (I i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<nexists>v. \<forall>cc\<in>c ` Is. v \<Turnstile>\<^sub>l\<^sub>e cc) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<nexists>v. \<forall>i\<in>Is. v \<Turnstile>\<^sub>l\<^sub>e c i) = (\<exists>C const. (\<forall>i\<in>Is. 0 \<le> C i) \<and> (\<Sum>i\<in>Is. Le_Constraint Leq_Rel (C i *R lec_poly (c i)) (C i *R lec_const (c i))) = Le_Constraint Leq_Rel 0 const \<and> const < 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_mult_scalar_distrib_right: "(sum f A) \<odot> v = (\<Sum>a\<in>A. f a \<odot> v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A \<odot> v = (\<Sum>a\<in>A. f a \<odot> v)
[PROOF STEP]
by (induct A rule: infinite_finite_induct, simp_all add: algebra_simps)


[STATEMENT]
lemma triangle_vertices_distinct2:
  assumes "triangle_in_graph x y z"
  shows "y \<noteq> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<noteq> z
[PROOF STEP]
by (metis assms triangle_vertices_distinct1 triangle_in_graph_def)


[STATEMENT]
lemma less_mask_eq:
  fixes x :: "'a::len word"
  assumes "x < 2 ^ n" shows "x AND mask n = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x AND mask n = x
[PROOF STEP]
by (metis (no_types) assms lt2p_lem mask_eq_iff not_less word_2p_lem word_size)


[STATEMENT]
lemma path_lverts_list_merge_supset_xs_notin:
  "\<forall>v \<in> fst ` set ys. a \<notin> set v
    \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs ys) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>fst ` set ys. a \<notin> set v \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs ys) a
[PROOF STEP]
proof(induction xs ys taking: cmp rule: Sorting_Algorithms.merge.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>ys. \<forall>v\<in>fst ` set ys. a \<notin> set v \<Longrightarrow> path_lverts_list [] a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp [] ys) a
 2. \<And>xs. \<forall>v\<in>fst ` set []. a \<notin> set v \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs []) a
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare cmp x y = Greater; \<forall>v\<in>fst ` set ys. a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) ys) a; \<lbrakk>compare cmp x y \<noteq> Greater; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs (y # ys)) a; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) (y # ys)) a
[PROOF STEP]
case (3 x xs y ys)
[PROOF STATE]
proof (state)
this:
\<lbrakk>compare cmp x y = Greater; \<forall>v\<in>fst ` set ys. a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) ys) a
\<lbrakk>compare cmp x y \<noteq> Greater; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs (y # ys)) a
\<forall>v\<in>fst ` set (y # ys). a \<notin> set v

goal (3 subgoals):
 1. \<And>ys. \<forall>v\<in>fst ` set ys. a \<notin> set v \<Longrightarrow> path_lverts_list [] a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp [] ys) a
 2. \<And>xs. \<forall>v\<in>fst ` set []. a \<notin> set v \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs []) a
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare cmp x y = Greater; \<forall>v\<in>fst ` set ys. a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) ys) a; \<lbrakk>compare cmp x y \<noteq> Greater; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs (y # ys)) a; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) (y # ys)) a
[PROOF STEP]
obtain v1 e1 where v1_def[simp]: "x = (v1,e1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v1 e1. x = (v1, e1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x = (v1, e1)

goal (3 subgoals):
 1. \<And>ys. \<forall>v\<in>fst ` set ys. a \<notin> set v \<Longrightarrow> path_lverts_list [] a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp [] ys) a
 2. \<And>xs. \<forall>v\<in>fst ` set []. a \<notin> set v \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs []) a
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare cmp x y = Greater; \<forall>v\<in>fst ` set ys. a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) ys) a; \<lbrakk>compare cmp x y \<noteq> Greater; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs (y # ys)) a; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) (y # ys)) a
[PROOF STEP]
obtain v2 e2 where "y = (v2,e2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v2 e2. y = (v2, e2) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
y = (v2, e2)

goal (3 subgoals):
 1. \<And>ys. \<forall>v\<in>fst ` set ys. a \<notin> set v \<Longrightarrow> path_lverts_list [] a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp [] ys) a
 2. \<And>xs. \<forall>v\<in>fst ` set []. a \<notin> set v \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs []) a
 3. \<And>x xs y ys. \<lbrakk>\<lbrakk>compare cmp x y = Greater; \<forall>v\<in>fst ` set ys. a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) ys) a; \<lbrakk>compare cmp x y \<noteq> Greater; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs (y # ys)) a; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) (y # ys)) a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = (v2, e2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
y = (v2, e2)

goal (1 subgoal):
 1. path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) (y # ys)) a
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
y = (v2, e2)
\<lbrakk>compare cmp x y = Greater; \<forall>v\<in>fst ` set ys. a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) ys) a
\<lbrakk>compare cmp x y \<noteq> Greater; \<forall>v\<in>fst ` set (y # ys). a \<notin> set v\<rbrakk> \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs (y # ys)) a
\<forall>v\<in>fst ` set (y # ys). a \<notin> set v

goal (1 subgoal):
 1. path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) (y # ys)) a
[PROOF STEP]
by (auto simp: path_lverts_list_def)
[PROOF STATE]
proof (state)
this:
path_lverts_list (x # xs) a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp (x # xs) (y # ys)) a

goal (2 subgoals):
 1. \<And>ys. \<forall>v\<in>fst ` set ys. a \<notin> set v \<Longrightarrow> path_lverts_list [] a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp [] ys) a
 2. \<And>xs. \<forall>v\<in>fst ` set []. a \<notin> set v \<Longrightarrow> path_lverts_list xs a \<subseteq> path_lverts_list (Sorting_Algorithms.merge cmp xs []) a
[PROOF STEP]
qed (auto simp: path_lverts_list_def)


[STATEMENT]
lemma poly_of_int_poly_1 [simp]: "poly (of_int_poly p) 1 = of_int (poly p 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (of_int_poly p) (1::'a) = of_int (poly p 1)
[PROOF STEP]
by (induction p) simp_all


[STATEMENT]
lemma game_ext_eq: "(G = H) = (left_options G = left_options H \<and> right_options G = right_options H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (G = H) = (left_options G = left_options H \<and> right_options G = right_options H)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (G = H) = (left_options G = left_options H \<and> right_options G = right_options H)
[PROOF STEP]
have "(G = H) = (Game (left_options G) (right_options G) = Game (left_options H) (right_options H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (G = H) = (Game (left_options G) (right_options G) = Game (left_options H) (right_options H))
[PROOF STEP]
by (simp add: game_split[symmetric])
[PROOF STATE]
proof (state)
this:
(G = H) = (Game (left_options G) (right_options G) = Game (left_options H) (right_options H))

goal (1 subgoal):
 1. (G = H) = (left_options G = left_options H \<and> right_options G = right_options H)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(G = H) = (Game (left_options G) (right_options G) = Game (left_options H) (right_options H))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(G = H) = (Game (left_options G) (right_options G) = Game (left_options H) (right_options H))

goal (1 subgoal):
 1. (G = H) = (left_options G = left_options H \<and> right_options G = right_options H)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(G = H) = (left_options G = left_options H \<and> right_options G = right_options H)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_MkIde_elem_of_img:
    assumes "A \<subseteq> S.Univ" and "S.ide (S.MkIde (elem_of ` A))"
    shows "S.set (S.MkIde (elem_of ` A)) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S.set (S.MkIde (elem_of ` A)) = A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S.set (S.MkIde (elem_of ` A)) = A
[PROOF STEP]
have "S.Dom (S.MkIde (elem_of ` A)) = elem_of ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S.Dom (S.MkIde (elem_of ` A)) = elem_of ` A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
S.Dom (S.MkIde (elem_of ` A)) = elem_of ` A

goal (1 subgoal):
 1. S.set (S.MkIde (elem_of ` A)) = A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S.Dom (S.MkIde (elem_of ` A)) = elem_of ` A

goal (1 subgoal):
 1. S.set (S.MkIde (elem_of ` A)) = A
[PROOF STEP]
have "arr_of ` elem_of ` A = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr_of ` elem_of ` A = A
[PROOF STEP]
using assms arr_of_elem_of
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> S.Univ
S.ide (S.MkIde (elem_of ` A))
?t \<in> S.Univ \<Longrightarrow> arr_of (elem_of ?t) = ?t

goal (1 subgoal):
 1. arr_of ` elem_of ` A = A
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
arr_of ` elem_of ` A = A

goal (1 subgoal):
 1. S.set (S.MkIde (elem_of ` A)) = A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S.Dom (S.MkIde (elem_of ` A)) = elem_of ` A
arr_of ` elem_of ` A = A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S.Dom (S.MkIde (elem_of ` A)) = elem_of ` A
arr_of ` elem_of ` A = A

goal (1 subgoal):
 1. S.set (S.MkIde (elem_of ` A)) = A
[PROOF STEP]
using assms Setp_elem_of_img set_char S.ide_MkIde
[PROOF STATE]
proof (prove)
using this:
S.Dom (S.MkIde (elem_of ` A)) = elem_of ` A
arr_of ` elem_of ` A = A
A \<subseteq> S.Univ
S.ide (S.MkIde (elem_of ` A))
?A \<in> S.set ` Collect S.ide \<Longrightarrow> Setp (elem_of ` ?A)
S.ide ?a \<Longrightarrow> S.set ?a = arr_of ` S.Dom ?a
?A \<in> Collect Setp \<Longrightarrow> S.ide (S.MkIde ?A)

goal (1 subgoal):
 1. S.set (S.MkIde (elem_of ` A)) = A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S.set (S.MkIde (elem_of ` A)) = A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_le_trans[trans]: "\<lbrakk> m1 \<subseteq>\<^sub>m m2; m2 \<subseteq>\<^sub>m m3\<rbrakk> \<Longrightarrow> m1 \<subseteq>\<^sub>m m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m1 \<subseteq>\<^sub>m m2; m2 \<subseteq>\<^sub>m m3\<rbrakk> \<Longrightarrow> m1 \<subseteq>\<^sub>m m3
[PROOF STEP]
by (auto simp add: map_le_def dom_def)


[STATEMENT]
lemma oppositeLiteralsHaveSameVariable [simp]:
  fixes literal::Literal
  shows "var (opposite literal) = var literal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. var (opposite literal) = var literal
[PROOF STEP]
by (induct literal) auto