[STATEMENT]
lemma all_partitions_equivalence':
  fixes xs::"'a list"
  shows "distinct xs \<Longrightarrow>
         ((set (map set (all_partitions_list xs)) =
          all_partitions (set xs)) \<and> (\<forall> ps \<in> set (all_partitions_list xs) . distinct ps))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> (\<forall>ps\<in>set (all_partitions_list xs). distinct ps)
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distinct [] \<Longrightarrow> set (map set (all_partitions_list [])) = all_partitions (set []) \<and> Ball (set (all_partitions_list [])) distinct
 2. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
distinct []

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> set (map set (all_partitions_list [])) = all_partitions (set []) \<and> Ball (set (all_partitions_list [])) distinct
 2. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
have "set (map set (all_partitions_list [])) = all_partitions (set [])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map set (all_partitions_list [])) = all_partitions (set [])
[PROOF STEP]
unfolding List.set_simps(1) emptyset_part_emptyset3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map set (all_partitions_list [])) = {{}}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list [])) = all_partitions (set [])

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> set (map set (all_partitions_list [])) = all_partitions (set []) \<and> Ball (set (all_partitions_list [])) distinct
 2. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
(* Sledgehammer no longer seems to find this, maybe after we have added the "distinct" part to the theorem statement. *)
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list [])) = all_partitions (set [])

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> set (map set (all_partitions_list [])) = all_partitions (set []) \<and> Ball (set (all_partitions_list [])) distinct
 2. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list [])) = all_partitions (set [])

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> set (map set (all_partitions_list [])) = all_partitions (set []) \<and> Ball (set (all_partitions_list [])) distinct
 2. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
have "\<forall> ps \<in> set (all_partitions_list []) . distinct ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ps\<in>set (all_partitions_list []). distinct ps
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>ps\<in>set (all_partitions_list []). distinct ps

goal (2 subgoals):
 1. distinct [] \<Longrightarrow> set (map set (all_partitions_list [])) = all_partitions (set []) \<and> Ball (set (all_partitions_list [])) distinct
 2. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (map set (all_partitions_list [])) = all_partitions (set [])
\<forall>ps\<in>set (all_partitions_list []). distinct ps
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set (map set (all_partitions_list [])) = all_partitions (set [])
\<forall>ps\<in>set (all_partitions_list []). distinct ps

goal (1 subgoal):
 1. set (map set (all_partitions_list [])) = all_partitions (set []) \<and> (\<forall>a\<in>set (all_partitions_list []). distinct a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list [])) = all_partitions (set []) \<and> (\<forall>a\<in>set (all_partitions_list []). distinct a)

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> (\<forall>a\<in>set (all_partitions_list xs). distinct a)
distinct (x # xs)

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
from Cons.prems Cons.hyps
[PROOF STATE]
proof (chain)
picking this:
distinct (x # xs)
distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> (\<forall>a\<in>set (all_partitions_list xs). distinct a)
[PROOF STEP]
have hyp_equiv: "set (map set (all_partitions_list xs)) = all_partitions (set xs)"
[PROOF STATE]
proof (prove)
using this:
distinct (x # xs)
distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> (\<forall>a\<in>set (all_partitions_list xs). distinct a)

goal (1 subgoal):
 1. set (map set (all_partitions_list xs)) = all_partitions (set xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list xs)) = all_partitions (set xs)

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
from Cons.prems Cons.hyps
[PROOF STATE]
proof (chain)
picking this:
distinct (x # xs)
distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> (\<forall>a\<in>set (all_partitions_list xs). distinct a)
[PROOF STEP]
have hyp_distinct: "\<forall> ps \<in> set (all_partitions_list xs) . distinct ps"
[PROOF STATE]
proof (prove)
using this:
distinct (x # xs)
distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> (\<forall>a\<in>set (all_partitions_list xs). distinct a)

goal (1 subgoal):
 1. \<forall>ps\<in>set (all_partitions_list xs). distinct ps
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>ps\<in>set (all_partitions_list xs). distinct ps

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
have distinct_xs: "distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
distinct (x # xs)

goal (1 subgoal):
 1. distinct xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct xs

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
have x_notin_xs: "x \<notin> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> set xs
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
distinct (x # xs)

goal (1 subgoal):
 1. x \<notin> set xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<notin> set xs

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
have "set (map set (all_partitions_list (x # xs))) = all_partitions (set (x # xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map set (all_partitions_list (x # xs))) = all_partitions (set (x # xs))
[PROOF STEP]
proof (rule equalitySubsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
(* -- {* case set \<rightarrow> list *} *)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
fix P::"'a set set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
(* a partition *)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
let ?P_without_x = "partition_without x P"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
have P_partitions_exc_x: "\<Union> ?P_without_x = \<Union> P - {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (partition_without x P) = \<Union> P - {x}
[PROOF STEP]
using partition_without_covers
[PROOF STATE]
proof (prove)
using this:
\<Union> (partition_without ?elem ?P) = \<Union> ?P - {?elem}

goal (1 subgoal):
 1. \<Union> (partition_without x P) = \<Union> P - {x}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Union> (partition_without x P) = \<Union> P - {x}

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
assume "P \<in> all_partitions (set (x # xs))"
[PROOF STATE]
proof (state)
this:
P \<in> all_partitions (set (x # xs))

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<in> all_partitions (set (x # xs))
[PROOF STEP]
have is_partition_of: "P partitions (set (x # xs))"
[PROOF STATE]
proof (prove)
using this:
P \<in> all_partitions (set (x # xs))

goal (1 subgoal):
 1. P partitions set (x # xs)
[PROOF STEP]
unfolding all_partitions_def
[PROOF STATE]
proof (prove)
using this:
P \<in> {P. P partitions set (x # xs)}

goal (1 subgoal):
 1. P partitions set (x # xs)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
P partitions set (x # xs)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P partitions set (x # xs)
[PROOF STEP]
have is_non_overlapping: "is_non_overlapping P"
[PROOF STATE]
proof (prove)
using this:
P partitions set (x # xs)

goal (1 subgoal):
 1. is_non_overlapping P
[PROOF STEP]
unfolding is_partition_of_def
[PROOF STATE]
proof (prove)
using this:
\<Union> P = set (x # xs) \<and> is_non_overlapping P

goal (1 subgoal):
 1. is_non_overlapping P
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_non_overlapping P

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
from is_partition_of
[PROOF STATE]
proof (chain)
picking this:
P partitions set (x # xs)
[PROOF STEP]
have P_covers: "\<Union> P = set (x # xs)"
[PROOF STATE]
proof (prove)
using this:
P partitions set (x # xs)

goal (1 subgoal):
 1. \<Union> P = set (x # xs)
[PROOF STEP]
unfolding is_partition_of_def
[PROOF STATE]
proof (prove)
using this:
\<Union> P = set (x # xs) \<and> is_non_overlapping P

goal (1 subgoal):
 1. \<Union> P = set (x # xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Union> P = set (x # xs)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
have "?P_without_x partitions (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_without x P partitions set xs
[PROOF STEP]
unfolding is_partition_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (partition_without x P) = set xs \<and> is_non_overlapping (partition_without x P)
[PROOF STEP]
using is_non_overlapping non_overlapping_without_is_non_overlapping partition_without_covers P_covers x_notin_xs
[PROOF STATE]
proof (prove)
using this:
is_non_overlapping P
is_non_overlapping ?P \<Longrightarrow> is_non_overlapping (partition_without ?elem ?P)
\<Union> (partition_without ?elem ?P) = \<Union> ?P - {?elem}
\<Union> P = set (x # xs)
x \<notin> set xs

goal (1 subgoal):
 1. \<Union> (partition_without x P) = set xs \<and> is_non_overlapping (partition_without x P)
[PROOF STEP]
by (metis Diff_insert_absorb List.set_simps(2))
[PROOF STATE]
proof (state)
this:
partition_without x P partitions set xs

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
with hyp_equiv
[PROOF STATE]
proof (chain)
picking this:
set (map set (all_partitions_list xs)) = all_partitions (set xs)
partition_without x P partitions set xs
[PROOF STEP]
have p_list: "?P_without_x \<in> set (map set (all_partitions_list xs))"
[PROOF STATE]
proof (prove)
using this:
set (map set (all_partitions_list xs)) = all_partitions (set xs)
partition_without x P partitions set xs

goal (1 subgoal):
 1. partition_without x P \<in> set (map set (all_partitions_list xs))
[PROOF STEP]
unfolding all_partitions_def
[PROOF STATE]
proof (prove)
using this:
set (map set (all_partitions_list xs)) = {P. P partitions set xs}
partition_without x P partitions set xs

goal (1 subgoal):
 1. partition_without x P \<in> set (map set (all_partitions_list xs))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
partition_without x P \<in> set (map set (all_partitions_list xs))

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
have "P \<in> coarser_partitions_with x ?P_without_x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> coarser_partitions_with x (partition_without x P)
[PROOF STEP]
using coarser_partitions_inv_without is_non_overlapping P_covers
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_non_overlapping ?P; ?elem \<in> \<Union> ?P\<rbrakk> \<Longrightarrow> ?P \<in> coarser_partitions_with ?elem (partition_without ?elem ?P)
is_non_overlapping P
\<Union> P = set (x # xs)

goal (1 subgoal):
 1. P \<in> coarser_partitions_with x (partition_without x P)
[PROOF STEP]
by (metis List.set_simps(2) insertI1)
[PROOF STATE]
proof (state)
this:
P \<in> coarser_partitions_with x (partition_without x P)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<in> coarser_partitions_with x (partition_without x P)
[PROOF STEP]
have "P \<in> \<Union> (coarser_partitions_with x ` set (map set (all_partitions_list xs)))"
[PROOF STATE]
proof (prove)
using this:
P \<in> coarser_partitions_with x (partition_without x P)

goal (1 subgoal):
 1. P \<in> \<Union> (coarser_partitions_with x ` set (map set (all_partitions_list xs)))
[PROOF STEP]
using p_list
[PROOF STATE]
proof (prove)
using this:
P \<in> coarser_partitions_with x (partition_without x P)
partition_without x P \<in> set (map set (all_partitions_list xs))

goal (1 subgoal):
 1. P \<in> \<Union> (coarser_partitions_with x ` set (map set (all_partitions_list xs)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P \<in> \<Union> (coarser_partitions_with x ` set (map set (all_partitions_list xs)))

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<in> \<Union> (coarser_partitions_with x ` set (map set (all_partitions_list xs)))
[PROOF STEP]
have "P \<in> all_coarser_partitions_with x (set (map set (all_partitions_list xs)))"
[PROOF STATE]
proof (prove)
using this:
P \<in> \<Union> (coarser_partitions_with x ` set (map set (all_partitions_list xs)))

goal (1 subgoal):
 1. P \<in> all_coarser_partitions_with x (set (map set (all_partitions_list xs)))
[PROOF STEP]
unfolding all_coarser_partitions_with_def
[PROOF STATE]
proof (prove)
using this:
P \<in> \<Union> (coarser_partitions_with x ` set (map set (all_partitions_list xs)))

goal (1 subgoal):
 1. P \<in> \<Union> (coarser_partitions_with x ` set (map set (all_partitions_list xs)))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
P \<in> all_coarser_partitions_with x (set (map set (all_partitions_list xs)))

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
 2. \<And>xa. xa \<in> all_partitions (set (x # xs)) \<Longrightarrow> xa \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<in> all_coarser_partitions_with x (set (map set (all_partitions_list xs)))
[PROOF STEP]
show "P \<in> set (map set (all_partitions_list (x # xs)))"
[PROOF STATE]
proof (prove)
using this:
P \<in> all_coarser_partitions_with x (set (map set (all_partitions_list xs)))

goal (1 subgoal):
 1. P \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
using all_coarser_partitions_with_list_equivalence hyp_distinct
[PROOF STATE]
proof (prove)
using this:
P \<in> all_coarser_partitions_with x (set (map set (all_partitions_list xs)))
\<forall>P\<in>set ?Ps. distinct P \<Longrightarrow> set (map set (all_coarser_partitions_with_list ?elem ?Ps)) = all_coarser_partitions_with ?elem (set (map set ?Ps))
\<forall>ps\<in>set (all_partitions_list xs). distinct ps

goal (1 subgoal):
 1. P \<in> set (map set (all_partitions_list (x # xs)))
[PROOF STEP]
by (metis all_partitions_list.simps(2))
[PROOF STATE]
proof (state)
this:
P \<in> set (map set (all_partitions_list (x # xs)))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
(* -- {* case list \<rightarrow> set *} *)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
fix P::"'a set set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
(* a partition *)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
assume P: "P \<in> set (map set (all_partitions_list (x # xs)))"
[PROOF STATE]
proof (state)
this:
P \<in> set (map set (all_partitions_list (x # xs)))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
have "set (map set (all_partitions_list (x # xs))) = set (map set (all_coarser_partitions_with_list x (all_partitions_list xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map set (all_partitions_list (x # xs))) = set (map set (all_coarser_partitions_with_list x (all_partitions_list xs)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list (x # xs))) = set (map set (all_coarser_partitions_with_list x (all_partitions_list xs)))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list (x # xs))) = set (map set (all_coarser_partitions_with_list x (all_partitions_list xs)))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
have "\<dots> = all_coarser_partitions_with x (set (map set (all_partitions_list xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map set (all_coarser_partitions_with_list x (all_partitions_list xs))) = all_coarser_partitions_with x (set (map set (all_partitions_list xs)))
[PROOF STEP]
using distinct_xs hyp_distinct all_coarser_partitions_with_list_equivalence
[PROOF STATE]
proof (prove)
using this:
distinct xs
\<forall>ps\<in>set (all_partitions_list xs). distinct ps
\<forall>P\<in>set ?Ps. distinct P \<Longrightarrow> set (map set (all_coarser_partitions_with_list ?elem ?Ps)) = all_coarser_partitions_with ?elem (set (map set ?Ps))

goal (1 subgoal):
 1. set (map set (all_coarser_partitions_with_list x (all_partitions_list xs))) = all_coarser_partitions_with x (set (map set (all_partitions_list xs)))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
set (map set (all_coarser_partitions_with_list x (all_partitions_list xs))) = all_coarser_partitions_with x (set (map set (all_partitions_list xs)))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (map set (all_coarser_partitions_with_list x (all_partitions_list xs))) = all_coarser_partitions_with x (set (map set (all_partitions_list xs)))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
have "\<dots> = all_coarser_partitions_with x (all_partitions (set xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_coarser_partitions_with x (set (map set (all_partitions_list xs))) = all_coarser_partitions_with x (all_partitions (set xs))
[PROOF STEP]
using distinct_xs hyp_equiv
[PROOF STATE]
proof (prove)
using this:
distinct xs
set (map set (all_partitions_list xs)) = all_partitions (set xs)

goal (1 subgoal):
 1. all_coarser_partitions_with x (set (map set (all_partitions_list xs))) = all_coarser_partitions_with x (all_partitions (set xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
all_coarser_partitions_with x (set (map set (all_partitions_list xs))) = all_coarser_partitions_with x (all_partitions (set xs))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (map set (all_partitions_list (x # xs))) = all_coarser_partitions_with x (all_partitions (set xs))
[PROOF STEP]
have P_set: "set (map set (all_partitions_list (x # xs))) = all_coarser_partitions_with x (all_partitions (set xs))"
[PROOF STATE]
proof (prove)
using this:
set (map set (all_partitions_list (x # xs))) = all_coarser_partitions_with x (all_partitions (set xs))

goal (1 subgoal):
 1. set (map set (all_partitions_list (x # xs))) = all_coarser_partitions_with x (all_partitions (set xs))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list (x # xs))) = all_coarser_partitions_with x (all_partitions (set xs))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
with P
[PROOF STATE]
proof (chain)
picking this:
P \<in> set (map set (all_partitions_list (x # xs)))
set (map set (all_partitions_list (x # xs))) = all_coarser_partitions_with x (all_partitions (set xs))
[PROOF STEP]
have "P \<in> all_coarser_partitions_with x (all_partitions (set xs))"
[PROOF STATE]
proof (prove)
using this:
P \<in> set (map set (all_partitions_list (x # xs)))
set (map set (all_partitions_list (x # xs))) = all_coarser_partitions_with x (all_partitions (set xs))

goal (1 subgoal):
 1. P \<in> all_coarser_partitions_with x (all_partitions (set xs))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
P \<in> all_coarser_partitions_with x (all_partitions (set xs))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<in> all_coarser_partitions_with x (all_partitions (set xs))
[PROOF STEP]
have "P \<in> \<Union> (coarser_partitions_with x ` (all_partitions (set xs)))"
[PROOF STATE]
proof (prove)
using this:
P \<in> all_coarser_partitions_with x (all_partitions (set xs))

goal (1 subgoal):
 1. P \<in> \<Union> (coarser_partitions_with x ` all_partitions (set xs))
[PROOF STEP]
unfolding all_coarser_partitions_with_def
[PROOF STATE]
proof (prove)
using this:
P \<in> \<Union> (coarser_partitions_with x ` all_partitions (set xs))

goal (1 subgoal):
 1. P \<in> \<Union> (coarser_partitions_with x ` all_partitions (set xs))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
P \<in> \<Union> (coarser_partitions_with x ` all_partitions (set xs))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<in> \<Union> (coarser_partitions_with x ` all_partitions (set xs))
[PROOF STEP]
obtain Y
      where P_in_Y: "P \<in> Y"
        and Y_coarser: "Y \<in> coarser_partitions_with x ` (all_partitions (set xs))"
[PROOF STATE]
proof (prove)
using this:
P \<in> \<Union> (coarser_partitions_with x ` all_partitions (set xs))

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>P \<in> Y; Y \<in> coarser_partitions_with x ` all_partitions (set xs)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
P \<in> Y
Y \<in> coarser_partitions_with x ` all_partitions (set xs)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
from Y_coarser
[PROOF STATE]
proof (chain)
picking this:
Y \<in> coarser_partitions_with x ` all_partitions (set xs)
[PROOF STEP]
obtain Q
      where Q_part_xs: "Q \<in> all_partitions (set xs)"
        and Y_coarser': "Y = coarser_partitions_with x Q"
[PROOF STATE]
proof (prove)
using this:
Y \<in> coarser_partitions_with x ` all_partitions (set xs)

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>Q \<in> all_partitions (set xs); Y = coarser_partitions_with x Q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Q \<in> all_partitions (set xs)
Y = coarser_partitions_with x Q

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
from P_in_Y Y_coarser'
[PROOF STATE]
proof (chain)
picking this:
P \<in> Y
Y = coarser_partitions_with x Q
[PROOF STEP]
have P_wrt_Q: "P \<in> coarser_partitions_with x Q"
[PROOF STATE]
proof (prove)
using this:
P \<in> Y
Y = coarser_partitions_with x Q

goal (1 subgoal):
 1. P \<in> coarser_partitions_with x Q
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
P \<in> coarser_partitions_with x Q

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<in> coarser_partitions_with x Q
[PROOF STEP]
have "Q \<in> all_partitions (set xs)"
[PROOF STATE]
proof (prove)
using this:
P \<in> coarser_partitions_with x Q

goal (1 subgoal):
 1. Q \<in> all_partitions (set xs)
[PROOF STEP]
using Q_part_xs
[PROOF STATE]
proof (prove)
using this:
P \<in> coarser_partitions_with x Q
Q \<in> all_partitions (set xs)

goal (1 subgoal):
 1. Q \<in> all_partitions (set xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Q \<in> all_partitions (set xs)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q \<in> all_partitions (set xs)
[PROOF STEP]
have "Q partitions (set xs)"
[PROOF STATE]
proof (prove)
using this:
Q \<in> all_partitions (set xs)

goal (1 subgoal):
 1. Q partitions set xs
[PROOF STEP]
unfolding all_partitions_def
[PROOF STATE]
proof (prove)
using this:
Q \<in> {P. P partitions set xs}

goal (1 subgoal):
 1. Q partitions set xs
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Q partitions set xs

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q partitions set xs
[PROOF STEP]
have "is_non_overlapping Q" and Q_covers: "\<Union> Q = set xs"
[PROOF STATE]
proof (prove)
using this:
Q partitions set xs

goal (1 subgoal):
 1. is_non_overlapping Q &&& \<Union> Q = set xs
[PROOF STEP]
unfolding is_partition_of_def
[PROOF STATE]
proof (prove)
using this:
\<Union> Q = set xs \<and> is_non_overlapping Q

goal (1 subgoal):
 1. is_non_overlapping Q &&& \<Union> Q = set xs
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
is_non_overlapping Q
\<Union> Q = set xs

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_non_overlapping Q
\<Union> Q = set xs
[PROOF STEP]
have P_partition: "is_non_overlapping P"
[PROOF STATE]
proof (prove)
using this:
is_non_overlapping Q
\<Union> Q = set xs

goal (1 subgoal):
 1. is_non_overlapping P
[PROOF STEP]
using non_overlapping_extension3 P_wrt_Q x_notin_xs
[PROOF STATE]
proof (prove)
using this:
is_non_overlapping Q
\<Union> Q = set xs
\<lbrakk>is_non_overlapping ?P; ?elem \<notin> \<Union> ?P; ?Q \<in> coarser_partitions_with ?elem ?P\<rbrakk> \<Longrightarrow> is_non_overlapping ?Q
P \<in> coarser_partitions_with x Q
x \<notin> set xs

goal (1 subgoal):
 1. is_non_overlapping P
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
is_non_overlapping P

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
have "\<Union> P = set xs \<union> {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> P = set xs \<union> {x}
[PROOF STEP]
using Q_covers P_in_Y Y_coarser' coarser_partitions_covers
[PROOF STATE]
proof (prove)
using this:
\<Union> Q = set xs
P \<in> Y
Y = coarser_partitions_with x Q
?Q \<in> coarser_partitions_with ?elem ?P \<Longrightarrow> \<Union> ?Q = insert ?elem (\<Union> ?P)

goal (1 subgoal):
 1. \<Union> P = set xs \<union> {x}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<Union> P = set xs \<union> {x}

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> P = set xs \<union> {x}
[PROOF STEP]
have "\<Union> P = set (x # xs)"
[PROOF STATE]
proof (prove)
using this:
\<Union> P = set xs \<union> {x}

goal (1 subgoal):
 1. \<Union> P = set (x # xs)
[PROOF STEP]
using x_notin_xs P_wrt_Q Q_covers
[PROOF STATE]
proof (prove)
using this:
\<Union> P = set xs \<union> {x}
x \<notin> set xs
P \<in> coarser_partitions_with x Q
\<Union> Q = set xs

goal (1 subgoal):
 1. \<Union> P = set (x # xs)
[PROOF STEP]
by (metis List.set_simps(2) insert_is_Un sup_commute)
[PROOF STATE]
proof (state)
this:
\<Union> P = set (x # xs)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> P = set (x # xs)
[PROOF STEP]
have "P partitions (set (x # xs))"
[PROOF STATE]
proof (prove)
using this:
\<Union> P = set (x # xs)

goal (1 subgoal):
 1. P partitions set (x # xs)
[PROOF STEP]
using P_partition
[PROOF STATE]
proof (prove)
using this:
\<Union> P = set (x # xs)
is_non_overlapping P

goal (1 subgoal):
 1. P partitions set (x # xs)
[PROOF STEP]
unfolding is_partition_of_def
[PROOF STATE]
proof (prove)
using this:
\<Union> P = set (x # xs)
is_non_overlapping P

goal (1 subgoal):
 1. \<Union> P = set (x # xs) \<and> is_non_overlapping P
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P partitions set (x # xs)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (map set (all_partitions_list (x # xs))) \<Longrightarrow> xa \<in> all_partitions (set (x # xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P partitions set (x # xs)
[PROOF STEP]
show "P \<in> all_partitions (set (x # xs))"
[PROOF STATE]
proof (prove)
using this:
P partitions set (x # xs)

goal (1 subgoal):
 1. P \<in> all_partitions (set (x # xs))
[PROOF STEP]
unfolding all_partitions_def
[PROOF STATE]
proof (prove)
using this:
P partitions set (x # xs)

goal (1 subgoal):
 1. P \<in> {P. P partitions set (x # xs)}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
P \<in> all_partitions (set (x # xs))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list (x # xs))) = all_partitions (set (x # xs))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list (x # xs))) = all_partitions (set (x # xs))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
have "\<forall> ps \<in> set (all_partitions_list (x # xs)) . distinct ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ps\<in>set (all_partitions_list (x # xs)). distinct ps
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
fix ps::"'a set list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
assume ps_part: "ps \<in> set (all_partitions_list (x # xs))"
[PROOF STATE]
proof (state)
this:
ps \<in> set (all_partitions_list (x # xs))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
have "set (all_partitions_list (x # xs)) = set (all_coarser_partitions_with_list x (all_partitions_list xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (all_partitions_list (x # xs)) = set (all_coarser_partitions_with_list x (all_partitions_list xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (all_partitions_list (x # xs)) = set (all_coarser_partitions_with_list x (all_partitions_list xs))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (all_partitions_list (x # xs)) = set (all_coarser_partitions_with_list x (all_partitions_list xs))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
have "\<dots> = set (concat (map (coarser_partitions_with_list x) (all_partitions_list xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (all_coarser_partitions_with_list x (all_partitions_list xs)) = set (concat (map (coarser_partitions_with_list x) (all_partitions_list xs)))
[PROOF STEP]
unfolding all_coarser_partitions_with_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (concat (map (coarser_partitions_with_list x) (all_partitions_list xs))) = set (concat (map (coarser_partitions_with_list x) (all_partitions_list xs)))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
set (all_coarser_partitions_with_list x (all_partitions_list xs)) = set (concat (map (coarser_partitions_with_list x) (all_partitions_list xs)))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (all_coarser_partitions_with_list x (all_partitions_list xs)) = set (concat (map (coarser_partitions_with_list x) (all_partitions_list xs)))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
have "\<dots> = \<Union> ((set \<circ> (coarser_partitions_with_list x)) ` (set (all_partitions_list xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (concat (map (coarser_partitions_with_list x) (all_partitions_list xs))) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (concat (map (coarser_partitions_with_list x) (all_partitions_list xs))) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))
[PROOF STEP]
have all_parts_unfolded: "set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> (coarser_partitions_with_list x)) ` (set (all_partitions_list xs)))"
[PROOF STATE]
proof (prove)
using this:
set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))

goal (1 subgoal):
 1. set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
(* \<dots> = \<Union> { set (coarser_partitions_with_list x ps) | ps . ps \<in> set (all_partitions_list xs) }
       (more readable, but less useful in proofs) *)
[PROOF STATE]
proof (state)
this:
set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
with ps_part
[PROOF STATE]
proof (chain)
picking this:
ps \<in> set (all_partitions_list (x # xs))
set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))
[PROOF STEP]
obtain qs
      where qs: "qs \<in> set (all_partitions_list xs)"
        and ps_coarser: "ps \<in> set (coarser_partitions_with_list x qs)"
[PROOF STATE]
proof (prove)
using this:
ps \<in> set (all_partitions_list (x # xs))
set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))

goal (1 subgoal):
 1. (\<And>qs. \<lbrakk>qs \<in> set (all_partitions_list xs); ps \<in> set (coarser_partitions_with_list x qs)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using UnionE comp_def imageE
[PROOF STATE]
proof (prove)
using this:
ps \<in> set (all_partitions_list (x # xs))
set (all_partitions_list (x # xs)) = \<Union> ((set \<circ> coarser_partitions_with_list x) ` set (all_partitions_list xs))
\<lbrakk>?A \<in> \<Union> ?C; \<And>X. \<lbrakk>?A \<in> X; X \<in> ?C\<rbrakk> \<Longrightarrow> ?R\<rbrakk> \<Longrightarrow> ?R
?f \<circ> ?g = (\<lambda>x. ?f (?g x))
\<lbrakk>?b \<in> ?f ` ?A; \<And>x. \<lbrakk>?b = ?f x; x \<in> ?A\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>qs. \<lbrakk>qs \<in> set (all_partitions_list xs); ps \<in> set (coarser_partitions_with_list x qs)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
qs \<in> set (all_partitions_list xs)
ps \<in> set (coarser_partitions_with_list x qs)

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
from qs
[PROOF STATE]
proof (chain)
picking this:
qs \<in> set (all_partitions_list xs)
[PROOF STEP]
have "set qs \<in> set (map set (all_partitions_list (xs)))"
[PROOF STATE]
proof (prove)
using this:
qs \<in> set (all_partitions_list xs)

goal (1 subgoal):
 1. set qs \<in> set (map set (all_partitions_list xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set qs \<in> set (map set (all_partitions_list xs))

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
with distinct_xs hyp_equiv
[PROOF STATE]
proof (chain)
picking this:
distinct xs
set (map set (all_partitions_list xs)) = all_partitions (set xs)
set qs \<in> set (map set (all_partitions_list xs))
[PROOF STEP]
have qs_hyp: "set qs \<in> all_partitions (set xs)"
[PROOF STATE]
proof (prove)
using this:
distinct xs
set (map set (all_partitions_list xs)) = all_partitions (set xs)
set qs \<in> set (map set (all_partitions_list xs))

goal (1 subgoal):
 1. set qs \<in> all_partitions (set xs)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
set qs \<in> all_partitions (set xs)

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set qs \<in> all_partitions (set xs)
[PROOF STEP]
have qs_part: "is_non_overlapping (set qs)"
[PROOF STATE]
proof (prove)
using this:
set qs \<in> all_partitions (set xs)

goal (1 subgoal):
 1. is_non_overlapping (set qs)
[PROOF STEP]
using all_partitions_def is_partition_of_def
[PROOF STATE]
proof (prove)
using this:
set qs \<in> all_partitions (set xs)
all_partitions ?A = {P. P partitions ?A}
?P partitions ?A = (\<Union> ?P = ?A \<and> is_non_overlapping ?P)

goal (1 subgoal):
 1. is_non_overlapping (set qs)
[PROOF STEP]
by (metis mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
is_non_overlapping (set qs)

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_non_overlapping (set qs)
[PROOF STEP]
have distinct_qs: "distinct qs"
[PROOF STATE]
proof (prove)
using this:
is_non_overlapping (set qs)

goal (1 subgoal):
 1. distinct qs
[PROOF STEP]
using qs distinct_xs hyp_distinct
[PROOF STATE]
proof (prove)
using this:
is_non_overlapping (set qs)
qs \<in> set (all_partitions_list xs)
distinct xs
\<forall>ps\<in>set (all_partitions_list xs). distinct ps

goal (1 subgoal):
 1. distinct qs
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
distinct qs

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
from Cons.prems
[PROOF STATE]
proof (chain)
picking this:
distinct (x # xs)
[PROOF STEP]
have "x \<notin> set xs"
[PROOF STATE]
proof (prove)
using this:
distinct (x # xs)

goal (1 subgoal):
 1. x \<notin> set xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<notin> set xs

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> set xs
[PROOF STEP]
have new: "{x} \<notin> set qs"
[PROOF STATE]
proof (prove)
using this:
x \<notin> set xs

goal (1 subgoal):
 1. {x} \<notin> set qs
[PROOF STEP]
using qs_hyp
[PROOF STATE]
proof (prove)
using this:
x \<notin> set xs
set qs \<in> all_partitions (set xs)

goal (1 subgoal):
 1. {x} \<notin> set qs
[PROOF STEP]
unfolding all_partitions_def is_partition_of_def
[PROOF STATE]
proof (prove)
using this:
x \<notin> set xs
set qs \<in> {P. \<Union> P = set xs \<and> is_non_overlapping P}

goal (1 subgoal):
 1. {x} \<notin> set qs
[PROOF STEP]
by (metis (lifting, mono_tags) UnionI insertI1 mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
{x} \<notin> set qs

goal (1 subgoal):
 1. \<And>ps. ps \<in> set (all_partitions_list (x # xs)) \<Longrightarrow> distinct ps
[PROOF STEP]
from ps_coarser distinct_qs qs_part new
[PROOF STATE]
proof (chain)
picking this:
ps \<in> set (coarser_partitions_with_list x qs)
distinct qs
is_non_overlapping (set qs)
{x} \<notin> set qs
[PROOF STEP]
show "distinct ps"
[PROOF STATE]
proof (prove)
using this:
ps \<in> set (coarser_partitions_with_list x qs)
distinct qs
is_non_overlapping (set qs)
{x} \<notin> set qs

goal (1 subgoal):
 1. distinct ps
[PROOF STEP]
by (rule coarser_partitions_with_list_distinct)
[PROOF STATE]
proof (state)
this:
distinct ps

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>ps\<in>set (all_partitions_list (x # xs)). distinct ps

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs) \<and> Ball (set (all_partitions_list xs)) distinct; distinct (a # xs)\<rbrakk> \<Longrightarrow> set (map set (all_partitions_list (a # xs))) = all_partitions (set (a # xs)) \<and> Ball (set (all_partitions_list (a # xs))) distinct
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (map set (all_partitions_list (x # xs))) = all_partitions (set (x # xs))
\<forall>ps\<in>set (all_partitions_list (x # xs)). distinct ps
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set (map set (all_partitions_list (x # xs))) = all_partitions (set (x # xs))
\<forall>ps\<in>set (all_partitions_list (x # xs)). distinct ps

goal (1 subgoal):
 1. set (map set (all_partitions_list (x # xs))) = all_partitions (set (x # xs)) \<and> (\<forall>a\<in>set (all_partitions_list (x # xs)). distinct a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
set (map set (all_partitions_list (x # xs))) = all_partitions (set (x # xs)) \<and> (\<forall>a\<in>set (all_partitions_list (x # xs)). distinct a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_less_one [simp]: "\<lfloor>x\<rfloor> < 1 \<longleftrightarrow> x < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> < 1) = (x < (1::'a))
[PROOF STEP]
by (simp add: floor_less_iff)


[STATEMENT]
lemma invariantsHoldInValidRuns:
  fixes F0 :: Formula and decisionVars :: "Variable set"
  assumes "invariantsHoldInState stateA F0 decisionVars" and
  "(stateA, stateB) \<in> transitionRelation F0 decisionVars"
  shows "invariantsHoldInState stateB F0 decisionVars"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invariantsHoldInState stateA F0 decisionVars
(stateA, stateB) \<in> transitionRelation F0 decisionVars

goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
using transitionsPreserveInvariants
[PROOF STATE]
proof (prove)
using this:
invariantsHoldInState stateA F0 decisionVars
(stateA, stateB) \<in> transitionRelation F0 decisionVars
\<lbrakk>transition ?stateA ?stateB ?F0.0 ?decisionVars; invariantsHoldInState ?stateA ?F0.0 ?decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState ?stateB ?F0.0 ?decisionVars

goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
using rtrancl_induct[of "stateA" "stateB"
  "{(stateA, stateB). transition stateA stateB F0 decisionVars}" "\<lambda> x. invariantsHoldInState x F0 decisionVars"]
[PROOF STATE]
proof (prove)
using this:
invariantsHoldInState stateA F0 decisionVars
(stateA, stateB) \<in> transitionRelation F0 decisionVars
\<lbrakk>transition ?stateA ?stateB ?F0.0 ?decisionVars; invariantsHoldInState ?stateA ?F0.0 ?decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState ?stateB ?F0.0 ?decisionVars
\<lbrakk>(stateA, stateB) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*; invariantsHoldInState stateA F0 decisionVars; \<And>y z. \<lbrakk>(stateA, y) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*; (y, z) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}; invariantsHoldInState y F0 decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState z F0 decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState stateB F0 decisionVars

goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
unfolding transitionRelation_def
[PROOF STATE]
proof (prove)
using this:
invariantsHoldInState stateA F0 decisionVars
(stateA, stateB) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*
\<lbrakk>transition ?stateA ?stateB ?F0.0 ?decisionVars; invariantsHoldInState ?stateA ?F0.0 ?decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState ?stateB ?F0.0 ?decisionVars
\<lbrakk>(stateA, stateB) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*; invariantsHoldInState stateA F0 decisionVars; \<And>y z. \<lbrakk>(stateA, y) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*; (y, z) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}; invariantsHoldInState y F0 decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState z F0 decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState stateB F0 decisionVars

goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
by auto


[STATEMENT]
theorem regular_lang: "regular (lang r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. regular (lang r)
[PROOF STEP]
by (induct r)
     (auto simp: regular_empty regular_nullstr regular_singstr regular_Un regular_conc regular_star)


[STATEMENT]
lemma (in domain) subring_polynomial_pow_degree:
  assumes "subring K R" and "p \<in> carrier (K[X])"
  shows "degree (p [^]\<^bsub>K[X]\<^esub> n) = n * degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p [^]\<^bsub>K [X]\<^esub> n) = n * degree p
[PROOF STEP]
using domain.polynomial_pow_degree[OF subring_is_domain, of K p n] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subring K R; p \<in> carrier (poly_ring (R\<lparr>carrier := K\<rparr>))\<rbrakk> \<Longrightarrow> degree (p [^]\<^bsub>poly_ring (R\<lparr>carrier := K\<rparr>)\<^esub> n) = n * degree p
subring K R
p \<in> carrier (K [X])

goal (1 subgoal):
 1. degree (p [^]\<^bsub>K [X]\<^esub> n) = n * degree p
[PROOF STEP]
unfolding univ_poly_consistent[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subring K R; p \<in> carrier (carrier (R\<lparr>carrier := K\<rparr>) [X])\<rbrakk> \<Longrightarrow> degree (p [^]\<^bsub>carrier (R\<lparr>carrier := K\<rparr>) [X]\<^esub> n) = n * degree p
subring K R
p \<in> carrier (K [X])

goal (1 subgoal):
 1. degree (p [^]\<^bsub>K [X]\<^esub> n) = n * degree p
[PROOF STEP]
by simp


[STATEMENT]
lemma octo_eq_iff:
  "x = y \<longleftrightarrow> Ree x = Ree y \<and> Im1 x = Im1 y \<and> Im2 x = Im2 y \<and> Im3 x = Im3 y \<and>
             Im4 x = Im4 y \<and> Im5 x = Im5 y \<and> Im6 x = Im6 y  \<and> Im7 x = Im7 y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = y) = (Ree x = Ree y \<and> Im1 x = Im1 y \<and> Im2 x = Im2 y \<and> Im3 x = Im3 y \<and> Im4 x = Im4 y \<and> Im5 x = Im5 y \<and> Im6 x = Im6 y \<and> Im7 x = Im7 y)
[PROOF STEP]
by (auto intro: octo.expand)


[STATEMENT]
lemma budget_constraint_is_feasible:
  assumes "i \<in> agents"
  assumes "X \<in> (budget_constraint (calculate_value P) consumption_set (P \<bullet> \<E>[i]))"
  shows "P \<bullet> X \<le> P \<bullet> \<E>[i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<bullet> X \<le> P \<bullet> \<E>[i]
[PROOF STEP]
using budget_constraint_def assms
[PROOF STATE]
proof (prove)
using this:
budget_constraint ?f ?S ?W = {x \<in> ?S. ?f x \<le> ?W}
i \<in> agents
X \<in> budget_constraint ((\<bullet>) P) consumption_set (P \<bullet> \<E>[i])

goal (1 subgoal):
 1. P \<bullet> X \<le> P \<bullet> \<E>[i]
[PROOF STEP]
by (simp add: budget_constraint_def)


[STATEMENT]
lemma size_queue_sum_list:
  "size (queue_to_multiset bq) = sum_list (map (size \<circ> tree_to_multiset) bq)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (queue_to_multiset bq) = sum_list (map (size \<circ> tree_to_multiset) bq)
[PROOF STEP]
by (induct bq) simp_all


[STATEMENT]
lemma real_of_int_div3: "real_of_int n / real_of_int x - real_of_int (n div x) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int n / real_of_int x - real_of_int (n div x) \<le> 1
[PROOF STEP]
apply (simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int n / real_of_int x \<le> 1 + real_of_int (n div x)
[PROOF STEP]
by (metis add.commute floor_correct floor_divide_of_int_eq less_eq_real_def of_int_1 of_int_add)


[STATEMENT]
lemma content_pos_lt_eq: "0 < content (cbox a (b::'a::euclidean_space)) \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < content (cbox a b)) = (\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i)
[PROOF STEP]
by (auto simp add: content_cbox_cases less_le prod_nonneg)


[STATEMENT]
lemma Suc_le_length_iff:
  "(Suc n \<le> length xs) = (\<exists>x ys. xs = x # ys \<and> n \<le> length ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc n \<le> length xs) = (\<exists>x ys. xs = x # ys \<and> n \<le> length ys)
[PROOF STEP]
by (metis Suc_le_D[of n] Suc_le_mono[of n] Suc_length_conv[of _ xs])


[STATEMENT]
lemma fct_bound':
  fixes f::"complex\<Rightarrow> real"
  assumes "f(-1) + f 1 = 1"
and "0 \<le> f 1"
and "0 \<le> f (-1)"
shows "\<bar>f 1  - f(-1)\<bar> \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f 1 - f (- 1)\<bar> \<le> 1
[PROOF STEP]
using assms fct_bound
[PROOF STATE]
proof (prove)
using this:
f (- 1) + f 1 = 1
0 \<le> f 1
0 \<le> f (- 1)
\<lbrakk>?f (- 1) + ?f 1 = 1; 0 \<le> ?f 1; 0 \<le> ?f (- 1)\<rbrakk> \<Longrightarrow> - 1 \<le> ?f 1 - ?f (- 1) \<and> ?f 1 - ?f (- 1) \<le> 1

goal (1 subgoal):
 1. \<bar>f 1 - f (- 1)\<bar> \<le> 1
[PROOF STEP]
by auto


[STATEMENT]
lemma length_alternating_list: "length (alternating_list n s t) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (alternating_list n s t) = n
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma oSuc_less_oSuc [iff]: "(oSuc x < oSuc y) = (x < y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (oSuc x < oSuc y) = (x < y)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. oSuc x < oSuc y \<Longrightarrow> x < y
 2. x < y \<Longrightarrow> oSuc x < oSuc y
[PROOF STEP]
apply (simp add: less_oSuc_eq_le order_less_le_trans[OF less_oSuc])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < y \<Longrightarrow> oSuc x < oSuc y
[PROOF STEP]
apply (erule order_le_less_trans[OF oSuc_leI less_oSuc])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eventually_less_imp_le:
  assumes "eventually (\<lambda>x. f x < (g x :: 'a :: order)) F"
  shows   "eventually (\<lambda>x. f x \<le> g x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<le> g x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x < g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<le> g x
[PROOF STEP]
by eventually_elim auto


[STATEMENT]
lemma convex_hull_exchange_Union:
  fixes a :: "'a::euclidean_space"
  assumes "a \<in> convex hull S"
  shows "convex hull S = (\<Union>b \<in> S. convex hull (insert a (S - {b})))" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull S = (\<Union>b\<in>S. convex hull insert a (S - {b}))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convex hull S \<subseteq> (\<Union>b\<in>S. convex hull insert a (S - {b}))
 2. (\<Union>b\<in>S. convex hull insert a (S - {b})) \<subseteq> convex hull S
[PROOF STEP]
show "?lhs \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull S \<subseteq> (\<Union>b\<in>S. convex hull insert a (S - {b}))
[PROOF STEP]
by (blast intro: in_convex_hull_exchange [OF assms])
[PROOF STATE]
proof (state)
this:
convex hull S \<subseteq> (\<Union>b\<in>S. convex hull insert a (S - {b}))

goal (1 subgoal):
 1. (\<Union>b\<in>S. convex hull insert a (S - {b})) \<subseteq> convex hull S
[PROOF STEP]
show "?rhs \<subseteq> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>b\<in>S. convex hull insert a (S - {b})) \<subseteq> convex hull S
[PROOF STEP]
proof clarify
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x b. \<lbrakk>b \<in> S; x \<in> convex hull insert a (S - {b})\<rbrakk> \<Longrightarrow> x \<in> convex hull S
[PROOF STEP]
fix x b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x b. \<lbrakk>b \<in> S; x \<in> convex hull insert a (S - {b})\<rbrakk> \<Longrightarrow> x \<in> convex hull S
[PROOF STEP]
assume"b \<in> S" "x \<in> convex hull insert a (S - {b})"
[PROOF STATE]
proof (state)
this:
b \<in> S
x \<in> convex hull insert a (S - {b})

goal (1 subgoal):
 1. \<And>x b. \<lbrakk>b \<in> S; x \<in> convex hull insert a (S - {b})\<rbrakk> \<Longrightarrow> x \<in> convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> S
x \<in> convex hull insert a (S - {b})
[PROOF STEP]
show "x \<in> convex hull S" if "b \<in> S"
[PROOF STATE]
proof (prove)
using this:
b \<in> S
x \<in> convex hull insert a (S - {b})

goal (1 subgoal):
 1. x \<in> convex hull S
[PROOF STEP]
by (metis (no_types) that assms order_refl hull_mono hull_redundant insert_Diff_single insert_subset subsetCE)
[PROOF STATE]
proof (state)
this:
b \<in> S \<Longrightarrow> x \<in> convex hull S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Union>b\<in>S. convex hull insert a (S - {b})) \<subseteq> convex hull S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_neg_powr_complex_of_nat:
  assumes "filterlim f at_top F" and "Re s < 0"
  shows   "((\<lambda>x. of_nat (f x) powr s) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. of_nat (f x) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. of_nat (f x) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
have "((\<lambda>x. of_real (real (f x)) powr s) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real (real (f x)) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
Re s < 0

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real (real (f x)) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
by (intro filterlim_compose[OF _ tendsto_neg_powr_complex_of_real]
              filterlim_compose[OF _ assms(1)] filterlim_real_sequentially filterlim_ident) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. complex_of_real (real (f x)) powr s) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>x. of_nat (f x) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. complex_of_real (real (f x)) powr s) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>x. of_nat (f x) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. of_nat (f x) powr s) \<longlongrightarrow> 0) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lcm_0_iff_nat [simp]: "lcm m n = 0 \<longleftrightarrow> m = 0 \<or> n = 0"
  for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lcm m n = 0) = (m = 0 \<or> n = 0)
[PROOF STEP]
by (fact lcm_eq_0_iff)


[STATEMENT]
lemma Smith_1xn_two_matrices_all:
  assumes is_SNF: "\<forall>(A::'a::comm_ring_1 mat) \<in> carrier_mat 1 n. is_SNF A (Smith_1xn A)"
  shows "\<exists>Smith_1xn'. \<forall>(A::'a::comm_ring_1 mat) \<in> carrier_mat 1 n. is_SNF A (1\<^sub>m 1, (Smith_1xn' A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Smith_1xn'. \<forall>A\<in>carrier_mat 1 n. is_SNF A (1\<^sub>m 1, Smith_1xn' A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>Smith_1xn'. \<forall>A\<in>carrier_mat 1 n. is_SNF A (1\<^sub>m 1, Smith_1xn' A)
[PROOF STEP]
let ?Smith_1xn' = "\<lambda>A. let (P,S,Q) = (Smith_1xn A) in (S, P $$ (0, 0) \<cdot>\<^sub>m Q)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>Smith_1xn'. \<forall>A\<in>carrier_mat 1 n. is_SNF A (1\<^sub>m 1, Smith_1xn' A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Smith_1xn'. \<forall>A\<in>carrier_mat 1 n. is_SNF A (1\<^sub>m 1, Smith_1xn' A)
[PROOF STEP]
by (rule exI[of _ ?Smith_1xn']) (smt Smith_1xn_two_matrices assms carrier_matD
        carrier_matI case_prodE determinant_one_element index_smult_mat(2,3) invertible_iff_is_unit_JNF
        invertible_mat_smult_mat smult_mat_mat_one_element left_mult_one_mat is_SNF_def
        mult_smult_assoc_mat mult_smult_distrib prod.simps(2))
[PROOF STATE]
proof (state)
this:
\<exists>Smith_1xn'. \<forall>A\<in>carrier_mat 1 n. is_SNF A (1\<^sub>m 1, Smith_1xn' A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cis_diff_cis_opposite [simp]:
  shows "cis \<phi> - cis (- \<phi>) = 2 * \<i> * sin \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis \<phi> - cis (- \<phi>) = 2 * \<i> * cor (sin \<phi>)
[PROOF STEP]
using Im_express_cnj[of "cis \<phi>"]
[PROOF STATE]
proof (prove)
using this:
cor (Im (cis \<phi>)) = (cis \<phi> - cnj (cis \<phi>)) / (2 * \<i>)

goal (1 subgoal):
 1. cis \<phi> - cis (- \<phi>) = 2 * \<i> * cor (sin \<phi>)
[PROOF STEP]
by simp


[STATEMENT]
lemma residue_1_zero:
  "residue 1 n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue 1 n = 0
[PROOF STEP]
by (simp add: residue_def)


[STATEMENT]
lemma integrable_componentwise:
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space"
  shows "(\<And>b. b \<in> Basis \<Longrightarrow> (\<lambda>x. f x \<bullet> b) integrable_on A) \<Longrightarrow> f integrable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. b \<in> Basis \<Longrightarrow> (\<lambda>x. f x \<bullet> b) integrable_on A) \<Longrightarrow> f integrable_on A
[PROOF STEP]
by (subst integrable_componentwise_iff) blast


[STATEMENT]
lemma distinct_alt:
  "finite (relations t)
    \<Longrightarrow> distinct_relations t \<longleftrightarrow> Finite_Set.card (relations t) = length (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (relations t) \<Longrightarrow> distinct_relations t = (Finite_Set.card (relations t) = length (inorder t))
[PROOF STEP]
using card_eq_length_impl_distinct distinct_impl_card_eq_length
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (relations ?t); height ?t \<le> ?n; Finite_Set.card (relations ?t) = length (inorder ?t)\<rbrakk> \<Longrightarrow> distinct_relations ?t
\<lbrakk>finite (relations ?t); height ?t \<le> ?n; distinct_relations ?t\<rbrakk> \<Longrightarrow> Finite_Set.card (relations ?t) = length (inorder ?t)

goal (1 subgoal):
 1. finite (relations t) \<Longrightarrow> distinct_relations t = (Finite_Set.card (relations t) = length (inorder t))
[PROOF STEP]
by auto


[STATEMENT]
lemma DERIV_unique: "DERIV f x :> D \<Longrightarrow> DERIV f x :> E \<Longrightarrow> D = E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative D) (at x); (f has_field_derivative E) (at x)\<rbrakk> \<Longrightarrow> D = E
[PROOF STEP]
unfolding DERIV_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>h. (f (x + h) - f x) / h) \<midarrow>0::'a\<rightarrow> D; (\<lambda>h. (f (x + h) - f x) / h) \<midarrow>0::'a\<rightarrow> E\<rbrakk> \<Longrightarrow> D = E
[PROOF STEP]
by (rule LIM_unique)


[STATEMENT]
lemma tendsto_of_real_0_I:
  "(f \<longlongrightarrow> 0) G \<Longrightarrow> ((\<lambda>x. (of_real (f x))) \<longlongrightarrow> (0 ::'a::real_normed_div_algebra)) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> 0) G \<Longrightarrow> ((\<lambda>x. of_real (f x)) \<longlongrightarrow> (0::'a)) G
[PROOF STEP]
using tendsto_of_real_iff
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. of_real (?f x)) \<longlongrightarrow> of_real ?c) ?F = (?f \<longlongrightarrow> ?c) ?F

goal (1 subgoal):
 1. (f \<longlongrightarrow> 0) G \<Longrightarrow> ((\<lambda>x. of_real (f x)) \<longlongrightarrow> (0::'a)) G
[PROOF STEP]
by force


[STATEMENT]
lemma column_transpose [simp]: "column i (transpose A) = row i A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (Finite_Cartesian_Product.transpose A) = row i A
[PROOF STEP]
by (simp add: row_def column_def transpose_def vec_eq_iff)


[STATEMENT]
lemma eventually_not_equal: "eventually (\<lambda>x::'a::linordered_semidom. x \<noteq> a) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. x \<noteq> a
[PROOF STEP]
using eventually_ge_at_top[of "a+1"]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) (a + (1::'a))) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. x \<noteq> a
[PROOF STEP]
by eventually_elim (insert less_add_one[of a], auto)


[STATEMENT]
lemma HNF_algorithm_soundness:
  assumes A: "A \<in> carrier_mat m n"
  shows "Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A)
    \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> (HNF_algorithm abs_flag A) = P * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
proof (cases "m\<noteq>n \<or> Determinant.det A = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
m \<noteq> n \<or> det A = 0

goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
have H_rw: "HNF_algorithm abs_flag A = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HNF_algorithm abs_flag A = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m]
[PROOF STEP]
using True A
[PROOF STATE]
proof (prove)
using this:
m \<noteq> n \<or> det A = 0
A \<in> carrier_mat m n

goal (1 subgoal):
 1. HNF_algorithm abs_flag A = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m]
[PROOF STEP]
unfolding HNF_algorithm_def Let_def
[PROOF STATE]
proof (prove)
using this:
m \<noteq> n \<or> det A = 0
A \<in> carrier_mat m n

goal (1 subgoal):
 1. (if dim_row A \<noteq> dim_col A then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else if \<bar>det_int A\<bar> = 0 then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A])) = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
HNF_algorithm abs_flag A = Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m]

goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
have "(\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> (HNF_algorithm abs_flag A) = P * (FindPreHNF_rectangular A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A
[PROOF STEP]
unfolding H_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<m] = P * FindPreHNF_rectangular A
[PROOF STEP]
proof (rule invertible_Hermite_of_list_of_rows)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. FindPreHNF_rectangular A \<in> carrier_mat m ?n
 2. echelon_form_JNF (FindPreHNF_rectangular A)
[PROOF STEP]
show "FindPreHNF_rectangular A \<in> carrier_mat m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FindPreHNF_rectangular A \<in> carrier_mat m n
[PROOF STEP]
by (smt A FindPreHNF_rectangular_soundness mult_carrier_mat)
[PROOF STATE]
proof (state)
this:
FindPreHNF_rectangular A \<in> carrier_mat m n

goal (1 subgoal):
 1. echelon_form_JNF (FindPreHNF_rectangular A)
[PROOF STEP]
show "echelon_form_JNF (FindPreHNF_rectangular A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. echelon_form_JNF (FindPreHNF_rectangular A)
[PROOF STEP]
using FindPreHNF_rectangular_soundness
[PROOF STATE]
proof (prove)
using this:
?A \<in> carrier_mat ?m ?n \<Longrightarrow> \<exists>P. invertible_mat P \<and> P \<in> carrier_mat ?m ?m \<and> P * ?A = FindPreHNF_rectangular ?A \<and> echelon_form_JNF (FindPreHNF_rectangular ?A)

goal (1 subgoal):
 1. echelon_form_JNF (FindPreHNF_rectangular A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
echelon_form_JNF (FindPreHNF_rectangular A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A

goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A

goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
have "(\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> (FindPreHNF_rectangular A) = P * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> FindPreHNF_rectangular A = P * A
[PROOF STEP]
by (metis A FindPreHNF_rectangular_soundness)
[PROOF STATE]
proof (state)
this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> FindPreHNF_rectangular A = P * A

goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> FindPreHNF_rectangular A = P * A
[PROOF STEP]
have "(\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> (HNF_algorithm abs_flag A) = P * A)"
[PROOF STATE]
proof (prove)
using this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * FindPreHNF_rectangular A
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> FindPreHNF_rectangular A = P * A

goal (1 subgoal):
 1. \<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A
[PROOF STEP]
by (smt assms assoc_mult_mat invertible_mult_JNF mult_carrier_mat)
[PROOF STATE]
proof (state)
this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A

goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A

goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
have "Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A)
[PROOF STEP]
by (metis A FindPreHNF_rectangular_soundness H_rw Hermite_Hermite_of_list_of_rows mult_carrier_mat)
[PROOF STATE]
proof (state)
this:
Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A)

goal (2 subgoals):
 1. m \<noteq> n \<or> det A = 0 \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
 2. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A
Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A
Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A)

goal (1 subgoal):
 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)

goal (1 subgoal):
 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (m \<noteq> n \<or> det A = 0)

goal (1 subgoal):
 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
hence mn: "m=n" and det_A_not0:"(Determinant.det A) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (m \<noteq> n \<or> det A = 0)

goal (1 subgoal):
 1. m = n &&& det A \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m = n
det A \<noteq> 0

goal (1 subgoal):
 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
have inv_RAT_A: "invertible_mat (map_mat rat_of_int A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_mat (of_int_hom.mat_hom A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible_mat (of_int_hom.mat_hom A)
[PROOF STEP]
have "det (map_mat rat_of_int A) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (of_int_hom.mat_hom A) \<noteq> 0
[PROOF STEP]
using det_A_not0
[PROOF STATE]
proof (prove)
using this:
det A \<noteq> 0

goal (1 subgoal):
 1. det (of_int_hom.mat_hom A) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det (of_int_hom.mat_hom A) \<noteq> 0

goal (1 subgoal):
 1. invertible_mat (of_int_hom.mat_hom A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
det (of_int_hom.mat_hom A) \<noteq> 0

goal (1 subgoal):
 1. invertible_mat (of_int_hom.mat_hom A)
[PROOF STEP]
by (metis False assms dvd_field_iff invertible_iff_is_unit_JNF map_carrier_mat)
[PROOF STATE]
proof (state)
this:
invertible_mat (of_int_hom.mat_hom A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
invertible_mat (of_int_hom.mat_hom A)

goal (1 subgoal):
 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
have "HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A
[PROOF STEP]
unfolding HNF_algorithm_def Hermite_mod_det_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if dim_row A \<noteq> dim_col A then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else if \<bar>det_int A\<bar> = 0 then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A])) = mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A])
[PROOF STEP]
using False A
[PROOF STATE]
proof (prove)
using this:
\<not> (m \<noteq> n \<or> det A = 0)
A \<in> carrier_mat m n

goal (1 subgoal):
 1. (if dim_row A \<noteq> dim_col A then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else if \<bar>det_int A\<bar> = 0 then Hermite_of_list_of_rows (FindPreHNF_rectangular A) [0..<dim_row A] else mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A])) = mat_of_rows (dim_col A) (map (row (Hermite_of_list_of_rows (FindPreHNF abs_flag \<bar>det_int A\<bar> (A @\<^sub>r \<bar>det_int A\<bar> \<cdot>\<^sub>m 1\<^sub>m (dim_col A))) [0..<dim_row A + dim_col A])) [0..<dim_row A])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A

goal (1 subgoal):
 1. \<not> (m \<noteq> n \<or> det A = 0) \<Longrightarrow> Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A

goal (1 subgoal):
 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
using Hermite_mod_det_soundness[OF mn A inv_RAT_A]
[PROOF STATE]
proof (prove)
using this:
HNF_algorithm abs_flag A = Hermite_mod_det abs_flag A
Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (Hermite_mod_det ?abs_flag A)
\<exists>P. invertible_mat P \<and> P \<in> carrier_mat m m \<and> Hermite_mod_det ?abs_flag A = P * A

goal (1 subgoal):
 1. Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Hermite_JNF (range ass_function_euclidean) (\<lambda>c. range (res_int c)) (HNF_algorithm abs_flag A) \<and> (\<exists>P. P \<in> carrier_mat m m \<and> invertible_mat P \<and> HNF_algorithm abs_flag A = P * A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma omega_sum_lex_less_iff_cases:
   "((length ms, omega_sum (m#ms)), (length ns, omega_sum (n#ns))) \<in> less_than <*lex*> VWF
   \<longleftrightarrow> length ms < length ns
            \<or> length ms = length ns \<and> m<n
            \<or> m=n \<and> ((length ms, omega_sum ms), (length ns, omega_sum ns)) \<in> less_than <*lex*> VWF"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((length ms, omega_sum (m # ms)), length ns, omega_sum (n # ns)) \<in> less_than <*lex*> VWF) = (length ms < length ns \<or> length ms = length ns \<and> m < n \<or> m = n \<and> ((length ms, omega_sum ms), length ns, omega_sum ns) \<in> less_than <*lex*> VWF)
[PROOF STEP]
using omega_sum_less_eqlen_iff_cases
[PROOF STATE]
proof (prove)
using this:
length ?ms = length ?ns \<Longrightarrow> (omega_sum (?m # ?ms) < omega_sum (?n # ?ns)) = (?m < ?n \<or> ?m = ?n \<and> omega_sum ?ms < omega_sum ?ns)

goal (1 subgoal):
 1. (((length ms, omega_sum (m # ms)), length ns, omega_sum (n # ns)) \<in> less_than <*lex*> VWF) = (length ms < length ns \<or> length ms = length ns \<and> m < n \<or> m = n \<and> ((length ms, omega_sum ms), length ns, omega_sum ns) \<in> less_than <*lex*> VWF)
[PROOF STEP]
by force


[STATEMENT]
lemma Min_neq_imp_greater[dest]: "\<lbrakk> finite I; k \<in> I; k \<noteq> Min I \<rbrakk> \<Longrightarrow> Min I < k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; k \<in> I; k \<noteq> Min I\<rbrakk> \<Longrightarrow> Min I < k
[PROOF STEP]
by (rule order_neq_le_trans[OF not_sym Min_le])


[STATEMENT]
lemma complex_i_not_zero [simp]: "\<i> \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> \<noteq> 0
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma bounded_two_points: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>x\<in>S. \<forall>y\<in>S. dist x y \<le> e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded S = (\<exists>e. \<forall>x\<in>S. \<forall>y\<in>S. dist x y \<le> e)
[PROOF STEP]
by (meson bounded_def diameter_bounded(1))


[STATEMENT]
lemma CARD_fin7681 [simp]: "CARD (fin7681) = 7681"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD(fin7681) = 7681
[PROOF STEP]
unfolding type_definition.card [OF type_definition_fin7681]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<7681} = 7681
[PROOF STEP]
by simp


[STATEMENT]
lemma ccSUP_inf_distrib2:
  "countable A \<Longrightarrow> countable B \<Longrightarrow> inf (SUP a\<in>A. f a) (SUP b\<in>B. g b) = (SUP a\<in>A. SUP b\<in>B. inf (f a) (g b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; countable B\<rbrakk> \<Longrightarrow> inf (Sup (f ` A)) (Sup (g ` B)) = (SUP a\<in>A. SUP b\<in>B. inf (f a) (g b))
[PROOF STEP]
by (subst ccSUP_commute) (simp_all add: inf_ccSUP ccSUP_inf)


[STATEMENT]
lemma is_solution_imp_solve_system:
  fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
  assumes xAb:"is_solution x A b"
  shows "is_solution x (fst (solve_system A b)) (snd (solve_system A b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_solution x (fst (solve_system A b)) (snd (solve_system A b))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_solution x (fst (solve_system A b)) (snd (solve_system A b))
[PROOF STEP]
have "(fst (Gauss_Jordan_PA A)*v(A *v x) = fst (Gauss_Jordan_PA A) *v b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_PA A) *v (A *v x) = fst (Gauss_Jordan_PA A) *v b
[PROOF STEP]
using xAb
[PROOF STATE]
proof (prove)
using this:
is_solution x A b

goal (1 subgoal):
 1. fst (Gauss_Jordan_PA A) *v (A *v x) = fst (Gauss_Jordan_PA A) *v b
[PROOF STEP]
unfolding is_solution_def
[PROOF STATE]
proof (prove)
using this:
A *v x = b

goal (1 subgoal):
 1. fst (Gauss_Jordan_PA A) *v (A *v x) = fst (Gauss_Jordan_PA A) *v b
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
fst (Gauss_Jordan_PA A) *v (A *v x) = fst (Gauss_Jordan_PA A) *v b

goal (1 subgoal):
 1. is_solution x (fst (solve_system A b)) (snd (solve_system A b))
[PROOF STEP]
hence "(snd (Gauss_Jordan_PA A) *v x = fst (Gauss_Jordan_PA A) *v b)"
[PROOF STATE]
proof (prove)
using this:
fst (Gauss_Jordan_PA A) *v (A *v x) = fst (Gauss_Jordan_PA A) *v b

goal (1 subgoal):
 1. snd (Gauss_Jordan_PA A) *v x = fst (Gauss_Jordan_PA A) *v b
[PROOF STEP]
unfolding matrix_vector_mul_assoc
[PROOF STATE]
proof (prove)
using this:
fst (Gauss_Jordan_PA A) ** A *v x = fst (Gauss_Jordan_PA A) *v b

goal (1 subgoal):
 1. snd (Gauss_Jordan_PA A) *v x = fst (Gauss_Jordan_PA A) *v b
[PROOF STEP]
unfolding fst_Gauss_Jordan_PA[of A]
[PROOF STATE]
proof (prove)
using this:
snd (Gauss_Jordan_PA A) *v x = fst (Gauss_Jordan_PA A) *v b

goal (1 subgoal):
 1. snd (Gauss_Jordan_PA A) *v x = fst (Gauss_Jordan_PA A) *v b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
snd (Gauss_Jordan_PA A) *v x = fst (Gauss_Jordan_PA A) *v b

goal (1 subgoal):
 1. is_solution x (fst (solve_system A b)) (snd (solve_system A b))
[PROOF STEP]
thus "is_solution x (fst (solve_system A b)) (snd (solve_system A b))"
[PROOF STATE]
proof (prove)
using this:
snd (Gauss_Jordan_PA A) *v x = fst (Gauss_Jordan_PA A) *v b

goal (1 subgoal):
 1. is_solution x (fst (solve_system A b)) (snd (solve_system A b))
[PROOF STEP]
unfolding is_solution_def solve_system_def Let_def
[PROOF STATE]
proof (prove)
using this:
snd (Gauss_Jordan_PA A) *v x = fst (Gauss_Jordan_PA A) *v b

goal (1 subgoal):
 1. fst (snd (Gauss_Jordan_PA A), fst (Gauss_Jordan_PA A) *v b) *v x = snd (snd (Gauss_Jordan_PA A), fst (Gauss_Jordan_PA A) *v b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_solution x (fst (solve_system A b)) (snd (solve_system A b))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "((*h* sin) x)\<^sup>2 + ((*h* cos) x)\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((*h* sin) x)\<^sup>2 + ((*h* cos) x)\<^sup>2 = 1
[PROOF STEP]
by (simp add: hyperdual_eq_iff one_hyperdual_def power2_eq_square field_simps)


[STATEMENT]
theorem HT_idem: "HT(HT(P)) = HT(P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HT (HT P) = HT P
[PROOF STEP]
by rel_auto


[STATEMENT]
lemma sinh_square_eq: "sinh x ^ 2 = cosh x ^ 2 - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sinh x)\<^sup>2 = (cosh x)\<^sup>2 - (1::'a)
[PROOF STEP]
by (simp add: cosh_square_eq)


[STATEMENT]
lemma prime_factorization_unique_int:
  fixes f :: "int \<Rightarrow> _"
  assumes S_eq: "S = {p. 0 < f p}"
    and "finite S"
    and S: "\<forall>p\<in>S. prime p" "abs n = (\<Prod>p\<in>S. p ^ f p)"
  shows "S = prime_factors n \<and> (\<forall>p. prime p \<longrightarrow> f p = multiplicity p n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = prime_factors n \<and> (\<forall>p. prime p \<longrightarrow> f p = multiplicity p n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S = {p. 0 < f p}
finite S
\<forall>p\<in>S. prime p
\<bar>n\<bar> = (\<Prod>p\<in>S. p ^ f p)

goal (1 subgoal):
 1. S = prime_factors n \<and> (\<forall>p. prime p \<longrightarrow> f p = multiplicity p n)
[PROOF STEP]
by (intro prime_factorization_unique'') auto


[STATEMENT]
lemma wens_single_finite_FF:
     "wens_single_finite (range (\<lambda>x. (x, x+1))) (atLeast k) n =
      atLeast (k - int n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wens_single_finite (range (\<lambda>x. (x, x + 1))) {k..} n = {k - int n..}
[PROOF STEP]
apply (induct n, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. wens_single_finite (range (\<lambda>x. (x, x + 1))) {k..} n = {k - int n..} \<Longrightarrow> wens_single_finite (range (\<lambda>x. (x, x + 1))) {k..} (Suc n) = {k - int (Suc n)..}
[PROOF STEP]
apply (force simp add: wens_FF
            def_wens_single_finite_Suc_eq_wens [OF FF_eq single_valued_actFF])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma minus_pi_half_less_zero: "-(pi/2) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 2) < 0
[PROOF STEP]
by simp


[STATEMENT]
lemma csin_add:
  "csin (x + y) = ccos x * csin y + csin x * ccos y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (sin (x + y)) = complex_of_real (cos x) * complex_of_real (sin y) + complex_of_real (sin x) * complex_of_real (cos y)
[PROOF STEP]
using sin_add[of x y]
[PROOF STATE]
proof (prove)
using this:
sin (x + y) = sin x * cos y + cos x * sin y

goal (1 subgoal):
 1. complex_of_real (sin (x + y)) = complex_of_real (cos x) * complex_of_real (sin y) + complex_of_real (sin x) * complex_of_real (cos y)
[PROOF STEP]
by simp