Tuesday, April 28, 2026

21st Century Mathematics: The Unfolding of the Proof of Erdös Problem 1196 by a Generative AI Model

It's April 13th 2026. Liam Price words a short, simple prompt into ChatGPT-5.4 Pro. An hour and half later the bot provides an answer: Jackpot!

For the first time one such GenAI models, in a single shot, developed a proof of a Mathematical conjecture that so far had escaped Mathematicians, and it did so using a novel approach that had been sidelined in the literature before.

The proof was then verified in Lean, a discussion unearthing insights from the AI-dumped proof followed, and a famous mathematician, Terence Tao, came up with a different, simpler proof of Erdös conjecture, all in the span of two days.

You can read how the whole story unfolded from the actual discussion the mathematicians had:

https://www.erdosproblems.com/forum/thread/1196?order=oldest

And Price did hit the jackpot: in the discussion that ensued after he announced the finding, it was suggested to "reproduce" said proof by asking the same and other chatbots for a proof. They failed to find any proof at all in 8 out of 10 trials, while the remaining proofs required several additional prompts  where mathematicians hinted the model [1].

But this event carries the signs of an historical moment. It showcased what will likely become a trait mark of tomorrow's Mathematics: 

1. Some "AI" model spits out a potential proof of a theorem. Such an event, in itself, is very close to useless for the human race, let alone the rest of Nature!

2. Humans, in the form and shape of mathematicians -for now-, verify the proof in a proof assistant, like Lean. The proof, now, acquired some tangible value.

3. At the same time, they and others try to find some insights into how the proof works, how to build an intuition around it and, the cherry on the top, eventually find a simpler, more intuitive proof. At this point, the event at step 1) gathers all the possible value it can get: it becomes yet another stepping stone upon which humans widened their knowledge.

I didn't say it first, but a recognized, worldwide authority as Tao:  https://mathstodon.xyz/@tao/116477351524980995

Welcome to the Mathematics of the 21st century!

PS: A word of caution: GenAIs are still stupid. If you throw them around without thinking, you will hurt someone the same way as you would if you blindly throw a hammer at a group of people.


[1] What counts as the first proof ever of a mathematical conjecture by an AI happened in February 2026, although it wasn't in a single shot, but required human assistance, and the method laid out by the model had close similarities to those employed in obtaining similar results in the literature. See Tao's summary  https://mathstodon.xyz/@tao/115855840223258103

Sunday, April 26, 2026

Continous Graphs

  We already established that I cannot focus my attention for too long, or maybe even long enough, on any given topic. Let me just jot down here what ideas crossed my mind in one of those insomnia trips of May 2024, almost exactly two years ago -I wish I were better at writing things down.


A favorite topic of mine is the problem of unsupervised clustering, in particular the role of symmetry groups in clustering given a weighted graph of  "affinities". 

I archived this problem long ago as I wasn't making progress, among other things because my only rudimentary knowledge of Representation Theory. I only update it when I come across an idea that I find suggestive for possibly unstucking that work.

When doing so I, and in particular for this pet problem of mine, I proceed very loosely, considering ideas whatever flimsy connection they may have. I only care that they are "suggestive". 

In this sense, I never pay much respect to the distinctions made in the literature between keywords as "classification", "clustering", "community finding", "partitioning", "grouping", etc.,  or even "tessellation", "phase separation", "fragmentation " or "pattern formation". Sure, their context and problem setting are different, but they also have a key shared pattern, namely, finding "heterogeneities" in what before was an "homogeneous" class of objects.

One such triggering idea was that classification is akin at finding (and computing!) a mapping that tells us whether two such objects satisfy the same set of properties; alternatively, the canonical mapping giving the "group" each of those objects "belong to" (see Avi Widgerson, Mathematics and Computation, 2017, page. 19).

Can we extend this to our case?  Would it be the case that:

1.- Clustering  $\iff$ a computation/program/function ?

2.- Clustering entails a model of computation?

For instance, we may consider that the partition $\bar 0$ of all _singletons_ would naturally map to the identity function. Similarly, the partition $\bar{\mathbb 1}$ would map to a constant function.

We may look at 1) from a more general point of view -something you could consider a common strategy when trying to solve a problem: a more general setting may sometimes be more amenable to analyzing and solving it. Case in point, in Mathematics and Physics, specially in the latter, very often one generalizes a discrete problem to a continuum one, e.g., translating discrete sums, $\sum_i\,f(i)$ into integrals $\int\,dx\,f(x)$.

How can we cluster a continuous set? In the discrete case we have a finite set of vertices $\mathbb V$ and a finite set of edges $E\,\subset \, \mathbb{V}\times\mathbb{V}$.

How could we define a continuous graph?

One possibility is to proceed in a similar way to the discrete case. 

Be $\mathbb V\,=\,\left[0\,1\right]$ the continuous set of vertices, and $f\,:\,\mathbb{V}\,\to\,\mathbb{I}\,\subset\,\mathbb{V}$ an injective continuous function, then we can define a continuous directed graph as $\mathbb{G}\,=\,\left(\mathbb{V}\,,\,\mathbb{E}_f\right)$, where the continuous set of edges is $\mathbb{E}_f\subset\mathbb{V}\times\mathbb{I}$.

Consider, e.g., $f(x)=(2\,x\,+\,1)/4$, the graph $\mathbb{G}$ is described by the plot of $f$, which gives us its edge-set $\mathbb{E}_f$.

For a different edge-function, $g(x)=\frac{-3}{4(2x-3)}$, we get a different continuous graph with edge-set $\mathbb{E}_g$.

Any flow on these directed graphs end on an attractor vertex given by $x^*=1/2$ and $x^*=(3-\sqrt(3))/4$, for $f$ and $g$, respectively.

These two examples are continuous graphs determined by a regular function. But we can envision other continuous graphs that can't be defined by a regular function. Some sketches will make it clearer.





In general, we will have a continuous, weighted directed graph with an edge-manifold implicitly defined by $F(x,y(x),z(x,y))=0$. Basically, extrude those plots vertically along the axis perpendicular to the screen. Projecting any point of the edge-manifold  $P(x,y,z)$ onto the plane $z=0$ determines whether two vertices $(x,y)$ are connected with an edge from $x$ to $y$. Alternatively, two vertices $x$ and $y$ are connected with an edge $(x,y)$ iff $F(x,y,z(x,y))=0$. The height above that plain determines the weight of the edge, $W(x,y)$.

These graph will contain both, continuous as well as discrete components:
$\mathbb{E}-\mbox{plot}\equiv\epsilon(x,y)=\sum_c\,W_c(x,y)\,+\,\sum_{x_0}\delta(x-x_0)\delta(y-y(x_0))$
where the first term sums over all continuous components and the second over the discrete set of edges with source $x_0$ and target $y_0\equiv y(x_0)$.

The associated adjacency graph could be defined as
$A-\mbox{plot}\equiv{\cal A}(x,y)=\sum_c\,\theta\big(\left\{W_c(x,y)\,+\,W_c(y,x)\right\}\big)$
where $\theta$ is the Heaviside step function and, for simplicity, we have ignored the discrete component and assumed all edge weights are non-negative. The absence of a weight is given by $W_c(x,y)=0$, for the lack of a better criterion.

Note: Writing these ideas down on the blog always takes more time than one expects. Unfortunately, I lost the original document where I wrote this down initially and now I have left only a pdf version. When exporting it to pdf, those first two plots fell between two pages. Thus, the black horizontal thick line.

Most likely this line of thought is a dead end. For instance, a curve $\gamma\subset f(\mathbb{V})\subset \mathbb{E}_f$ is a colection of edges that, in general, doesn't define say a flow, although in this case it does contain a flow $F\subset\gamma$.

Anyway, reconnecting with the initial idea, this lead to ask other questions that I had:
1. What does function composition tell us about clustering?
2. What does clustering tell us about function composition?
3. How can clustering define composition of functions?

EDIT: Of course, as it's usual with my insomnia triggered speculations, an idea of continuous graphs had already appeared in the literature before in the form of metric graphs, see Mugnolo's paper https://ar5iv.labs.arxiv.org/html/1912.07549 . The name continuous graph shows in a more recent paper referencing this one https://arxiv.org/html/2501.14554v1#bib.bib13 .

EDIT2 (29.04.2026): Graphons! I had totally missed this. It turns out the above continuous graphs I discuss are almost the same as the Continuous Graphs in the literature: Graphons, from "Graph"+"function". Instead of a "weight function" $W(x,y)\in\mathbb{R}$ for the edge $(x,y)$, they introduce a probabilistic description $W(U_x,U_y)\in [0,1]$ for there being an edge $(x,y)$. Here $U_{x,y}\in [0,1]$ are random latent variables associated to the source and target vertices, respectively.

Friday, October 10, 2025

On the Impact of AI/LLMs in Mathematics and the Role of Embeddings

 For a view on LLMs from the point of view of Mathematical research watch Alex Kontorovich's recent talk at Harvard CMSA, The Shape of Math to Come [2].

If you want to skip the beginning I may suggest jumping to min 33 [1]. But he does make a reference to earlier slides when describing what speedup he's looking for when it comes to using LLMs to generate new mathematical results.

Tl;dr: He envisions a future of math hinging on two components: first formalization in a language like Lean or similar (Agda, Coq,...) and second an AI component atop of the former. In this case he only has in mind a generative one, namely an LLM (compare this to Lecunn's Dino talk [3]). At min33 he starts conveying the main idea of where he wants to get: what  matters is the idea we want to express, not its formalization, except that we need a system or process ensuring the latter actually conveys the former correctly. Even if an LLM system like AlphaProof could generate new mathematical results (papers) that are 99% of the cases fully correct and true, it is not useful for advancing Mathematics because of that probabilistic nature of its correctness. But LLMs could help in the initial step of translating ideas into Lean and then finding a proof, which, by the typed nature of Lean, if it "compiles", it is correct. Therein could lie the real speed up in Mathematical research, where researches would be able to spend more time in shaping their ideas, instead of having to dedicate quite a significant effort in proofreading their own derivations.

I wonder if one could not draw a direct analogy between the role of that formalization step in Lean and the universal underlying representation, in AI parlance, embedding step. In the following text I will be using interchangeably embedding, representation, description and up to some extend formalization too.

Here, formalization is meant as a graded concept: the same math result expressed in Lean would be 100% formalized, while in Natural language in would be anywhere between 0% and say 1% -the point being it's upper bounded. 

In this sense is that I would say describing some objects as vectors using an array of integers is in itself a formalization level, at the same time as an embedding. But you could be describing your vectors in a synthetic way, as geometrical objects -the arrows. Or you might be able to dispense altogether of the idea of vectors and describe your problem in a purely diagrammatic way. Mind you, all these descriptions belong to a well formalized area of Mathematics (Linear Algebra, Synthetic Geometry or say Clifford Algebra or Geometric Algebra, and (many) diagrammatic descriptions can be put within Category Theory. 

Each description/representation of your world will have different computational advantages. Hence, using different formal math tools (say from different math fields) could make a huge improvement in the results or usefulness of any given ML/AI tool. Maybe these AI tools have each different representations (descriptions, embeddings, formalizations) where their use is optimal. 

So,  while say the area of Reinforced Learning (RL) is currently stuck, that could change if we find a better description suitable for it. The same would apply in a practical problem you may be stuck trying to use some ML/DL tool to solve it, but changing your world description may lead you efficiently to its solution. 

The latter is in fact a "universal" trick not only in Math or Physics: change the way you look at things and they could go from being a roadblock to boosting you forward.


Anyway, it's highly possible that all this is but an incoherent rambling under the influence of a little bug I'm currently evicting. 


Note: In Kontorovich video, image and sound are out of sync by far; however, sound and subtitles are in sync.

[1] min33: https://youtu.be/xIG1RI44Nog?t=2002[2] full: https://www.youtube.com/watch?v=xIG1RI44Nog

[3] Lecunn's talk on Dino3: https://www.youtube.com/watch?v=yUmDRxV0krg 


PS: Talking about different descriptions, Youtube just fed to me this other recent video on "Towards a Geometric Theory of Deap Learning" by Govind Menon. Maybe worth having a closer look another time.


PS2: The Internet gods pointed me to another video that would perfectly match as a second part of Kontorovich's one: "Where is mathematics going (September 24, 2025)" by Kevin Buzzard, sponsored by the Simons foundation.

Monday, October 6, 2025

On "The Bitter Lesson" by Richard Sutton

Just found an interview with Richard Sutton referencing his "Bitter Lesson" post from 2019. See link at the bottom.

He claims to be making two points. I think his first one is a useful view for considering what AI topic might be more fruitful in the long run. Here long run is meant as on a personal level, not on a long run of Science. Read further along.


The successful approaches would be based fundamentally only on "search" and "learning". These are what often are critized as "simple brute-force approaches". 


This approach has been the one leading to the current wide-spread adoption and surprising effectiveness of RL -exemplified by solutions like AlphaGo, AlphaZero-, DeepLearning and LLMs.


And this success should be contrasted to the comparatively failed attempts at implementing techniques bearing what our own understanding of how we solve the same tasks or how we learn is.


In summary, trying to come up with techniques based on our previous world models fared way worse than techniques based on simple, general brute-force methods.


As he mentions in that interview, these claims are meant but as a reflection of what has or not worked out in the past 70 or so years. He makes no claim this will be the case in the future.


His second claim consists of his very last paragraph. However, I'm not certain if his point here isn't just a rephrasing of the previous one. 


Neither am I convinced he is consistent: One might argue that what he thinks of "search & learning " are but idealizations, i.e., models of methods created  by our minds. In particular, I think that what he considers as "learning" is simply RL, reinforced learning. 


But this method is nothing but human knowledge that we would be putting into the AI, which is the approach he seems to be arguing against in this second point.


His only argument around this seems to be that he considers these two processes as simple enough for serving as guiding principles. They do fit with the view of his first point though.


References

* https://en.wikipedia.org/wiki/Richard_S._Sutton 

* http://www.incompleteideas.net/IncIdeas/BitterLesson.html


Tuesday, August 26, 2025

The "homotopic"/Geometric Nature of Mathematical Induction

 Mathematical Induction for the Natural Numbers ${\mathbb N}$ can be expressed as the following Inference rule within Martin-Löf's Dependent Type Theory:

$\Gamma\,,\,x:{\mathbb N}\,\vdash\,P(x)\;Type$

$\Gamma \,\vdash\,p_0\,:\,P(0_{\mathbb N})$

$\Gamma \,\vdash\,p_s\,:\,\Pi_{(n:{\mathbb N})}\,P(n)\,\to\,P(succ_{\mathbb N}(n))$

 $-----------------\;{\mathbb N} ind$ 

$\Gamma \,\vdash\, ind_{\mathbb N}(p_0\,p_s) \,:\, \Pi_{(n:{\mathbb N})}\,P(n)$

with the computation rules -where we implicitly assume the same premises:

$ind_{\mathbb N}(p_0\,,\,p_s\,,\,0_{\mathbb N})\,\doteq\,p_0\,:\,P(0_{\mathbb N})$

$ind_{\mathbb N}(p_0\,,\,p_s\,,\, succ(n) ) \,\doteq\, p_s(n\, ,\, ind_{\mathbb N}(p_0\,,\,p_s\,,\, n )) \,:\, P(succ(n))$

Together this can be expressed graphically as  


 Thus, induction provides a way to build a function for free on an Inductive Type: If we have a way to hop from one fiber to "its neighboring" fiber, then, given a point at a starting fiber, we can built a section in the total space of that Type.  

That way of "hopping" between fibers is nothing else than the inductive step! 

First analogy, a curve can be defined by a differential equation and an initial condition. This equation can be given by a vector field that expresses the tangent to the curve at each point.

Also, in Differential Geometry we have the Covariant derivative, which expresses how we can move a tensor between infinitesimally close points in order to compare it meaningfully at those two points. Imposing the "Covariant change" to be zero along a given curve gives us a particular way to move a tensor between infinitesimally close points such that it stays parallel. This is the parallel transport of a tensor.

We can do the following: parallel transport a vector field along the very same curve it defines.  This curve is nothing other than a geodesic.

I'm definitely tempted to draw here an analogy between these Differential Geometry problems and the Induction rule, I'm just not sure what the best analogy might be. As induction gives as a curve, is Induction akin to building a geodesic through a point?

More general an analogy is the relation between induction an Sheaf theory. Paraphrasing an LLM, "both guarantee existence of global objects from local rules, though the technical frameworks differ: induction is sequential and algebraic; sheaf theory is topological and categorical".

Analogies aside, Dependent Type Theory through the lens of Homotopy Type Theory is very rich in intuitive pictures. I find this super cool!

Thursday, August 21, 2025

The Curry-Howard Correspondence

 Logic, from the point of view of Dependent Type Theory (DTT), hinges on the Curry-Howard interpretation/correspondence:

Any proposition/predicate is a Dependent Type (DT)

Take the following statement about the Natural numbers $\mathbb N$: $d\,\vert\,n\;\equiv$ "d divides n"

As we know from classical Number Theory, this is equivalent to saying (classical logic) $\exists\, k\,\in\,{\mathbb N}\;\vert\quad d\cdot k\,=\,n$.

Hence, the correspondence is 

$d\, \vert\, n\quad\leftrightarrow\quad\Sigma_{(k:\mathbb N)}d\cdot k\;=\;n$

On the LHS we have classical Logic/Number Theory; on the RHS we have Dependent Type Theory. Thus, in DTT the existential quantifier gets translated into a dependent sum.


But what is that equality on the rhs? Ans.: $IdentPath_{\mathbb N}(d\cdot k\,,\,n)$, the Path type defined on the Natural numbers identifying both values.


Thus, any value $p$ of that sum type, $p\,:\,\Sigma_{k:\mathbb N}d\cdot k = n$, is a point $\left(k\, ,IdentPath_{\mathbb N}(d\cdot k\, , n)\right)$ that provides a proof of the divisibility of $n$ by $d$.

Let's see how we would prove a statement like "any natural numbers $x$ is divisible by 1". The universal quantifier from classical logic involved here gets translated into the Product type:

$\Pi_{x:\mathbb N }\,1\vert x\quad\equiv\quad\Pi_{x:\mathbb N}\Sigma_{k:\mathbb N}\,1\cdot k = x$

In oder to prove this we need to find/construct a "witness" or element $p\,:\,\Pi_{x:\mathbb N}1\vert x$. Incidentally, this is called a section on the space $\Sigma_{x:\mathbb N}1\vert x$.

Decomposing $p$ by applying it to a number $x$ we see that it must be $p(x):\Sigma_{k:\mathbb N}1\cdot k = x$. Again, this is of the form $(k, q(x))$, where $q(x):\,1\cdot k\,=\,x$.

Here comes where would use the fact that in a DTT formulation of the Natural Numbers we would previously have constructed a path like $r(x)\,:\,1\cdot x\,=\,x$, which corresponds to the rule of left multiplication by the neutral element of the product in the Natural numbers. 

Hence, we have the element $p(x) = \left(x\, ,r(x)\right)$ which is of the desired type $\Sigma_{k:\mathbb N}1\cdot k\,=\,x$. As $x$ is an arbitrary number,  $p$ is the sought for function $p\,:\,\Pi_{x:\mathbb N}\,1\vert x$.  

We have thus proved in Dependent Type Theory that 1 divides any natural number.


I thought these two examples could show the gist of how to think in Dependent Type Theory about logical problems and proofs. 


Andrej Bauer's online course slides are great, but one of the books he recommends for further reading I'm starting to like quite a lot:   "Introduction to Homotopy Type Theory" by Egbert Rijke, which is available for free at https://arxiv.org/pdf/2212.11082. These examples are from there.


Sunday, July 27, 2025

"Holography" in Euclidean Geometry

Let's make one last summary of all below.

Since I learned on my own to address problems in Euclidean geometry from a purely synthetic approach, I've been fascinated by it. If only I had learned this on my teenage years...

Yet this time the passion for a visual approach seems to have mislead me down a windy rabbit hole just come out at what seems trivial had I chosen a more analytical approach of counting degrees of freedom.

We need 6 numbers to specify the coordinates of three points in the plane. If it's a right triangle, only five coordinates are independent. 

But we don't have to stick to cartesian coordinates. 

If we fix one point on the origin, we need four number for the two remaining points plus two more for defining the translation that sat this triangle on the origin.

We can repeat that thought process and further constrain a second point to be on the vertical axis. We can bring it there by a rotation, after using a translation to fix the first point. This leaves then three coordinates for one point "and a half", plus a number for specifying the rotation we had to apply, and two more numbers for the translation. For a right triangle, the third point is constrained as well, in this case, to be on the horizontal axis. Again it amounts to 6 and 5 dof, respectively.

If we fix the length of the "vertical" side to 1, we reduce the previous count of coordinates by one, which we use to specify a dilation. Fir right triangles then we have one horizontal coordinate, one scaling factor, one rotation, and the two numbers for a translation.

And this is nothing more what all the rambling below amounts to.

So, yeah, we have reduced a right triangle to a single point on a line; the whole 2d figure "emerges" from that single point. But the number of degrees of freedom have not changed, we simply hid them in the form of transformations.

I think one take home lesson is to always explore a problem from multiple perspectives, e.g, synthetic & analytic , very soon at the start. Some paths offer much less resistance for making solid steps forward.

--

Saturday, April 19, 2025

On the foolishness of NL programming

 The title of this post is but that of an article by the late E.W. Dijkstra that is still fully valid in these days of frantic work on LLMs:

The virtue of formal texts is that their manipulations, in order to be legitimate, need to satisfy only a few simple rules; they are, when you come to think of it, an amazingly effective tool for ruling out all sorts of nonsense that, when we use our native tongues, are almost impossible to avoid.

Instead of regarding the obligation to use formal symbols as a burden, we should regard the convenience of using them as a privilege: thanks to them, school children can learn to do what in earlier days only genius could achieve. When all is said and told, the "naturalness" with which we use our native tongues boils down to the ease with which we can use them for making statements the nonsense of which is not obvious.

You can access it here.


Sunday, April 6, 2025

A Scoop On The Current Research Frontiers

 BREAKTHROUGH PRICES 2025

GLP-1 Diabetes and Obesity Discovery | Multiple Sclerosis Causes and Treatments | DNA Editing

Exploration of Nature at Shortest Distances

Proof of Geometric Langlands Conjecture

Special Prize Awarded to Giant of Theoretical Physics

Breakthrough Prize in Life Sciences Awarded to Daniel J. Drucker, Joel Habener, Jens Juul Holst, Lotte Bjerre Knudsen and Svetlana Mojsov; Alberto Ascherio and Stephen L. Hauser; and David R. Liu

Breakthrough Prize in Fundamental Physics Awarded to More than 13,000 Researchers from ATLAS, CMS, ALICE and LHCb Experiments at CERN

Breakthrough Prize in Mathematics Awarded to Dennis Gaitsgory

Special Breakthrough Prize in Fundamental Physics Awarded to Gerardus 't Hooft

Six New Horizons Prizes Awarded for Early-Career Achievements in Physics and Mathematics

Three Maryam Mirzakhani New Frontiers Prizes Awarded to Women Mathematicians for Early-Career Work


Te official announcement has descriptions of each contribution: https://breakthroughprize.org/News/91 

Wednesday, February 5, 2025

DevOps Basics I: The Structure of your Scripts v0

I have many things I'd like to/should  write about but this shit blogger is a huge deterrent. I haven't found yet a (1) nice markdown-based framework that would allow for automated indexing of posts and (2) that would allow for a smooth way to move the things I already have here...

So today I will "just" (still painful formatting work to do) post a document I wrote some four years ago when working at IMS.

I see the following guidelines applying almost always when *automating* a task. They aim at perfecting the accountability of the actions taken when running the script. You log actions for a postmortem analysis; nobody gives a shit when things do go as expected!

Notice I said automating *a task*. This includes thus any program, irrespectively of the language! However, I will focus here on the context of a DevOps work to help motivate my points.

I distilled them from experience and you may say they are tuned to compensate my own ADHD: The ultimate goal is to understand everything the script did when looking at the log it writes. 

And by everything I really mean everything: starting with who ran it, which script file did they call, in which location was the file, how exactly did they call it (all arguments supplied in the command line), to timestamps of every action the script is performing, which part of the script is logging that action (name of module+function+line number), all that as well in cases when the script ends in failure, etc. A screenshot of the output should be telling us everything!

Bash scripting guidelines

This tutorial is intended as a crash course to help fixing the minimal set of  ideas to allow one modify the scripts built in house. In particular we will focus on understanding the automated-upgrade.sh DS5 upgrade script.

Generality or precision have consequently been sacrificed in order to keep this tutorial concise and practical.

(Still a work in progress)

Concepts to brush up for this tutorial


1. Key "actions" we do in any program


Print out some "stuff"

Read in some "stuff"

Store in memory some "stuff"

Make a choice

Repeat some statements in an automated way (so called "loops")


That's all what any program, in any language does.


The first two are part of what's called I/O (input/output) procedures.


2. Variable assignment

This is how we store things in memory



x=43

yz="Hello World"

b=true

Remark


A statement like x=43 means the following:


The computer reads the equal sign and then knows that


43 is a value (see section on Types below) that the computer stores in memory.


x is a label (string) that the computer the computer uses to point to the memory location where the previous value was stored.


After a variable assignment, whenever we use x the computer looks up the memory location pointed to by x and uses the value stored there, i.e., 43


These facts are summarized by saying that the variable x is a reference for the value 43.


2.1 Accessing the value referred to by a variable


In bash we do this similarly to what's called dereferencing, i.e., accessing the value from the memory location that a variable label is pointing to.


In bash we do this by writing a dollar sign in front of the variable name.

Example:


echo $x    # 43


In some cases, you may have to wrap the variable label within braces

Example


echo ${x}  # 43


3. Bash Types


There are NO Types when it comes to variables' values.


Other languages make distinctions like 'x is a number' and 'yz is a string'.


In bash, basically everything is a string.

The above statements mean that even variable x has a value that is a string, despite its looks.


The only 2 exceptions that we will encounter are that of a


Boolean Type. Case in point, the above variable b has been assigned a Boolean value.


Array/List


4. Conditionals


These are the if-then-else type of statements.


We have the computer crunch different group of statements depending on some conditions being true or false.


This is how we make choices in a programming language.


5. Loops


We have a list of 1000 files and we want to change their names and add the suffix -test.


How can we do that in the most efficient -i.e., fastest- way?


For each file we have to do issue the same command, namely a mv: mv oldname oldname-test.

This means that the action we need to perform has a well defined pattern that is the same for all files.

This is precisely the scenario where we should use a loop.


Loops come in different "forms":


while loop


for loop


until loop (we won't discuss this)


Example of loop in plain English


let x be 3

while x is greater than 0 ; do the following

 print the value of x

 decrease x by 1

done


In bash we can do it the following way


x=3

while [ $x -gt 0 ] ; do

    echo $x

    x=$(( x-1 ))

done


6. I/O


6.1 Printing


It's enough to use the command echo. It's not the only one: there is also the printf,

but we won't comment this but on passing.


6.2 Reading in "stuff"


We will be using 5 different ways:


Prompting (interactively) the user


Command line parameters


Redirection


Pipes


Sourcing


We will discuss all this cases in the tutorial though.


7. Functions


A function is a "machine" that, as all machines, takes in some input, and spits out some output, whatever those may be.


In that sense, any Linux command is a function. All take in some input (this could be either provided by the user or read directly from the OS environment) and do something. The latter can be just printing things out on the screen or changing something at the OS or filesystem level or all of the above.


You have seen function in high school: f(x) = 2x. This  is a function that doubles any number that we feed to it.


It is vital to make a linguistic distinction:


The name of the function is f


In that example above, x is called the argument of f. Here, we may also call it the parameter of f.


The expression above f(x) is called a function call


Many programming languages use the same syntax. Alas, Bash does not quite do so.


Still, every time we see a label followed by ( we know that the label refers to a function.


In bash, a function call is done as f x.


Yet, when defining a function we must write


f(){

 ...statements that ...

 ...the function will do...

}


That is, the label f followed by () will tell the computer that f is a function!


Remark


Any script is for all purposes the same as a function


Any script can itself define new functions and those can be called inside that script


Hence, the same way we read the command-line parameters that we provide to a script is the way

we may grab the arguments we pass to a function when defining that function.


Example


f(){

 x=$1

 echo $((2*x))

}


# Now let's call function f with argument 3

f 3 # This will print 6 on screen


Design Patterns we follow


The first key idea to keep always in mind is modularity.


We want our code to be split into different chunks. Each chunk should be as independent as possible from any other chunk.


In Bash we have two ways to achieve this modularity:


Split your code into functions all defined in a single file.


Split your code into functions each defined in a separate file.


In both cases there will be one of those functions that triggers the execution of all the others we may need to run.

For such a reason we may call such function the "main" function.


Opposite to such a modular design is that of a monolithic, sequential and imperative code as the one we started with at the beginning of our project. Such a code is always more complicated to maintain and will never scale well: The more features one adds to it the more complex it becomes adding them. It leads systematically to a code that violates both the DRY and KISS rules.


Basic structure of our code


Minimal design pattern


All scripts should follow the following MINIMAL skeleton:


#!/bin/bash

trap trapFailurerMsgLogFile ERR

set -Eeuo pipefail

usage(){

}


main(){

}


#### HELPER FUNCTIONS

printInfo(){

}


trapFailurerMsgLogFile(){

}


errorExit(){

}


main "$@"


The order of those statements is an essential part of the design of our code. Below we will see why.


Explanation


Line by line:


1 ) Needed in order to be able to execute the file from the command line by directly calling its name. 

. <file>.sh or if made executable (chmod -x <file>.sh) call it with ./<file>.sh.


2 ) Defines a trapping mechanism for the signal ERR. This signal is triggered at runtime whenever a command returns a values greater than 0. This line then says that in such a case the function trapFailurerMsgLogFile() should be called. This is where you can make the script bail out in a nice and controlled way. See below.


3 ) Enables the raising errors even within pipes


4-5 ) Defines the function usage(). This function has only one job: to print out the instructions on how to use the present script.


7-8 ) Defines the function main() which will play the role of our main function, that is, the one that will trigger the execution of all the other functions.


10 ) A comment line identifying that the rest of the script contains helper functions. These are functions that aren't key for the task at hand, but just come handy as they capture what are some recurrent design patterns.


11-12 ) Defines a function whose only task will be to print out logging information in a well-defined format.


14-15 ) Defines the function that the bash trapping mechanism will call whenever a command returns an error status value, that is, roughly, whenever a statement ends in an error.


17-18 ) Defines the function that exits the script in a well-controlled way whenever there is an error. A call to this function may well be the last statement of function trapFailurerMsgLogFile()


20 ) This constitutes the call to function main() which triggers the execution of the whole script. We are passing to this function the argument $@. Even though it looks like one single argument, the shell unfolds it into all arguments we passed to the script when we called it from the command line.


Why such order


Setting up the trapping mechanism must be done as soon as possible, lest we miss to react on some errors.


The very first two functions shall be the usage() and the main function. The reason is simple: we write code not for the computer, but for others to read it and understand as quickly and easily as possible what our code does.


By writing the usage first, even other developers can quickly get an idea of how this program is expected to work. If they are experienced enough, it may even give them a hint on how it is designed and the underlying logic.


By writing the main() function next, we offer a chance to the interested reader to quickly get a grasp of the logic of the program.


Furthermore, we will see that often we will havemain() handle the command line arguments. If so, we will deal with them almost at the very top of the function main()'s body. Thus, by being the second function of the script, the interested developer will quickly and easily have access to the command line behavior of the script. This facilitates modifying such behavior; and, when doing so, modifying as well the usage help accordingly, as it right there above the arguments handling code.


The only exception to main() being the second function is if we define an extra function getArguments whose task would be precisely to deal with the command line arguments.


In such a case, getArguments shall come as the second function of the script, immediately followed by main().


To summarize our leading idea on the order of things: First, instructions and goal of the script, then logic, and finally the details.


Stack Tracing your Bash scripts


To get a meaningful information when an error is caught we need to add information on the stack of relevant callers at the time the exception was thrown.


Let's modify the minimal script to see how to include that.


We will achieve this by using two built-in Bash features: the (script's ENV) array FUNCNAME and the function caller.


#!/bin/bash

trap trapFailurerMsgLogFile ERR

set -Eeuo pipefail


## BASIC GLOBAL VARS

# This script full path name, no matter how we call it.

THISEXE="$(if [ "$(dirname $0)" == "." ]; then echo $(pwd)/${0##*/}; else echo $0; fi)"

# This script basename. Used only once at the start for cleaning up of working directory

THISEXEBASENAME=$(basename $0)


# Keep working directoy tidy: Use date/time stamp and each upgrade within own folder

RUN_DATE="$(date "+%Y%m%d-%H%M")"

# Define the working directory. Currently (Oct 15th 2021) it's where the config.dat is expected and the log file is being written.

WORKING_DIRECTORY_BASENAME="/usr/local/upgrade"

WORKING_DIRECTORY=$WORKING_DIRECTORY_BASENAME/Drivesync5_upgrade-$RUN_DATE


# LOGFILE

LOGFILE="$WORKING_DIRECTORY_BASENAME/Drivesync5_upgrade-$RUN_DATE.log"

## END BASIC GLOBAL VARS


usage() {

    cat <<EOU

Usage: $THISEXEBASENAME [OPTIONS]


This script does ...bla bla bla ...


OPTIONS:

-h, --help      Print this help.


EOU

}


main() {

    if [ $# -lt 1 ]; then

        printInfo "Use option -h for help"

        exit

    fi


    while [ $# -gt 0 ]; do

        case $1 in

        -h | -help | --help)

            shift

            usage

            exit

            ;;

        *)

            errorExit "Unknown option $1"

            ;;

        esac

    done


}


#### HELPER FUNCTIONS

printInfo() {

    local caller=${FUNCNAME[1]}

    [ $# -ge 1 ] || errorExit "Caller: $caller ($(caller)) : Missing log message. Exiting."

    logThisMessage INFO $caller "$@"

}


# logThisMessage signature: msgType MessgeLoggingFunction ActualMessageString(s)

logThisMessage() {

    local caller=${FUNCNAME[1]}

    [ $# -ge 3 ] || errorExit "Caller: $caller ($(caller)) : Missing $((3 - $#)) logging arguments out of type/caller/message. Exiting."

    local msgType=$1 ; shift

    local logger=$1 ; shift

    echo -e "[$(date)] $THISEXEBASENAME :: $msgType : $logger : $@"

}


printError() {

    local caller=${FUNCNAME[1]}

    [ $# -ge 1 ] || errorExit "Caller: $caller ($(caller)) : Missing log message. Exiting."

    logThisMessage ERROR $caller "$@"

}


trapFailurerMsgLogFile() {

    printError "${FUNCNAME[1]} ($(caller))" "See log file under $LOGFILE"

}


errorExit() {

    local caller=${FUNCNAME[1]}

    echo -e "[$(date)] $THISEXEBASENAME :: ERROR: $caller ($(caller)): $@"

    exit 1

}


main "$@" 2>&1 | tee $LOGFILE


What does this achieve:


The script clones its output to both the standard output (screen) and a logfile define on line 18


All the output has a well-defined structure that makes it easier to parse by other automated tools


Helper functions include a "contract": This is similar to what an assert in some programming languages does, namely enforcing some constraints. In this case, we are making sure at runtime that those helper functions are being called with the expected amount of arguments. This is the best we can do to detect programming errors as Bash, being an interpret language, lacks the equivalent of a compile-time code check.


All helper functions record the caller function in a local variable called caller. This is the function that called the present helper function


In addition, all helper functions call the Bash, built-in function caller. Its output is collected as a string on-the-fly by using the back-tilde notation caller. Another equivalent form to do the same would be writing $(caller) instead. In any case, this call to function caller returns the name of the script and the line number in the code where it was called from. This feature allows us to mimic the stack tracing of our Bash script in a similar, but more limited, way to the stack tracing available in richer programming languages, e.g., Python.


We could simplify the code by removing the local variables. However, using them makes the code more readable -given we name those variables smartly enough. There is always a trade-off like this when programming, between shortness/simplicity and readability.


In addition this code shows how to use


a conditional if-then,


a while-loop,


querying the number of arguments passed to a function $#,


a multiway branch statement case ... esac. In other languages this is available as a switch statement, e.g., in C++. In Bash, each case we want to catch starts with one or more guards, e.g. -h|-help|--help). These specify the string patterns that trigger each case. Also, each case must end with double semi-colon ;;. We could as well have used a regex for it, namely, -h*|--h*). The pattern defined by the asterisk * means any string, hence, it's the way we define the default behavior.


Once we enable the trapping mechanism for regular error return values (“trap errfunc ERR” as in line 2 above), we **must write all in-line conditionals in normal disjunctive form**, in case we intent to come up gracefully from an error.


Example:


With trapping enabled the following line 2 will never be executed if line 1 ends in error. 


The correct way is show in the second code box.


systemctl start jboss

[ $? -gt 0 ] && errorExit "There was an error when starting JBOSS"   #NEVER EXECUTED




systemctl start jboss || errorExit "There was an error when starting JBOSS"  # OK


Arrays


The following example shows how to define, use, and loop through the elements of an array.


$ myarr=( a1 a2 a3 )

$ echo "$myarr - ${myarr[0]} - ${myarr[1]} - ${myarr[2]} -${myarr[3]}"

a1 - a1 - a2 - a3 -

$ echo ">>$myarr - ${myarr[0]} - ${myarr[1]} - ${myarr[2]} -${myarr[3]}<<"

>>a1 - a1 - a2 - a3 -<<

$ echo "${myarr[@]}"

a1 a2 a3

$ for arrelem in ${myarr[@]} ; do echo $arrelem ; done

a1

a2

a3

$ for arrelem in ${myarr[*]} ; do echo $arrelem ; done

a1

a2

a3

$ for arrelem in "${myarr[@]}" ; do echo $arrelem ; done

a1

a2

a3

$ for arrelem in "${myarr[*]}" ; do echo $arrelem ; done

a1 a2 a3


Remarks:


When referencing beyond the last element of an array, like in ${myarr[3]}, Bash simply prints the empty string, but does't throw an error.


Indexes of array elements start by 0


Referencing $myarr is equivalent to referencing the first element of the array, i.e., ${myarr[0]}.


There is an important, but very subtle difference when referencing ALL the contents of an array at once using the at index @ or the asterisk index *. This difference is only noticeable when we quote such reference: The former still shows up as individual array entries, while the second shows up as one single string!


The structure of the for loop is for [variable-label] in [list-of-items-to-loop-through] ; do [code-to-execute-for-each-item] ; done


Use of Bash built-in FUNCNAME array and caller function


See the following example:


$ foo(){ echo "${FUNCNAME[0]} - ${FUNCNAME[1]} - `caller`" ;}

$ goo(){ foo ;}

$ goo

foo - goo - 1 main


First we define two functions foo and goo. The latter just calls the fist.


When we execute goo, it calls foo, which in turn prints out the first 2 elements of the array FUNCNAME as well as the output of the Bash built-in function caller.


As this example is run directly on the command-line, there is no script name, and also the execution entails only one line, namely the one where we call function goo. Hence, the function caller returns line number 1 and as "script-name", the string "main". If we would run these three line from inside a script the name printed out would be that of the script.


Tuesday, January 7, 2025

RTB aka Mass Surveillance on the loose

Real-Time Bidding (RTB)

In our society, nowadays, it would really be challenging to live without our smartphones, tablets or computers. If you are curious about privacy issues  or how your personal information may be handled when using those devices, you may want to read this article from the Electronic Frontier Foundation.

My iPad Safari is giving me this summary: 

"RTB is a process used to select targeted online ads, exposes personal information to thousands of companies daily. This data, called 'bidstream data', is easily linked to real people and can be exploited by data brokers for invasive purposes like tracking union organizers and compiling sensitive demographic information. To protect yourself, disable your mobile advertising ID, audit app permissions, and install Privacy Badger, a browser extension that blocks online trackers".

And if that read left you really concerned, you might be interested in what Janet Vertesi does to keep all that privacy-siphoning at bay. She offers suggestions galore for tightening your privacy when online and using your phone or even when shopping.  

Wednesday, October 9, 2024

Nobel Prize in Physics & Chemistry 2024 (Part I)

I will elaborate my thoughts in a later post. For now, this is meant as a stub addressing some misunderstanding of the relevance, or lack of, of "AI" (but not LLMs!) in these respective fields.

Let's start with the Nobel award for chemistry.

AlphaFold won the CASP competition in 2018 & 2020. The thing is that's a recurrent competition in Computational Biology seeking new methods/models for determining protein structure. These may have multiple applications, e.g, in protein design, where you want to optimize an amino acid sequence starting with a given structure. If I remember correctly, David Baker was the first in coming up with a new design and successfully synthesizing it -can't find the reference right now.

Biology not having a Nobel prize on its own makes it a candidate for either the Chemistry or Medicine categories. As I'm sure you know, Structural biology, as a part of biochemistry, is like "usual" chemistry but on steroids.

All this makes the award in chemistry meaningful to me: They all made important contributions to the field of Structural Biology.

It's hard to say the same of any impact of Hopfield, or even less Hinton, on Physics though. It's specially insidious in the case of the latter.

Let's now switch to the Nobel award for Physics that went to Hopfield and Hinton.

Hopfield, with his Associative Memory model, and McCulloc & Pitts, with their perceptron model, can be consider among the forefathers of Neural Networks (NN), in the shadow of Martin Minsky; Hinton made those NN "deep", and in doing so he ignited the "AI" fever of nowadays.

Hinton played first with a model similar to that of Hopfield, both of these based on what's called the Ising model in Physics. This was initially invented as a simple model of a ferromagnet. Let's see what how it works.

A ferromagnet is a material that behaves as a magnet on its own, after having it exposed to an external magnetic field. Kind of, "you charge it" and it becomes a magnet. It can "discharge" as well, again in the presence of an external magnetic field. Remember, the earth is a magnet, so expect some progressive discharge with time.

The transition from "normal" (non-magnetic) to magnetic state, or vice-versa, is the prototypical example of what in physics is called a second-order phase transition (PT). These are a special case of very "smooth" (in a precise mathematical sense) transitions. Many materials and systems, having nothing to do with magnetism, may exhibit such a PT. So the magnetism of the Ising model is, in principle, just a distracting, anecdotical feature. The ice-liquid transition of water is NOT an example of 2nd order phase transition, but a "less smooth" one, boringly called 1st order PT.

It turns out that in these 2nd-order phase transitions all the microscopic details of the different materials and systems become completely irrelevant for describing the overall features of the transition. There are differences on the exact value of when the PT happens, or how effectively it extends over the whole sample, etc. But, you can say that they all behave the same way if you "shift the graphs results" compensating for those numerical differences. To put an analogy, both alcohol and water evaporate at different temperatures, but both two transitions are first-order PT. You can perfectly overlap their graph results if you rescale them appropriately based on those numerical differences. Think of all instances of the character "s" in the previous sentence. They all are located at different positions along the sentence. However, you'd say "it's the same "s"' because you can "rescale" (translate) their position so as to overlap them perfectly. The rescaling you may do for second-order PT is different than that for first-order PT. This is a type of symmetry difference that puts those two types of transitions apart.

OK, so we have a ferromagnet that gets (de)magnetized in the presence of a magnetic field. Can we model this transition so as to convey those "universal features" of it? The Ising model is the first and simplest of models doing just that. This models the ferromagnet as a collection of "spins" that can be in only two positions, up or dow. Think of them as microscopic magnets having their "north" either up or down. When all spins are randomly up and down, the material shows no magnetization. But if all were pointing in the same direction, the piece of macroscopic sample you are holding in your hands would behave as a magnet.

Incidentally, Physics has a systematic procedure for removing all microscopic details of a fine-grained model. In doing so we obtain what's called an effective Hamiltonian (aka, model), e.g., capturing only some basic, coarse-grained features of the system. Clearly, any such model, by its simpler nature, may describe other systems of a completely different nature say like a physical system, a geometric problem or a combinatorial one. The Ising model can be described as such an effective "model".

As we often do in Physics, we describe the state of a system as that of minimum energy. That is, finding the properties of the system entails solving an optimization problem using a given model. For high temperatures all spins point randomly and the minimum energy of the Isign model gives exactly that, i.e., no magnetization. But fir low enough temperatures the minimum-energy solution of the Ising model shows practically all spins pointing along the same direction, i.e., spontaneous magnetization.

There you go, we used an optimization technique (mathematics) on a model (mathematics too, but with inspiration in Physics) with the goal of describing a phase transition (physical phenomenon).

Say you improve the optimization technique, f.i. by making it 10x faster, or tweak the model so as to describe a different material, but keep the goal of describing the PT. Clearly, you would still be making a contribution to physics.

Use the same technique and model but aim at storing and retrieving an image...and you are NOT making a direct contribution to the understanding of physical phenomena. You would be contributing to... you guessed it, Machine Learnig.

Emphasis in "direct" in that last paragraph. If you want to argue that all our knoledge is connected or that our reality might be digital, that's a whole different discussion that you are a free to pursue.

Let's recapitulate. The fact that you can use methods and models initially developed for Physics to study problems in domains far away from it may be surprising and lead you to think there is some substance to the award. But, as you can infer now from the previous discussion on the Ising model, on one hand, that's a feature of Physics and its language, Mathematics. On the other hand, that fact leads to a, currently still a philosophical, question of what is the ultimate object of study of Physics.  Landauer's principle directly connecting Physics and information (erasure) opens the door to interesting speculations, as it makes information a "traditional" physical observable that can be measured in principle.

So, no, I don't think Hopfield, and specially not Hinton, deserve the Nobel prize in Physics.

Note added in proof: If the Nobel committee just wanted to "sell" us something I can understand. That's what I did in assigning labels to this post.

https://www.nobelprize.org/prizes/physics/2024/advanced-information/

Monday, September 16, 2024

Insomnia: van Aubel's Theorem

I woke up in the middle of the night and stumbled upon this post in mathstodon about a simple theorem in Euclidean geometry. So I thought it was a good time to dust off my Geogebra app.

Van Aubel's theorem states that if you start with a convex quadrilateral and construct a square on each side, externally to the quadrilateral, then the line segments connecting the centers of opposite squares will be equal in length and perpendicular to each other.

The following images provide a synthetic proof of this theorem. The line segments mentioned are colored in green and red.

The green and red circumference cross on point $O_1$, which is the center of the blue circumference. By construction, the blue circumference contains points $M_1$ and $K_1$. Hence the red and green segments are of equal length.

The purple line is the perpendiculat to the green line that passes through $P_1$. As can be seen, the purple line contains the red segment. Hence the green and red segments are perpendicular.

This concludes the proof of this theorem.

I much clearer proof is following diagram.The red circle around $M$ contains the centers $I$ and $K$ on its diameter as well as point $N$, where both (green) segments joining opposite centers cross, thus forming an inscribed triangle, which proves the segments being perpendicular. 

Finally, each segment can pivot around $I$ and $K$, respectively, meeting at a common point $O$, around which they can pivot again drawing the large red circle that contains $I$ and $K$. This proves both segments are the same length.

The last diagram shows that, in essence, Aubel's theorem hinges on a similar property for triangles. Here $H$ is the midpoint of a side. The yellow circle, centered on the midpoint between $F$ and $G$, shows that the two green segments are perpendicular, while the purple circle, centered on $M$,  proves they are the same length.




Thursday, August 10, 2023

Concurrent Programming: Linux Memory

While I finish the blogger version, you can have a look at the original entry in my GitHub account.

TL;DR:

One practical take home message is this:
When using top in Linux, it's not meaningfull to add the RES value of different processes as that does not amount to the actual, combined physical memory used by all of them. It's also not meaningful to add the values of USED for different processes; neither is it to add the values of RSsh: They do not account for independent chunks of physical memory; we are overcounting in general!
See the examples in that post.

Tuesday, March 14, 2023

What Is Science?


 We all "know" what Science is...at least at we have a pedestrian working definition of sorts: based on experimentation, models and theories need to explain known facts but also predict new ones that then must be confirmed...by experiments. Some say this as they must be refutable -as in the opposite of not even wrong.

Here I want to suggest another, hopefully equivalent, idea. Something that has bothered me for some time now is that naive realism that I feel lurks under expressions like the following attributed to Max Planck

An experiment is a question which science poses to Nature and a  measurement is the recording of Nature's answer.

The following ideas are closer to a different quote attributed to Carl Sagan

Science is a way of thinking much more than a body of knowledge


So, What is Science then?

Looking through the window you might say "the trees are tall, the grass is green, the hill is smooth, the dairies are white and yellow,...".

That is poetry, literature. It's another approach to reality, to learn about ourselves in relation to others and to Nature. And it is a necessary one.

But it is not Science. Nor those are the only type of sentences we can come up with.

Here some different statements: 

  • "When the sun shines flowers bloom, grass grows and becomes greener, trees get more & greener leaves,..."
  • "When humans constantly tread on the grass, the grass dies and the area becomes sandy & arid"
Wait, "dies"?? What's that? What is death? A possible answer would convey the following idea:
  • "When we provide food to a living being it grows and multiplies. Eventually it stops doing this and we say then that it died."
All of Science is in essence a collection of sentences of the type
When we do/it does this, it happens that
In order to understand the it, we (let) apply "transformations" on it -the object of the transformation-, and "collect" the output -which itself is an it! 

I saw a parallel with Category Theory: Objects are secondary; what matters are the morphisms. These tell us everything about the objects.

In Science, experiments are but transformations.

Stated like that, it reminds me of the warning of Carnap about Science: it's a combination of experiment plus theory. Theory as a mental construct/model.

Q1: What is theory in our view?
Ans: Our view doesn't change this, but it may give it a spin. Theory & models are but a mathematical guide for us to do
  • Actual experiments
  • Gedanken experiments
And thus anticipate the outcome (or rather, how the outcome behaves). 

As these mathematical constructs can themselves eventually be expressed within CT, we could justify the claim 

Science is about applying & combining transformations

The inputs & outputs are themselves understood as transformations, thus it seems redundant to include them in the above claim.

Q2: This still seems to miss Carnap's observation that Science is not a collection of facts. A better formulation?
Ans: Science is about applying & combining transformations...and the talk about it.

We mentioned transformations as synonyms for actual experiments.

The talk about it is our on-paper, mathematical experimenting plus the verbal talk and descriptions. The verbal talk can eventually be fitted within CT.

Q3: Usually one stresses the fact that scientific method must be 1) predictive and 2) refutable. Are we missing this?

Maybe we can introduce a "why":

We experiment and talk about it in order to be able to anticipate (predict).


Consider the following:
"If you drink this potion and repeat 10 times these words, the gods will vest you with the power of invulnerability against bullets"

It talks about transformations (drink potion, utter words), has a prediction (invulnerability against bullets) and is refutable.

Our goal to anticipate makes us try ti make sure it works -instead of just take for granted-, and thuscto refute it. And it turns out to be false.

Maybe then the "why" and its answer "to anticipate" comprise those common two traits.

We come then to the following statement:

Science is about applying & combining transformations and our talk about it in order for us to anticipate (the outcome)

What I find so much appealing about Category Theory is that it applies the same approach to study mathematics itself. Instead of mathematical object&structures it shifts the focus to the morphisms (transformations) on & between them plus the properties of combinations between those morphisms.

For example, and this is a general modus operandi, not something CT, if we want to understand different types of graphs we could run a set of stochastic processes on them. One same stochastic process may proceed differently on different graphs. Ultimately this allows us to distinguish and classify those graphs.

That "talk about it" is thus a talk  in terms of applying and combining mathematical transformations. 

Tuesday, September 20, 2022

Ingredients for a Successful DevOps Practice

...At least three basic ingredients.

If I would have to pick what I think could be three basic ingredients for becoming a successful and valued DevOps, it would be the following.


First and foremost one has to have a passion for automating things. It's the "hate to do things twice" attitude. But this is not software development per se. The goal here is to abstract away a process in a manner that gives us

  1. the possibility to control, test and run it with a range of options and
  2. to grant us a meaningful birds-eye view of that same process that will facilitate the discussion of it and of our infrastructure as well as eventually lead to further improvements of it.


It is automation as a way to gain a better overview of the infrastructure, its uses, and the needs for the business

Second ingredient, the "how you achieve automation of a process". Make a real story of your Jira story! Don't shy away nor be lazy to add comments full of details. This is the place where you don't need to worry much about formatting, yet you have all the tools to insert screenshots, links to other boards or documents, link it to further stories, tasks or even epics, explicitly raise the attention to other people that may or not be in your team, add snippets or even full scripts code, etc. Most importantly, it's a single stop shop where you can

  1. First just jot down an idea of a project
  2. Draft the requirements and goals
  3. Annotate some initial tests and investigations for solutions
  4. Divide the story into tasks and littel milestones
  5. Go to step 2 and keep improving until a satisfactory solution is found


Again, you get to do all that without worrying about the eye-candy of formatting not even constantly writing full sentences.

Clearly, the story is a living object that may evolve in content as you advance in its solution. And the good news is that it is always there.  In the short term this helps gain accountability as well as keep in check our logic. In the mid and long term this attitude serves the traceability of the decisions and solutions taken. Others will certainly benefit greatly from it!

The third and last basic ingredient I would highlight: Show due reverence for the logs. Any scientific field, be it Physics, Math, Engineering or even Language or Humanities can be understood as a composition of processes. A network of maps each with its inputs and outputs: the output of each process is the input of the next.

The logs of your automation include any of its required outputs (say updating a bucket, building a stack, triggering a pipeline, etc.). But it's vital that its output be seen as a story in itself: Reading the logs of your scripts should immediately provide us with a clear view of a

  1. Full path of your script as it was called
  2. All values of all variables used
  3. timestamp of each step and two cents of what it's doing
  4. which function in the script is doing what at that time
  5. which function ended in error and in which line of the script


And that should be done with a formatting that is

  • consistent
  • easy to parse

I can hear some of you already shouting "how does this apply to Terraforming or CD/CI?". 

Well, you better structure your Terraform code into modules -yes, beyond the basic main.tf, variables.tf and terraform.tfvars. You see, It isn't then any different! And the whole CD/CI...There is a reason why the mathematicl concept of a map (for CS minded readers, think of lambda calculus, or a language like Lisp or Ocaml) is so powerful: It conveys the most basic idea of a path/process, among a plethora of other technical details. And that's what our pipelines are.


Of course is easy to keep adding ingredients: Eagerness to constantly learn and use new technology, embracing the KISS rule, be quick in documenting things, ... But if I'd have to pick a fourth one I would first go with a 

Trust the adage "good is better than perfect".
 

Although I first heard it as "Perfect is the enemy of good". You get the idea though.