src/HOL/Library/Quotient_Option.thy
changeset 47094 1a7ad2601cb5
parent 45802 b16f976db515
child 47308 9caab698dbe4
equal deleted inserted replaced
47093:0516a6c1ea59 47094:1a7ad2601cb5
    13 where
    13 where
    14   "option_rel R None None = True"
    14   "option_rel R None None = True"
    15 | "option_rel R (Some x) None = False"
    15 | "option_rel R (Some x) None = False"
    16 | "option_rel R None (Some x) = False"
    16 | "option_rel R None (Some x) = False"
    17 | "option_rel R (Some x) (Some y) = R x y"
    17 | "option_rel R (Some x) (Some y) = R x y"
    18 
       
    19 declare [[map option = option_rel]]
       
    20 
    18 
    21 lemma option_rel_unfold:
    19 lemma option_rel_unfold:
    22   "option_rel R x y = (case (x, y) of (None, None) \<Rightarrow> True
    20   "option_rel R x y = (case (x, y) of (None, None) \<Rightarrow> True
    23     | (Some x, Some y) \<Rightarrow> R x y
    21     | (Some x, Some y) \<Rightarrow> R x y
    24     | _ \<Rightarrow> False)"
    22     | _ \<Rightarrow> False)"
    63   apply (simp_all add: Option.map.compositionality comp_def Option.map.identity option_rel_eq option_rel_map1 option_rel_map2 Quotient_abs_rep [OF assms] Quotient_rel_rep [OF assms])
    61   apply (simp_all add: Option.map.compositionality comp_def Option.map.identity option_rel_eq option_rel_map1 option_rel_map2 Quotient_abs_rep [OF assms] Quotient_rel_rep [OF assms])
    64   using Quotient_rel [OF assms]
    62   using Quotient_rel [OF assms]
    65   apply (simp add: option_rel_unfold split: option.split)
    63   apply (simp add: option_rel_unfold split: option.split)
    66   done
    64   done
    67 
    65 
       
    66 declare [[map option = (option_rel, option_quotient)]]
       
    67 
    68 lemma option_None_rsp [quot_respect]:
    68 lemma option_None_rsp [quot_respect]:
    69   assumes q: "Quotient R Abs Rep"
    69   assumes q: "Quotient R Abs Rep"
    70   shows "option_rel R None None"
    70   shows "option_rel R None None"
    71   by simp
    71   by simp
    72 
    72