Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
File size: 1,220 Bytes
4365a98 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
(* Author: Joshua Schneider, ETH Zurich
Author: Andreas Lochbihler, ETH Zurich *)
section \<open>An abstract applicative functor\<close>
theory Abstract_AF imports
Applicative
"HOL-Library.Adhoc_Overloading"
begin
typedef 'a af = "UNIV :: 'a set" ..
setup_lifting type_definition_af
abbreviation "af_pure \<equiv> Abs_af"
lift_definition af_ap :: "('a \<Rightarrow> 'b) af \<Rightarrow> 'a af \<Rightarrow> 'b af" is "\<lambda>f x. f x" .
adhoc_overloading Applicative.pure Abs_af
adhoc_overloading Applicative.ap af_ap
context includes applicative_syntax
begin
lemma af_identity: "af_pure id \<diamondop> x = x"
by transfer simp
lemma af_homomorphism: "af_pure f \<diamondop> af_pure x = af_pure (f x)"
by(fact af_ap.abs_eq)
lemma af_composition: "af_pure comp \<diamondop> g \<diamondop> f \<diamondop> x = g \<diamondop> (f \<diamondop> x)"
by transfer simp
lemma af_interchange: "f \<diamondop> af_pure x = af_pure (\<lambda>g. g x) \<diamondop> f"
by transfer simp
end
lifting_forget af.lifting
hide_const Abs_af Rep_af
hide_fact af_ap_def
applicative af
for
pure: af_pure
ap: af_ap
using af_homomorphism af_composition af_identity af_interchange
unfolding id_def comp_def[abs_def]
.
end
|