src/HOL/Quotient_Examples/Lift_Set.thy
changeset 55584 a879f14b6f95
parent 49834 b27bbb021df1
child 58889 5b7a9633cfa8
equal deleted inserted replaced
55583:a0134252ac29 55584:a879f14b6f95
    10 
    10 
    11 definition set where "set = (UNIV :: ('a \<Rightarrow> bool) set)"
    11 definition set where "set = (UNIV :: ('a \<Rightarrow> bool) set)"
    12 
    12 
    13 typedef 'a set = "set :: ('a \<Rightarrow> bool) set"
    13 typedef 'a set = "set :: ('a \<Rightarrow> bool) set"
    14   morphisms member Set
    14   morphisms member Set
    15   unfolding set_def by auto
    15   unfolding set_def by (rule UNIV_witness)
    16 
    16 
    17 setup_lifting type_definition_set[unfolded set_def]
    17 setup_lifting type_definition_set[unfolded set_def]
    18 
    18 
    19 text {* Now, we can employ lift_definition to lift definitions. *}
    19 text {* Now, we can employ lift_definition to lift definitions. *}
    20 
    20 
    21 lift_definition empty :: "'a set" is "bot :: 'a \<Rightarrow> bool" done
    21 lift_definition empty :: "'a set" is "bot :: 'a \<Rightarrow> bool" .
    22 
    22 
    23 term "Lift_Set.empty"
    23 term "Lift_Set.empty"
    24 thm Lift_Set.empty_def
    24 thm Lift_Set.empty_def
    25 
    25 
    26 lift_definition insert :: "'a => 'a set => 'a set" is "\<lambda> x P y. y = x \<or> P y" done 
    26 lift_definition insert :: "'a => 'a set => 'a set" is "\<lambda> x P y. y = x \<or> P y" . 
    27 
    27 
    28 term "Lift_Set.insert"
    28 term "Lift_Set.insert"
    29 thm Lift_Set.insert_def
    29 thm Lift_Set.insert_def
    30 
    30 
    31 export_code empty insert in SML
    31 export_code empty insert in SML
    32 
    32 
    33 end
    33 end
    34