Practical Foundations of Mathematics

Paul Taylor

6.8  Exercises VI

  1. Construct FV(t), the set of free variables of a term in a free algebra for a free theory, as an example of the conjunctive (or, rather, disjunctive) interpretation.

  2. Any subset U A has a characteristic function cU:A W (Notation 2.8.2). Suppose that U is a T-subalgebra of A and endow W with the conjunctive interpretation. Is cU a homomorphism? What is the effect of applying the heredity operator (Definition  2.5.4) to it?

  3. Define the additive interpretation in N of any finitary free theory in an analogous way to the conjunctive interpretation in W. Describe the free algebra F1 on one generator and the interpretation [[-]]:F1 N in terms of trees. Generalise to an interpretation of infinitary free theories with the class of sets as its carrier.

  4. Explain how the set of streams in an alphabet G is the final coalgebra for T = (-)xG. Derive the final coalgebra for an infinitary free theory from Proposition 6.1.11.

  5. Show that the functor List preserves pullbacks, and Pf preserves monos.

  6. Show that the functor T of Definition  6.1.1 preserves directed unions iff the arities of all of the operations are finitely generable.

  7. Prove Remark 1.6.12, that each of the rules of natural deduction for the predicate calculus preserves validity of formulae in any interpretation, in the sense defined by Example 6.1.9.

  8. Define a function List(R+{+, -,x,}) List(R)+{*} which evaluates arithmetic expressions written in Polish notation.

  9. Formulate and prove the Substitution Lemmas 1.1.5 and 1.1.12.

  10. Use the List functor, head, tail, their analogues for reversed lists, and equalisers to construct the set of morphisms of the free category on a graph (Theorem  6.2.8(a)). Use append and a pullback to define composition.

  11. Show that if the set W of operation-symbols of a finitary free theory has decidable equality then so does the initial algebra.

  12. Let e:X\twoheadrightarrow Y. Consider the free theory with W = X+{r}, where ar[x] = and ar[r] = Y. Let F be its free algebra. Consider also the algebra A = Y+(Y+1)Y with xA = n0(e(x)) and \oprA(g) = n1(g;k) for g AY, where k = (id+!):A Y+1. Show that each n0(y) is in the smallest W- subalgebra of A, and hence so is n1(\expx n0). But if this lies in the ( Set-)image of the unique homomorphism p:F A then e is split.

  13. Give a direct categorical proof of Corollary  6.3.6.

  14. Let ev:TW W be the characteristic map of the subset T{T} TW. Use this to show that the recursion scheme implies the induction scheme for any functor T ( cf Remark 6.3.10).

  15. Show that if \parseX:X TX is well founded or extensional then so is T\parseX:TX T2X ( cf Exercise  3.40 and Lemma 6.3.11 ).

  16. Show that any colimit of well founded coalgebras and homomorphisms is well founded. Discuss extensionality for filtered colimits and pushouts.

  17. Let W X be a subcoalgebra and suppose that W (but not X) is well founded. Show that it is the largest well founded subcoalgebra iff the square is a pullback: omitted diagram environment

  18. Show that for every well founded relation (X,\prec ) there is a wff-system (for a free theory) of which it is the immediate sub-expression relation. [Hint: take tgt:(\prec ) X as the arity display of the theory.]

  19. Show how to apply the General Recursion Theorem  6.3.13 to Remark  6.2.10 and Proposition  6.2.6.

  20. Give the symbolic proofs in set theory and algebra corresponding to Proposition 6.3.9, Lemma  6.3.12 and the last part of Theorem  6.3.13, cf the comments after Lemma 6.3.11.

  21. Follow the particular cases of the predecessor function and the Euclidean algorithm through Section  6.4.

  22. A natural transformation sG,A:GxT A T(GxA) is called a strength for the functor T if it satisfies
    s1,A = \idTA        sGxD,A = (\idD xsG,A);sD,GxA.
    Find s for the covariant powerset and for the functor which codes a free algebraic theory.

  23. The notions of T-coalgebra and algebra with parameters in G are given by parse:GxX TX and ev:GxTQ Q, in the presence of a strength s. Explain how the diagram on the left describes the parametric recursion scheme, in particular in the cases of the powerset and a free algebraic theory: omitted diagram environment If the category is cartesian closed show how a solution of the non-parametric recursion on the right solves the given one, cf Remark  6.1.6.

    Using Corollary 6.3.6, show that if X TX (doesn't depend on G and) is well founded then so is GxX T( GxX). Without using cartesian closure, formulate and prove directly the parametric version of Proposition  6.3.9, and hence of the General Recursion Theorem 6.3.13.

  24. Recursion may be parametric in another sense, namely that the argument is used in the evaluation phase. This issue itself divides into two parts, depending on whether the argument is used in parsed or unparsed form. The second case is given by the diagram on the left: omitted diagram environment By a similar method to the previous exercise, show that this is equivalent to the form on the right in a cartesian closed category, where T has a strength s. Again, formulate and prove the parametric General Recursion Theorem directly without using cartesian closure.

  25. If the original argument is used in parsed form, the recursion scheme simplifies to omitted diagram environment Derive this from the previous case by putting Q = FxX. Conversely, reduce that one to this using \evX = parse-1X, in the case where X is the initial T-algebra (an extensional well founded coalgebra is enough, \evX being partial).

  26. A unary recursion problem is one which makes at most one recursive call at each level, but where the argument may be used again after the return from the nested call. Explain how this is coded by a functor of the form T = K+Cx(-) and show how to reduce this to the diagram on the left (allowing the argument as a parameter as in Exercise  6.25): omitted diagram environment The map a:XxQ Q gives a homomorphism List(X) [Q Q] of monoids. Suppose that this factors through another monoid M, which is called an accumulator. Show how to reformulate the problem as a tail recursion with functor T = (-)+(NxM), as on the right.

    Explain how the case M = List(X) corresponds to a stack, and how M = N suffices if a does not depend on X. The last map QxM Q is itself defined by recursion over M: to what part of the execution of a recursive program does it correspond?

  27. Express the factorial program in this form and apply the transformation, using the monoid M = (N,x). Do the same for the Fibonacci function, which is calculated using the unary recursion on N2
    p(0) = (0,1)        p(n+1) = (v,u+v) where (u,v) = p(n),
    using the monoid of (2×2) matrices under multiplication. Hence show that p(n) = (0,1)(0  1 || 1  1)n, so by calculating (0  1 || 1  1)2k the problem can be solved in logarithmic time. What features of a recursive program must a compiler recognise in order to make use of optimisations of this kind?

  28. Express fold and append for lists (Definition 2.7.4) using Exercise  6.26, with M = List(X), and translate these back into functional programs. What advantage, if any, do the tail- recursive programs have over the original non-tail recursion using a stack?

  29. General recursion extends primitive recursion by use of the search or minimalisation operator m. For any partial recursive function f:GxN \rightharpoonup 2, mn.f(x,n) is the n (if any) for which f(x,n) = 1 but f(x,m) = 0 for all m < n (if any of these values is undefined then so is mn.f(x,n)). Express this as a while program, and hence as recursion over a certain coalgebra structure (GxN)\rightharpoonup (GxN)+N.

  30. Show that (L,z,s) (List(X),[  ], cons) iff the diagrams omitted diagram environment are respectively a coproduct and a coequaliser, cf Example  6.4.13.

  31. Modify the Floyd rules of Remarks 4.3.5, 5.3.2 and 5.3.9 for partial correctness, as in Remark 6.4.16ff.

  32. Express the unification algorithm in the style of Sections 6.3-6.4.

  33. Investigate unification in equationally free algebras that are not necessarily well founded, so that the equation x = r(x) can be solved.

  34. Show that the unifier is the quotient by the parsing congruence, and that the congruence is the kernel of the unifier, cf Section 5.6. Allow infinitely many equations, and infinite arities.

  35. Investigate the non-determinacy in the unification algorithm.

  36. Apply the unification algorithm as given to Remark  6.5.4(a).

  37. Explain why, in Definition  6.6.2(b), any coequaliser diagram k\rightrightarrows n generates a finite equivalence relation on n.

  38. Prove the pigeonhole principle, which is that, for any function f:n+1 n, there are some i < j n with f(i) = f(j). Deduce Bo Peep's theorem (Exercise 1.1).

  39. Develop a Kuratowski-style unary induction scheme for finitely enumerable sets, and use it to prove the pigeonhole principle in an extensive category (Section 5.5) without assuming the existence of N, or using numbers at all.

  40. By considering the orders of elements of its Sylow subgroups, show that there is no simple group of order 105.

  41. Show that {*|f} (Remark  2.2.7) is finitely enumerated iff f is decidable. [Hint: exactly how many elements does it have?] Show that this also holds for finite generability.

  42. Show that every finitely presented set is finitely enumerable.

  43. Develop the results about Kuratowski finiteness and the finite powerset starting from the unary induction scheme in Lemma  6.6.10(b), in the style of Definition  3.8.6.

  44. Show that the following binary Kuratowski induction scheme is equivalent to the unary one:
    omitted prooftree environment

  45. Let R:X\leftharpoondown \rightharpoonup Y be any binary relation, and suppose that U X, V Y are finitely generable sets which match in the sense that


    "u.$v.u R v
           
    " v.$u.u R v
    .
    Show that U and V have matching listings, ie U = {\argu0, ,\argun-1} and V = {\argv0,,\argvn-1} with "i.\argui R \argvi. Deduce the following results by taking R to be equality or an order relation.

    (a)
    The kernel pair of the set of elements function List (X) P(X) is generated by the laws for a semilattice; use Section 5.6 to deduce that Pf(X) is the free semilattice on X.

    (b)
    Let (X, ) be a preorder. Suppose Pf(X) also carries a preorder \sqsubseteq ( not inclusion) with respect to which :Pf(X)xPf(X) Pf(X) and {-}:X Pf(X) are monotone. Then if U,V X are finitely generable and match with respect to , ie U\cvx V in the notation of Exercise 3.55, then U\sqsubseteq V.

  46. Let L be a single-sorted algebraic theory with only finitely many operation-symbols and laws, and let A be an L-algebra. Show that if the carrier of A is a finite set then A is finitely presentable as an algebra.

  47. Let L be a single-sorted algebraic theory which is finitary in the stronger sense that it has finitely many ( ie a finitely enumerated set of) operation-symbols, each of finite arity, and finitely many laws (where, for example, the associative law counts as one law). Let A be an algebra whose carrier is Kuratowski-finite, so there is a surjection n\twoheadrightarrow A for some n. Show that there are a finitely enumerated algebra B and a surjective homomorphism B\twoheadrightarrow A. [Hint: show that n is an algebra for the operation-symbols of L but not necessarily the laws, and that the laws of L define a finite equivalence relation k\rightrightarrows n.]

  48. Find a finitely generated monoid with no finite presentation.

  49. (Only for those who have studied ring theory.) Using the fact that polynomial rings are Noetherian, show that every finitely generable commutative ring is finitely presentable.

  50. Let G be a set with decidable equality equipped with a map G G which has no cycles ( cf Exercise 2.47). Construct functions n:GxPf (G) G and s:Pf(G)xPf(G) Pf (G) such that n(x,U) U and s(U,V) U+V, where the coproduct inclusions are also to be found. The functions must not depend on the order in which the elements of the finite sets are given.

  51. Using the results of Section 2.6, show how to code ww , www , etc either as special orders on N or with the arithmetical order on Q.

  52. Describe the three product relations on axa defined in Propositions 2.6.7- 2.6.9, for each of a = w, w2 and w2. If the result is not extensional, describe the extensional quotient as a binary operation axa b. [Hint: one of them gives ordinal multiplication and another intersection.]

  53. Given a Choice function c:P(Q)\ {} Q (Exercise 2.15), define T:P(Q)\{} P( Q) by T(U) = U{c(Q\U)} for U Q and T(Q) = Q. Let a P(Q) be the smallest set closed under T and union ( cf Proposition  3.7.11 and Exercise  3.46). Show that a is in bijection with Q, and that every non-empty subset of a has a first ( -greatest) element (without using Hartogs' Lemma; this was Zermelo's proof).

  54. Show, using excluded middle, that if a poset X has a least fixed point for every monotone endofunction s:X X then X has a least element and all ordinal-indexed joins. [Hint: for ^, take s = id; for y X and a diagram x(-):a X consider whether { b|xb y} is a or an element of a, and in the second case use the successor.]

  55. Show that the relation x\prec y (\lnot xy ) on W is extensional and well founded, but that the reflexive closure of this relation is sparser than unless excluded middle holds. Show that this structure has no non-trivial automorphism, and that (up to isomorphism) this is the only extensional well founded relation on W.

  56. Let X be a set with a bijection X+X X. Construct a bijection HXxHX HX. An ordinal k is said to be a cardinal (or an initial ordinal) if it is least amongst the ordinal structures on the same underlying set. Show that , H- and generate the class of cardinals, and hence deduce that kxk k for any cardinal k. Hk k+ is called its successor cardinal.

  57. Show that any transitive extensional well founded relation is trichotomous, using proof boxes, making explicit the use of excluded middle in the form \lnot \lnot f\vdash f. [This is not easy: try Remark 2.4.10.]