equal
deleted
inserted
replaced
400 shows "mapping_of_pmf (pmf_of_list xs) = |
400 shows "mapping_of_pmf (pmf_of_list xs) = |
401 Mapping.tabulate (remdups (map fst xs)) |
401 Mapping.tabulate (remdups (map fst xs)) |
402 (\<lambda>x. listsum (map snd (filter (\<lambda>z. fst z = x) xs)))" |
402 (\<lambda>x. listsum (map snd (filter (\<lambda>z. fst z = x) xs)))" |
403 proof - |
403 proof - |
404 from assms have wf: "pmf_of_list_wf xs" by (intro pmf_of_list_wfI) force |
404 from assms have wf: "pmf_of_list_wf xs" by (intro pmf_of_list_wfI) force |
405 moreover from this assms have "set_pmf (pmf_of_list xs) = fst ` set xs" |
405 with assms have "set_pmf (pmf_of_list xs) = fst ` set xs" |
406 by (intro set_pmf_of_list_eq) auto |
406 by (intro set_pmf_of_list_eq) auto |
407 ultimately show ?thesis |
407 with wf show ?thesis |
408 by (intro mapping_of_pmfI) (auto simp: lookup_tabulate pmf_pmf_of_list) |
408 by (intro mapping_of_pmfI) (auto simp: lookup_tabulate pmf_pmf_of_list) |
409 qed |
409 qed |
410 |
410 |
411 lemma mapping_of_pmf_pmf_of_list': |
411 lemma mapping_of_pmf_pmf_of_list': |
412 assumes "pmf_of_list_wf xs" |
412 assumes "pmf_of_list_wf xs" |