1 (* Title: HOL/Quotient_Examples/Lift_Set.thy
2 Author: Lukas Bulwahn and Ondrey Kuncar
5 header {* Example of lifting definitions with the quotient infrastructure *}
11 typedef 'a set = "(UNIV :: ('a => bool) => bool)"
12 morphisms member Set by auto
14 text {* Here is some ML setup that should eventually be incorporated in the typedef command. *}
16 local_setup {* fn lthy =>
18 val quotients = {qtyp = @{typ "'a set"}, rtyp = @{typ "'a => bool"}, equiv_rel = @{term "dummy"}, equiv_thm = @{thm refl}}
19 val qty_full_name = @{type_name "set"}
21 fun qinfo phi = Quotient_Info.transform_quotients phi quotients
23 |> Local_Theory.declaration {syntax = false, pervasive = true}
24 (fn phi => Quotient_Info.update_quotients qty_full_name (qinfo phi)
25 #> Quotient_Info.update_abs_rep qty_full_name (Quotient_Info.transform_abs_rep phi {abs = @{term "Set"}, rep = @{term "member"}}))
29 text {* Now, we can employ quotient_definition to lift definitions. *}
31 quotient_definition empty where "empty :: 'a set"
35 thm Lift_Set.empty_def
37 quotient_definition insert where "insert :: 'a => 'a set => 'a set"
40 term "Lift_Set.insert"
41 thm Lift_Set.insert_def