src/HOL/List.thy
changeset 73411 1f1366966296
parent 73396 8a1c6c7909c9
child 73442 855a3c18b9c8
equal deleted inserted replaced
73410:7b59d2945e54 73411:1f1366966296
  5618   from assms have 1: "length xs = length ys" by (auto dest!: distinct_card)
  5618   from assms have 1: "length xs = length ys" by (auto dest!: distinct_card)
  5619   from assms show ?thesis
  5619   from assms show ?thesis
  5620   proof(induct rule:list_induct2[OF 1])
  5620   proof(induct rule:list_induct2[OF 1])
  5621     case 1 show ?case by simp
  5621     case 1 show ?case by simp
  5622   next
  5622   next
  5623     case 2 thus ?case by simp (metis Diff_insert_absorb antisym insertE insert_iff)
  5623     case (2 x xs y ys)
       
  5624     then show ?case
       
  5625       by (cases \<open>x = y\<close>) (auto simp add: insert_eq_iff)
  5624   qed
  5626   qed
  5625 qed
  5627 qed
  5626 
  5628 
  5627 lemma map_sorted_distinct_set_unique:
  5629 lemma map_sorted_distinct_set_unique:
  5628   assumes "inj_on f (set xs \<union> set ys)"
  5630   assumes "inj_on f (set xs \<union> set ys)"
  5737 by (induct xs) simp_all
  5739 by (induct xs) simp_all
  5738 
  5740 
  5739 lemma insort_key_left_comm:
  5741 lemma insort_key_left_comm:
  5740   assumes "f x \<noteq> f y"
  5742   assumes "f x \<noteq> f y"
  5741   shows "insort_key f y (insort_key f x xs) = insort_key f x (insort_key f y xs)"
  5743   shows "insort_key f y (insort_key f x xs) = insort_key f x (insort_key f y xs)"
  5742 by (induct xs) (auto simp add: assms dest: antisym)
  5744 by (induct xs) (auto simp add: assms dest: order.antisym)
  5743 
  5745 
  5744 lemma insort_left_comm:
  5746 lemma insort_left_comm:
  5745   "insort x (insort y xs) = insort y (insort x xs)"
  5747   "insort x (insort y xs) = insort y (insort x xs)"
  5746 by (cases "x = y") (auto intro: insort_key_left_comm)
  5748 by (cases "x = y") (auto intro: insort_key_left_comm)
  5747 
  5749