[STATEMENT]
lemma ordered_incidence_sysI:
  assumes "finite_incidence_system \<V> \<B>"
  assumes "\<V>s \<in> permutations_of_set \<V>" and "\<B>s \<in> permutations_of_multiset \<B>"
  shows "ordered_incidence_system \<V>s \<B>s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordered_incidence_system \<V>s \<B>s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ordered_incidence_system \<V>s \<B>s
[PROOF STEP]
have veq: "\<V> = set \<V>s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<V> = set \<V>s
[PROOF STEP]
using assms permutations_of_setD(1)
[PROOF STATE]
proof (prove)
using this:
finite_incidence_system \<V> \<B>
\<V>s \<in> permutations_of_set \<V>
\<B>s \<in> permutations_of_multiset \<B>
?xs \<in> permutations_of_set ?A \<Longrightarrow> set ?xs = ?A

goal (1 subgoal):
 1. \<V> = set \<V>s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<V> = set \<V>s

goal (1 subgoal):
 1. ordered_incidence_system \<V>s \<B>s
[PROOF STEP]
have beq: "\<B> = mset \<B>s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<B> = mset \<B>s
[PROOF STEP]
using assms permutations_of_multisetD
[PROOF STATE]
proof (prove)
using this:
finite_incidence_system \<V> \<B>
\<V>s \<in> permutations_of_set \<V>
\<B>s \<in> permutations_of_multiset \<B>
?xs \<in> permutations_of_multiset ?A \<Longrightarrow> mset ?xs = ?A

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

goal (1 subgoal):
 1. ordered_incidence_system \<V>s \<B>s
[PROOF STEP]
interpret fisys: finite_incidence_system "set \<V>s" "mset \<B>s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_incidence_system (set \<V>s) (mset \<B>s)
[PROOF STEP]
using assms(1) veq beq
[PROOF STATE]
proof (prove)
using this:
finite_incidence_system \<V> \<B>
\<V> = set \<V>s
\<B> = mset \<B>s

goal (1 subgoal):
 1. finite_incidence_system (set \<V>s) (mset \<B>s)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ordered_incidence_system \<V>s \<B>s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordered_incidence_system \<V>s \<B>s
[PROOF STEP]
proof (unfold_locales)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>b. b \<in># mset \<B>s \<Longrightarrow> b \<subseteq> set \<V>s
 2. distinct \<V>s
[PROOF STEP]
show "\<And>b. b \<in># mset \<B>s \<Longrightarrow> b \<subseteq> set \<V>s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. b \<in># mset \<B>s \<Longrightarrow> b \<subseteq> set \<V>s
[PROOF STEP]
using fisys.wellformed
[PROOF STATE]
proof (prove)
using this:
?b \<in># mset \<B>s \<Longrightarrow> ?b \<subseteq> set \<V>s

goal (1 subgoal):
 1. \<And>b. b \<in># mset \<B>s \<Longrightarrow> b \<subseteq> set \<V>s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?b \<in># mset \<B>s \<Longrightarrow> ?b \<subseteq> set \<V>s

goal (1 subgoal):
 1. distinct \<V>s
[PROOF STEP]
show "distinct \<V>s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct \<V>s
[PROOF STEP]
using assms permutations_of_setD(2)
[PROOF STATE]
proof (prove)
using this:
finite_incidence_system \<V> \<B>
\<V>s \<in> permutations_of_set \<V>
\<B>s \<in> permutations_of_multiset \<B>
?xs \<in> permutations_of_set ?A \<Longrightarrow> distinct ?xs

goal (1 subgoal):
 1. distinct \<V>s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct \<V>s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ordered_incidence_system \<V>s \<B>s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nfoldli_alt_simp[simp]:
  "nfoldli_alt [] c f s = RETURN s"
  "nfoldli_alt (x#ls) c f s = do {
    let b = c s;
    if b then f x s \<bind> nfoldli_alt ls c f else RETURN s
  }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli_alt [] c f s = RETURN s &&& nfoldli_alt (x # ls) c f s = (let b = c s in if b then f x s \<bind> nfoldli_alt ls c f else RETURN s)
[PROOF STEP]
apply (subst nfoldli_alt_eq, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli_alt (x # ls) c f s = (let b = c s in if b then f x s \<bind> nfoldli_alt ls c f else RETURN s)
[PROOF STEP]
apply (subst nfoldli_alt_eq, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma literalElListIffOppositeLiteralElOppositeLiteralList:
  fixes literal :: Literal and literalList :: "Literal list"
  shows "literal el literalList = (opposite literal) el (oppositeLiteralList literalList)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. literal el literalList = opposite literal el oppositeLiteralList literalList
[PROOF STEP]
unfolding oppositeLiteralList_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. literal el literalList = opposite literal el map opposite literalList
[PROOF STEP]
proof (induct literalList)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. literal el [] = opposite literal el map opposite []
 2. \<And>a literalList. literal el literalList = opposite literal el map opposite literalList \<Longrightarrow> literal el a # literalList = opposite literal el map opposite (a # literalList)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. literal el [] = opposite literal el map opposite []
 2. \<And>a literalList. literal el literalList = opposite literal el map opposite literalList \<Longrightarrow> literal el a # literalList = opposite literal el map opposite (a # literalList)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. literal el [] = opposite literal el map opposite []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
literal el [] = opposite literal el map opposite []

goal (1 subgoal):
 1. \<And>a literalList. literal el literalList = opposite literal el map opposite literalList \<Longrightarrow> literal el a # literalList = opposite literal el map opposite (a # literalList)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a literalList. literal el literalList = opposite literal el map opposite literalList \<Longrightarrow> literal el a # literalList = opposite literal el map opposite (a # literalList)
[PROOF STEP]
case (Cons l literalLlist')
[PROOF STATE]
proof (state)
this:
literal el literalLlist' = opposite literal el map opposite literalLlist'

goal (1 subgoal):
 1. \<And>a literalList. literal el literalList = opposite literal el map opposite literalList \<Longrightarrow> literal el a # literalList = opposite literal el map opposite (a # literalList)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
[PROOF STEP]
proof (cases "l = literal")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. l = literal \<Longrightarrow> literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
 2. l \<noteq> literal \<Longrightarrow> literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
l = literal

goal (2 subgoals):
 1. l = literal \<Longrightarrow> literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
 2. l \<noteq> literal \<Longrightarrow> literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
l = literal

goal (1 subgoal):
 1. literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')

goal (1 subgoal):
 1. l \<noteq> literal \<Longrightarrow> literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l \<noteq> literal \<Longrightarrow> literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
l \<noteq> literal

goal (1 subgoal):
 1. l \<noteq> literal \<Longrightarrow> literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
l \<noteq> literal

goal (1 subgoal):
 1. literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
literal el l # literalLlist' = opposite literal el map opposite (l # literalLlist')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rbt_sorted_fold_rbt_insertwk:
  "rbt_sorted t \<Longrightarrow> rbt_sorted (List.fold (\<lambda>(k, v). rbt_insert_with_key f k v) xs t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rbt_sorted t \<Longrightarrow> rbt_sorted (List.fold (\<lambda>(k, v). rbt_insert_with_key f k v) xs t)
[PROOF STEP]
by(induct xs rule: rev_induct)(auto simp add: rbt_insertwk_rbt_sorted)


[STATEMENT]
lemma mset_neg_sum_set: "(\<And>m. m \<in> M \<Longrightarrow> mset_neg (f m) = {#}) \<Longrightarrow> mset_neg (\<Sum>m\<in>M. f m) = {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m. m \<in> M \<Longrightarrow> mset_neg (f m) = {#}) \<Longrightarrow> mset_neg (sum f M) = {#}
[PROOF STEP]
by (induct M rule: infinite_finite_induct) auto


[STATEMENT]
lemma gauss_eq:
  \<open>a = of_int (Re a) + \<i> * of_int (Im a)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = of_int (Re a) + \<i> * of_int (Im a)
[PROOF STEP]
by (simp add: gauss_eq_iff)


[STATEMENT]
lemma isUbD: "isUb R S x \<Longrightarrow> y \<in> S \<Longrightarrow> y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isUb R S x; y \<in> S\<rbrakk> \<Longrightarrow> y \<le> x
[PROOF STEP]
by (simp add: isUb_def setle_def)


[STATEMENT]
lemma interior_ball [simp]: "interior (ball x e) = ball x e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior (ball x e) = ball x e
[PROOF STEP]
by (simp add: interior_open)


[STATEMENT]
lemma initial_ofsm_table_lookup_invar: "ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q . states M) 0 q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
proof (cases "q \<in> states M")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q \<in> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
 2. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
q \<in> FSM.states M

goal (2 subgoals):
 1. q \<in> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
 2. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<in> FSM.states M
[PROOF STEP]
have "q \<in> list.set (states_as_list M)"
[PROOF STATE]
proof (prove)
using this:
q \<in> FSM.states M

goal (1 subgoal):
 1. q \<in> set (states_as_list M)
[PROOF STEP]
using states_as_list_set
[PROOF STATE]
proof (prove)
using this:
q \<in> FSM.states M
set (states_as_list ?M) = FSM.states ?M

goal (1 subgoal):
 1. q \<in> set (states_as_list M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q \<in> set (states_as_list M)

goal (2 subgoals):
 1. q \<in> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
 2. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<in> set (states_as_list M)
[PROOF STEP]
have "Mapping.lookup (initial_ofsm_table M) q = Some (states M)"
[PROOF STATE]
proof (prove)
using this:
q \<in> set (states_as_list M)

goal (1 subgoal):
 1. Mapping.lookup (initial_ofsm_table M) q = Some (FSM.states M)
[PROOF STEP]
unfolding initial_ofsm_table.simps
[PROOF STATE]
proof (prove)
using this:
q \<in> set (states_as_list M)

goal (1 subgoal):
 1. Mapping.lookup (Mapping.tabulate (states_as_list M) (\<lambda>q. FSM.states M)) q = Some (FSM.states M)
[PROOF STEP]
by (simp add: lookup_tabulate)
[PROOF STATE]
proof (state)
this:
Mapping.lookup (initial_ofsm_table M) q = Some (FSM.states M)

goal (2 subgoals):
 1. q \<in> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
 2. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup (initial_ofsm_table M) q = Some (FSM.states M)
[PROOF STEP]
have "ofsm_lookup (initial_ofsm_table M) q = states M"
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (initial_ofsm_table M) q = Some (FSM.states M)

goal (1 subgoal):
 1. ofsm_lookup (initial_ofsm_table M) q = FSM.states M
[PROOF STEP]
by (simp add: lookup_default_def)
[PROOF STATE]
proof (state)
this:
ofsm_lookup (initial_ofsm_table M) q = FSM.states M

goal (2 subgoals):
 1. q \<in> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
 2. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ofsm_lookup (initial_ofsm_table M) q = FSM.states M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (initial_ofsm_table M) q = FSM.states M

goal (1 subgoal):
 1. ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (initial_ofsm_table M) q = FSM.states M
q \<in> FSM.states M

goal (1 subgoal):
 1. ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q

goal (1 subgoal):
 1. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
q \<notin> FSM.states M

goal (1 subgoal):
 1. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<notin> FSM.states M
[PROOF STEP]
have "q \<notin> list.set (states_as_list M)"
[PROOF STATE]
proof (prove)
using this:
q \<notin> FSM.states M

goal (1 subgoal):
 1. q \<notin> set (states_as_list M)
[PROOF STEP]
using states_as_list_set
[PROOF STATE]
proof (prove)
using this:
q \<notin> FSM.states M
set (states_as_list ?M) = FSM.states ?M

goal (1 subgoal):
 1. q \<notin> set (states_as_list M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q \<notin> set (states_as_list M)

goal (1 subgoal):
 1. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<notin> set (states_as_list M)
[PROOF STEP]
have "Mapping.lookup (initial_ofsm_table M) q = None"
[PROOF STATE]
proof (prove)
using this:
q \<notin> set (states_as_list M)

goal (1 subgoal):
 1. Mapping.lookup (initial_ofsm_table M) q = None
[PROOF STEP]
unfolding initial_ofsm_table.simps
[PROOF STATE]
proof (prove)
using this:
q \<notin> set (states_as_list M)

goal (1 subgoal):
 1. Mapping.lookup (Mapping.tabulate (states_as_list M) (\<lambda>q. FSM.states M)) q = None
[PROOF STEP]
by (simp add: lookup_tabulate)
[PROOF STATE]
proof (state)
this:
Mapping.lookup (initial_ofsm_table M) q = None

goal (1 subgoal):
 1. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Mapping.lookup (initial_ofsm_table M) q = None
[PROOF STEP]
have "ofsm_lookup (initial_ofsm_table M) q = {}"
[PROOF STATE]
proof (prove)
using this:
Mapping.lookup (initial_ofsm_table M) q = None

goal (1 subgoal):
 1. ofsm_lookup (initial_ofsm_table M) q = {}
[PROOF STEP]
by (simp add: lookup_default_def)
[PROOF STATE]
proof (state)
this:
ofsm_lookup (initial_ofsm_table M) q = {}

goal (1 subgoal):
 1. q \<notin> FSM.states M \<Longrightarrow> ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ofsm_lookup (initial_ofsm_table M) q = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (initial_ofsm_table M) q = {}

goal (1 subgoal):
 1. ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
ofsm_lookup (initial_ofsm_table M) q = {}
q \<notin> FSM.states M

goal (1 subgoal):
 1. ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ofsm_lookup (initial_ofsm_table M) q = ofsm_table M (\<lambda>q. FSM.states M) 0 q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem subst_preserves_beta': "r \<rightarrow>\<^sub>\<beta>\<^sup>* s ==> r[t/i] \<rightarrow>\<^sub>\<beta>\<^sup>* s[t/i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<rightarrow>\<^sub>\<beta>\<^sup>* s \<Longrightarrow> r[t/i] \<rightarrow>\<^sub>\<beta>\<^sup>* s[t/i]
[PROOF STEP]
apply (induct set: rtranclp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. r[t/i] \<rightarrow>\<^sub>\<beta>\<^sup>* r[t/i]
 2. \<And>y z. \<lbrakk>r \<rightarrow>\<^sub>\<beta>\<^sup>* y; y \<rightarrow>\<^sub>\<beta> z; r[t/i] \<rightarrow>\<^sub>\<beta>\<^sup>* y[t/i]\<rbrakk> \<Longrightarrow> r[t/i] \<rightarrow>\<^sub>\<beta>\<^sup>* z[t/i]
[PROOF STEP]
apply (rule rtranclp.rtrancl_refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y z. \<lbrakk>r \<rightarrow>\<^sub>\<beta>\<^sup>* y; y \<rightarrow>\<^sub>\<beta> z; r[t/i] \<rightarrow>\<^sub>\<beta>\<^sup>* y[t/i]\<rbrakk> \<Longrightarrow> r[t/i] \<rightarrow>\<^sub>\<beta>\<^sup>* z[t/i]
[PROOF STEP]
apply (erule rtranclp.rtrancl_into_rtrancl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y z. \<lbrakk>r \<rightarrow>\<^sub>\<beta>\<^sup>* y; y \<rightarrow>\<^sub>\<beta> z\<rbrakk> \<Longrightarrow> y[t/i] \<rightarrow>\<^sub>\<beta> z[t/i]
[PROOF STEP]
apply (erule subst_preserves_beta)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma r01_to_r01_r01_snd'in01:
  "\<And>n. r01_to_r01_r01_snd' r n \<in> {0,1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. r01_to_r01_r01_snd' r n \<in> {0, 1}
[PROOF STEP]
using real01_binary_expansion'_0or1
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion' ?r ?n \<in> {0, 1}

goal (1 subgoal):
 1. \<And>n. r01_to_r01_r01_snd' r n \<in> {0, 1}
[PROOF STEP]
by (simp add: r01_to_r01_r01_snd'_def)


[STATEMENT]
lemma delete_node_is_path:
    assumes "is_path_undir G x p y"
    assumes "x \<noteq> v"
    assumes "v \<notin> fst`set p \<union> snd`snd`set p"
    shows "is_path_undir (delete_node v G) x p y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_path_undir (delete_node v G) x p y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_path_undir G x p y
x \<noteq> v
v \<notin> fst ` set p \<union> snd ` snd ` set p

goal (1 subgoal):
 1. is_path_undir (delete_node v G) x p y
[PROOF STEP]
unfolding delete_node_def
[PROOF STATE]
proof (prove)
using this:
is_path_undir G x p y
x \<noteq> v
v \<notin> fst ` set p \<union> snd ` snd ` set p

goal (1 subgoal):
 1. is_path_undir \<lparr>nodes = V - {v}, edges = E \<inter> (- {v}) \<times> UNIV \<times> - {v}\<rparr> x p y
[PROOF STEP]
by (induction p arbitrary: x y) auto


[STATEMENT]
lemma initial_ofsm_table_keys_invar: "Mapping.keys (initial_ofsm_table M) = states M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.keys (initial_ofsm_table M) = FSM.states M
[PROOF STEP]
using states_as_list_set[of M]
[PROOF STATE]
proof (prove)
using this:
set (states_as_list M) = FSM.states M

goal (1 subgoal):
 1. Mapping.keys (initial_ofsm_table M) = FSM.states M
[PROOF STEP]
by simp


[STATEMENT]
lemma bits_stable_imp_add_self:
  \<open>a + a mod 2 = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + a mod (2::'a) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a + a mod (2::'a) = (0::'a)
[PROOF STEP]
have \<open>a div 2 * 2 + a mod 2 = a\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a div (2::'a) * (2::'a) + a mod (2::'a) = a
[PROOF STEP]
by (fact div_mult_mod_eq)
[PROOF STATE]
proof (state)
this:
a div (2::'a) * (2::'a) + a mod (2::'a) = a

goal (1 subgoal):
 1. a + a mod (2::'a) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a div (2::'a) * (2::'a) + a mod (2::'a) = a
[PROOF STEP]
have \<open>a * 2 + a mod 2 = a\<close>
[PROOF STATE]
proof (prove)
using this:
a div (2::'a) * (2::'a) + a mod (2::'a) = a

goal (1 subgoal):
 1. a * (2::'a) + a mod (2::'a) = a
[PROOF STEP]
by (simp add: stable)
[PROOF STATE]
proof (state)
this:
a * (2::'a) + a mod (2::'a) = a

goal (1 subgoal):
 1. a + a mod (2::'a) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a * (2::'a) + a mod (2::'a) = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a * (2::'a) + a mod (2::'a) = a

goal (1 subgoal):
 1. a + a mod (2::'a) = (0::'a)
[PROOF STEP]
by (simp add: mult_2_right ac_simps)
[PROOF STATE]
proof (state)
this:
a + a mod (2::'a) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma problem_plan_bound_ge_min_pls:
  fixes PROB :: "'a problem" and s :: "'a state" and as k
  assumes "finite PROB" "(s \<in> valid_states PROB)" "(as \<in> valid_plans PROB)"
    "(problem_plan_bound PROB \<le> k)"
  shows "(Inf (PLS s as) \<le> problem_plan_bound PROB)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (PLS s as) \<le> problem_plan_bound PROB
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf (PLS s as) \<le> problem_plan_bound PROB
[PROOF STEP]
have "Inf (PLS s as) \<in> MPLS PROB"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (PLS s as) \<in> MPLS PROB
[PROOF STEP]
using assms(2, 3) S_VALID_AS_VALID_IMP_MIN_IN_PLS
[PROOF STATE]
proof (prove)
using this:
s \<in> valid_states PROB
as \<in> valid_plans PROB
\<lbrakk>?s \<in> valid_states ?PROB; ?as \<in> valid_plans ?PROB\<rbrakk> \<Longrightarrow> Inf (PLS ?s ?as) \<in> MPLS ?PROB

goal (1 subgoal):
 1. Inf (PLS s as) \<in> MPLS PROB
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Inf (PLS s as) \<in> MPLS PROB

goal (1 subgoal):
 1. Inf (PLS s as) \<le> problem_plan_bound PROB
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Inf (PLS s as) \<in> MPLS PROB

goal (1 subgoal):
 1. Inf (PLS s as) \<le> problem_plan_bound PROB
[PROOF STEP]
have "finite (MPLS PROB)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (MPLS PROB)
[PROOF STEP]
using assms(1) FINITE_MPLS
[PROOF STATE]
proof (prove)
using this:
finite PROB
finite ?Pi \<Longrightarrow> finite (MPLS ?Pi)

goal (1 subgoal):
 1. finite (MPLS PROB)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (MPLS PROB)

goal (1 subgoal):
 1. Inf (PLS s as) \<le> problem_plan_bound PROB
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Inf (PLS s as) \<in> MPLS PROB
finite (MPLS PROB)
[PROOF STEP]
have "Inf (PLS s as) \<le> Sup (MPLS PROB)"
[PROOF STATE]
proof (prove)
using this:
Inf (PLS s as) \<in> MPLS PROB
finite (MPLS PROB)

goal (1 subgoal):
 1. Inf (PLS s as) \<le> Sup (MPLS PROB)
[PROOF STEP]
using le_cSup_finite
[PROOF STATE]
proof (prove)
using this:
Inf (PLS s as) \<in> MPLS PROB
finite (MPLS PROB)
\<lbrakk>finite ?X; ?x \<in> ?X\<rbrakk> \<Longrightarrow> ?x \<le> Sup ?X

goal (1 subgoal):
 1. Inf (PLS s as) \<le> Sup (MPLS PROB)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Inf (PLS s as) \<le> Sup (MPLS PROB)

goal (1 subgoal):
 1. Inf (PLS s as) \<le> problem_plan_bound PROB
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Inf (PLS s as) \<le> Sup (MPLS PROB)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Inf (PLS s as) \<le> Sup (MPLS PROB)

goal (1 subgoal):
 1. Inf (PLS s as) \<le> problem_plan_bound PROB
[PROOF STEP]
unfolding problem_plan_bound_def
[PROOF STATE]
proof (prove)
using this:
Inf (PLS s as) \<le> Sup (MPLS PROB)

goal (1 subgoal):
 1. Inf (PLS s as) \<le> Sup (MPLS PROB)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Inf (PLS s as) \<le> problem_plan_bound PROB

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zip_inj: "\<lbrakk>length a = length b; length a' = length b'; zip a b = zip a' b'\<rbrakk> \<Longrightarrow> a=a' \<and> b=b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length a = length b; length a' = length b'; zip a b = zip a' b'\<rbrakk> \<Longrightarrow> a = a' \<and> b = b'
[PROOF STEP]
proof (induct a b arbitrary: a' b' rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a' b'. \<lbrakk>length a' = length b'; zip [] [] = zip a' b'\<rbrakk> \<Longrightarrow> [] = a' \<and> [] = b'
 2. \<And>x xs y ys a' b'. \<lbrakk>length xs = length ys; \<And>a' b'. \<lbrakk>length a' = length b'; zip xs ys = zip a' b'\<rbrakk> \<Longrightarrow> xs = a' \<and> ys = b'; length a' = length b'; zip (x # xs) (y # ys) = zip a' b'\<rbrakk> \<Longrightarrow> x # xs = a' \<and> y # ys = b'
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
length a' = length b'
zip [] [] = zip a' b'

goal (2 subgoals):
 1. \<And>a' b'. \<lbrakk>length a' = length b'; zip [] [] = zip a' b'\<rbrakk> \<Longrightarrow> [] = a' \<and> [] = b'
 2. \<And>x xs y ys a' b'. \<lbrakk>length xs = length ys; \<And>a' b'. \<lbrakk>length a' = length b'; zip xs ys = zip a' b'\<rbrakk> \<Longrightarrow> xs = a' \<and> ys = b'; length a' = length b'; zip (x # xs) (y # ys) = zip a' b'\<rbrakk> \<Longrightarrow> x # xs = a' \<and> y # ys = b'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length a' = length b'
zip [] [] = zip a' b'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length a' = length b'
zip [] [] = zip a' b'

goal (1 subgoal):
 1. [] = a' \<and> [] = b'
[PROOF STEP]
by (cases a'; cases b'; auto)
[PROOF STATE]
proof (state)
this:
[] = a' \<and> [] = b'

goal (1 subgoal):
 1. \<And>x xs y ys a' b'. \<lbrakk>length xs = length ys; \<And>a' b'. \<lbrakk>length a' = length b'; zip xs ys = zip a' b'\<rbrakk> \<Longrightarrow> xs = a' \<and> ys = b'; length a' = length b'; zip (x # xs) (y # ys) = zip a' b'\<rbrakk> \<Longrightarrow> x # xs = a' \<and> y # ys = b'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs y ys a' b'. \<lbrakk>length xs = length ys; \<And>a' b'. \<lbrakk>length a' = length b'; zip xs ys = zip a' b'\<rbrakk> \<Longrightarrow> xs = a' \<and> ys = b'; length a' = length b'; zip (x # xs) (y # ys) = zip a' b'\<rbrakk> \<Longrightarrow> x # xs = a' \<and> y # ys = b'
[PROOF STEP]
case (Cons x xs y ys)
[PROOF STATE]
proof (state)
this:
length xs = length ys
\<lbrakk>length ?a' = length ?b'; zip xs ys = zip ?a' ?b'\<rbrakk> \<Longrightarrow> xs = ?a' \<and> ys = ?b'
length a' = length b'
zip (x # xs) (y # ys) = zip a' b'

goal (1 subgoal):
 1. \<And>x xs y ys a' b'. \<lbrakk>length xs = length ys; \<And>a' b'. \<lbrakk>length a' = length b'; zip xs ys = zip a' b'\<rbrakk> \<Longrightarrow> xs = a' \<and> ys = b'; length a' = length b'; zip (x # xs) (y # ys) = zip a' b'\<rbrakk> \<Longrightarrow> x # xs = a' \<and> y # ys = b'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs = length ys
\<lbrakk>length ?a' = length ?b'; zip xs ys = zip ?a' ?b'\<rbrakk> \<Longrightarrow> xs = ?a' \<and> ys = ?b'
length a' = length b'
zip (x # xs) (y # ys) = zip a' b'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
\<lbrakk>length ?a' = length ?b'; zip xs ys = zip ?a' ?b'\<rbrakk> \<Longrightarrow> xs = ?a' \<and> ys = ?b'
length a' = length b'
zip (x # xs) (y # ys) = zip a' b'

goal (1 subgoal):
 1. x # xs = a' \<and> y # ys = b'
[PROOF STEP]
by (cases a'; cases b'; auto)
[PROOF STATE]
proof (state)
this:
x # xs = a' \<and> y # ys = b'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma items_le_fix_D:
  assumes items_le_fix: "items_le k I = I"
  assumes x_dom: "x \<in> I"
  shows "item_end x \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. item_end x \<le> k
[PROOF STEP]
using items_le_def items_le_fix x_dom
[PROOF STATE]
proof (prove)
using this:
items_le ?k ?I = {x \<in> ?I. item_end x \<le> ?k}
items_le k I = I
x \<in> I

goal (1 subgoal):
 1. item_end x \<le> k
[PROOF STEP]
by blast


[STATEMENT]
lemma cn_cf_ObjMap_CId[cat_cn_cs_simps]:
  assumes "\<FF> : \<AA> \<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<BB>" and "c \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
  shows "\<FF>\<lparr>ArrMap\<rparr>\<lparr>\<AA>\<lparr>CId\<rparr>\<lparr>c\<rparr>\<rparr> = \<BB>\<lparr>CId\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>c\<rparr>\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF>\<lparr>ArrMap\<rparr>\<lparr>\<AA>\<lparr>CId\<rparr>\<lparr>c\<rparr>\<rparr> = \<BB>\<lparr>CId\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>c\<rparr>\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<FF>\<lparr>ArrMap\<rparr>\<lparr>\<AA>\<lparr>CId\<rparr>\<lparr>c\<rparr>\<rparr> = \<BB>\<lparr>CId\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>c\<rparr>\<rparr>
[PROOF STEP]
interpret is_functor \<alpha> \<open>op_cat \<AA>\<close> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : op_cat \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<FF>\<lparr>ArrMap\<rparr>\<lparr>\<AA>\<lparr>CId\<rparr>\<lparr>c\<rparr>\<rparr> = \<BB>\<lparr>CId\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>c\<rparr>\<rparr>
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
c \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
have c: "c \<in>\<^sub>\<circ> op_cat \<AA>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
using this:
c \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. c \<in>\<^sub>\<circ> op_cat \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cat_op_simps
[PROOF STATE]
proof (prove)
using this:
c \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. c \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c \<in>\<^sub>\<circ> op_cat \<AA>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<FF>\<lparr>ArrMap\<rparr>\<lparr>\<AA>\<lparr>CId\<rparr>\<lparr>c\<rparr>\<rparr> = \<BB>\<lparr>CId\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>c\<rparr>\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF>\<lparr>ArrMap\<rparr>\<lparr>\<AA>\<lparr>CId\<rparr>\<lparr>c\<rparr>\<rparr> = \<BB>\<lparr>CId\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>c\<rparr>\<rparr>
[PROOF STEP]
by (rule cf_ObjMap_CId[OF c, unfolded cat_op_simps])
[PROOF STATE]
proof (state)
this:
\<FF>\<lparr>ArrMap\<rparr>\<lparr>\<AA>\<lparr>CId\<rparr>\<lparr>c\<rparr>\<rparr> = \<BB>\<lparr>CId\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>c\<rparr>\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_ms_aux'_altdef:
  "sin_ms_aux' xs = times_ms_aux xs (powser_ms_aux' sin_series_stream (times_ms_aux xs xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin_ms_aux' xs = times_ms_aux xs (powser_ms_aux' sin_series_stream (times_ms_aux xs xs))
[PROOF STEP]
by (simp add: sin_ms_aux'_def powser_ms_aux'_def)


[STATEMENT]
lemma treap_of_unique:
  "\<lbrakk> treap t;  inj_on snd (set_tree t) \<rbrakk>
  \<Longrightarrow> treap_of (set_tree t) = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>treap t; inj_on snd (set_tree t)\<rbrakk> \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
proof(induction "set_tree t" arbitrary: t rule: treap_of.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t. \<lbrakk>\<And>x xb ta. \<lbrakk>\<not> (infinite (set_tree t) \<or> set_tree t = {}); x = arg_min_on snd (set_tree t); set_tree ta = {p \<in> set_tree t. fst p < fst x}; xb = {p \<in> set_tree t. fst x < fst p}; treap ta; inj_on snd (set_tree ta)\<rbrakk> \<Longrightarrow> treap_of (set_tree ta) = ta; \<And>x xa ta. \<lbrakk>\<not> (infinite (set_tree t) \<or> set_tree t = {}); x = arg_min_on snd (set_tree t); xa = {p \<in> set_tree t. fst p < fst x}; set_tree ta = {p \<in> set_tree t. fst x < fst p}; treap ta; inj_on snd (set_tree ta)\<rbrakk> \<Longrightarrow> treap_of (set_tree ta) = ta; treap t; inj_on snd (set_tree t)\<rbrakk> \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
case (1 t)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> (infinite (set_tree t) \<or> set_tree t = {}); ?x = arg_min_on snd (set_tree t); set_tree ?t = {p \<in> set_tree t. fst p < fst ?x}; ?xb = {p \<in> set_tree t. fst ?x < fst p}; treap ?t; inj_on snd (set_tree ?t)\<rbrakk> \<Longrightarrow> treap_of (set_tree ?t) = ?t
\<lbrakk>\<not> (infinite (set_tree t) \<or> set_tree t = {}); ?x = arg_min_on snd (set_tree t); ?xa = {p \<in> set_tree t. fst p < fst ?x}; set_tree ?t = {p \<in> set_tree t. fst ?x < fst p}; treap ?t; inj_on snd (set_tree ?t)\<rbrakk> \<Longrightarrow> treap_of (set_tree ?t) = ?t
treap t
inj_on snd (set_tree t)

goal (1 subgoal):
 1. \<And>t. \<lbrakk>\<And>x xb ta. \<lbrakk>\<not> (infinite (set_tree t) \<or> set_tree t = {}); x = arg_min_on snd (set_tree t); set_tree ta = {p \<in> set_tree t. fst p < fst x}; xb = {p \<in> set_tree t. fst x < fst p}; treap ta; inj_on snd (set_tree ta)\<rbrakk> \<Longrightarrow> treap_of (set_tree ta) = ta; \<And>x xa ta. \<lbrakk>\<not> (infinite (set_tree t) \<or> set_tree t = {}); x = arg_min_on snd (set_tree t); xa = {p \<in> set_tree t. fst p < fst x}; set_tree ta = {p \<in> set_tree t. fst x < fst p}; treap ta; inj_on snd (set_tree ta)\<rbrakk> \<Longrightarrow> treap_of (set_tree ta) = ta; treap t; inj_on snd (set_tree t)\<rbrakk> \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. treap_of (set_tree t) = t
[PROOF STEP]
proof (cases "infinite (set_tree t) \<or> set_tree t = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. infinite (set_tree t) \<or> set_tree t = {} \<Longrightarrow> treap_of (set_tree t) = t
 2. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
infinite (set_tree t) \<or> set_tree t = {}

goal (2 subgoals):
 1. infinite (set_tree t) \<or> set_tree t = {} \<Longrightarrow> treap_of (set_tree t) = t
 2. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite (set_tree t) \<or> set_tree t = {}

goal (1 subgoal):
 1. treap_of (set_tree t) = t
[PROOF STEP]
by(simp add: treap_of.simps)
[PROOF STATE]
proof (state)
this:
treap_of (set_tree t) = t

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (infinite (set_tree t) \<or> set_tree t = {})

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
let ?m = "arg_min_on snd (set_tree t)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
let ?L = "{p \<in> set_tree t. fst p < fst ?m}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
let ?R = "{p \<in> set_tree t. fst p > fst ?m}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
obtain l a r where t: "t = Node l a r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l a r. t = \<langle>l, a, r\<rangle> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> (infinite (set_tree t) \<or> set_tree t = {})

goal (1 subgoal):
 1. (\<And>l a r. t = \<langle>l, a, r\<rangle> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases t) auto
[PROOF STATE]
proof (state)
this:
t = \<langle>l, a, r\<rangle>

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
have "\<forall>kp \<in> set_tree t. snd a \<le> snd kp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>kp\<in>set_tree t. snd a \<le> snd kp
[PROOF STEP]
using "1.prems"(1)
[PROOF STATE]
proof (prove)
using this:
treap t

goal (1 subgoal):
 1. \<forall>kp\<in>set_tree t. snd a \<le> snd kp
[PROOF STEP]
by(auto simp add: t treap_def ball_Un)
        (metis image_eqI snd_conv tree.set_map)+
[PROOF STATE]
proof (state)
this:
\<forall>kp\<in>set_tree t. snd a \<le> snd kp

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
hence "a = ?m"
[PROOF STATE]
proof (prove)
using this:
\<forall>kp\<in>set_tree t. snd a \<le> snd kp

goal (1 subgoal):
 1. a = arg_min_on snd (set_tree t)
[PROOF STEP]
by (metis "1.prems"(2) False arg_min_if_finite(1) arg_min_if_finite(2) inj_on_def
          le_neq_trans t tree.set_intros(2))
[PROOF STATE]
proof (state)
this:
a = arg_min_on snd (set_tree t)

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
have "treap l" "treap r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. treap l &&& treap r
[PROOF STEP]
using "1.prems"(1)
[PROOF STATE]
proof (prove)
using this:
treap t

goal (1 subgoal):
 1. treap l &&& treap r
[PROOF STEP]
by(auto simp: treap_def t)
[PROOF STATE]
proof (state)
this:
treap l
treap r

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
have l: "set_tree l = {p \<in> set_tree t. fst p < fst a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_tree l = {p \<in> set_tree t. fst p < fst a}
[PROOF STEP]
using "1.prems"(1)
[PROOF STATE]
proof (prove)
using this:
treap t

goal (1 subgoal):
 1. set_tree l = {p \<in> set_tree t. fst p < fst a}
[PROOF STEP]
by(auto simp add: treap_def t ball_Un tree.set_map)
[PROOF STATE]
proof (state)
this:
set_tree l = {p \<in> set_tree t. fst p < fst a}

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
have r: "set_tree r = {p \<in> set_tree t. fst p > fst a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_tree r = {p \<in> set_tree t. fst a < fst p}
[PROOF STEP]
using "1.prems"(1)
[PROOF STATE]
proof (prove)
using this:
treap t

goal (1 subgoal):
 1. set_tree r = {p \<in> set_tree t. fst a < fst p}
[PROOF STEP]
by(auto simp add: treap_def t ball_Un tree.set_map)
[PROOF STATE]
proof (state)
this:
set_tree r = {p \<in> set_tree t. fst a < fst p}

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
have "l = treap_of ?L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l = treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}
[PROOF STEP]
using "1.hyps"(1)[OF False \<open>a = ?m\<close> l r \<open>treap l\<close>]
        l \<open>a = ?m\<close> "1.prems"(2)
[PROOF STATE]
proof (prove)
using this:
inj_on snd (set_tree l) \<Longrightarrow> treap_of (set_tree l) = l
set_tree l = {p \<in> set_tree t. fst p < fst a}
a = arg_min_on snd (set_tree t)
inj_on snd (set_tree t)

goal (1 subgoal):
 1. l = treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}
[PROOF STEP]
by (fastforce simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
l = treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
have "r = treap_of ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r = treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}
[PROOF STEP]
using "1.hyps"(2)[OF False \<open>a = ?m\<close> l r \<open>treap r\<close>]
        r \<open>a = ?m\<close> "1.prems"(2)
[PROOF STATE]
proof (prove)
using this:
inj_on snd (set_tree r) \<Longrightarrow> treap_of (set_tree r) = r
set_tree r = {p \<in> set_tree t. fst a < fst p}
a = arg_min_on snd (set_tree t)
inj_on snd (set_tree t)

goal (1 subgoal):
 1. r = treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}
[PROOF STEP]
by (fastforce simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
r = treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
have "t = Node (treap_of ?L) ?m (treap_of ?R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t = \<langle>treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}, arg_min_on snd (set_tree t), treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}\<rangle>
[PROOF STEP]
using \<open>a = ?m\<close> \<open>l = treap_of ?L\<close> \<open>r = treap_of ?R\<close>
[PROOF STATE]
proof (prove)
using this:
a = arg_min_on snd (set_tree t)
l = treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}
r = treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}

goal (1 subgoal):
 1. t = \<langle>treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}, arg_min_on snd (set_tree t), treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}\<rangle>
[PROOF STEP]
by(subst t) simp
[PROOF STATE]
proof (state)
this:
t = \<langle>treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}, arg_min_on snd (set_tree t), treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}\<rangle>

goal (1 subgoal):
 1. \<not> (infinite (set_tree t) \<or> set_tree t = {}) \<Longrightarrow> treap_of (set_tree t) = t
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
t = \<langle>treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}, arg_min_on snd (set_tree t), treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}\<rangle>

goal (1 subgoal):
 1. treap_of (set_tree t) = t
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
t = \<langle>treap_of {p \<in> set_tree t. fst p < fst (arg_min_on snd (set_tree t))}, arg_min_on snd (set_tree t), treap_of {p \<in> set_tree t. fst (arg_min_on snd (set_tree t)) < fst p}\<rangle>
\<not> (infinite (set_tree t) \<or> set_tree t = {})

goal (1 subgoal):
 1. treap_of (set_tree t) = t
[PROOF STEP]
by (subst treap_of.simps) simp
[PROOF STATE]
proof (state)
this:
treap_of (set_tree t) = t

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
treap_of (set_tree t) = t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma limit_inter_INF:
  assumes hyp: "limit w \<inter> S \<noteq> {}"
  shows "\<exists>\<^sub>\<infinity> n. w n \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<^sub>\<infinity>n. w n \<in> S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<^sub>\<infinity>n. w n \<in> S
[PROOF STEP]
from hyp
[PROOF STATE]
proof (chain)
picking this:
limit w \<inter> S \<noteq> {}
[PROOF STEP]
obtain x where "\<exists>\<^sub>\<infinity> n. w n = x" and "x \<in> S"
[PROOF STATE]
proof (prove)
using this:
limit w \<inter> S \<noteq> {}

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>\<exists>\<^sub>\<infinity>n. w n = x; x \<in> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp add: limit_def)
[PROOF STATE]
proof (state)
this:
\<exists>\<^sub>\<infinity>n. w n = x
x \<in> S

goal (1 subgoal):
 1. \<exists>\<^sub>\<infinity>n. w n \<in> S
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>\<^sub>\<infinity>n. w n = x
x \<in> S

goal (1 subgoal):
 1. \<exists>\<^sub>\<infinity>n. w n \<in> S
[PROOF STEP]
by (auto elim: INFM_mono)
[PROOF STATE]
proof (state)
this:
\<exists>\<^sub>\<infinity>n. w n \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_field_derivative_Lambert_W [derivative_intros]:
  assumes x: "x > -exp (-1)"
  shows   "(Lambert_W has_real_derivative inverse (x + exp (Lambert_W x))) (at x within A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Lambert_W has_real_derivative inverse (x + exp (Lambert_W x))) (at x within A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Lambert_W has_real_derivative inverse (x + exp (Lambert_W x))) (at x within A)
[PROOF STEP]
write Lambert_W ("W")
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
- exp (- 1) < x
[PROOF STEP]
have "W x > W (-exp (-1))"
[PROOF STATE]
proof (prove)
using this:
- exp (- 1) < x

goal (1 subgoal):
 1. W (- exp (- 1)) < W x
[PROOF STEP]
by (subst Lambert_W_less_iff) auto
[PROOF STATE]
proof (state)
this:
W (- exp (- 1)) < W x

goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
hence "W x > -1"
[PROOF STATE]
proof (prove)
using this:
W (- exp (- 1)) < W x

goal (1 subgoal):
 1. - 1 < W x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- 1 < W x

goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
note [derivative_intros] = DERIV_inverse_function[where g = Lambert_W]
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?f has_real_derivative ?D) (at (W ?x)); ?D \<noteq> 0; ?a < ?x; ?x < ?b; \<And>y. \<lbrakk>?a < y; y < ?b\<rbrakk> \<Longrightarrow> ?f (W y) = y; isCont W ?x\<rbrakk> \<Longrightarrow> (W has_real_derivative inverse ?D) (at ?x)

goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
have "((\<lambda>x. x * exp x) has_real_derivative (1 + W x) * exp (W x)) (at (W x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x * exp x) has_real_derivative (1 + W x) * exp (W x)) (at (W x))
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x * exp x) has_real_derivative (1 + W x) * exp (W x)) (at (W x))

goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
hence "(W has_real_derivative inverse ((1 + W x) * exp (W x))) (at x)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x * exp x) has_real_derivative (1 + W x) * exp (W x)) (at (W x))

goal (1 subgoal):
 1. (W has_real_derivative inverse ((1 + W x) * exp (W x))) (at x)
[PROOF STEP]
by (rule DERIV_inverse_function[where a = "-exp (-1)" and b = "x + 1"])
       (use x \<open>W x > -1\<close> in \<open>auto simp: Lambert_W_times_exp_self Lim_ident_at
                                  intro!: continuous_intros\<close>)
[PROOF STATE]
proof (state)
this:
(W has_real_derivative inverse ((1 + W x) * exp (W x))) (at x)

goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(W has_real_derivative inverse ((1 + W x) * exp (W x))) (at x)

goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
have "(1 + W x) * exp (W x) = x + exp (W x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + W x) * exp (W x) = x + exp (W x)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
- exp (- 1) < x

goal (1 subgoal):
 1. (1 + W x) * exp (W x) = x + exp (W x)
[PROOF STEP]
by (simp add: algebra_simps Lambert_W_times_exp_self)
[PROOF STATE]
proof (state)
this:
(1 + W x) * exp (W x) = x + exp (W x)

goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(W has_real_derivative inverse (x + exp (W x))) (at x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(W has_real_derivative inverse (x + exp (W x))) (at x)

goal (1 subgoal):
 1. (W has_real_derivative inverse (x + exp (W x))) (at x within A)
[PROOF STEP]
by (rule has_field_derivative_at_within)
[PROOF STATE]
proof (state)
this:
(W has_real_derivative inverse (x + exp (W x))) (at x within A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rHom_mem:"\<lbrakk> f \<in> rHom A R; a \<in> carrier A \<rbrakk> \<Longrightarrow> f a \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> rHom A R; a \<in> carrier A\<rbrakk> \<Longrightarrow> f a \<in> carrier R
[PROOF STEP]
apply (simp add:rHom_def, frule conjunct1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> aHom A R \<and> (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. f (x \<cdot>\<^sub>r\<^bsub>A\<^esub> y) = f x \<cdot>\<^sub>r\<^bsub>R\<^esub> f y) \<and> f 1\<^sub>r\<^bsub>A\<^esub> = 1\<^sub>r\<^bsub>R\<^esub>; a \<in> carrier A; f \<in> aHom A R\<rbrakk> \<Longrightarrow> f a \<in> carrier R
[PROOF STEP]
apply (thin_tac "f \<in> aHom A R \<and>
     (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. f (x \<cdot>\<^sub>r\<^bsub>A\<^esub> y) = f x \<cdot>\<^sub>r\<^bsub>R\<^esub> f y) \<and> f 1\<^sub>r\<^bsub>A\<^esub> = 1\<^sub>r\<^bsub>R\<^esub>")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; f \<in> aHom A R\<rbrakk> \<Longrightarrow> f a \<in> carrier R
[PROOF STEP]
apply (simp add:aHom_def, frule conjunct1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; f \<in> carrier A \<rightarrow> carrier R \<and> f \<in> extensional (carrier A) \<and> (\<forall>a\<in>carrier A. \<forall>b\<in>carrier A. f (a \<plusminus>\<^bsub>A\<^esub> b) = f a \<plusminus>\<^bsub>R\<^esub> f b); f \<in> carrier A \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> f a \<in> carrier R
[PROOF STEP]
apply (thin_tac "f \<in> carrier A \<rightarrow> carrier R \<and>
     f \<in> extensional (carrier A) \<and>
     (\<forall>a\<in>carrier A. \<forall>b\<in>carrier A. f (a \<plusminus>\<^bsub>A\<^esub> b) = f a \<plusminus>\<^bsub>R\<^esub> f b)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; f \<in> carrier A \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> f a \<in> carrier R
[PROOF STEP]
apply (simp add:funcset_mem)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma permutep_eq_monom_of_set_iff [simp]:
  assumes "bij f"
  shows   "permutep f mon = monom_of_set A \<longleftrightarrow> mon = monom_of_set (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (permutep f mon = monom_of_set A) = (mon = monom_of_set (f ` A))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
assume eq: "permutep f mon = monom_of_set A"
[PROOF STATE]
proof (state)
this:
permutep f mon = monom_of_set A

goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
have "permutep (inv_into UNIV f) (permutep f mon) = monom_of_set (inv_into UNIV f -` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutep (inv f) (permutep f mon) = monom_of_set (inv f -` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij f

goal (1 subgoal):
 1. permutep (inv f) (permutep f mon) = monom_of_set (inv f -` A)
[PROOF STEP]
by (simp add: eq bij_imp_bij_inv assms permutep_monom_of_set)
[PROOF STATE]
proof (state)
this:
permutep (inv f) (permutep f mon) = monom_of_set (inv f -` A)

goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
permutep (inv f) (permutep f mon) = monom_of_set (inv f -` A)

goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
have "inv_into UNIV f -` A = f ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv f -` A = f ` A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij f

goal (1 subgoal):
 1. inv f -` A = f ` A
[PROOF STEP]
by (force simp: bij_is_surj image_iff inv_f_f bij_is_inj surj_f_inv_f)
[PROOF STATE]
proof (state)
this:
inv f -` A = f ` A

goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inv f -` A = f ` A

goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
have "permutep (inv_into UNIV f) (permutep f mon) = permutep (f \<circ> inv_into UNIV f) mon"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutep (inv f) (permutep f mon) = permutep (f \<circ> inv f) mon
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij f

goal (1 subgoal):
 1. permutep (inv f) (permutep f mon) = permutep (f \<circ> inv f) mon
[PROOF STEP]
by (simp add: permutep_comp bij_imp_bij_inv)
[PROOF STATE]
proof (state)
this:
permutep (inv f) (permutep f mon) = permutep (f \<circ> inv f) mon

goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
permutep (inv f) (permutep f mon) = permutep (f \<circ> inv f) mon

goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
have "f \<circ> inv_into UNIV f = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> inv f = id
[PROOF STEP]
by (subst surj_iff [symmetric]) (insert assms, auto simp: bij_is_surj)
[PROOF STATE]
proof (state)
this:
f \<circ> inv f = id

goal (2 subgoals):
 1. permutep f mon = monom_of_set A \<Longrightarrow> mon = monom_of_set (f ` A)
 2. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
permutep id mon = monom_of_set (f ` A)
[PROOF STEP]
show "mon = monom_of_set (f ` A)"
[PROOF STATE]
proof (prove)
using this:
permutep id mon = monom_of_set (f ` A)

goal (1 subgoal):
 1. mon = monom_of_set (f ` A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mon = monom_of_set (f ` A)

goal (1 subgoal):
 1. mon = monom_of_set (f ` A) \<Longrightarrow> permutep f mon = monom_of_set A
[PROOF STEP]
qed (insert assms, auto simp: permutep_monom_of_set inj_vimage_image_eq bij_is_inj)


[STATEMENT]
lemma iT_Div_commute: "I \<oslash> a \<oslash> b = I \<oslash> b \<oslash> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<oslash> a \<oslash> b = I \<oslash> b \<oslash> a
[PROOF STEP]
by (simp add: iT_Div_assoc mult.commute[of a])


[STATEMENT]
lemma sum_img_lt:
  assumes "\<forall>t \<in> fst ` fset xs. (g::'a \<Rightarrow> nat) (f t) \<le> g t"
      and "\<exists>t \<in> fst ` fset xs. g (f t) < g t"
      and "\<forall>t \<in> fst ` fset xs. g t > 0"
    shows "(\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| xs). g x) < (\<Sum>(x,y)\<in> fset xs. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>fst ` fset xs. g (f t) \<le> g t
\<exists>t\<in>fst ` fset xs. g (f t) < g t
\<forall>t\<in>fst ` fset xs. 0 < g t

goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
proof(induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<forall>t\<in>fst ` fset {||}. g (f t) \<le> g t; \<exists>t\<in>fst ` fset {||}. g (f t) < g t; \<forall>t\<in>fst ` fset {||}. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| {||}). g x) < (\<Sum>(x, y)\<in>fset {||}. g x)
 2. \<And>x xs. \<lbrakk>x |\<notin>| xs; \<lbrakk>\<forall>t\<in>fst ` fset xs. g (f t) \<le> g t; \<exists>t\<in>fst ` fset xs. g (f t) < g t; \<forall>t\<in>fst ` fset xs. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| xs). g x) < (\<Sum>(x, y)\<in>fset xs. g x); \<forall>t\<in>fst ` fset (finsert x xs). g (f t) \<le> g t; \<exists>t\<in>fst ` fset (finsert x xs). g (f t) < g t; \<forall>t\<in>fst ` fset (finsert x xs). 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| finsert x xs). g x) < (\<Sum>(x, y)\<in>fset (finsert x xs). g x)
[PROOF STEP]
case (insert x xs)
[PROOF STATE]
proof (state)
this:
x |\<notin>| xs
\<lbrakk>\<forall>t\<in>fst ` fset xs. g (f t) \<le> g t; \<exists>t\<in>fst ` fset xs. g (f t) < g t; \<forall>t\<in>fst ` fset xs. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset xs. case a of (x, y) \<Rightarrow> g x)
\<forall>t\<in>fst ` fset (finsert x xs). g (f t) \<le> g t
\<exists>t\<in>fst ` fset (finsert x xs). g (f t) < g t
\<forall>t\<in>fst ` fset (finsert x xs). 0 < g t

goal (2 subgoals):
 1. \<lbrakk>\<forall>t\<in>fst ` fset {||}. g (f t) \<le> g t; \<exists>t\<in>fst ` fset {||}. g (f t) < g t; \<forall>t\<in>fst ` fset {||}. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| {||}). g x) < (\<Sum>(x, y)\<in>fset {||}. g x)
 2. \<And>x xs. \<lbrakk>x |\<notin>| xs; \<lbrakk>\<forall>t\<in>fst ` fset xs. g (f t) \<le> g t; \<exists>t\<in>fst ` fset xs. g (f t) < g t; \<forall>t\<in>fst ` fset xs. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| xs). g x) < (\<Sum>(x, y)\<in>fset xs. g x); \<forall>t\<in>fst ` fset (finsert x xs). g (f t) \<le> g t; \<exists>t\<in>fst ` fset (finsert x xs). g (f t) < g t; \<forall>t\<in>fst ` fset (finsert x xs). 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| finsert x xs). g x) < (\<Sum>(x, y)\<in>fset (finsert x xs). g x)
[PROOF STEP]
obtain t e where t_def: "x = (t,e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t e. x = (t, e) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x = (t, e)

goal (2 subgoals):
 1. \<lbrakk>\<forall>t\<in>fst ` fset {||}. g (f t) \<le> g t; \<exists>t\<in>fst ` fset {||}. g (f t) < g t; \<forall>t\<in>fst ` fset {||}. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| {||}). g x) < (\<Sum>(x, y)\<in>fset {||}. g x)
 2. \<And>x xs. \<lbrakk>x |\<notin>| xs; \<lbrakk>\<forall>t\<in>fst ` fset xs. g (f t) \<le> g t; \<exists>t\<in>fst ` fset xs. g (f t) < g t; \<forall>t\<in>fst ` fset xs. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| xs). g x) < (\<Sum>(x, y)\<in>fset xs. g x); \<forall>t\<in>fst ` fset (finsert x xs). g (f t) \<le> g t; \<exists>t\<in>fst ` fset (finsert x xs). g (f t) < g t; \<forall>t\<in>fst ` fset (finsert x xs). 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| finsert x xs). g x) < (\<Sum>(x, y)\<in>fset (finsert x xs). g x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = (t, e)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
x = (t, e)

goal (1 subgoal):
 1. (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
proof(cases "(f t,e) \<notin> fset ((\<lambda>(t,e). (f t, e)) |`| xs)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>x = (t, e); (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
case f_notin_xs: True
[PROOF STATE]
proof (state)
this:
(f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)

goal (2 subgoals):
 1. \<lbrakk>x = (t, e); (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
proof(cases "g (f t) < g t")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
g (f t) < g t

goal (2 subgoals):
 1. g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
have "(\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| (finsert x xs)). g x)
                = g (f t) + (\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| xs). g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
using t_def f_notin_xs
[PROOF STATE]
proof (prove)
using this:
x = (t, e)
(f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)

goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (2 subgoals):
 1. g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (2 subgoals):
 1. g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
have "\<dots> < g t + (\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| xs). g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
g (f t) < g t

goal (1 subgoal):
 1. g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (2 subgoals):
 1. g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (2 subgoals):
 1. g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
have "\<dots> \<le> g t + (\<Sum>(x,y)\<in> fset xs. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
using sum_img_le insert.prems(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>fst ` fset ?xs. ?g (?f t) \<le> ?g t \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (?f t, e)) |`| ?xs). ?g x) \<le> (\<Sum>(x, y)\<in>fset ?xs. ?g x)
\<forall>t\<in>fst ` fset (finsert x xs). g (f t) \<le> g t

goal (1 subgoal):
 1. g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> g t + (\<Sum>(x, y)\<in>fset xs. g x)

goal (2 subgoals):
 1. g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
 2. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)

goal (1 subgoal):
 1. (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
using insert.hyps t_def notin_fset
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
x |\<notin>| xs
x = (t, e)
(?x |\<notin>| ?S) = (?x \<notin> fset ?S)

goal (1 subgoal):
 1. (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)

goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> g (f t) < g t

goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> g (f t) < g t
[PROOF STEP]
have 0: "\<exists>t \<in> fst ` fset xs. g (f t) < g t"
[PROOF STATE]
proof (prove)
using this:
\<not> g (f t) < g t

goal (1 subgoal):
 1. \<exists>t\<in>fst ` fset xs. g (f t) < g t
[PROOF STEP]
using insert.prems(2) t_def
[PROOF STATE]
proof (prove)
using this:
\<not> g (f t) < g t
\<exists>t\<in>fst ` fset (finsert x xs). g (f t) < g t
x = (t, e)

goal (1 subgoal):
 1. \<exists>t\<in>fst ` fset xs. g (f t) < g t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>t\<in>fst ` fset xs. g (f t) < g t

goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
have "(\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| (finsert x xs)). g x)
                = g (f t) + (\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| xs). g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
using t_def f_notin_xs
[PROOF STATE]
proof (prove)
using this:
x = (t, e)
(f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)

goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
have "\<dots> \<le> g t + (\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| xs). g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
using t_def insert.prems(1)
[PROOF STATE]
proof (prove)
using this:
x = (t, e)
\<forall>t\<in>fst ` fset (finsert x xs). g (f t) \<le> g t

goal (1 subgoal):
 1. g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g (f t) + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
have "\<dots> < g t + (\<Sum>(x,y)\<in> fset xs. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
using insert.IH insert.prems(1,3) 0
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>t\<in>fst ` fset xs. g (f t) \<le> g t; \<exists>t\<in>fst ` fset xs. g (f t) < g t; \<forall>t\<in>fst ` fset xs. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset xs. case a of (x, y) \<Rightarrow> g x)
\<forall>t\<in>fst ` fset (finsert x xs). g (f t) \<le> g t
\<forall>t\<in>fst ` fset (finsert x xs). 0 < g t
\<exists>t\<in>fst ` fset xs. g (f t) < g t

goal (1 subgoal):
 1. g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g t + (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)

goal (1 subgoal):
 1. \<not> g (f t) < g t \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)

goal (1 subgoal):
 1. (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
using insert.hyps t_def notin_fset
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
x |\<notin>| xs
x = (t, e)
(?x |\<notin>| ?S) = (?x \<notin> fset ?S)

goal (1 subgoal):
 1. (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)

goal (1 subgoal):
 1. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)

goal (1 subgoal):
 1. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)
[PROOF STEP]
have "(\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| (finsert x xs)). g x)
              = (\<Sum>(x,y)\<in> fset ((\<lambda>(t,e). (f t, e)) |`| xs). g x)"
[PROOF STATE]
proof (prove)
using this:
\<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)

goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)
[PROOF STEP]
by (metis (no_types, lifting) t_def fimage_finsert finsert_absorb notin_fset prod.case)
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (1 subgoal):
 1. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) = (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x)

goal (1 subgoal):
 1. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
have "\<dots> \<le> (\<Sum>(x,y)\<in> fset xs. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
using sum_img_le insert.prems(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>fst ` fset ?xs. ?g (?f t) \<le> ?g t \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (?f t, e)) |`| ?xs). ?g x) \<le> (\<Sum>(x, y)\<in>fset ?xs. ?g x)
\<forall>t\<in>fst ` fset (finsert x xs). g (f t) \<le> g t

goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> (\<Sum>(x, y)\<in>fset xs. g x)

goal (1 subgoal):
 1. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| xs). g x) \<le> (\<Sum>(x, y)\<in>fset xs. g x)

goal (1 subgoal):
 1. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
have "\<dots> < g t + (\<Sum>(x,y)\<in> fset xs. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset xs. g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
using insert.prems(3) t_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>fst ` fset (finsert x xs). 0 < g t
x = (t, e)

goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>fset xs. g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>fset xs. g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)

goal (1 subgoal):
 1. \<lbrakk>x = (t, e); \<not> (f t, e) \<notin> fset ((\<lambda>(t, e). (f t, e)) |`| xs)\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)

goal (1 subgoal):
 1. (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
using insert.hyps t_def notin_fset
[PROOF STATE]
proof (prove)
using this:
(\<Sum>(x, y)\<in>fset ((\<lambda>(t, e). (f t, e)) |`| finsert x xs). g x) < g t + (\<Sum>(x, y)\<in>fset xs. g x)
x |\<notin>| xs
x = (t, e)
(?x |\<notin>| ?S) = (?x \<notin> fset ?S)

goal (1 subgoal):
 1. (\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>fset ((\<lambda>a. case a of (t, a) \<Rightarrow> (f t, a)) |`| finsert x xs). case a of (x, y) \<Rightarrow> g x) < (\<Sum>a\<in>fset (finsert x xs). case a of (x, y) \<Rightarrow> g x)

goal (1 subgoal):
 1. \<lbrakk>\<forall>t\<in>fst ` fset {||}. g (f t) \<le> g t; \<exists>t\<in>fst ` fset {||}. g (f t) < g t; \<forall>t\<in>fst ` fset {||}. 0 < g t\<rbrakk> \<Longrightarrow> (\<Sum>(x, y)\<in>fset ((\<lambda>(t, y). (f t, y)) |`| {||}). g x) < (\<Sum>(x, y)\<in>fset {||}. g x)
[PROOF STEP]
qed (simp)


[STATEMENT]
lemma fi_map_None: "(fi_map u = None) \<longleftrightarrow> u\<notin>f`V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fi_map u = None) = (u \<notin> f ` V)
[PROOF STEP]
unfolding fi_map_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if u \<in> f ` V then Some (fi u) else None) = None) = (u \<notin> f ` V)
[PROOF STEP]
by (auto split: if_split_asm)


[STATEMENT]
lemma connected_impl_maximally_connected:
    assumes "connected_graph H"
    assumes subgraph: "subgraph H G"
    shows "maximally_connected H G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. maximally_connected H G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
connected_graph H
subgraph H G

goal (1 subgoal):
 1. maximally_connected H G
[PROOF STEP]
unfolding connected_graph_def connected_graph_axioms_def maximally_connected_def
      subgraph_def
[PROOF STATE]
proof (prove)
using this:
valid_graph H \<and> (\<forall>v\<in>nodes H. \<forall>v'\<in>nodes H. nodes_connected H v v')
nodes H = V \<and> edges H \<subseteq> E

goal (1 subgoal):
 1. \<forall>v\<in>V. \<forall>v'\<in>V. nodes_connected G v v' \<longrightarrow> nodes_connected H v v'
[PROOF STEP]
by blast


[STATEMENT]
lemma eval_terms_cong: "(\<And>n. n \<in> fv_terms_set ts \<Longrightarrow> \<sigma> n = \<sigma>' n) \<Longrightarrow>
  eval_terms \<sigma> ts = eval_terms \<sigma>' ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. n \<in> fv_terms_set ts \<Longrightarrow> \<sigma> n = \<sigma>' n) \<Longrightarrow> \<sigma> \<odot> ts = \<sigma>' \<odot> ts
[PROOF STEP]
by (auto simp: eval_terms_def fv_terms_set_def intro: eval_term_cong)


[STATEMENT]
lemma E_validD: assumes "(v,e,v')\<in>E"
      shows "v\<in>V" "v'\<in>V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> V &&& v' \<in> V
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. v \<in> V
 2. v' \<in> V
[PROOF STEP]
apply (rule subsetD[OF E_valid(1)])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. v \<in> fst ` E
 2. v' \<in> V
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(v, e, v') \<in> E

goal (2 subgoals):
 1. v \<in> fst ` E
 2. v' \<in> V
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v' \<in> V
[PROOF STEP]
apply (rule subsetD[OF E_valid(2)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v' \<in> snd ` snd ` E
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(v, e, v') \<in> E

goal (1 subgoal):
 1. v' \<in> snd ` snd ` E
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Lcm_eq_0_I:
  assumes "0 \<in> A"
  shows "Lcm A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm A = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Lcm A = (0::'a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<in> A
[PROOF STEP]
have "0 dvd Lcm A"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<in> A

goal (1 subgoal):
 1. (0::'a) dvd Lcm A
[PROOF STEP]
by (rule dvd_Lcm)
[PROOF STATE]
proof (state)
this:
(0::'a) dvd Lcm A

goal (1 subgoal):
 1. Lcm A = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(0::'a) dvd Lcm A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0::'a) dvd Lcm A

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in CRR_market) delta_hedging_self_financing:
  shows "self_financing Mkt (delta_hedging N der matur)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. self_financing Mkt (delta_hedging N der matur)
[PROOF STEP]
unfolding delta_hedging_def self_fin_delta_pf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. self_financing Mkt (self_finance Mkt (integral\<^sup>L N (discounted_value r (\<lambda>m. der) matur)) (delta_pf N der matur) risk_free_asset)
[PROOF STEP]
proof (rule self_finance_charact)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>n w. prices Mkt risk_free_asset (Suc n) w \<noteq> 0
 2. portfolio (delta_pf N der matur)
[PROOF STEP]
show "\<forall>n w. prices Mkt risk_free_asset (Suc n) w \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n w. prices Mkt risk_free_asset (Suc n) w \<noteq> 0
[PROOF STEP]
using positive
[PROOF STATE]
proof (prove)
using this:
\<forall>n w. 0 < prices Mkt risk_free_asset n w

goal (1 subgoal):
 1. \<forall>n w. prices Mkt risk_free_asset (Suc n) w \<noteq> 0
[PROOF STEP]
by (metis less_numeral_extra(3))
[PROOF STATE]
proof (state)
this:
\<forall>n w. prices Mkt risk_free_asset (Suc n) w \<noteq> 0

goal (1 subgoal):
 1. portfolio (delta_pf N der matur)
[PROOF STEP]
show "portfolio (delta_pf N der matur)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. portfolio (delta_pf N der matur)
[PROOF STEP]
using delta_pf_portfolio
[PROOF STATE]
proof (prove)
using this:
portfolio (delta_pf ?N ?der ?matur)

goal (1 subgoal):
 1. portfolio (delta_pf N der matur)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
portfolio (delta_pf N der matur)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_wrt_gen2: "sorted_wrt (<\<^sub>r\<^sub>l\<^sub>e\<^sub>x\<^sub>2) (gen2 A B m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (<\<^sub>r\<^sub>l\<^sub>e\<^sub>x\<^sub>2) (gen2 A B m n)
[PROOF STEP]
by (intro sorted_wrt_concat_map_map [where Q = "(<\<^sub>r\<^sub>l\<^sub>e\<^sub>x)"] sorted_wrt_gen)
    (auto simp: set_gen rlex_def intro:  lex_append_leftI lex_append_rightI)


[STATEMENT]
lemma
  iFROM_iprev': "t \<in> [n\<dots>] \<Longrightarrow> iprev (Suc t) [n\<dots>] = t" and
  iFROM_iprev: "n < t  \<Longrightarrow> iprev t [n\<dots>] = t - Suc 0" and
  iTILL_iprev: "t \<in> [\<dots>n] \<Longrightarrow> iprev t [\<dots>n] = t - Suc 0" and
  iIN_iprev: "\<lbrakk> n < t; t \<le> n + d \<rbrakk> \<Longrightarrow> iprev t [n\<dots>,d] = t - Suc 0" and
  iIN_iprev': "\<lbrakk> n \<le> t; t < n + d \<rbrakk> \<Longrightarrow> iprev (Suc t) [n\<dots>,d] = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((t \<in> [n\<dots>] \<Longrightarrow> iprev (Suc t) [n\<dots>] = t) &&& (n < t \<Longrightarrow> iprev t [n\<dots>] = t - Suc 0)) &&& (t \<in> [\<dots>n] \<Longrightarrow> iprev t [\<dots>n] = t - Suc 0) &&& (\<lbrakk>n < t; t \<le> n + d\<rbrakk> \<Longrightarrow> iprev t [n\<dots>,d] = t - Suc 0) &&& (\<lbrakk>n \<le> t; t < n + d\<rbrakk> \<Longrightarrow> iprev (Suc t) [n\<dots>,d] = t)
[PROOF STEP]
by (simp add: iT_defs iprev_atLeast iprev_atMost iprev_atLeastAtMost)+


[STATEMENT]
lemma cis_pi [simp]: "cis pi = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis pi = - 1
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma mult_mat_vec_carrier[simp]:
  "A \<in> carrier_mat nr n \<Longrightarrow> v \<in> carrier_vec n \<Longrightarrow> A *\<^sub>v v \<in> carrier_vec nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr n; v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> A *\<^sub>v v \<in> carrier_vec nr
[PROOF STEP]
unfolding carrier_mat_def carrier_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> {m. dim_row m = nr \<and> dim_col m = n}; v \<in> {v. dim_vec v = n}\<rbrakk> \<Longrightarrow> A *\<^sub>v v \<in> {v. dim_vec v = nr}
[PROOF STEP]
by auto