by standard (auto simp: less_eq_complex_lex_def less_complex_lex_def complex_eq_iff)

lemmas [trans] =

complex_lex.order.trans complex_lex.less_le_trans

complex_lex.less_trans complex_lex.le_less_trans

lemma (in ordered_comm_monoid_add) sum_mono_complex_lex:

"(\<And>i. i\<in>K \<Longrightarrow> f i \<le>\<^sub>\<complex> g i) \<Longrightarrow> (\<Sum>i\<in>K. f i) \<le>\<^sub>\<complex> (\<Sum>i\<in>K. g i)"

by (induct K rule: infinite_finite_induct) (use complex_lex.add_mono in auto)

lemma sum_strict_mono_ex1_complex_lex:

fixes f g :: "'i \<Rightarrow> complex"

assumes "finite A"

and "\<forall>x\<in>A. f x \<le>\<^sub>\<complex> g x"

and "\<exists>a\<in>A. f a <\<^sub>\<complex> g a"

shows "sum f A <\<^sub>\<complex> sum g A"

proof-

from assms(3) obtain a where a: "a \<in> A" "f a <\<^sub>\<complex> g a" by blast

have "sum f A = sum f ((A - {a}) \<union> {a})"

by (simp add: insert_absorb[OF \<open>a \<in> A\<close>])

also have "\<dots> = sum f (A - {a}) + sum f {a}"

using \<open>finite A\<close> by (subst sum.union_disjoint) auto

also have "\<dots> \<le>\<^sub>\<complex> sum g (A - {a}) + sum f {a}"

by (intro complex_lex.add_mono sum_mono_complex_lex) (simp_all add: assms)

also have "\<dots> <\<^sub>\<complex> sum g (A - {a}) + sum g {a}"

using a by (intro complex_lex.add_strict_left_mono) auto

also have "\<dots> = sum g ((A - {a}) \<union> {a})"

using \<open>finite A\<close> by (subst sum.union_disjoint[symmetric]) auto

also have "\<dots> = sum g A" by (simp add: insert_absorb[OF \<open>a \<in> A\<close>])