src/HOL/Library/Poly_Mapping.thy
changeset 76484 defaa0b17424
parent 75455 91c16c5ad3e9
child 76987 4c275405faae
equal deleted inserted replaced
76480:5ba13c82a286 76484:defaa0b17424
  1485 lemma items_the_value:
  1485 lemma items_the_value:
  1486   assumes "sorted (List.map fst xs)" and "distinct (List.map fst xs)" and "0 \<notin> snd ` set xs"
  1486   assumes "sorted (List.map fst xs)" and "distinct (List.map fst xs)" and "0 \<notin> snd ` set xs"
  1487   shows "items (the_value xs) = xs"
  1487   shows "items (the_value xs) = xs"
  1488 proof -
  1488 proof -
  1489   from assms have "sorted_list_of_set (set (List.map fst xs)) = List.map fst xs"
  1489   from assms have "sorted_list_of_set (set (List.map fst xs)) = List.map fst xs"
  1490     unfolding sorted_list_of_set_sort_remdups by (simp add: distinct_remdups_id sorted_sort_id)
  1490     unfolding sorted_list_of_set_sort_remdups by (simp add: distinct_remdups_id sort_key_id_if_sorted)
  1491   moreover from assms have "keys (the_value xs) = fst ` set xs"
  1491   moreover from assms have "keys (the_value xs) = fst ` set xs"
  1492     by transfer (auto simp add: image_def split: option.split dest: set_map_of_compr)
  1492     by transfer (auto simp add: image_def split: option.split dest: set_map_of_compr)
  1493   ultimately show ?thesis
  1493   ultimately show ?thesis
  1494     unfolding items_def using assms
  1494     unfolding items_def using assms
  1495     by (auto simp add: lookup_the_value intro: map_idI)
  1495     by (auto simp add: lookup_the_value intro: map_idI)