Patterns
1 Linear or Cauchy pattern
f *
| / \
* == f f
/ \ | | x y x y
2 Functions and differentials
\[ A \mapsto B \] \[ \delta A \overset{?}{\mapsto} \delta B \]
- When we think of maps we should also think about change.
3 Division as mapping
\[\frac{A::Miles}{B::inches}\] \[ B::inches \mapsto A::Miles \]
- One can think of division as a map. How B inches maps to A Miles.
4 Division as normalization
- Beta in finance, Variance of AAPL maps to Covariance of (AAPL,SPX)
- We can think of the denominator as a normalization variable
- Beta tells us how much AAPL is affected by the SPX. The division normalizes AKA removes the AAPL variance from the (AAPL,SPX) covariance.
5 Essence vs Is
IS is a subset relation
\[Squares \subseteq Rectangles\] \[\forall x (x \in Squares \rightarrow x \in Rectangles) \qquad x\in Square = \text{x is a square object}\]
The above says for all objects, if that object is a square then it is also a rectangle.
\[Essence(Squares) = \bigcap\limit_{i \in Squares} Properties(i)\] \[Essence(Rectangles) \subseteq Essence(Squares) \qquad x \in Essence(Squares) = \text{x is in a point in the space of squareness properties }\]
The above says the essence of a rectangle is contained in the essence of a square.
The Essence of a square is the core concept of squareness which is shared by all squares.
In programming the essence relation is how we code compositional interfaces/classes
Example 2
- The present singleton set of only me IS a subset of the set of all possible me’s of different realities
- The family intersection of the set of all possible me’s is the soul of me
- The soul that distinguishes me is contained in the present me.
Applications to Classes and Interface
- The tesla object is a subset of the Car object. (All teslas are cars)
- The properties and methods of the Car interface is a component of the properties and methods of the tesla interface.
Pattern
- Tesla is more specific than a Car. There are less Tesla objects than Car objects. Subset implies less than implies Injection.
- High Specificity Object is a type of Low Specificity Object
- Code of Low Specificity Object is a piece of the Code of the High Specificity Object
type details struct {
string
genre string
genreRating string
reviews }
type game struct {
string
name string
price
details}
- Every game Object is a detail Object
- The essence of details are always a subset of the essence of games
When designing interfaces the hardest part is knowing what is the “essence” of a interface. This requires wisdom from encountering multiple objects and finding the essence intersection of them.
- Essence that is too specific will only fit a few objects but these interfaces are powerful since they have alot of functionality.
- Essence that is too generic will fit many objects but these interfaces are too weak since they have little functionality.
This paradox of power vs contraint which is also shown in sets intersection.
6 logic and Negated quantifier
- Expanding quantifiers
- \(\forall x \in A, x \in B\)
- \(\forall x (x \in A \rightarrow x \in B)\)
- \(\forall x (x \notin A \lor x \in B)\)
- Negating quantifiers
- \(\lnot (\forall x \in A, x \in B)\)
- \(\lnot (\forall x (x \notin A \lor \in B))\)
- \(\exists x \lnot (x \notin A \lor x \in B)\)
- \(\exists x (x \in A \land x \notin B)\)
- \(\exists x \in A, x \notin B\)
6.1 Sets
- Sets to logic notation
- \(Bleh = \{ x \in U| Even(x) \land Hah(x)\}\)
- \(\forall x \in U( x \in Bleh \leftrightarrow Even(x) \land Hah(x))\)
6.2 Kinds
A set containing different humanTypes(species) are of one humanKind
\[ humanTypes: humanKind \iff humanTypes \in humanKind \]
- we literally have a physical pig for every species of pig?
- for all PigsType : PigsKind ( Exist v TypeOfPig)
- PigsKind holds the set of different PigsTypes. v is an actual pig selected from each species of Pigs aka each PigsType.
- A set of genes is sufficient for certain mechanism?
- (forall Genes : (RelevantGeneSet )( Exist v Gene)) -> Exist z Mechanism
- Exist v Gene means the “Gene is expressed”
- v is really evidence of expression. Exist v Gene, tells exist evidence of expression of Gene.
- Academic biological sufficiency really means if some Gene is in RelevantGeneSet
- Alternative formulation
- Think of each gene as a space. The intersection of multiple gene spaces is required for functionality of a mechanism.
- forall x (RelevantGeneSpace ), Exist z Mechanism
(forall bags in bagkind, there exist a ball in each bag) -> (some ball in the mechanism bag)
sufficency can have vacuous conditions.
x is sufficient for mechanism AND(x,y,z ) -> mechanism
7 Fixpoint
- \(x=2x+5\) the sol is \(x=-5\)
- Since this is equality, we should be able to replace x with itself
- \(x=2(2x+5)+5\)
- \(x=2(2(2x+5)+5)+5\)
- Surprise, the sol is \(x=-5\) for all equations.
8 Geometric series
- \(0.\overline{27} = 0.27 + 0.0027 + 0.000027 + ...\)
- \(= \frac{27}{100} + \frac{27}{100^2} + \frac{27}{100^3} + ...\)
- \(r = \frac{1}{100} \qquad a_1 = \frac{27}{100}\)
- \(Sum = \frac{a_1}{1-r}\)
9 Plots and equations
- 2x + 3 = x^2 + 4 can be reduced to f(x) = g(x) and the intersection of functions is the solution
- The diagonal y = x is the fixed point.
9.1 Axis and vectors
We are so used to having each vector represent an observation and each axis aka column represents a different property aka measurement but we should know to reverse this mindset as well
Use Axis to represent samples (clearly limited to 2 or 3 objects/observations/samples aka 2d or 3d axis)
Each vector represents a different property of a sample.
e.g
- Bob is x-axis, Alice is y-axis
- Height is vector [5, 6]
- Weight is vector [50, 70]
- Looks is vector [2, 6]
- A convex combination of vectors means we can build an overall profile based on these vectors. Of course this also means we can bias this combination towards Bob or Alice by putting a larger coefficient or weight on a certain vector.
- Alice has better looks so we can give Height 0.1 , Weight 0.1, Looks 0.8 to bias it towards Alice.
10 CS bridge math
- Quantum mechanics is functional analysis which uses infinite-dimensional linear algebra and real analysis
- Quantum circuits are described by unitary operators on a Hilbert space
- Hilbert space is vector space with an inner product which makes it metrically complete under the norm induced by that inner product.
- Hilbert spaces allow us to use linear algebra and real analysis.
- Error correcting code, coding theory uses finite linear algebra
- PageRank is fundamentally a problem of computing approximations to eigenvectors of a linear map on a vector space with a basis consisting of all the pages on the web
- computable functions between types is, if not the same, then at least extremely similar to the study of continuous maps between topological spaces
- monoids from abstract algebra is highly important to (if not just another way of looking at) the theory of formal languages. You’ve probably heard of regular expressions. Well, the languages of strings described by regular expressions are exactly those languages which are the preimage under a monoid homomorphism of a subset of a finite monoid in a free monoid. Understanding some things about monoids, through that lets us figure out things about regular languages (for one)
- Order theory is important to the theory of semantics of programming languages and recursion theory, where types of values are given definedness orderings which make them into directed-complete partial orders. (This shines through especially well in non-strict functional programming languages like Haskell, where people use the language of ‘bottom’ to refer to nonterminating computations – a completely undefined value being at the bottom of the order.)
- Generalising the theory of monoids and order theory at the same time, you have category theory,