src/HOL/Nat_Transfer.thy
changeset 35821 ee34f03a7d26
parent 35683 70ace653fe77
child 39198 f967a16dfcdd
equal deleted inserted replaced
35820:b57c3afd1484 35821:ee34f03a7d26
     8 uses ("Tools/transfer.ML")
     8 uses ("Tools/transfer.ML")
     9 begin
     9 begin
    10 
    10 
    11 subsection {* Generic transfer machinery *}
    11 subsection {* Generic transfer machinery *}
    12 
    12 
    13 definition transfer_morphism:: "('b \<Rightarrow> 'a) \<Rightarrow> 'b set \<Rightarrow> bool"
    13 definition transfer_morphism:: "('b \<Rightarrow> 'a) \<Rightarrow> ('b \<Rightarrow> bool) \<Rightarrow> bool"
    14   where "transfer_morphism f A \<longleftrightarrow> True"
    14   where "transfer_morphism f A \<longleftrightarrow> (\<forall>P. (\<forall>x. P x) \<longrightarrow> (\<forall>y. A y \<longrightarrow> P (f y)))"
    15 
    15 
    16 lemma transfer_morphismI:
    16 lemma transfer_morphismI:
    17   "transfer_morphism f A"
    17   assumes "\<And>P y. (\<And>x. P x) \<Longrightarrow> A y \<Longrightarrow> P (f y)"
    18   by (simp add: transfer_morphism_def)
    18   shows "transfer_morphism f A"
       
    19   using assms by (auto simp add: transfer_morphism_def)
    19 
    20 
    20 use "Tools/transfer.ML"
    21 use "Tools/transfer.ML"
    21 
    22 
    22 setup Transfer.setup
    23 setup Transfer.setup
    23 
    24 
    25 subsection {* Set up transfer from nat to int *}
    26 subsection {* Set up transfer from nat to int *}
    26 
    27 
    27 text {* set up transfer direction *}
    28 text {* set up transfer direction *}
    28 
    29 
    29 lemma transfer_morphism_nat_int: "transfer_morphism nat (op <= (0::int))"
    30 lemma transfer_morphism_nat_int: "transfer_morphism nat (op <= (0::int))"
    30   by (fact transfer_morphismI)
    31   by (rule transfer_morphismI) simp
    31 
    32 
    32 declare transfer_morphism_nat_int [transfer add
    33 declare transfer_morphism_nat_int [transfer add
    33   mode: manual
    34   mode: manual
    34   return: nat_0_le
    35   return: nat_0_le
    35   labels: nat_int
    36   labels: nat_int
   264 subsection {* Set up transfer from int to nat *}
   265 subsection {* Set up transfer from int to nat *}
   265 
   266 
   266 text {* set up transfer direction *}
   267 text {* set up transfer direction *}
   267 
   268 
   268 lemma transfer_morphism_int_nat: "transfer_morphism int (\<lambda>n. True)"
   269 lemma transfer_morphism_int_nat: "transfer_morphism int (\<lambda>n. True)"
   269   by (fact transfer_morphismI)
   270 by (rule transfer_morphismI) simp
   270 
   271 
   271 declare transfer_morphism_int_nat [transfer add
   272 declare transfer_morphism_int_nat [transfer add
   272   mode: manual
   273   mode: manual
   273   return: nat_int
   274   return: nat_int
   274   labels: int_nat
   275   labels: int_nat