equal
deleted
inserted
replaced
495 by (rule fmap_ext) auto |
495 by (rule fmap_ext) auto |
496 |
496 |
497 lemma fmdrop_fset_fmdrop[simp]: "fmdrop_fset S (fmdrop b m) = fmdrop_fset (finsert b S) m" |
497 lemma fmdrop_fset_fmdrop[simp]: "fmdrop_fset S (fmdrop b m) = fmdrop_fset (finsert b S) m" |
498 by (rule fmap_ext) auto |
498 by (rule fmap_ext) auto |
499 |
499 |
500 lift_definition fmadd :: "('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" (infixl "++\<^sub>f" 100) |
500 lift_definition fmadd :: "('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap" (infixl \<open>++\<^sub>f\<close> 100) |
501 is map_add |
501 is map_add |
502 parametric map_add_transfer |
502 parametric map_add_transfer |
503 by simp |
503 by simp |
504 |
504 |
505 lemma fmlookup_add[simp]: |
505 lemma fmlookup_add[simp]: |
609 lemma fmpred_cases[consumes 1]: |
609 lemma fmpred_cases[consumes 1]: |
610 assumes "fmpred P m" |
610 assumes "fmpred P m" |
611 obtains (none) "fmlookup m x = None" | (some) y where "fmlookup m x = Some y" "P x y" |
611 obtains (none) "fmlookup m x = None" | (some) y where "fmlookup m x = Some y" "P x y" |
612 using assms by auto |
612 using assms by auto |
613 |
613 |
614 lift_definition fmsubset :: "('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> bool" (infix "\<subseteq>\<^sub>f" 50) |
614 lift_definition fmsubset :: "('a, 'b) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> bool" (infix \<open>\<subseteq>\<^sub>f\<close> 50) |
615 is map_le |
615 is map_le |
616 . |
616 . |
617 |
617 |
618 lemma fmsubset_alt_def: "m \<subseteq>\<^sub>f n \<longleftrightarrow> fmpred (\<lambda>k v. fmlookup n k = Some v) m" |
618 lemma fmsubset_alt_def: "m \<subseteq>\<^sub>f n \<longleftrightarrow> fmpred (\<lambda>k v. fmlookup n k = Some v) m" |
619 by transfer' (auto simp: map_pred_def map_le_def dom_def split: option.splits) |
619 by transfer' (auto simp: map_pred_def map_le_def dom_def split: option.splits) |
799 lemma fmimageE[elim]: |
799 lemma fmimageE[elim]: |
800 assumes "y |\<in>| fmimage m A" |
800 assumes "y |\<in>| fmimage m A" |
801 obtains x where "fmlookup m x = Some y" "x |\<in>| A" |
801 obtains x where "fmlookup m x = Some y" "x |\<in>| A" |
802 using assms by (auto simp: fmlookup_image_iff) |
802 using assms by (auto simp: fmlookup_image_iff) |
803 |
803 |
804 lift_definition fmcomp :: "('b, 'c) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'c) fmap" (infixl "\<circ>\<^sub>f" 55) |
804 lift_definition fmcomp :: "('b, 'c) fmap \<Rightarrow> ('a, 'b) fmap \<Rightarrow> ('a, 'c) fmap" (infixl \<open>\<circ>\<^sub>f\<close> 55) |
805 is map_comp |
805 is map_comp |
806 parametric map_comp_transfer |
806 parametric map_comp_transfer |
807 by (rule dom_comp_finite) |
807 by (rule dom_comp_finite) |
808 |
808 |
809 lemma fmlookup_comp[simp]: "fmlookup (m \<circ>\<^sub>f n) x = Option.bind (fmlookup n x) (fmlookup m)" |
809 lemma fmlookup_comp[simp]: "fmlookup (m \<circ>\<^sub>f n) x = Option.bind (fmlookup n x) (fmlookup m)" |