src/HOL/Lifting.thy
changeset 47325 ec6187036495
parent 47308 9caab698dbe4
child 47351 0193e663a19e
child 47435 e1b761c216ac
equal deleted inserted replaced
47324:ed2bad9b7c6a 47325:ec6187036495
     4 *)
     4 *)
     5 
     5 
     6 header {* Lifting package *}
     6 header {* Lifting package *}
     7 
     7 
     8 theory Lifting
     8 theory Lifting
     9 imports Plain Equiv_Relations
     9 imports Plain Equiv_Relations Transfer
    10 keywords
    10 keywords
    11   "print_quotmaps" "print_quotients" :: diag and
    11   "print_quotmaps" "print_quotients" :: diag and
    12   "lift_definition" :: thy_goal and
    12   "lift_definition" :: thy_goal and
    13   "setup_lifting" :: thy_decl
    13   "setup_lifting" :: thy_decl
    14 uses
    14 uses
    16   ("Tools/Lifting/lifting_term.ML")
    16   ("Tools/Lifting/lifting_term.ML")
    17   ("Tools/Lifting/lifting_def.ML")
    17   ("Tools/Lifting/lifting_def.ML")
    18   ("Tools/Lifting/lifting_setup.ML")
    18   ("Tools/Lifting/lifting_setup.ML")
    19 begin
    19 begin
    20 
    20 
    21 subsection {* Function map and function relation *}
    21 subsection {* Function map *}
    22 
    22 
    23 notation map_fun (infixr "--->" 55)
    23 notation map_fun (infixr "--->" 55)
    24 
    24 
    25 lemma map_fun_id:
    25 lemma map_fun_id:
    26   "(id ---> id) = id"
    26   "(id ---> id) = id"
    27   by (simp add: fun_eq_iff)
    27   by (simp add: fun_eq_iff)
    28 
       
    29 definition
       
    30   fun_rel :: "('a \<Rightarrow> 'c \<Rightarrow> bool) \<Rightarrow> ('b \<Rightarrow> 'd \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('c \<Rightarrow> 'd) \<Rightarrow> bool" (infixr "===>" 55)
       
    31 where
       
    32   "fun_rel R1 R2 = (\<lambda>f g. \<forall>x y. R1 x y \<longrightarrow> R2 (f x) (g y))"
       
    33 
       
    34 lemma fun_relI [intro]:
       
    35   assumes "\<And>x y. R1 x y \<Longrightarrow> R2 (f x) (g y)"
       
    36   shows "(R1 ===> R2) f g"
       
    37   using assms by (simp add: fun_rel_def)
       
    38 
       
    39 lemma fun_relE:
       
    40   assumes "(R1 ===> R2) f g" and "R1 x y"
       
    41   obtains "R2 (f x) (g y)"
       
    42   using assms by (simp add: fun_rel_def)
       
    43 
       
    44 lemma fun_rel_eq:
       
    45   shows "((op =) ===> (op =)) = (op =)"
       
    46   by (auto simp add: fun_eq_iff elim: fun_relE)
       
    47 
       
    48 lemma fun_rel_eq_rel:
       
    49   shows "((op =) ===> R) = (\<lambda>f g. \<forall>x. R (f x) (g x))"
       
    50   by (simp add: fun_rel_def)
       
    51 
    28 
    52 subsection {* Quotient Predicate *}
    29 subsection {* Quotient Predicate *}
    53 
    30 
    54 definition
    31 definition
    55   "Quotient R Abs Rep T \<longleftrightarrow>
    32   "Quotient R Abs Rep T \<longleftrightarrow>