A thread about "recursion versus induction".
This is about a beautiful idea discovered by Per Martin-Löf in his now known as Martin-Löf type theory, or MLTT.
Suppose you want to define a function f : ℕ → A.
One possibility is that we have an element a₀ : A and a function s : A → A, and then we can define
f 0 = a₀,
f(n+1) = s (f n).
This is a (simple) recursive definition of f.
1/
A stainless steel pan sits on a black stovetop, filled with a mixture of small, diced pieces. The contents appear to be mostly translucent, with pale yellow and light pink hues. There are several small, reddish-purple pieces scattered throughout the mixture, suggesting diced onions. The mixture is surrounded by a light, brownish liquid, and it appears to be simmering or cooking. The pan has rounded sides and a metallic sheen.
Provided by @altbot, generated privately and locally using Gemma3:27b
🌱 Energy used: 0.081 Wh
Steelers LB TJ Watt has surgery to repair a partially collapsed lung, older brother J.J. Watt says
https://apnews.com/article/pittsburgh-steelers-tj-watt-6469ace1666a1a8a7b73f45f48bbe01a?utm_source=flipboard&utm_medium=activitypub
Posted into Sports @sports-AssociatedPress
Festival La Nuit de l'Erdre. Ben Harper, Vanessa Paradis, Lenny Kravitz : Enorme programmation pour 2026
Lenny Kravitz, Vanessa Paradis, Ben Harper, Suzane, Bob Sainclar... ! Pour le festival 2026, la plus grande édition de l'histoire, les organisateurs de la Nuit de l'Erdre ont fait fort ! Rencontre avec Olivier Tenailleau, programmateur du Festival depuis 15 ans !
Festival La Nuit de l'Erdre. Ben Harper, Vanessa Paradis, Lenny Kravitz : Enorme programmation pour 2026
Lenny Kravitz, Vanessa Paradis, Ben Harper, Suzane, Bob Sainclar... ! Pour le festival 2026, la plus grande édition de l'histoire, les organisateurs de la Nuit de l'Erdre ont fait fort ! Rencontre avec Olivier Tenailleau,...Salomé Poirier (France 3 Pays de la Loire)
Canårđø-2.žerø reshared this.
Jeff Lynne - Electric Light Orchestra - “Livin' Thing”
youtube.com/watch?v=UL98FL32JB…
- YouTube
Auf YouTube findest du die angesagtesten Videos und Tracks. Außerdem kannst du eigene Inhalte hochladen und mit Freunden oder gleich der ganzen Welt teilen.www.youtube.com
I love the process of making a thing where I just start throwing things at the wall and all of a sudden something clicks and it keeps me busy and excited for a while. If you also like uplifting cheesy house tracks...I have a new one for you 😂 Happy Friday! 🧀🎶🕺
Oh, elle est super intéressante cette évolution de la densité à Paris sur 150 ans !
On dirait une diffusion chimique...
Si j'avais la foi, j'en ferais un gif animé, mais là tout de suite, vu mes (non) compétences graphiques et l'heure, je vais plutôt manger à la place.
N'hésitez pas à me piquer l'idée si ça vous dit !
fr.wikipedia.org/wiki/Arrondis…
I challenged myself to get a new #album finished by August of this year. I failed at that, but nobody got hurt so I'm gonna cut me some slack.
The current state of the world is enraging to everyone who isn't a fascist sycophant. But rage is a destructive emotion when left to roam the psyche freely. Since I'm a schmuck with some instruments I decided to spin that feeling into songs.
Sometimes something hits you from the side, unexpected.
An article someone sent me leads with
Actor Bette Davis once said, “Getting old ain’t for sissies.”
and all I can think of is the famous SF Men's Chorus photo
The photograph shows 115 members of the San Francisco Gay Men's Chorus with their backs turned to the camera, representing the former members of the choir who have died of HIV/AIDS, with seven founding members of the choir facing the camera. The picture is authentic, but it was taken almost 30 years ago in 1993. Since then, the number of former choir members to have died of HIV/AIDS has exceeded 300, thereby outstripping the number of current members.
snopes.com/fact-check/gay-mens…
Does a Poignant Photo of Gay Men's Choir Show Devastating Impact of HIV/AIDS?
A widely-shared photograph illustrates the devastating effect of the HIV/AIDS epidemic on the San Francisco Gay Men's Chorus.Dan MacGuill (Snopes.com)
reshared this
@ireneista I know a married gay male couple who are in their 70s who literally do not have any other gay friends of their age group because everyone else died of AIDS.
They're not grieving any more - it's mostly been decades - but it's really not a happy topic.
x.com/atrupar/status/199915269…
Y’all, you know I avoid the HellSite like it was a plague pit, but a dozen or more people have sent me this, and .... wow. More of this please. Stand up to the lies in broad daylight. Tell the world with your whole chest what monsters this administration has unleashed.
Chicago Ridge son charged with murder thought father was using ‘dark magic,’ prosecutors say
https://www.chicagotribune.com/2025/12/12/chicago-ridge-son-father-murder-dark-magic/?utm_source=flipboard&utm_medium=activitypub
Posted into Chicago-area news @chicago-area-news-chicagotribune
Manfred Mann’s Earth Band - Blinded By The Light 1999
youtube.com/watch?v=7gxUmCfa_Q…
- YouTube
Auf YouTube findest du die angesagtesten Videos und Tracks. Außerdem kannst du eigene Inhalte hochladen und mit Freunden oder gleich der ganzen Welt teilen.www.youtube.com
Spotify hates Art
King Gizzard Pulled Their Music From Spotify in Protest, and Now Spotify Is Hosting AI Knockoffs of Their Songs futurism.com/future-society/ki…
King Gizzard Pulled Their Music From Spotify in Protest, and Now Spotify Is Hosting AI Knockoffs of Their Songs
An impersonator appears to be using generative AI to poorly clone rock band King Gizzard and the Lizard Wizard's iconic sound on Spotify.Victor Tangermann (Futurism)
19h VASP: Distribuição de jornais diários pode ser interrompida
18h30 Edição Valter Madureira
www.rtp.pt/noticias/noticiario-desporto/18h30-edicao-valter-madureira_a1_1703957


Martin Escardo
in reply to Martin Escardo • • •We can be a bit more sophisticated. We may instead have a function s : ℕ → A → A. Then we can define
f 0 = a₀
f(n+1) = s n (f n).
The only difference is that now s can use n as a parameter in the recursive call.
I would like to call this a "primitive-recursive" definition of f from a₀ : A and s : ℕ → A → A.
Let's pause to see what we have done. We started from a₀ and s, and we produced f.
I will write
f = primrec a₀ s
to summarize this.
What's the type of primrec?
primrec : A → (ℕ → A → A) → ℕ → A.
2/
Martin Escardo
in reply to Martin Escardo • • •Now let's be more ambitious.
Suppose that we want to be more liberal regarding what the type of s is.
Let's change it from
s : ℕ → A → A
to
s : (n : ℕ) → A n → A (n+1).
What is happening here is that instead of having a fixed A, we now have an A that depends on a parameter n : ℕ.
A so-called dependently-typed function.
And, importantly, with this modification, the above definition
f 0 = a₀
f(n+1) = s n (f n).
still makes sense.
People say "it type checks".
Now, I will write, to summarize the dependency of f on a₀ and s,
f = induction a₀ s
Why did I change "recursion" to "induction"?
Well, look at the type that "induction" must have for the above to make sense.
induction
: A 0
→ ((n : ℕ) → A n → A (n+1))
→ (n : ℕ) → A n
This *type* looks exactly like the *induction principle* for natural numbers.
But here it is just the type of a *program* for doing *dependently t
... show moreNow let's be more ambitious.
Suppose that we want to be more liberal regarding what the type of s is.
Let's change it from
s : ℕ → A → A
to
s : (n : ℕ) → A n → A (n+1).
What is happening here is that instead of having a fixed A, we now have an A that depends on a parameter n : ℕ.
A so-called dependently-typed function.
And, importantly, with this modification, the above definition
f 0 = a₀
f(n+1) = s n (f n).
still makes sense.
People say "it type checks".
Now, I will write, to summarize the dependency of f on a₀ and s,
f = induction a₀ s
Why did I change "recursion" to "induction"?
Well, look at the type that "induction" must have for the above to make sense.
induction
: A 0
→ ((n : ℕ) → A n → A (n+1))
→ (n : ℕ) → A n
This *type* looks exactly like the *induction principle* for natural numbers.
But here it is just the type of a *program* for doing *dependently typed recursion* - which we call induction.
To finish, this phenomenon is not restricted to the particular type ℕ.
*All* types in MLTT have "recursion" (non-dependent elimination) and "induction" (dependent elimination). And in all cases, "recursion" is a particular case of "induction".
3/(of 3 for the moment)
soaproot
in reply to Martin Escardo • • •For my edification, I will attempt a mini-thread translating the start of this thread to Metamath notation.
Write seq 1 ( G , F ) for the sequence F(1), F(1) G F(2), ( F(1) G F(2) ) G F(3), . . .
Simple recursive example: 5^N = seq 1 ( • , ( i ∈ ℕ ↦ 5 ) ) . Here a₀ is 5 and s maps a number to 5 times that number.
Primitive-recursive example: N! = seq 1 ( • , ( i ∈ ℕ ↦ i ) ) .
Here a₀ is 1 and s maps a number to that number times the index in the sequence.
1/3
soaproot
in reply to soaproot • • •Metamath doesn't have enough dependent typing examples to go much further than this, but we do have one usage which is at least in one sense dependently typed.
Suppose that G : ( C × D ) ⟶ C , F(1) ∈ C , and F(n) ∈ D for n at least 2
Then we can show seq 1 ( G , F ) : ℕ ⟶ C
This is a very limited form of dependent typing: F has one type at the first element, and a second type at all the rest, and that's it.
2/3
soaproot
in reply to soaproot • • •Metamath references:
* definition of seq: us.metamath.org/ileuni/df-seqf… (following the definitions back will eventually make it to set theory axioms)
* exponentiation defined using seq: us.metamath.org/ileuni/df-exp.…
* factorial defined using seq: us.metamath.org/ileuni/df-fac.…
* "dependent" typing: us.metamath.org/ileuni/seqf2.h… which is used, indirectly, to prove us.metamath.org/ileuni/ctinf.h… ("A set is countably infinite if and only if it has decidable equality, is countable, and is infinite.")
3/3
df-seqfrec - Intuitionistic Logic Explorer
us.metamath.orgAndrej Bauer
in reply to soaproot • • •soaproot
in reply to Andrej Bauer • • •Andrej Bauer
in reply to soaproot • • •@soaproot Right, in set theory the induction principle for ℕ says this: suppose a family of sets P : ℕ → V is given, and suppose a ∈ P 0, and we have a family of maps h_n : P n → P (n + 1), indexed by n ∈ ℕ. Then there is a unique f ∈ ∏ (n : N), P n such that f(0) = a and f(n + 1) = h_n (f (n)),
To get the usual induction from this, given a predicate φ : ℕ → {⊥, ⊤}, consider the family P(n) = {⋆ | φ(n)}.
soaproot
in reply to Andrej Bauer • • •@andrejbauer That would seem to translate to our notation (I wrote it up at github.com/metamath/set.mm/iss… ) but I don't think we've proved anything too much like that.
Yet, anyway.
Dependently typed induction (or recursion) principle
jkingdon (GitHub)Martin Escardo
in reply to soaproot • • •@soaproot writes "For my edification, I will attempt a mini-thread translating [...]"
That's the best way to try to understand anything.
Translate it to your own language, whatever this language is, natural, formal, or whatever.
Whenever I tried to understand a paper when I was a PhD student, I rewrote it in my own way.
I still do this close to retirement.
soaproot reshared this.