|
A new "gst-fun" theory is created as a child of "gst-ax".
The theory will contain the definitions of ordered pairs, relations and functions and related material for general use.
|
|
We now introduce ordered pairs, which are required for representing functions as graphs.
|
|
A relation is defined as a set of ordered pairs.
Cartesian product and relation space are defined.
|
|
The domain, range and field of a relation are defined.
|
|
|
Definition of partial and total functions and the corresponding function spaces.
|
|
Functional abstraction is defined as a new variable binding construct yeilding a functional set.
|
|
In this section we define function application and show that functions are extensional.
|
|
Finalisation of a proof context.
|
|
|
|
|
Motivation
Most of the specification work which I am likely to do with galactic set theory will make use of functions.
My first application of the functions will be in the theory of pure functors, which is frivolous and unlikely to be widely
applied, and so I am creating this theory first so that more generally applicable results which are required for the theory
of pure functors will be available separately.
I have no clear idea of what this theory will contain, it will initially contain basic materials about functions, but will
be augmented by anything else that turns out to be necessary elsewhere and which can appropriately be placed here.
|
|
|
The Theory gst-fun
The new theory is first created, together with a proof context which we will build up as we develop the theory.
|
xl-sml
open_theory "gst-ax";
force_new_theory "gst-fun";
force_new_pc "gst-fun";
merge_pcs ["xl_cs_∃_conv"] "gst-fun";
set_merge_pcs ["basic_hol", "gst-ax", "gst-fun"];
|
|
|
|
Ordered Pairs
|
xl-sml
declare_infix (240,"↦g");
|
This is more abstract than the usual definition since it conceals the way in which ordered pairs are encoded.
We can't hide everything about the representation, because we will need to know at least that galaxies are closed under formation
of ordered pairs, usually a much tighter constraint is known but I will say nothing stronger until I know why it is needed.
Behind the scenes the usual definition is used to prove that this looser definition is a conservative extension.
|
xl-sml
add_pc_thms "gst-fun" [get_spec ⌜$↦g⌝];
set_merge_pcs ["basic_hol", "gst-ax", "gst-fun"];
|
|
|
Projections
The following functions may be used for extracting the components of ordered pairs.
|
xl-holconst fst snd : GS → GS
|
∀s t• fst(s ↦g t) = s ∧ snd(s ↦g t) = t
|
|
|
|
Cartesian Product
The following theorem is required to introduce the conservative specification of cartesian product.
The witness for the proof is shown, involving a double application of replacement.
This is necessary because the loose specification of ordered pair does not provide sufficient information for a more conventional
definition using separation.
|
|
After completing this proof cartesian product can be specified by conservative extension as follows:
|
xl-holconst $×g : GS → GS → GS
|
∀s t e• e ∈g s ×g t ⇔ ∃l r•l ∈g s ∧ r ∈g t ∧ e = l ↦g r
|
|
|
|
Pair-Projection inverse theorem
|
xl-sml
set_goal ([],⌜∀s t p• p ∈g s ×g t ⇒ fst(p) ↦g snd(p) = p⌝);
a (prove_tac[×g_spec]);
a (asm_rewrite_tac[]);
val f↦gs_thm = save_pop_thm "f↦gs_thm";
|
|
|
Var in Product theorem
|
|
|
|
Relation Space
This is the set of all relations over some domain and codomain, i.e. the power set of the cartesian product.
|
xl-sml
declare_infix(240,"↔g");
|
|
xl-holconst $↔g : GS → GS → GS
|
∀s t• s ↔g t = ℘g(s ×g t)
|
|
|
Relation Subset Product Theorem
We prove here that relations are subsets of cartesian products.
|
xl-sml
set_goal ([], ⌜∀s t r• r ∈g s ↔g t ⇔ r ⊆g (s ×g t)⌝);
a (prove_tac[get_spec⌜$↔g⌝, gst_relext_clauses]);
val ↔g⊆g×g_thm = save_pop_thm "↔g⊆g×g_thm";
|
|
|
|
Relation Space Non-Empty
We prove here that the empty set is a member of every relation space.
|
xl-sml
set_goal ([], ⌜∀s t• ∅g ∈g s ↔g t⌝);
a (prove_tac[get_spec⌜$↔g⌝, gst_relext_clauses]);
val ∅g∈g↔g_thm = save_pop_thm "∅g∈g↔g_thm";
add_pc_thms "gst-fun" [∅g∈g↔g_thm];
set_merge_pcs ["basic_hol", "gst-ax", "gst-fun"];
|
|
|
|
Another Pair-Projection Inverse Theorem
Couched in terms of membership of relation spaces.
|
|
|
Member of Relation Theorem
|
|
|
Relations
|
xl-holconst rel : GS → BOOL
|
∀x• rel x ⇔ ∀y• y ∈g x ⇒ ∃s t• y = s ↦g t
|
|
|
|
|
Relational Composition
|
xl-sml
declare_infix (250,"og");
|
|
|
|
domain
The domain is the set of elements which are related to something under the relationship.
|
xl-holconst dom : GS → GS
|
∀x• dom x = Sep (Gx x) (λw• ∃v• w ↦g v ∈g x)
|
|
xl-gft
dom_∅g_thm = ⊢ dom ∅g = ∅g
dom_thm = ⊢ ∀ r y• y ∈g dom r ⇔ (∃ x• y ↦g x ∈g r)
|
|
|
|
range
|
xl-holconst ran : GS → GS
|
∀x• ran x = Sep (Gx x) (λw• ∃v• v ↦g w ∈g x)
|
|
xl-gft
ran_∅g_thm ⊢ ran ∅g = ∅g
ran_thm = ⊢ ∀r y• y ∈g ran r ⇔ ∃ x• x ↦g y ∈g r
|
|
|
|
Relation Subset of Cartesian Product
|
xl-gft
rel_sub_cp_thm = ⊢ ∀ x• rel x ⇔ (∃ s t• x ⊆g s ×g t)
|
|
|
|
field
|
xl-holconst field : GS → GS
|
∀s e• e ∈g (field s)
⇔ e ∈g (dom s) ∨ e ∈g (ran s)
|
|
|
|
The field of the empty set
|
xl-gft
field_∅g_thm = ⊢ field ∅g = ∅g
|
|
|
|
Partial Function Space
This is the set of all partial functions (i.e. many one mapings) over some domain and codomain.
|
xl-sml
declare_infix (240, "g");
|
|
xl-holconst $g : GS → GS → GS
|
∀s t• s g t = Sep (s ↔g t) fun
|
|
|
|
Partial Function Space Non-Empty
First the theorem that the empty set is a partial function over any domain and codomain.
And then that every partial function space is non-empty.
|
|
|
Function Space
This is the set of all total functions over some domain and codomain.
|
xl-sml
declare_infix (240, "→g");
|
|
xl-holconst $→g : GS → GS → GS
|
∀s t• s →g t = Sep (s g t) λr• dom r = s
|
|
|
Function Space Non-Empty
First, for the special case of function spaces with empty domain we prove the theorem that the empty set is a member:
|
|
Then that whenever the codomain is non-empty the function space is non-empty.
|
xl-gft
∃→g_thm =
⊢ ∀ s t• (∃ x• x ∈g t) ⇒ (∃ f• f ∈g s →g t)
|
|
|
|
Abstraction
Because of the closeness to lambda abstraction "λg" is used as the name of a new binder for set theoretic functional abstraction.
declare_binder "λg";
To define a functional set we need a HOL function over sets together with a set which is to be the domain of the function.
Specification of the range is not needed.
The binding therefore yields a function which maps sets to sets (maps the domain to the function).
The following definition is a placeholder, a more abstract definition might eventually be substituted.
The function is defined as that subset of the cartesian product of the set s and its image under the function f which coincides
with the graph of f over s.
|
|
|
Application
Application by juxtaposition cannot be overloaded and is used for application of HOL functions.
Application of functional sets is therefore defined as an infix operator whose name is the empty name subscripted by "g".
|
xl-sml
declare_infix (250,"g");
|
The particular form shown here is innovative in the value specified for applications of functions to values outside their
domain.
The merit of the particular value chosen is that it makes true an extensionality theorem which quantifies over all sets as
arguments to the function, which might not otherwise be the case.
Whether this form is useful I don't know.
Generally a result with fewer conditionals is harder to prove but easier to use, but in this case I'm not so sure of the benefit.
It may be noted that it may also be used to apply a non-functional relation, if what you want it some arbitrary value (selected
by the choice function) to which some object relates.
|
|
The "Type" of an Application (1)
The following theorem states that the result of applying a partial function to a value in its domain is a value in its codomain.∧
|
|
The "Type" of an Application (2)
The following theorem states that the result of applying a total function to a value in its domain is a value in its codomain.
|
|
Partial functions are total
Every partial function is total over its domain.
(there is an ambiguity in the use of the term "domain" for a partial function.
It might mean the left hand operand of some partial function space construction within which the partial function concerned
may be found, or it might mean the set of values over which the function is defined.
Here we are saying that if f is a partial function over A, then its domain is some subset of A and f is a total function over
that subset of A.)
|
|
The Identity Function
|
specification
|
xl-holconst id : GS → GS
|
∀s• id s = Sep (s ×g s) λx• fst x = snd x
|
|
|
|