# Name the function While we wait to start: what would be a suitable name for the function below? ```cpp template
T fn(T a, T b) { while (true) { if ( b < a ) a -= b; else if (a < b) b -= a; else return a; } } ``` --- Mircea Baja - 12 June 2020 # Irregularity in Generic Programming ## Part III: Bibliography --- class: large-points # Agenda - Brief history of mathematics - a lot of Euclid and a bit of Gödel - Stepanov's Elements of Programming - Brief history of support for concepts in C++ --- # Books
--- # Euclid's Elements
--- # Triplets
3
4
5
--- # Proof
a
b
c
b
2
a
2
c
2
--- # Infinity
1
1
sqrt(2)
---
--- class: large-points # Definitions - B.I D.1: A point is that of which there is no part. - ... - B.I D.22: And of the quadrilateral figures: a square is that which is right-angled and equilateral ... --- # Postulates
1
2
3
4
5
5p
--- # Common notions
1
a = b = c
2
a = b = c
a + b = a + b
3
a - b = a - b
4
a = a
5
--- # Book I, Proposition 47
A
B
C
D
E
F
G
H
K
L
--- class: large-points # Direct results - Euclidian geometry - geometric algebra - subtractive GCD - square root of two: infinity - infinite prime numbers - Platonic solids (4, 6, 8, 12, 20) - not all numbers are the same --- class: large-points # Scolia - the need for scolia in classic style - only prove the difficult case (e.g. B.I P.7 has additional cases that require 2nd part of B.I P.5) - systematic exploration of a problem: the converse propositions, but also more complex cases like the congruence of triangles - analysis and synthesis --- class: large-points # Logic and reasoning - the historical benefit/coin story - demonstrative proofs rather than empirical methods - axiomatic system: avoid circular reasoning - reduction to absurd - definition: what it is and that it is: B.I P.46 - definition in the negative: B.I D.1 - definition in the logical vs intuitive order - demonstration of things that cannot be done e.g. B.I P.7 - the power of reasoning: atoms - the dangers of pseudo-reasoning: life on other planets - the aesthetic choice in mathematics --- class: large-points # Various - Zeno - Diophantus - al-Khwarizmi - the Arabs --- # Hyperbolic (Poincaré disk)
5h
--- # Elliptic (Sphere geodesic lines)
5e
2
--- class: large-points # Cantor - 1, 2, 3, 4, 5, ... - 1, 4, 9, 16, 25, ... (Galileo's paradox) - 0, 1, 2, 3, 4, ... (natural numbers) - 0, -1, 1, -2, 2, ... (integers) - 1/1, 1/2, 2/1, 1/3, 2/3, 3/1, ... (rationals) - ..., sqrt(2), ... (solutions of algebraic equations) --- # Peano
--- class: large-points # -isms - Paradoxes - Logicisms - Intuitionism / constructivism - Formalism - Consistency - Wir müssen wissen – wir werden wissen --- # Gödel's Incompleteness
--- # Turing's machine
--- # Stepanov's Elements (EOP)
--- class: large-points # About EOP - Bjarne Stroustrup: "some of the most beautiful code I've ever seen" - relatively short book - in classic style - lacks scolia - the structure of STL (algorithms with some data structures) - concepts - multithemed - recurring themes: efficiency, mathematical foundation of algorithms, etc. - systematic exploration of the fundamentals of (generic) programming for a machine with a CPU and memory --- class: large-points # EOP Contents - Chapter 1 - Chapter 2 - Chapter 3 - Chapter 4 - Chapter 5 - ... - Chapter 12 - Appendix A and B --- class: large-points # EOP Concepts syntax ```cpp template
requires(Readable(I) && Iterator(I)) I find(I f, I l, const ValueType(I)& x) { // Precondition: readable_bounded_range(f, l) while (f != l && source(f) != x) f = successor(f); return f; } ``` --- class: large-points # GCD in rotate ![Image](../assets/2020-02-26-irregularity/11-rotate.png) --- class: large-points # Regularity/Irregularity - the importance of Euclid's common notions - equality and (strict total) order - the complexity of equality - stronger: identity - weaker: congruence - even weaker: same area - actually the importance of relations --- class: large-points # C++ concepts - long history - C++11 - EOP - Redesign for C++20, usage: [Good concepts](https://www.stroustrup.com/good_concepts.pdf) - Irregularity [SLE2011](http://www.stroustrup.com/sle2011-concepts.pdf) --- # Questions?