Programs as Diagrams: From Categorical Computability to Computable Categories
Book information
Description
It is not always clear what computer programs mean in the various languages in which they can be written, yet a picture can be worth 1000 words, a diagram 1000 instructions. In this unique textbook/reference, programs are drawn as string diagrams in the language of categories, which display a universal syntax of mathematics (Computer scientists use them to analyze the program semantics; programmers to display the syntax of computations). Here, the string-diagrammatic depictions of computations are construed as programs in a single-instruction programming language. Such programs as diagrams show how functions are packed in boxes and tied by strings. Readers familiar with categories will learn about the foundations of computability; readers familiar with computability gain access to category theory. Additionally, readers familiar with both are offered many opportunities to improve the approach. While programmers program computers in a great variety of languages, mathematicians study mathematics in a great variety of completely different languages. A great variety of languages is a good thing, provided that the languages do not isolate but diversify the views of the world and that there are multi-lingual communities to connect them. Many mathematicians speak programming languages; many programmers are conversant with mathematics. The language of categories seems convenient for both, and to some extent connects the communities. In this book, we use a categorical language based on string diagrams that is so basic that it must be contained in every mathematical model of computation, and so compact that every programming language must project onto it. It evolved through many years of teaching mathematics of computation. The diversity of the mathematical and the programming languages makes such teaching and learning tasks into lengthy affairs, loaded with standard prerequisites. By peeling off what got standardized by accident and following the shortcuts that emerged, and then peeling off what became unnecessary after that, we arrived at a mathematical model of computation generated by a single diagrammatic element, which is also a single-instruction programming language. I know it sounds crazy, but read on. Topics and features: Delivers a ‘crash’ diagram-based course in theory of computation Uses single-instruction diagrammatic programming language Offers a practical introduction into categories and string diagrams as computational tools Reveals how computability is programmability, rather than an ‘ether’ permeating computers Provides a categorical model of intensional computation is unique up to isomorphism Serves as a stepping stone into research of computable categories In addition to its early chapters introducing computability for beginners, this flexible textbook/resource also contains both middle chapters that expand for suitability to a graduate course as well as final chapters opening up new research. Preface What? Contents 1 Drawing Types and Functions 1.1 Types as Strings: Data Passing Without Variables 1.1.1 Types 1.1.2 Strings Instead of Variables 1.1.3 Tupling and Switching 1.2 Data Services: Copying and Deleting, Cartesianness 1.3 Monoidal Functions as Boxes 1.3.1 Composing Functions 1.3.2 The Middle-Two-Interchange Law 1.3.3 Sliding Boxes 1.4 Cartesian Functions as Boxes with a Dot 1.5 Categories: Universes of Types and Functions 1.6 Workout 1.7 Stories 1.7.1 Prehistory of Types 1.7.2 Categories as Type Universes 1.7.3 Logics of Types 1.7.3.1 Propositions-as-Types 1.7.3.2 Cartesian-Closed Categories 1.7.4 Categorical Diagrams: Chasing Arrows and Weaving Strings 1.7.4.1 Arrow Diagrams 1.7.4.2 String Diagrams 2 Monoidal Computer: Computability as a Structure 2.1 Computer as a Universal Machine 2.2 Universality of Program Evaluation 2.2.1 Program Evaluators 2.2.1.1 Definition 2.2.1.2 What Is the Difference Between Parameters and Inputs? 2.2.1.3 Constant Programs and Slicing Two Ways 2.2.2 Partial Evaluators 2.2.3 Composing Programs 2.3 Computable Types Are Retracts of Programming Languages 2.3.1 Data Are Programs 2.3.2 Types as Idempotents 2.3.3 Pairs of Programs Are Programs 2.3.4 Idempotents Split 2.4 Logic and Equality 2.4.1 Truth Values and Branching 2.4.2 Program Equality 2.4.3 The Type of Booleans 2.4.4 Propositional Connectives 2.4.5 Predicates and Decidability 2.5 Monoidal Computer 2.5.1 Definition 2.5.2 Examples 2.5.3 Program Evaluation as a Natural Operation 2.6 Workout 2.6.1 How Many Programs? 2.6.2 Counting by Evaluating: the Church Numerals 2.6.3 Monoid Computer? 2.6.3.1 Universal Program Evaluator {to.}to.2mu-:6muplus1muPP-3mu→P 2.6.3.2 C Is the Idempotent Completion of Its Submonoid on P 2.6.3.3 Relating the Products in C and the Pairing on P 2.6.3.4 Reducing Program Evaluators {to.}to.AB to {to.}to.PP 2.7 Stories 2.7.1 Who Invented the Computer? 2.7.2 How Many Truth Values? 3 Fixpoints 3.1 Computable Functions Have Fixpoints 3.2 Divergent, Partial, Monoidal Computations 3.2.1 A Divergent Truth Value 3.2.2 Divergent Elements 3.2.3 A Divergent Program 3.2.4 Computations Are Monoidal 3.3 The Fundamental Theorem of Computation 3.3.1 Example: Polymorphic Quine 3.3.2 Example: Polymorphic Virus 3.4 -Combinators and Their Classifiers 3.4.1 -Combinator Constructions 3.4.2 -Combinator Classifiers 3.5 Software Systems as Systems of Equations 3.5.1 Smullyan Fixpoints 3.5.2 Systems of Program Equations 3.6 Workout 3.6.1 Divergence and Lazy Branching 3.6.2 Stateful Fixpoints 3.6.3 Qing, Kuine, Narcissist, Virus Generator 3.6.4 A Loopy Software System 3.7 Stories 4 What Can Be Computed 4.1 Reverse Programming 4.2 Numbers and Sequences 4.2.1 Counting Numbers 4.2.2 Numbers as Sets 4.2.3 Numbers as Programs 4.2.4 Type N as an Idempotent 4.2.5 Sequences 4.3 Counting Down: Induction and Recursion 4.3.1 Computing by Counting 4.3.2 Induction 4.3.3 Reverse Programming Induction 4.3.4 Recursion 4.3.5 Running Recursion 4.4 Counting up: Search and Loops 4.4.1 Search 4.4.2 Loops 4.5 Workout 4.5.1 Early Induction 4.5.2 Recursion Work 4.5.3 Search Work 4.6 Stories 4.6.1 Church's Reverse Programming 4.6.2 Story of Curly Brackets 4.6.3 The Church-Turing Thesis 4.6.4 Turing-Completeness 5 What Cannot Be Computed 5.1 Decidable Extensional Properties 5.2 Gödel, Tarski: Provability and Truth Are Undecidable 5.3 Turing: Halting Is Undecidable 5.4 Rice: Decidable Extensional Predicates Are Constant 5.5 Workout 5.6 Stories 5.6.1 I Cannot Decide Whether I Lie 5.6.2 The Church-Turing Antithesis 6 Computing Programs 6.1 Idea of Metaprogramming 6.2 Compilation and Supercompilation 6.2.1 Compilation 6.2.2 Supercompilation 6.3 Metaprogramming Hyperfunctions 6.3.1 Ackermann's Hyperfunction 6.3.2 Metaprogramming Parametric Iteration 6.3.3 Metaprogramming a Hyperfunction 6.4 Metaprogramming Ordinals 6.4.1 Collection as Abstraction 6.4.2 Collecting Natural Numbers: The Ordinal ωas a Program 6.4.3 Transfinite Addition 6.4.4 Transfinite Multiplication 6.4.5 Transfinite Hyperfunction 6.4.6 Background: Computable Ordinal Notations 6.5 Workout 6.5.1 Is There a Fourth Futamura Projection? 6.5.2 Is Iteration All That Hyper? 6.6 Stories 6.6.1 Programming Languages 6.6.2 Software Systems and Networks 6.6.2.1 System Programming 6.6.2.2 Portable Executables 6.6.2.3 Interpreters and Scripting 6.6.3 Software 7 Stateful Computing 7.1 From Functions to Processes 7.2 Simulations as Process Morphisms 7.3 When Is a Process Computational? 7.4 Universality of Program Execution 7.5 Imperative Programs 7.6 Workout 7.6.1 Lossless Simulations 7.6.2 Program Execution as a Polymorphic Operation 7.7 Story 8 Program-Closed Categories: Computability as a Property 8.1 Program Order 8.1.1 Well-Order 8.1.2 Consequences of Well-Order 8.1.3 What If P Is Well-Ordered? 8.2 Program-Closed Categories 8.3 Programming Languages Are Isomorphic 8.3.1 The Isomorphism Theorem 8.3.2 Simulations Between Programming Languages 8.3.3 The Isomorphism Construction 8.4 Upshot: The Closures 8.4.1 Cartesian Closure 8.4.2 Program Closure 8.5 Workout 8.5.1 Exercises 8.5.2 Application: Associative Pairing Monoid Oracle 8.6 Story 8.6.1 Prehistory of Well-Order 8.6.2 Toward Categorical Computers What?? 1 What Am I? 2 What Are We Becoming? 3 What Computes? Thanks A On Categories and Functors A.1 Categories A.2 Six Concrete Categories A.3 Functors A.4 Natural Transformations A.5 Equivalence of Categories A.6 Exercises B On Idempotents C What Numbers Are Not D Work References Index
Similar books
Programs as Diagrams: From Categorical Computability to Computable Categories (Theory and Applications of Computability)
2023 · PDF
Predicates and Fibrations
1990 · PDF
Programs as Diagrams: From Categorical Computability to Computable Categories
2023 · EPUB
Programs as Diagrams: From Categorical Computability to Computable Categories
2023 · PDF
Foundations of Security, Protocols, and Equational Reasoning: Essays Dedicated to Catherine A. Meadows
2019 · EPUB
Foundations of Security, Protocols, and Equational Reasoning: Essays Dedicated to Catherine A. Meadows
2019 · PDF
MySQL® Notes for Professionals book
2018 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF