src/HOL/Library/Permutation.thy
changeset 25287 094dab519ff5
parent 25277 95128fcdd7e8
child 25379 12bcf37252b1
     1.1 --- a/src/HOL/Library/Permutation.thy	Mon Nov 05 17:48:51 2007 +0100
     1.2 +++ b/src/HOL/Library/Permutation.thy	Mon Nov 05 18:18:39 2007 +0100
     1.3 @@ -179,4 +179,25 @@
     1.4  apply (metis perm_set_eq)
     1.5  done
     1.6  
     1.7 +lemma eq_set_perm_remdups: "set xs = set ys ==> remdups xs <~~> remdups ys"
     1.8 +apply(induct xs arbitrary: ys rule:length_induct)
     1.9 +apply (case_tac "remdups xs", simp, simp)
    1.10 +apply(subgoal_tac "a : set (remdups ys)")
    1.11 + prefer 2 apply (metis set.simps(2) insert_iff set_remdups)
    1.12 +apply(drule split_list) apply(elim exE conjE)
    1.13 +apply(drule_tac x=list in spec) apply(erule impE) prefer 2
    1.14 + apply(drule_tac x="ysa@zs" in spec) apply(erule impE) prefer 2
    1.15 +  apply simp
    1.16 +  apply(subgoal_tac "a#list <~~> a#ysa@zs")
    1.17 +   apply (metis Cons_eq_appendI perm_append_Cons trans)
    1.18 +  apply (metis Cons Cons_eq_appendI distinct.simps(2) distinct_remdups distinct_remdups_id perm_append_swap perm_distinct_iff)
    1.19 + apply(subgoal_tac "set (a#list) = set (ysa@a#zs) & distinct (a#list) & distinct (ysa@a#zs)")
    1.20 +  apply(fastsimp simp add: insert_ident)
    1.21 + apply (metis distinct_remdups set_remdups)
    1.22 +apply (metis Nat.le_less_trans Suc_length_conv le_def length_remdups_leq less_Suc_eq)
    1.23 +done
    1.24 +
    1.25 +lemma perm_remdups_iff_eq_set: "remdups x <~~> remdups y = (set x = set y)"
    1.26 +by (metis List.set_remdups perm_set_eq eq_set_perm_remdups)
    1.27 +
    1.28  end