src/HOL/Quotient_Examples/Lift_Set.thy
changeset 47092 fa3538d6004b
parent 45970 b6d0cff57d96
child 47097 987cb55cac44
equal deleted inserted replaced
47091:d5cd13aca90b 47092:fa3538d6004b
    18 
    18 
    19 local_setup {* fn lthy =>
    19 local_setup {* fn lthy =>
    20   let
    20   let
    21     val quotients =
    21     val quotients =
    22       {qtyp = @{typ "'a set"}, rtyp = @{typ "'a => bool"},
    22       {qtyp = @{typ "'a set"}, rtyp = @{typ "'a => bool"},
    23         equiv_rel = @{term "dummy"}, equiv_thm = @{thm refl}}
    23         equiv_rel = @{term "op ="}, equiv_thm = @{thm refl}}
    24     val qty_full_name = @{type_name "set"}
    24     val qty_full_name = @{type_name "set"}
    25 
    25 
    26     fun qinfo phi = Quotient_Info.transform_quotients phi quotients
    26     fun qinfo phi = Quotient_Info.transform_quotients phi quotients
    27   in
    27   in
    28     lthy
    28     lthy
    35 *}
    35 *}
    36 
    36 
    37 text {* Now, we can employ quotient_definition to lift definitions. *}
    37 text {* Now, we can employ quotient_definition to lift definitions. *}
    38 
    38 
    39 quotient_definition empty where "empty :: 'a set"
    39 quotient_definition empty where "empty :: 'a set"
    40 is "bot :: 'a \<Rightarrow> bool"
    40 is "bot :: 'a \<Rightarrow> bool" done
    41 
    41 
    42 term "Lift_Set.empty"
    42 term "Lift_Set.empty"
    43 thm Lift_Set.empty_def
    43 thm Lift_Set.empty_def
    44 
    44 
    45 definition insertp :: "'a \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" where
    45 definition insertp :: "'a \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" where
    46   "insertp x P y \<longleftrightarrow> y = x \<or> P y"
    46   "insertp x P y \<longleftrightarrow> y = x \<or> P y"
    47 
    47 
    48 quotient_definition insert where "insert :: 'a => 'a set => 'a set"
    48 quotient_definition insert where "insert :: 'a => 'a set => 'a set"
    49 is insertp
    49 is insertp done
    50 
    50 
    51 term "Lift_Set.insert"
    51 term "Lift_Set.insert"
    52 thm Lift_Set.insert_def
    52 thm Lift_Set.insert_def
    53 
    53 
    54 end
    54 end