Skip to main content

Oracle Computability and Turing Reducibility in the Calculus of Inductive Constructions

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2023)

Abstract

We develop synthetic notions of oracle computability and Turing reducibility in the Calculus of Inductive Constructions (CIC), the constructive type theory underlying the Coq proof assistant. As usual in synthetic approaches, we employ a definition of oracle computations based on meta-level functions rather than object-level models of computation, relying on the fact that in constructive systems such as CIC all definable functions are computable by construction. Such an approach lends itself well to machine-checked proofs, which we carry out in Coq.

There is a tension in finding a good synthetic rendering of the higher-order notion of oracle computability. On the one hand, it has to be informative enough to prove central results, ensuring that all notions are faithfully captured. On the other hand, it has to be restricted enough to benefit from axioms for synthetic computability, which usually concern first-order objects. Drawing inspiration from a definition by Andrej Bauer based on continuous functions in the effective topos, we use a notion of sequential continuity to characterise valid oracle computations.

As main technical results, we show that Turing reducibility forms an upper semilattice, transports decidability, and is strictly more expressive than truth-table reducibility, and prove that whenever both a predicate p and its complement are semi-decidable relative to an oracle q, then p Turing-reduces to q.

Yannick Forster received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No. 101024493. Dominik Kirst is supported by a Minerva Fellowship of the Minerva Stiftung Gesellschaft fuer die Forschung mbH.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    The non-relativised form of the latter statement also appears under the name of “Post’s theorem” in the literature [42], not to be confused with the mentioned theorem regarding the arithmetical hierarchy, see the explanation in Sect. 9.

  2. 2.

    https://github.com/uds-psl/coq-synthetic-computability/tree/code-paper-oracle-computability.

  3. 3.

    There are many ways how semi-decidable partial values can be represented in CIC, for instance via step-indexing. Since the actual implementation does not matter, we abstract over any representation providing the necessary operations, see Appendix A.

References

  1. Bauer, A.: First steps in synthetic computability theory. Electron. Not. Theoret. Comput. Sci. 155, 5–31 (2006). https://doi.org/10.1016/j.entcs.2005.11.049

    Article  MATH  Google Scholar 

  2. Bauer, A.: On fixed-point theorems in synthetic computability. Tbilisi Math. J. 10(3), 167–181 (2017). https://doi.org/10.1515/tmj-2017-0107

    Article  MathSciNet  MATH  Google Scholar 

  3. Bauer, A.: Synthetic mathematics with an excursion into computability theory (slide set). University of Wisconsin Logic seminar (2020). http://math.andrej.com/asset/data/madison-synthetic-computability-talk.pdf

  4. Bauer, A.: Formalizing invisible mathematics. In: Workshop on Machine Assisted Proofs, Institute for Pure and Applied Mathematics (IPAM) at the University of California in Los Angeles (UCLA), 13–17 February 2023 (2023). https://www.youtube.com/watch?v=wZSvuCJBaFU

  5. Bridges, D., Richman, F.: Varieties of Constructive Mathematics, vol. 97. Cambridge University Press (1987). https://doi.org/10.1017/CBO9780511565663

  6. Coquand, T., Huet, G.P.: The calculus of constructions. Inf. Comput. 76(2/3), 95–120 (1988). https://doi.org/10.1016/0890-5401(88)90005-3

  7. Davis, M.D.: Computability and Unsolvability. McGraw-Hill Series in Information Processing and Computers. McGraw-Hill (1958)

    Google Scholar 

  8. Dekker, J.C.E.: A theorem on hypersimple sets. Proc. Am. Math. Soc. 5, 791–796 (1954). https://doi.org/10.1090/S0002-9939-1954-0063995-6

    Article  MathSciNet  MATH  Google Scholar 

  9. Escardo, M.: Continuity of Gödel’s system T definable functionals via effectful forcing. Electron. Not. Theoret. Comput. Sci. 298, 119–141 (2013). https://doi.org/10.1016/j.entcs.2013.09.010

  10. Forster, Y.: Church’s thesis and related axioms in Coq’s type theory. In: Baier, C., Goubault-Larrecq, J. (eds.) 29th EACSL Annual Conference on Computer Science Logic (CSL 2021). Leibniz International Proceedings in Informatics (LIPIcs), vol. 183, pp. 21:1–21:19. Schloss Dagstuhl-Leibniz-Zentrum für Informatik, Dagstuhl, Germany (2021). https://doi.org/10.4230/LIPIcs.CSL.2021.21. https://drops.dagstuhl.de/opus/volltexte/2021/13455

  11. Forster, Y.: Computability in constructive type theory. Ph.D. thesis, Saarland University (2021). https://doi.org/10.22028/D291-35758

  12. Forster, Y.: Parametric Church’s thesis: synthetic computability without choice. In: Artemov, S., Nerode, A. (eds.) LFCS 2022. LNCS, vol. 13137, pp. 70–89. Springer, Cham (2022). https://doi.org/10.1007/978-3-030-93100-1_6

    Chapter  Google Scholar 

  13. Forster, Y., Jahn, F.: Constructive and synthetic reducibility degrees: post’s problem for many-one and truth-table reducibility in Coq. In: Klin, B., Pimentel, E. (eds.) 31st EACSL Annual Conference on Computer Science Logic (CSL 2023). Leibniz International Proceedings in Informatics (LIPIcs), vol. 252, pp. 21:1–21:21. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, Dagstuhl, Germany (2023). https://doi.org/10.4230/LIPIcs.CSL.2023.21. https://drops.dagstuhl.de/opus/volltexte/2023/17482

  14. Forster, Y., Jahn, F., Smolka, G.: A computational cantor-Bernstein and Myhill’s isomorphism theorem in constructive type theory. In: CPP 2023–12th ACM SIGPLAN International Conference on Certified Programs and Proofs, pp. 1–8. ACM, Boston, United States, January 2023. https://doi.org/10.1145/3573105.3575690. https://inria.hal.science/hal-03891390

  15. Forster, Y., Kirst, D.: Synthetic Turing reducibility in constructive type theory. In: 28th International Conference on Types for Proofs and Programs (TYPES 2022) (2022). https://types22.inria.fr/files/2022/06/TYPES_2022_paper_64.pdf

  16. Forster, Y., Kirst, D., Smolka, G.: On synthetic undecidability in Coq, with an application to the Entscheidungsproblem. In: Proceedings of the 8th ACM SIGPLAN International Conference on Certified Programs and Proofs - CPP 2019. ACM Press (2019). https://doi.org/10.1145/3293880.3294091. https://doi.org/10.1145/3293880.3294091

  17. Forster, Y., Kunze, F., Lauermann, N.: Synthetic kolmogorov complexity in Coq. In: Andronick, J., de Moura, L. (eds.) 13th International Conference on Interactive Theorem Proving (ITP 2022). Leibniz International Proceedings in Informatics (LIPIcs), vol. 237, pp. 12:1–12:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, Dagstuhl, Germany (2022). https://doi.org/10.4230/LIPIcs.ITP.2022.12. https://drops.dagstuhl.de/opus/volltexte/2022/16721

  18. Forster, Y., et al.: A Coq library of undecidable problems. In: The Sixth International Workshop on Coq for Programming Languages (CoqPL 2020) (2020). https://github.com/uds-psl/coq-library-undecidability

  19. Friedberg, R.M.: Two recursively enumerable sets of incomparable degrees of unsovlability (solution of Post’s problem), 1944. Proc. Nat. Acad. Sci. 43(2), 236–238 (1957). https://doi.org/10.1073/pnas.43.2.236. https://doi.org/10.1073/pnas.43.2.236

  20. Hermes, M., Kirst, D.: An analysis of Tennenbaum’s theorem in constructive type theory. In: Felty, A.P. (ed.) 7th International Conference on Formal Structures for Computation and Deduction, FSCD 2022, 2–5 August 2022, Haifa, Israel. LIPIcs, vol. 228, pp. 9:1–9:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2022). https://doi.org/10.4230/LIPIcs.FSCD.2022.9

  21. Kirst, D.: Computational back-and-forth arguments in constructive type theory. In: Andronick, J., de Moura, L. (eds.) 13th International Conference on Interactive Theorem Proving (ITP 2022). Leibniz International Proceedings in Informatics (LIPIcs), vol. 237, pp. 22:1–22:12. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, Dagstuhl, Germany (2022). https://doi.org/10.4230/LIPIcs.ITP.2022.22. https://drops.dagstuhl.de/opus/volltexte/2022/16731

  22. Kirst, D., Forster, Y., Mück, N.: Synthetic versions of the kleene-post and post’s theorem. In: 28th International Conference on Types for Proofs and Programs (TYPES 2022) (2022). https://types22.inria.fr/files/2022/06/TYPES_2022_paper_65.pdf

  23. Kirst, D., Hermes, M.: Synthetic undecidability and incompleteness of first-order axiom systems in Coq: extended version. J. Autom. Reason. 67(1), 13 (2023). https://doi.org/10.1007/s10817-022-09647-x

    Article  MATH  Google Scholar 

  24. Kirst, D., Peters, B.: Gödel’s theorem without tears - essential incompleteness in synthetic computability. In: Klin, B., Pimentel, E. (eds.) 31st EACSL Annual Conference on Computer Science Logic, CSL 2023, 13–16 February 2023, Warsaw, Poland. LIPIcs, vol. 252, pp. 30:1–30:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2023). https://doi.org/10.4230/LIPIcs.CSL.2023.30

  25. Kleene, S.C.: Recursive functionals and quantifiers of finite types I. Trans. Am. Math. Soc. 91(1), 1 (1959). https://doi.org/10.2307/1993145. https://www.jstor.org/stable/1993145?origin=crossref

  26. Kleene, S.C.: Introduction to Metamathematics, vol. 483. Van Nostrand, New York (1952)

    Google Scholar 

  27. Kleene, S.C., Post, E.L.: The upper semi-lattice of degrees of recursive unsolvability. Ann. Math. 59(3), 379 (1954). https://doi.org/10.2307/1969708

  28. Kreisel, G.: Mathematical logic. Lect. Mod. Math. 3, 95–195 (1965). https://doi.org/10.2307/2315573

    Article  MATH  Google Scholar 

  29. Muchnik, A.A.: On strong and weak reducibility of algorithmic problems. Sibirskii Matematicheskii Zhurnal 4(6), 1328–1341 (1963)

    MathSciNet  Google Scholar 

  30. Mück, N.: The arithmetical hierarchy, oracle computability, and Post’s theorem in synthetic computability. Bachelor’s thesis, Saarland University (2022). https://ps.uni-saarland.de/~mueck/bachelor.php

  31. Odifreddi, P.: Classical Recursion Theory: The Theory of Functions and Sets of Natural Numbers. Elsevier (1992)

    Google Scholar 

  32. van Oosten, J.: A combinatory algebra for sequential functionals of finite type. In: Models and Computability, pp. 389–406. Cambridge University Press, June 1999. https://doi.org/10.1017/cbo9780511565670.019

  33. van Oosten, J.: Partial combinatory algebras of functions. Notre Dame J. Formal Logic 52(4), 431–448 (2011). https://doi.org/10.1215/00294527-1499381

    Article  MathSciNet  MATH  Google Scholar 

  34. Paulin-Mohring, C.: Inductive definitions in the system Coq rules and properties. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 328–345. Springer, Heidelberg (1993). https://doi.org/10.1007/BFb0037116

    Chapter  MATH  Google Scholar 

  35. Post, E.L.: Recursively enumerable sets of positive integers and their decision problems. Bull. Am. Math. Soc. 50(5), 284–316 (1944). https://doi.org/10.1090/S0002-9904-1944-08111-1

  36. Post, E.L.: Degrees of recursive unsolvability - preliminary report. Bull. Am. Math. Soc. 54(7), 641–642 (1948)

    Google Scholar 

  37. Richman, F.: Church’s thesis without tears. J. Symbolic Logic 48(3), 797–803 (1983). https://doi.org/10.2307/2273473

    Article  MathSciNet  MATH  Google Scholar 

  38. Rogers, H.: Theory of Recursive Functions and Effective Computability (1987)

    Google Scholar 

  39. Swan, A., Uemura, T.: On Church’s thesis in cubical assemblies. arXiv preprint arXiv:1905.03014 (2019)

  40. Swan, A.W.: Oracle modalities. In: Second International Conference on Homotopy Type Theory (HoTT 2023) (2023). https://hott.github.io/HoTT-2023/abstracts/HoTT-2023_abstract_35.pdf

  41. The Coq Development Team: The Coq proof assistant, June 2023. https://doi.org/10.5281/zenodo.8161141

  42. Troelstra, A.S., van Dalen, D.: Constructivism in Mathematics. Studies in Logic and the Foundations of Mathematics, vol. i, 26 (1988)

    Google Scholar 

  43. Turing, A.M.: Systems of logic based on ordinals. Proc. Lond. Math. Soc. 2(1), 161–228 (1939). https://doi.org/10.1112/plms/s2-45.1.161

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgements

We want to thank Felix Jahn, Gert Smolka, Dominique Larchey-Wendling, and the participants of the TYPES ’22 conference for many fruitful discussions about Turing reducibility, as well as Martin Baillon, Yann Leray, Assia Mahboubi, Pierre-Marie Pédrot, and Matthieu Piquerez for discussions about notions of continuity. The central inspiration to start working on Turing reducibility in type theory is due to Andrej Bauer’s talk at the Wisconsin logic seminar in February 2021.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Yannick Forster .

Editor information

Editors and Affiliations

Appendices

A Glossary of Definitions

We collect some basic notations and definitions:

  • \(\mathbb {P}\) is the (impredicative) universe of propositions.

  • Natural numbers:              \( n : \mathbb {N}:\,\!:= 0 \mid \textsf{S}\; n\)

  • Booleans:              \( b : \mathbb {B}:\,\!:= \textsf{true}\mid \textsf{false}\)

  • Unit type:                    \(\mathbbm {1}:\,\!:= \star \)

  • Sum type:        \( X + Y :\,\!:= \textsf{inl} x \mid \textsf{inr} y \quad (x : X, y : Y) \)

  • Option type:        \(o : X^{?} :\,\!:= \textsf {None}\mid {\textsf {Some}\;}x \quad (x : X)\)

  • Lists:        \( l : X^* :\,\!:= [\;] \mid x :\,\!: l \quad (x : X) \)

List operations. We often rely on concatenation of of two lists \(l_1 \mathbin {+\!\!\!+}l_2\):

figure h

Also, we use an inductive predicate \(\textsf{Forall}_2\!:\!(X\rightarrow Y\rightarrow \mathbb {P}) \rightarrow X^* \rightarrow Y^* \rightarrow \mathbb {P}\)

figure i

Characteristic Relation. The characteristic relation \(\hat{p}\!:\!X\rightarrow \mathbb {B}\rightarrow \mathbb {P}\) of a predicate \(p\!:\!X\rightarrow \mathbb {P}\) is introduced in Sect. 3 as

$$\hat{p}~:=~\lambda x b. {\left\{ \begin{array}{ll} px &{} \text {if } b = \textsf{true}\\ \lnot p x &{} \text {if } b = \textsf{false}. \\ \end{array}\right. }$$

Reducibility.\(\preceq _{m}\) is many-one reducibility, introduced in Sect. 6. \(\preceq _{\texttt {tt}}\) is truth-table reducibility, introduced in Sect. 8. \(\preceq _{\textsf{T}}\) is Turing reducibility, introduced in Sect. 3.

Interrogations. The interrogation predicate \(\sigma \mathbin {;} R \vdash _{} qs \mathbin {;} as \) is introduced in Sect. 2. It works on a tree \(\sigma \!:\!A^* \rightarrow Q + O\). We often also use trees taking an input, i.e. \(\tau \!:\!I \rightarrow A^* \rightarrow Q + O\). Given \(\sigma \), we denote the subtree starting at path \(l \!:\!A^*\) with \(\sigma \mathbin {@}l := \lambda l'.\;\sigma (l \mathbin {+\!\!\!+}l')\).

Partial Functions. We use an abstract type of partial values over X, denoted as \(\mathcal P X\), with evaluation relation \(\triangleright \!:\!\mathcal P X \rightarrow X \rightarrow \mathbb {P}\). We set \(X \rightharpoonup Y := X \rightarrow \mathcal P Y\) and use

  • \(\textsf {ret}\;\!:\!X \rightharpoonup X\) with \(\textsf {ret}\;x \triangleright x\),

  • \(\mathbin {>\!\!\!>\!\!=}\!:\! \mathcal P X \rightarrow (X \rightarrow \mathcal P Y) \rightarrow \mathcal P Y \) with \(x \mathbin {>\!\!\!>\!\!=} f \triangleright y \leftrightarrow \exists v.\;x \triangleright v \wedge f v \triangleright y\),

  • \(\mu \!:\!(\mathbb {N}\rightarrow \mathcal P \mathbb {B}) \rightarrow \mathcal P \mathbb {N} \) with \(\mu f \triangleright n \leftrightarrow f n \triangleright \textsf{true}\wedge \forall m < n.\;f m \triangleright \textsf{false}\), and

  • \(\textsf {undef}\!:\!\mathcal P X\) with \(\forall v.\;\textsf {undef}\not \triangleright v\).

One can for instance implement \(\mathcal P X\) as monotonic sequences \(f:\mathbb {N}\rightarrow X^{?}\), i.e. with \(f n = {\textsf {Some}\;}x \rightarrow \forall m \ge n.\;f m = {\textsf {Some}\;}x\) and \(f \triangleright x := \exists n.\;f n = {\textsf {Some}\;}x\). For any implementation it is only crucial that the graph relation \(\lambda x y.f x \triangleright y\) for \(f \!:\!\mathbb {N}\rightharpoonup \mathbb {N}\) is semi-decidable but cannot be proved decidable. Semi-decidability induces a function \(\rho \!:\!\mathcal {P} X \rightarrow \mathbb {N}\rightarrow X^{?}\), which we write as \(\rho ^n x\) with the properties that \(x \triangleright v \leftrightarrow \exists n.\;\rho ^n x = {\textsf {Some}\;}v\) and \(\rho ^n x = {\textsf {Some}\;}v \rightarrow \forall m \ge n.\;\rho ^m x = {\textsf {Some}\;}v\).

B Extended Forms of Interrogations

1.1 B.1 Extended Interrogations with State

As an auxiliary notion, before introducing the stalling interrogations, we first introduce extended interrogations with a state argument, but without stalling. An extended tree is a function \(\sigma : S \rightarrow A^* \rightharpoonup (S \times Q) + O\). We define an inductive extended interrogation predicate \(\sigma \mathbin {;} R \vdash _{} qs \mathbin {;} as \mathbin {;} s \succ s'\) by:

figure j

A functional F mapping \(R \!:\!Q \rightarrow A \rightarrow \mathbb {P}\) to a relation of type \( I \rightarrow O \rightarrow \mathbb {P}\) is computable via extended interrogations if there are a type S, an element \(s_0 : S\), and a function \(\tau \!:\!I \rightarrow S \rightarrow A^* \rightharpoonup (S \times Q) + O\) such that

$$\begin{aligned} \forall R\,i\,o.\;F R\,i\,o \leftrightarrow \exists qs \; as \; s. ~ \tau i \mathbin {;} R \vdash _{} qs \mathbin {;} as \mathbin {;} s_0 \succ s ~\wedge ~ \tau \,i\,s\; as \triangleright \textsf{out}\;o. \end{aligned}$$

Note that we do not pass the question history to the function here, because if necessary it can be part of the type S.

Lemma 37 Computable functionals are computable via extended interrogations.

Proof

Let F be computable by \(\tau \). Set S to be any inhabited type with element \(s_0\) and define

$$\tau '\; i\; s\; l := \tau \,i\,l \mathbin {>\!\!\!>\!\!=} \lambda x.\; {\left\{ \begin{array}{ll} \textsf {ret}\;(\textsf{ask}\;(s, q)) &{} \text {if } x = \textsf{ask}\;q \\ \textsf {ret}\;o &{} \text {if } x = \textsf{out}\;o. \end{array}\right. }. $$

Then \(\tau '\) computes F via extended interrogations.    \(\square \)

Lemma 38 Functionals computable via extended interrogations are computable.

Proof

Let \(\tau \!:\!I \rightarrow S \rightarrow A^* \rightharpoonup (S \times Q) + O\) compute F via extended interrogations. Define \(\tau ' \!:\!S \rightarrow A^* \rightarrow I \rightarrow A^* \rightharpoonup Q + O\) as

figure k

Then \(\tau '\,s_0\,[]\) computes F.    \(\square \)

1.2 B.2 Stalling Interrogations

We here give the left out proofs that stalling interrogations as described in Sect. 9 and interrogations are equivalent.

Lemma 39 Functionals computable via extended interrogations are computable via stalling interrogations.

Proof

Let F be computable using a type S and element \(s_0\) by \(\tau \) via extended interrogations. We use the same type S and element \(s_0\) and define \(\tau '\) to never use stalling:

$$\tau '\, i\, s\, l := \tau \,i\,s\,l \mathbin {>\!\!\!>\!\!=} \lambda x.\; {\left\{ \begin{array}{ll} \textsf {ret}\;(\textsf{ask}\;(s', {\textsf {Some}\;}q)) &{} \text {if } x = \textsf{ask}\;(s',q) \\ \textsf {ret}\;(\textsf{out}\;o) &{} \text {if } x = \textsf{out}\;o. \end{array}\right. } $$

Then \(\tau '\) computes F via stalling interrogations.    \(\square \)

Lemma 40 Functionals computable via stalling interrogations are computable via extended interrogations.

Proof

Take \(\tau \!:\!I \rightarrow S \rightarrow A^* \rightharpoonup (S \times Q^{?}) + O\) computing F via stalling interrogations. We construct \(\tau '\,i\,s\, as \) to iterate the function \(\lambda s'.\;\tau \,i\,s'\, as \) of type \(S \rightharpoonup (S \times Q^{?}) + O\). If \(\textsf{ask}\;(s'',\textsf {None})\) is returned, the iteration continues with \(s''\). If \(\textsf{ask}\;(s, {\textsf {Some}\;}q)\) is returned, \(\tau '\,i\,s as \) returns \(\textsf{ask}\;(s, q)\). If \(\textsf{out}\;o\) is returned, \(\tau '\,i\,s\, as \) returns \(\textsf{out}\;o\) as well.

We omit the technical details how to implement this iteration process using unbounded search \(\mu : (\mathbb {N}\rightharpoonup \mathbb {B}) \rightharpoonup \mathbb {N}\).    \(\square \)

1.3 B.3 Proofs of Closure Properties

We here give the proofs that executing two computable functionals one after the other, composing computable functionals, and performing an unbounded search on a computable functional are all computable operations as stated in Sect. 4. We explain the tree constructions, which are always the core of the argument. The verification of the trees are then tedious but relatively straightforward inductions, we refer to the Coq code for full detail.

Proof

(of Lemma 7). Let \(\tau _1\) compute \(F_1\) maping relations \(R \!:\!Q\rightarrow A \rightarrow \mathbb {P}\) to relations of type \(I \rightarrow O' \rightarrow \mathbb {P}\), and \(\tau _2\) compute \(F_2\) mapping relations \(R \!:\!Q\rightarrow A \rightarrow \mathbb {P}\) to relations of type \((I \times O') \rightarrow O \rightarrow \mathbb {P}\).

To compute the functional mapping an oracle \(R \!:\!Q\rightarrow A \rightarrow \mathbb {P}\) to a computation \(\lambda i o.\,\exists o' \!:\!O'.\,F_1\,R\,i\,o' \wedge F_2\,R\,(i,o')\,o\) of type \(I \rightarrow O \rightarrow \mathbb {P}\) we construct a stalling tree with state type \((O' \times \mathbb {N})^{?}\) and starting state \(\textsf {None}\). The intuition is that the state s remains \(\textsf {None}\) as long as \(\tau _1\) asks questions, and once an output \(o'\) is produced we save it and the number of questions that were asked until then in the state, which remains unchanged after. Then, \(\tau _2\) can ask questions, but since \( as \) contains also answers to questions of \(\tau _1\), we drop the first n before passing it to \(\tau _2\).

Formally, the tree takes as arguments the input i, state s ans answer list \( as \), and returns

$$ {\left\{ \begin{array}{ll} \textsf {ret}\;(\textsf{ask}\;(\textsf {None}, {\textsf {Some}\;}q)) &{} \text {if } s = \textsf {None}, \tau _1\,i\, as \triangleright {\textsf {Some}\;}(\textsf{ask}\;q) \\ \textsf {ret}\;(\textsf{ask}\;({\textsf {Some}\;}(o', | as |), \textsf {None})) &{} \text {if } s = \textsf {None}, \tau _1\,i\, as \triangleright {\textsf {Some}\;}(\textsf{out}\;o') \\ \textsf {ret}\;(\textsf{ask}\;({\textsf {Some}\;}(o',n), {\textsf {Some}\;}q)) &{} \text {if } s = {\textsf {Some}\;}(o', n), \tau _2\,(i, o')\,( as \uparrow _n) \triangleright {\textsf {Some}\;}(\textsf{ask}\;q) \\ \textsf {ret}\;(\textsf{ask}\;({\textsf {Some}\;}(o',n), {\textsf {Some}\;}q)) &{} \text {if } s = {\textsf {Some}\;}(o', n), \tau _2\,(i, o')\,( as \uparrow _n) \triangleright {\textsf {Some}\;}(\textsf{out}\;o) \end{array}\right. } $$

where \( as \uparrow _n\) drops the first n elements of \( as \). Note that formally, we use bind to analyse the values of \(\tau _1\) and \(\tau _2\), but just write a case analysis on paper.    \(\square \)

Proof

(of Lemma 8). Let \(\tau _1\) compute \(F_1\) mapping relations \(R \!:\!Q\rightarrow A \rightarrow \mathbb {P}\) to relations \(X \rightarrow Y \rightarrow \mathbb {P}\), and \(\tau _1\) compute \(F_2\) mapping relations \(R \!:\!X\rightarrow Y \rightarrow \mathbb {P}\) to relations \(I \rightarrow O \rightarrow \mathbb {P}\). We construct a stalling tree \(\tau \) computing a functional mapping \(R \!:\!Q\rightarrow A \rightarrow \mathbb {P}\) to \(\lambda i o.\;F_2\,(F_1 R)\,i\,o\) of type \(I \rightarrow O \rightarrow \mathbb {P}\).

Intuitively, we want to execute \(\tau _2\). Whenever it asks a question x, we record it and execute \(\tau _1\,x\) to produce an answer. Since the answer list \( as \) at any point will also contain answers of the oracle produces for any earlier question \(x'\) of \(\tau _2\), we record furthermore how many questions were already asked to the oracle to compute \(\tau _1 x\).

As state type, we thus use \((X\times Y)^* \times (X \times \mathbb {N})^{?}\), where the first component remembers questions and answers for \(\tau _2\), and the second component indicates whether we are currently executing \(\tau _2\) (then it is \(\textsf {None}\)), or \(\tau _1\), when it is \({\textsf {Some}\;}(x,n)\) to indicate that on answer list \( as \) we need to run \(\tau _1\,x\,( as \downarrow ^n)\), where \( as \downarrow ^n\) contains the last n elements of \( as \). The initial state is \(([\,], \textsf {None})\).

We define \(\tau \) to take as arguments an input i, a state (tz), and an answer list \( as \) and return

$$ {\left\{ \begin{array}{ll} \textsf{out}\;o &{} \text {if } x = \textsf {None}, \tau _2\,i\,(\textsf {map}\,\pi _2\,t) \triangleright \textsf{out}\;o \\ \textsf{ask}\;(t, {\textsf {Some}\;}(x,0), \textsf {None}) &{} \text {if } x = \textsf {None}, \tau _2\,i\,(\textsf {map}\,\pi _2\,t) \triangleright \textsf{ask}\;x \\ \textsf{ask}\;(t, {\textsf {Some}\;}(x, {\textsf {S}\;}n), {\textsf {Some}\;}q) &{} \text {if } x = {\textsf {Some}\;}(x,n), \tau _1\,x\,( as \uparrow ^n) \triangleright \textsf{ask}\;q \\ \textsf{ask}\;(t \mathbin {+\!\!\!+}[(x,y)], \textsf {None}, \textsf {None}) &{} \text {if } x = {\textsf {Some}\;}(x,n), \tau _1\,x\,( as \uparrow ^n) \triangleright \textsf{out}\;y \end{array}\right. } $$

Intuitively, when we are in the mode to execute \(\tau _2\) and it returns an output, we return the output. If it returns a question x, we change mode and stall. When we are in the mode to execute \(\tau _1\) to produce an answer for x, taking the last n given answers into account and it asks a question q, we ask the question and indicate that now one more answer needs to be taken into account. If it returns an output y, we add the pair [(xy)] to the question answer list for \(\tau _1\), change the mode back to execute \(\tau _2\), and stall.    \(\square \)

Proof

(of Lemma 9). We define a tree \(\tau \) computing the functional mapping \(R\!:\!(I \times \mathbb {N}) \rightarrow \mathbb {B}\rightarrow \mathbb {P}\) to the following relation of type \(I \rightarrow \mathbb {N}\rightarrow \mathbb {P}\): \(\lambda i n.\; R\, (i,n)\, \textsf{true}\wedge \forall m < n.\; R\, (i, m)\, \textsf{false}\).

$$\tau \,i\, as := {\left\{ \begin{array}{ll} \textsf {ret}\;(\textsf{out}\;i) &{} \text {if } as [i] = \textsf{true}\\ \textsf {ret}\;(\textsf{ask}\;(i, | as |)) &{} \text {if } \forall j.\, as [j] = \textsf{false}\end{array}\right. } $$

Note that a function \(\textsf{find}\, as \) computing the smallest i such that \( as \) at position i is \(\textsf{true}\), and else returning \(\textsf {None}\) is easy to implement.

Intuitively, we just ask all natural numbers as questions in order. On answer list l with length n, this means we have asked \([0,\dots ,n-1]\). We check whether for one of these the oracle returned \(\textsf{true}\), and else ask \(n = |l|\).    \(\square \)

C Relation to Bauer’s Turing Reducibility

We show the equivalence of the modulus continuity as defined in Lemma 1 with the order-theoretic characterisation used by Bauer [3]. The latter notion is more sensible for functionals acting on functional relations, so we fix some

$$F:(Q\,\rightsquigarrow \,A)\rightarrow (I\,\rightsquigarrow \,O)$$

where \(X\,\rightsquigarrow \,Y\) denotes the type of functional relations \(X\rightarrow Y \rightarrow \mathbb {P}\). To simplify proofs and notation, we assume extensionality in the form that we impose \(R=R'\) for all \(R,R':X\,\rightsquigarrow \,Y\) with \(Rxy\leftrightarrow R'xy\) for all x : X and y : Y.

To clarify potential confusion upfront, note that Bauer does not represent oracles on \(\mathbb {N}\) as (functional) relations but as pairs (XY) of disjoint sets with \(X,Y:\mathbb {N}\rightarrow \mathbb {P}\), so his oracle computation operate on such pairs. However, since such a pair (XY) gives rise to a functional relation \(R: \mathbb {N}\,\rightsquigarrow \,\mathbb {B}\) by setting \(R\,n\,b := (X\,n \wedge b = \textsf{true})\vee (Y\,n \wedge b = \textsf{false})\) and, conversely, \(R: \mathbb {N}\,\rightsquigarrow \,\mathbb {B}\) induces a pair (XY) via \(X\,n := R\,n\,\textsf{true}\) and \(Y\,n := R\,n\,\textsf{false}\), Bauer’s oracle functionals correspond to our specific case of functionals \((\mathbb {N}\,\rightsquigarrow \,\mathbb {B})\rightarrow (\mathbb {N}\,\rightsquigarrow \,\mathbb {B})\). He then describes the computable behaviour of an oracle functional by imposing continuity and a computational core operating on disjoint pairs (XY) of enumerable sets that the original oracle functional factors through, which in our chosen approach correspond to the existence of computation trees. So while the overall setup of our approach still fits to Bauer’s suggestion, we now show that our notion of continuity is strictly stronger than his by showing the latter equivalent to modulus continuity.

Informally, Bauer’s notion of continuity requires that F preserves suprema, which given a non-empty directed set \(:(Q\,\rightsquigarrow \,A)\rightarrow \mathbb {P}\) of functional relations requires that \(F\,(\bigcup _{R\in S} R)=\bigcup _{R\in S}\, F\,R\), i.e. that the F applied to the union of S should be the union of F applied to each R in S. Here directedness of S means that for every \(R_1,R_2\in S\) there is also \(R_3\in S\) with \(R_1,R_2\subseteq R_3\), which ensures that the functional relations included in S are compatible so that the union of S is again a functional relation.

Lemma 41 If F is modulus-continuous, then it preserves suprema.

Proof

First, we observe that F is monotone, given that from \(F\,R\,i\,o\) we obtain some modulus \(L:Q^*\) that directly induces \(F\,R'\,i\,o\) for every \(R'\) with \(R\subseteq R'\).

So now S be directed and non-empty, we show both inclusions separately. First \(\bigcup _{R\in S}\, F\,R \subseteq F\,(\bigcup _{R\in S} R)\) follows directly from monotonicity, since if \(F\,R\,i\,o\) for some \(R\in S\) we also have \(F\,(\bigcup _{R\in S} R)\,i\,o\) given \(R\subseteq \bigcup _{R\in S} R\).

Finally assuming \(F\,(\bigcup _{R\in S} R)\,i\,o\), let \(L:Q^*\) be a corresponding modulus, so in particular \(L\subseteq \textsf{dom}(\bigcup _{R\in S} R)\). Using directedness (and since S is non-empty), by induction on L we can find \(R_L\in S\) such that already \(L\subseteq \textsf{dom}(R_L)\). But then also \(F\,R_L\,i\,o\) since L is a modulus and \(R_L\) agrees with \(\bigcup _{R\in S} R)\) on L.    \(\square \)

Lemma 42 If F is preserves suprema, then it is modulous continuous.

Proof

Again, we first observe that F is monotone, given that for \(R\subseteq R'\) the (non-empty) set \(S:=\{R,R'\}\) is directed and hence if \(F\,R\,i\,o\) we obtain \(F\,R'\,i\,o\) since \(R'=\bigcup _{R\in S} R\).

Now assuming \(F\,R\,i\,o\) we want to find a corresponding modulus. Consider

$$S:=\{R_L \mid L \subseteq \textsf{dom}(R) \}$$

where \(R_L\,q\,a := q\in L \wedge R\,q\,a\), so S contains all terminating finite subrelations of R. So by construction, we have \(R=\bigcup _{R\in S} R\) and hence \(F\,(\bigcup _{R\in S} R)\,i\,o\), thus since F preserves suprema we obtain \(L \subseteq \textsf{dom}(R)\) such that already \(F\,R_L\,i\,o\). The remaining part of L being a modulus for \(F\,R\,i\,o\) follows from monotonicity.    \(\square \)

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Forster, Y., Kirst, D., Mück, N. (2023). Oracle Computability and Turing Reducibility in the Calculus of Inductive Constructions. In: Hur, CK. (eds) Programming Languages and Systems. APLAS 2023. Lecture Notes in Computer Science, vol 14405. Springer, Singapore. https://doi.org/10.1007/978-981-99-8311-7_8

Download citation

  • DOI: https://doi.org/10.1007/978-981-99-8311-7_8

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-99-8310-0

  • Online ISBN: 978-981-99-8311-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics