This theory covers basic properties of function spaces. A set of functions with domain \(X\) and values in the set \(Y\) is denoted in Isabelle as \(X\rightarrow Y\). It just happens that the colon ":" is a synonym of the set membership symbol \(\in\) in Isabelle/ZF so we can write \(f:X\rightarrow Y\) instead of \(f \in X\rightarrow Y\). This is the only case that we use the colon instead of the regular set membership symbol.
Functions in ZF are sets of pairs. This means that if \(f: X\rightarrow Y \) then \(f\subseteq X\times Y\). This section is mostly about consequences of this understanding of the notion of function.
We define the notion of function that preserves a collection here. Given two collection of sets a function preserves the collections if the inverse image of sets in one collection belongs to the second one. This notion does not have a name in romantic math. It is used to define continuous functions in Topology_ZF_2 theory. We define it here so that we can use it for other purposes, like defining measurable functions. Recall that \( f^{-1}(A) \) means the inverse image of the set \(A\).
Definition
\( PresColl(f,S,T) \equiv \forall A\in T.\ f^{-1}(A)\in S \)
A definition that allows to get the first factor of the domain of a binary function \(f: X\times Y \rightarrow Z\).
Definition
\( fstdom(f) \equiv domain(domain(f)) \)
If a function maps \(A\) into another set, then \(A\) is the domain of the function.
lemma func1_1_L1:
assumes \( f:A\rightarrow C \)
shows \( domain(f) = A \) using assms , domain_of_funStandard Isabelle defines a \( function(f) \) predicate. the next lemma shows that our function satisfy that predicate. It is a special version of Isabelle's fun_is_function.
lemma fun_is_fun:
assumes \( f:X\rightarrow Y \)
shows \( function(f) \) using assms , fun_is_functionA lemma explains what fstdom is for.
lemma fstdomdef:
assumes A1: \( f: X\times Y \rightarrow Z \) and A2: \( Y\neq 0 \)
shows \( fstdom(f) = X \)proofA first-order version of Pi_type.
lemma func1_1_L1A:
assumes A1: \( f:X\rightarrow Y \) and A2: \( \forall x\in X.\ f(x) \in Z \)
shows \( f:X\rightarrow Z \)proofA variant of func1_1_L1A.
lemma func1_1_L1B:
assumes A1: \( f:X\rightarrow Y \) and A2: \( Y\subseteq Z \)
shows \( f:X\rightarrow Z \)proofThere is a value for each argument.
lemma func1_1_L2:
assumes A1: \( f:X\rightarrow Y \), \( x\in X \)
shows \( \exists y\in Y.\ \langle x,y\rangle \in f \)proofInverse image of any set is contained in the domain.
lemma func1_1_L3:
assumes A1: \( f:X\rightarrow Y \)
shows \( f^{-1}(D) \subseteq X \)proofThe inverse image of the range is the domain.
lemma func1_1_L4:
assumes \( f:X\rightarrow Y \)
shows \( f^{-1}(Y) = X \) using assms , func1_1_L3 , func1_1_L2 , vimage_iffThe arguments belongs to the domain and values to the range.
lemma func1_1_L5:
assumes A1: \( \langle x,y\rangle \in f \) and A2: \( f:X\rightarrow Y \)
shows \( x\in X \wedge y\in Y \)proofFunction is a subset of cartesian product.
lemma fun_subset_prod:
assumes A1: \( f:X\rightarrow Y \)
shows \( f \subseteq X\times Y \)proofThe (argument, value) pair belongs to the graph of the function.
lemma func1_1_L5A:
assumes A1: \( f:X\rightarrow Y \), \( x\in X \), \( y = f(x) \)
shows \( \langle x,y\rangle \in f \), \( y \in range(f) \)proofThe next theorem illustrates the meaning of the concept of function in ZF.
theorem fun_is_set_of_pairs:
assumes A1: \( f:X\rightarrow Y \)
shows \( f = \{\langle x, f(x)\rangle .\ x \in X\} \)proofThe range of function thet maps \(X\) into \(Y\) is contained in \(Y\).
lemma func1_1_L5B:
assumes A1: \( f:X\rightarrow Y \)
shows \( range(f) \subseteq Y \)proofThe image of any set is contained in the range.
lemma func1_1_L6:
assumes A1: \( f:X\rightarrow Y \)
shows \( f(B) \subseteq range(f) \) and \( f(B) \subseteq Y \)proofThe inverse image of any set is contained in the domain.
lemma func1_1_L6A:
assumes A1: \( f:X\rightarrow Y \)
shows \( f^{-1}(A)\subseteq X \)proofImage of a greater set is greater.
lemma func1_1_L8:
assumes A1: \( A\subseteq B \)
shows \( f(A)\subseteq f(B) \) using assms , image_UnA set is contained in the the inverse image of its image. There is similar theorem in equalities.thy (function_image_vimage) which shows that the image of inverse image of a set is contained in the set.
lemma func1_1_L9:
assumes A1: \( f:X\rightarrow Y \) and A2: \( A\subseteq X \)
shows \( A \subseteq f^{-1}(f(A)) \)proofThe inverse image of the image of the domain is the domain.
lemma inv_im_dom:
assumes A1: \( f:X\rightarrow Y \)
shows \( f^{-1}(f(X)) = X \)proofA technical lemma needed to make the func1_1_L11 proof more clear.
lemma func1_1_L10:
assumes A1: \( f \subseteq X\times Y \) and A2: \( \exists !y.\ (y\in Y \wedge \langle x,y\rangle \in f) \)
shows \( \exists !y.\ \langle x,y\rangle \in f \)proofIf \(f\subseteq X\times Y\) and for every \(x\in X\) there is exactly one \(y\in Y\) such that \((x,y)\in f\) then \(f\) maps \(X\) to \(Y\).
lemma func1_1_L11:
assumes \( f \subseteq X\times Y \) and \( \forall x\in X.\ \exists !y.\ y\in Y \wedge \langle x,y\rangle \in f \)
shows \( f: X\rightarrow Y \) using assms , func1_1_L10 , Pi_iff_oldA set defined by a lambda-type expression is a fuction. There is a similar lemma in func.thy, but I had problems with lamda expressions syntax so I could not apply it. This lemma is a workaround this. Besides, lambda expressions are not readable.
lemma func1_1_L11A:
assumes A1: \( \forall x\in X.\ b(x) \in Y \)
shows \( \{\langle x,y\rangle \in X\times Y.\ b(x) = y\} : X\rightarrow Y \)proofThe next lemma will replace func1_1_L11A one day.
lemma ZF_fun_from_total:
assumes A1: \( \forall x\in X.\ b(x) \in Y \)
shows \( \{\langle x,b(x)\rangle .\ x\in X\} : X\rightarrow Y \)proofThe value of a function defined by a meta-function is this meta-function.
lemma func1_1_L11B:
assumes A1: \( f:X\rightarrow Y \), \( x\in X \) and A2: \( f = \{\langle x,y\rangle \in X\times Y.\ b(x) = y\} \)
shows \( f(x) = b(x) \)proofThe next lemma will replace func1_1_L11B one day.
lemma ZF_fun_from_tot_val:
assumes A1: \( f:X\rightarrow Y \), \( x\in X \) and A2: \( f = \{\langle x,b(x)\rangle .\ x\in X\} \)
shows \( f(x) = b(x) \)proofIdentical meaning as ZF_fun_from_tot_val, but phrased a bit differently.
lemma ZF_fun_from_tot_val0:
assumes \( f:X\rightarrow Y \) and \( f = \{\langle x,b(x)\rangle .\ x\in X\} \)
shows \( \forall x\in X.\ f(x) = b(x) \) using assms , ZF_fun_from_tot_valWe can extend a function by specifying its values on a set disjoint with the domain.
lemma func1_1_L11C:
assumes A1: \( f:X\rightarrow Y \) and A2: \( \forall x\in A.\ b(x)\in B \) and A3: \( X\cap A = 0 \) and Dg: \( g = f \cup \{\langle x,b(x)\rangle .\ x\in A\} \)
shows \( g : X\cup A \rightarrow Y\cup B \), \( \forall x\in X.\ g(x) = f(x) \), \( \forall x\in A.\ g(x) = b(x) \)proofWe can extend a function by specifying its value at a point that does not belong to the domain.
lemma func1_1_L11D:
assumes A1: \( f:X\rightarrow Y \) and A2: \( a\notin X \) and Dg: \( g = f \cup \{\langle a,b\rangle \} \)
shows \( g : X\cup \{a\} \rightarrow Y\cup \{b\} \), \( \forall x\in X.\ g(x) = f(x) \), \( g(a) = b \)proofA technical lemma about extending a function both by defining on a set disjoint with the domain and on a point that does not belong to any of those sets.
lemma func1_1_L11E:
assumes A1: \( f:X\rightarrow Y \) and A2: \( \forall x\in A.\ b(x)\in B \) and A3: \( X\cap A = 0 \) and A4: \( a\notin X\cup A \) and Dg: \( g = f \cup \{\langle x,b(x)\rangle .\ x\in A\} \cup \{\langle a,c\rangle \} \)
shows \( g : X\cup A\cup \{a\} \rightarrow Y\cup B\cup \{c\} \), \( \forall x\in X.\ g(x) = f(x) \), \( \forall x\in A.\ g(x) = b(x) \), \( g(a) = c \)proofInverse image of intersection is the intersection of inverse images.
lemma invim_inter_inter_invim:
assumes \( f:X\rightarrow Y \)
shows \( f^{-1}(A\cap B) = f^{-1}(A) \cap f^{-1}(B) \) using assms , fun_is_fun , function_vimage_IntThe inverse image of an intersection of a nonempty collection of sets is the intersection of the inverse images. This generalizes invim_inter_inter_invim which is proven for the case of two sets.
lemma func1_1_L12:
assumes A1: \( B \subseteq Pow(Y) \) and A2: \( B\neq 0 \) and A3: \( f:X\rightarrow Y \)
shows \( f^{-1}(\bigcap B) = (\bigcap U\in B.\ f^{-1}(U)) \)proofThe inverse image of a set does not change when we intersect the set with the image of the domain.
lemma inv_im_inter_im:
assumes \( f:X\rightarrow Y \)
shows \( f^{-1}(A \cap f(X)) = f^{-1}(A) \) using assms , invim_inter_inter_invim , inv_im_dom , func1_1_L6AIf the inverse image of a set is not empty, then the set is not empty. Proof by contradiction.
lemma func1_1_L13:
assumes A1: \( f^{-1}(A) \neq 0 \)
shows \( A\neq 0 \) using assmsIf the image of a set is not empty, then the set is not empty. Proof by contradiction.
lemma func1_1_L13A:
assumes A1: \( f(A)\neq 0 \)
shows \( A\neq 0 \) using assmsWhat is the inverse image of a singleton?
lemma func1_1_L14:
assumes \( f\in X\rightarrow Y \)
shows \( f^{-1}(\{y\}) = \{x\in X.\ f(x) = y\} \) using assms , func1_1_L6A , vimage_singleton_iff , apply_iffA lemma that can be used instead fun_extension_iff to show that two functions are equal
lemma func_eq:
assumes \( f: X\rightarrow Y \), \( g: X\rightarrow Z \) and \( \forall x\in X.\ f(x) = g(x) \)
shows \( f = g \) using assms , fun_extension_iffFunction defined on a singleton is a single pair.
lemma func_singleton_pair:
assumes A1: \( f : \{a\}\rightarrow X \)
shows \( f = \{\langle a, f(a)\rangle \} \)proofA single pair is a function on a singleton. This is similar to singleton_fun from standard Isabelle/ZF.
lemma pair_func_singleton:
assumes A1: \( y \in Y \)
shows \( \{\langle x,y\rangle \} : \{x\} \rightarrow Y \)proofThe value of a pair on the first element is the second one.
lemma pair_val:
shows \( \{\langle x,y\rangle \}(x) = y \) using singleton_fun , apply_equalityA more familiar definition of inverse image.
lemma func1_1_L15:
assumes A1: \( f:X\rightarrow Y \)
shows \( f^{-1}(A) = \{x\in X.\ f(x) \in A\} \)proofA more familiar definition of image.
lemma func_imagedef:
assumes A1: \( f:X\rightarrow Y \) and A2: \( A\subseteq X \)
shows \( f(A) = \{f(x).\ x \in A\} \)proofWhat is the image of a singleton?
lemma singleton_image:
assumes \( f\in X\rightarrow Y \) and \( x\in X \)
shows \( f\{x\}= \{f(x)\} \) using assms , func_imagedefIf an element of the domain of a function belongs to a set, then its value belongs to the imgage of that set.
lemma func1_1_L15D:
assumes \( f:X\rightarrow Y \), \( x\in A \), \( A\subseteq X \)
shows \( f(x) \in f(A) \) using assms , func_imagedefRange is the image of the domain. Isabelle/ZF defines \( range(f) \) as \( domain(converse(f)) \), and that's why we have something to prove here.
lemma range_image_domain:
assumes A1: \( f:X\rightarrow Y \)
shows \( f(X) = range(f) \)proofThe difference of images is contained in the image of difference.
lemma diff_image_diff:
assumes A1: \( f: X\rightarrow Y \) and A2: \( A\subseteq X \)
shows \( f(X) - f(A) \subseteq f(X-A) \)proofThe image of an intersection is contained in the intersection of the images.
lemma image_of_Inter:
assumes A1: \( f:X\rightarrow Y \) and A2: \( I\neq 0 \) and A3: \( \forall i\in I.\ P(i) \subseteq X \)
shows \( f(\bigcap i\in I.\ P(i)) \subseteq ( \bigcap i\in I.\ f(P(i)) ) \)proofThe image of a nonempty subset of domain is nonempty.
lemma func1_1_L15A:
assumes A1: \( f: X\rightarrow Y \) and A2: \( A\subseteq X \) and A3: \( A\neq 0 \)
shows \( f(A) \neq 0 \)proofThe next lemma allows to prove statements about the values in the domain of a function given a statement about values in the range.
lemma func1_1_L15B:
assumes \( f:X\rightarrow Y \) and \( A\subseteq X \) and \( \forall y\in f(A).\ P(y) \)
shows \( \forall x\in A.\ P(f(x)) \) using assms , func_imagedefAn image of an image is the image of a composition.
lemma func1_1_L15C:
assumes A1: \( f:X\rightarrow Y \) and A2: \( g:Y\rightarrow Z \) and A3: \( A\subseteq X \)
shows \( g(f(A)) = \{g(f(x)).\ x\in A\} \), \( g(f(A)) = (g\circ f)(A) \)proofWhat is the image of a set defined by a meta-fuction?
lemma func1_1_L17:
assumes A1: \( f \in X\rightarrow Y \) and A2: \( \forall x\in A.\ b(x) \in X \)
shows \( f(\{b(x).\ x\in A\}) = \{f(b(x)).\ x\in A\} \)proofWhat are the values of composition of three functions?
lemma func1_1_L18:
assumes A1: \( f:A\rightarrow B \), \( g:B\rightarrow C \), \( h:C\rightarrow D \) and A2: \( x\in A \)
shows \( (h\circ g\circ f)(x) \in D \), \( (h\circ g\circ f)(x) = h(g(f(x))) \)proofA composition of functions is a function. This is a slight generalization of standard Isabelle's comp_fun
lemma comp_fun_subset:
assumes A1: \( g:A\rightarrow B \) and A2: \( f:C\rightarrow D \) and A3: \( B \subseteq C \)
shows \( f\circ g : A \rightarrow D \)proofA lemma about a value of a function that is a union of some collection of functions.
lemma fun_Union_apply:
assumes A1: \( \bigcup F : X\rightarrow Y \) and A2: \( f\in F \) and A3: \( f:A\rightarrow B \) and A4: \( x\in A \)
shows \( (\bigcup F)(x) = f(x) \)proofStandard Isabelle/ZF defines the notion \( restrict(f,A) \) of to mean a function (or relation) \(f\) restricted to a set. This means that if \(f\) is a function defined on \(X\) and \(A\) is a subset of \(X\) then \( restrict(f,A) \) is a function whith the same values as \(f\), but whose domain is \(A\).
What is the inverse image of a set under a restricted fuction?
lemma func1_2_L1:
assumes A1: \( f:X\rightarrow Y \) and A2: \( B\subseteq X \)
shows \( restrict(f,B)^{-1}(A) = f^{-1}(A) \cap B \)proofA criterion for when one function is a restriction of another. The lemma below provides a result useful in the actual proof of the criterion and applications.
lemma func1_2_L2:
assumes A1: \( f:X\rightarrow Y \) and A2: \( g \in A\rightarrow Z \) and A3: \( A\subseteq X \) and A4: \( f \cap A\times Z = g \)
shows \( \forall x\in A.\ g(x) = f(x) \)proofHere is the actual criterion.
lemma func1_2_L3:
assumes A1: \( f:X\rightarrow Y \) and A2: \( g:A\rightarrow Z \) and A3: \( A\subseteq X \) and A4: \( f \cap A\times Z = g \)
shows \( g = restrict(f,A) \)proofWhich function space a restricted function belongs to?
lemma func1_2_L4:
assumes A1: \( f:X\rightarrow Y \) and A2: \( A\subseteq X \) and A3: \( \forall x\in A.\ f(x) \in Z \)
shows \( restrict(f,A) : A\rightarrow Z \)proofA simpler case of func1_2_L4, where the range of the original and restricted function are the same.
corollary restrict_fun:
assumes A1: \( f:X\rightarrow Y \) and A2: \( A\subseteq X \)
shows \( restrict(f,A) : A \rightarrow Y \)proofA composition of two functions is the same as composition with a restriction.
lemma comp_restrict:
assumes A1: \( f : A\rightarrow B \) and A2: \( g : X \rightarrow C \) and A3: \( B\subseteq X \)
shows \( g\circ f = restrict(g,B)\circ f \)proofConstant functions are trivial, but still we need to prove some properties to shorten proofs.
We define constant(\(=c\)) functions on a set \(X\) in a natural way as ConstantFunction\((X,c)\).
Definition
\( ConstantFunction(X,c) \equiv X\times \{c\} \)
Constant function belongs to the function space.
lemma func1_3_L1:
assumes A1: \( c\in Y \)
shows \( ConstantFunction(X,c) : X\rightarrow Y \)proofConstant function is equal to the constant on its domain.
lemma func1_3_L2:
assumes A1: \( x\in X \)
shows \( ConstantFunction(X,c)(x) = c \)proofIn this section we prove the properties of the spaces of injections, surjections and bijections that we can't find in the standard Isabelle's Perm.thy.
For injections the image a difference of two sets is the difference of images
lemma inj_image_dif:
assumes A1: \( f \in inj(A,B) \) and A2: \( C \subseteq A \)
shows \( f(A-C) = f(A) - f(C) \)proofFor surjection from \(A\) to \(B\) the image of the domain is \(B\).
lemma surj_range_image_domain:
assumes A1: \( f \in surj(A,B) \)
shows \( f(A) = B \)proofRestriction of an bijection to a set without a point is a a bijection.
lemma bij_restrict_rem:
assumes A1: \( f \in bij(A,B) \) and A2: \( a\in A \)
shows \( restrict(f, A-\{a\}) \in bij(A-\{a\}, B-\{f(a)\}) \)proofThe domain of a bijection between \(X\) and \(Y\) is \(X\).
lemma domain_of_bij:
assumes A1: \( f \in bij(X,Y) \)
shows \( domain(f) = X \)proofThe value of the inverse of an injection on a point of the image of a set belongs to that set.
lemma inj_inv_back_in_set:
assumes A1: \( f \in inj(A,B) \) and A2: \( C\subseteq A \) and A3: \( y \in f(C) \)
shows \( converse(f)(y) \in C \), \( f(converse(f)(y)) = y \)proofFor injections if a value at a point belongs to the image of a set, then the point belongs to the set.
lemma inj_point_of_image:
assumes A1: \( f \in inj(A,B) \) and A2: \( C\subseteq A \) and A3: \( x\in A \) and A4: \( f(x) \in f(C) \)
shows \( x \in C \)proofFor injections the image of intersection is the intersection of images.
lemma inj_image_of_Inter:
assumes A1: \( f \in inj(A,B) \) and A2: \( I\neq 0 \) and A3: \( \forall i\in I.\ P(i) \subseteq A \)
shows \( f(\bigcap i\in I.\ P(i)) = ( \bigcap i\in I.\ f(P(i)) ) \)proofA lemma about extending a surjection by one point.
lemma surj_extend_point:
assumes A1: \( f \in surj(X,Y) \) and A2: \( a\notin X \) and A3: \( g = f \cup \{\langle a,b\rangle \} \)
shows \( g \in surj(X\cup \{a\},Y\cup \{b\}) \)proofA lemma about extending an injection by one point. Essentially the same as standard Isabelle's inj_extend.
lemma inj_extend_point:
assumes \( f \in inj(X,Y) \), \( a\notin X \), \( b\notin Y \)
shows \( (f \cup \{\langle a,b\rangle \}) \in inj(X\cup \{a\},Y\cup \{b\}) \)proofA lemma about extending a bijection by one point.
lemma bij_extend_point:
assumes \( f \in bij(X,Y) \), \( a\notin X \), \( b\notin Y \)
shows \( (f \cup \{\langle a,b\rangle \}) \in bij(X\cup \{a\},Y\cup \{b\}) \) using assms , surj_extend_point , inj_extend_point , bij_defA quite general form of the \(a^{-1}b = 1\) implies \(a=b\) law.
lemma comp_inv_id_eq:
assumes A1: \( converse(b)\circ a = id(A) \) and A2: \( a \subseteq A\times B \), \( b \in surj(A,B) \)
shows \( a = b \)proofA special case of comp_inv_id_eq - the \(a^{-1}b = 1\) implies \(a=b\) law for bijections.
lemma comp_inv_id_eq_bij:
assumes A1: \( a \in bij(A,B) \), \( b \in bij(A,B) \) and A2: \( converse(b)\circ a = id(A) \)
shows \( a = b \)proofFor a surjection The union if images of singletons is the whole range.
lemma surj_singleton_image:
assumes A1: \( f \in surj(X,Y) \)
shows \( (\bigcup x\in X.\ \{f(x)\}) = Y \)proofFor every function of two variables we can define families of functions of one variable by fixing the other variable. This section establishes basic definitions and results for this concept.
If we fix an \(x\in X\) we obtain a function on \(Y\). Note that if \( domain(f) \) is \(X\times Y\), \( range(domain(f)) \) extracts \(Y\) from \(X\times Y\).
Definition
\( Fix1stVar(f,x) \equiv \{\langle y,f\langle x,y\rangle \rangle .\ y \in range(domain(f))\} \)
For every \(y\in Y\) we can fix the second variable in a binary function \(f: X\times Y \rightarrow Z\) to get a function on \(X\).
Definition
\( Fix2ndVar(f,y) \equiv \{\langle x,f\langle x,y\rangle \rangle .\ x \in domain(domain(f))\} \)
We defined Fix1stVar and Fix2ndVar so that the domain of the function is not listed in the arguments, but is recovered from the function. The next lemma is a technical fact that makes it easier to use this definition.
lemma fix_var_fun_domain:
assumes A1: \( f : X\times Y \rightarrow Z \)
shows \( x\in X \longrightarrow Fix1stVar(f,x) = \{\langle y,f\langle x,y\rangle \rangle .\ y \in Y\} \), \( y\in Y \longrightarrow Fix2ndVar(f,y) = \{\langle x,f\langle x,y\rangle \rangle .\ x \in X\} \)proofIf we fix the first variable, we get a function of the second variable.
lemma fix_1st_var_fun:
assumes A1: \( f : X\times Y \rightarrow Z \) and A2: \( x\in X \)
shows \( Fix1stVar(f,x) : Y \rightarrow Z \)proofIf we fix the second variable, we get a function of the first variable.
lemma fix_2nd_var_fun:
assumes A1: \( f : X\times Y \rightarrow Z \) and A2: \( y\in Y \)
shows \( Fix2ndVar(f,y) : X \rightarrow Z \)proofWhat is the value of \( Fix1stVar(f,x) \) at \(y\in Y\) and the value of \( Fix2ndVar(f,y) \) at \(x\in X\)"?
lemma fix_var_val:
assumes A1: \( f : X\times Y \rightarrow Z \) and A2: \( x\in X \), \( y\in Y \)
shows \( Fix1stVar(f,x)(y) = f\langle x,y\rangle \), \( Fix2ndVar(f,y)(x) = f\langle x,y\rangle \)proofFixing the second variable commutes with restrictig the domain.
lemma fix_2nd_var_restr_comm:
assumes A1: \( f : X\times Y \rightarrow Z \) and A2: \( y\in Y \) and A3: \( X_1 \subseteq X \)
shows \( Fix2ndVar(restrict(f,X_1\times Y),y) = restrict(Fix2ndVar(f,y),X_1) \)proof