CGPA // Cat Girl Program Analysis
πŸ”’

⚠ Thread Locked by Administrator

This thread has been locked by admin-nyanko and can no longer receive new replies.
Reason: "persistent personal attacks, strawmanning, and approximately four simultaneous violations of rule Β§7 (Be Excellent to Each Other). Read the lock post. I'm tired."
Locked on 2025-11-14 at 03:47 UTC Β· 118 replies Β· 4,021 views

Intensional vs Extensional Equality πŸ”’ Locked

πŸ“ Type Theory & Formal Verification πŸ’¬ 118 replies πŸ‘ 4,021 views πŸ‘€ Started by EqEqEq πŸ“… 2025-11-09
#type-theory #lean4 #rocq #agda #hott #flame-war πŸ”’ locked
πŸ“¨ Posts 118 πŸ‘ Views 4,021 πŸ‘₯ Participants 14 ⚠ Mod Actions 3 πŸ—‘ Deleted Posts 7 πŸ“Œ Status LOCKED
🐱
EqEqEq
Ξ£-Type Enjoyer
Posts: 1,337
Lean Rocq
#1 ΒΆ permalink

Okay so I keep seeing this conflation between intensional equality and extensional equality everywhere (including in some recent proof-assistant discourse on the birdsite) and I want to lay it out carefully for once. Let's have a proper technical thread.

Quick framing: in intensional type theory (the kind Lean 4, Rocq/Coq, and Agda use), the identity type Id A a b (or a = b) is an inductively defined type family. It's inhabited only by refl up to definitional equality, and you interact with it via the J eliminator (path induction). Critically, propositional equality is not the same as definitional/judgmental equality.

-- Lean 4: the Id type is inductive
inductive Eq {Ξ± : Sort u} : Ξ± β†’ Ξ± β†’ Prop
  | refl : (a : Ξ±) β†’ Eq a a

-- J eliminator / path induction
theorem J {Ξ±} {a : Ξ±} (P : βˆ€ (b : Ξ±), a = b β†’ Prop)
    (h : P a rfl) : βˆ€ {b} (p : a = b), P b p := ...

In extensional type theory (ETT), you add the equality reflection rule: if you have a proof p : a =_A b, then a and b are definitionally equal. This collapses propositional and judgmental equality into one.

The cost is steep: type checking becomes undecidable in ETT. NuPRL is the classic example of a proof assistant based on this design β€” it uses meaning explanations instead of a decidable type checker. Most modern proof assistants deliberately avoid ETT for this reason.

I think there are real tradeoffs here worth discussing. What does the forum think? Are there situations where ETT's convenience outweighs the undecidability cost?

-- EqEqEq | "refl is just the identity path" | cgpa member since 2021
πŸ‘ Like (42) πŸ’¬ Quote πŸ”— Link
edited 2025-11-09 18:14 UTC
😾
TypeNihilistKat
Definitional β‰  Propositional
Posts: 3,891
Agda HoTT
#2 ΒΆ permalink

Good post. One thing worth adding early: the origin of the "intensional/extensional" naming is genuinely confusing and trips people up constantly.

The names refer specifically to the behavior of definitional equality, not to what the identity type represents. The identity type is always in some sense "extensional" β€” it asserts that two things are equal from the outside. But whether that propositional equality collapses into definitional equality (making the type theory "extensional") or stays separate (leaving it "intensional") β€” that's the question.

So when you hear "HoTT is intensional", it means: HoTT does not have the reflection rule. Identity types are not collapsed into judgmental equality. They can have rich higher structure β€” paths, paths between paths, etc. This is completely consistent with HoTT also assuming function extensionality (as a separate axiom or via univalence). Don't conflate "functional extensionality" with "extensional type theory."

-- Agda: K axiom (UIP) can be postulated, but isn't default
-- {-# OPTIONS --with-K #-} enables it
-- Cubical Agda provides an alternative: transport, Glue types

postulate
  funext : {A B : Set} {f g : A β†’ B}
          β†’ (βˆ€ x β†’ f x ≑ g x)
          β†’ f ≑ g
-- In cubical Agda this is provable, not postulated

The intensionality of MLTT means type checking is decidable. As EqEqEq notes, this is why Lean/Rocq/Agda can have fast, reliable type checkers β€” every judgment can be verified algorithmically.

πŸ‘ Like (28) πŸ’¬ Quote πŸ”— Link
πŸ¦„
UnivalentUnicorn
∞-Groupoid Gang
Posts: 2,204
HoTT Lean
#3 ΒΆ permalink

Wonderful, I've been waiting for this thread. Let me add the HoTT angle since neither of you have fully gone there yet.

The really beautiful thing about intensional type theory β€” precisely because propositional equality is separate from definitional equality β€” is that identity types have room to be interesting. In HoTT / Univalent Foundations, identity types are interpreted as path spaces. The type a = b is not merely a proposition, it's a space of paths from a to b.

This is exactly what breaks under ETT. The reflection rule forces a = b to always be a proposition (h-level 1, a set in HoTT terms). ETT is fundamentally incompatible with univalence because the universe itself would need to be an h-set, killing all higher structure.

-- HoTT-Agda style: loop space of the circle is β„€
-- This only makes sense if Id types can be non-trivial!
SΒΉ : Type    -- higher inductive type
base : SΒΉ
loop : base = base    -- nontrivial path!

-- In ETT with reflection, loop would be forced = refl
-- The circle collapses to a point. That's the murder of topology.

So the question "should we use ETT?" is partly the question "do you want to do synthetic homotopy theory?" If no, ETT might be fine for setoid-level math. But you're giving up something profound.

πŸ‘ Like (51) πŸ’¬ Quote πŸ”— Link
🐱
EqEqEq
Ξ£-Type Enjoyer
Posts: 1,337
Lean Rocq
#4 ΒΆ permalink

Right, and to be fair to ETT practitioners: the everyday inconvenience of ITT is real. Consider working with integers in intensional MLTT. β„€ defined as a quotient of β„• Γ— β„• requires setoid overhead β€” you're constantly carrying around propositional equality proofs and coercing along them. In ETT, quotient types would just "work" because equality reflection handles the transport for you.

The setoid hell is a genuine ergonomic problem. In Rocq you end up with this:

(* Coq/Rocq: working with quotients manually *)
Definition int_eq (p q : nat * nat) : Prop :=
  fst p + snd q = fst q + snd p.

(* Then you carry Setoid instances everywhere, *)
(* rewrite with morphism proofs... it's verbose *)
Instance int_eq_equiv : Equivalence int_eq := ...
Add Parametric Morphism : int_add
  with signature int_eq ==> int_eq ==> int_eq
  as int_add_mor. ...

This is the cost you pay to keep type checking decidable. It's not free. Quotient types (which Lean 4 has via Quot) are a middle ground β€” you get setoid-free quotients without full ETT undecidability, but you need propext and funext as axioms.

πŸ‘ Like (33) πŸ’¬ Quote πŸ”— Link
😾
TypeNihilistKat
Definitional β‰  Propositional
Posts: 3,891
Agda HoTT
#5 ΒΆ permalink
↩ EqEqEq wrote (#4):
"the everyday inconvenience of ITT is real... The setoid hell is a genuine ergonomic problem"

I partially agree but let's be precise: "setoid hell" is partly an artifact of specific proof assistants, not an inherent property of intensional type theory. Cubical Type Theory (CTT) is intensional in the relevant sense β€” no reflection rule β€” but gives you computational univalence, so function extensionality and many quotient-type operations just hold by computation.

Agda's cubical mode makes a lot of the traditional setoid pain go away. You get HITs, you get proper quotients, you get function extensionality β€” all without the reflection rule and without sacrificing decidability of type checking.

-- Cubical Agda: integers as a HIT (β„€ without setoid hell)
data β„€ : Type where
  pos  : β„• β†’ β„€
  neg  : β„• β†’ β„€   -- neg 0 = pos 0 via path constructor
  posneg : pos 0 ≑ neg 0

-- no quotient noise; equality is baked into the type

So "ETT to escape setoid hell" is a solution to a problem that CTT solves better, without the undecidability cost.

πŸ‘ Like (44) πŸ’¬ Quote πŸ”— Link
πŸ¦„
UnivalentUnicorn
∞-Groupoid Gang
Posts: 2,204
HoTT Lean
#6 ΒΆ permalink

Also worth noting the UIP angle. In standard ITT (vanilla MLTT), you don't have Uniqueness of Identity Proofs (UIP / K axiom) by default. K says: any proof of a = a is propositionally equal to refl. This is consistent with classical MLTT but incompatible with univalence.

The independence of UIP from ITT is actually a deep result. Hofmann and Streicher's groupoid model showed you can have identity types that are non-trivial (the universe contains a type with multiple distinct self-loops), so UIP is not derivable from J alone.

Agda by default assumes K (pattern matching compiles to it). Lean 4 lives in Prop-land for most equality and also derives K for Prop. Rocq/Coq has UIP_refl derivable for decidable types. None of this is "extensional type theory" β€” it's all still intensional! The reflection rule is the bright line.

-- The K axiom (incompatible with full univalence)
axiom K : {Ξ± : Sort u} {a : Ξ±} (P : a = a β†’ Prop)
         β†’ P rfl β†’ βˆ€ (h : a = a), P h
-- K implies all loops are trivial β†’ h-set universe
-- Bad for HoTT. Fine if you only care about sets.
πŸ‘ Like (38) πŸ’¬ Quote πŸ”— Link
β€” posts #7–#20 omitted for brevity β€”
😾
TypeNihilistKat
Definitional β‰  Propositional
Posts: 3,891
Agda HoTT
#21 ΒΆ permalink
↩ KernelPanic404 wrote (#19):
"ETT practitioners are just people who couldn't handle the complexity of keeping equalities straight. It's basically giving up."

That's a massive mischaracterization. The people working on NuPRL and Nuprl-style systems were not "giving up" β€” they had a coherent philosophical position rooted in Martin-LΓΆf's meaning explanations. The idea that propositional equality should collapse into definitional equality if you have a proof of it is a defensible semantic position, not incompetence.

I think ETT is a bad choice for foundational tools for specific technical reasons β€” undecidability of type checking being the main one. Not because its practitioners are cognitively deficient. This kind of rhetoric makes people defensive and turns a technical conversation into a status contest.

πŸ‘ Like (61) πŸ’¬ Quote πŸ”— Link
😀
KernelPanic404
Compiles Sometimes
Posts: 287
Lean
#22 ΒΆ permalink

Sorry not sorry, if your type checker can't decide whether two terms are equal without a human feeding it proofs, that IS giving up on the core promise of formal verification. "Meaning explanations" is philosophy-department cope for "we made the machine slower." NuPRL is a rounding error in the history of proof assistants. Nobody uses it.

Also @TypeNihilistKat you literally just defended ETT in the same breath as calling it bad. Make up your mind.

πŸ‘Ž Dislike (34) πŸ’¬ Quote πŸ”— Link
😾
TypeNihilistKat
Definitional β‰  Propositional
Posts: 3,891
Agda HoTT
#23 ΒΆ permalink

I defended the intellectual tradition behind ETT while calling the specific design choice bad for engineering, which is a completely coherent position. These are not the same thing. If you can't read at that level of resolution, maybe formal logic isn't for you.

And "nobody uses NuPRL" is a red herring. By that logic, nobody uses Agda either compared to Python. Usage numbers don't determine semantic correctness.

πŸ‘ Like (18) πŸ’¬ Quote πŸ”— Link
⚠️

⚠ Moderator Warning β€” First Notice

Posts #22 and #23 are approaching territory that violates Rule Β§7 (Be Excellent to Each Other) and Rule Β§3 (No ad hominem). "Maybe formal logic isn't for you" is a personal attack. Keep arguments about technical merits, not people. Next violation will result in a 24h posting suspension.

Issued by: admin-nyanko 🐱 · 2025-11-10 · 12:45 UTC · Warning ID #2025-1110-04
β€” posts #24–#55 omitted β€” things calm down briefly β€”
πŸ¦„
UnivalentUnicorn
∞-Groupoid Gang
Posts: 2,204
HoTT Lean
#56 ΒΆ permalink

Let's get back on track. I want to address something that came up in the omitted posts: the claim that "Observational Type Theory is just ETT with extra steps."

This is wrong. OTT (Altenkirch-McBride) keeps propositional equality separate from definitional equality. It's very much in the intensional family. What it does is provide a computational characterization of propositional equality by structural induction on types, so you get things like functional extensionality and propositional extensionality by construction β€” no reflection rule, no undecidability.

-- OTT: equality is defined by induction on type structure
-- Eq : (A : Set) β†’ A β†’ A β†’ Prop
Eq (A β†’ B) f g  =  βˆ€ x, Eq A x x β†’ Eq B (f x) (g x)
Eq (A Γ— B) p q  =  Eq A (fst p) (fst q) Γ— Eq B (snd p) (snd q)
-- Functions: equal if pointwise equal. Extensionality for free!
-- But Eq is always a proposition. No higher structure.

Setoid Truncated Type Theory (SETT), Quotient Inductive Types (QITs), and the whole Observational spectrum all live in the intensional camp. The line is the reflection rule. It's really one of the most semantically meaningful single rules in all of type theory.

πŸ‘ Like (57) πŸ’¬ Quote πŸ”— Link
πŸ™€
CoqIsLegacyKat
Lean4 or bust
Posts: 89
Lean
#57 ΒΆ permalink

OK real talk, can we stop pretending Rocq is a serious modern proof assistant? This whole thread is treating Rocq/Coq as a peer to Lean 4 when it's clearly legacy software living on academic inertia. Lean 4 has a real programming language baked in, a metaprogramming framework that doesn't make you cry, and an active community. The Coq tactic language is a historical artifact.

The "setoid hell" problem EqEqEq described in #4? That's a Coq problem, not an ITT problem. Lean 4 handles this so much better with typeclass synthesis and Quotient. Stop generalizing from your Coq trauma.

πŸ‘Ž Dislike (41) πŸ’¬ Quote πŸ”— Link
πŸ—‘οΈ Post #58 by RocqForeverCat has been removed by a moderator. Reason: personal attacks exceeding warning threshold.
🐱
EqEqEq
Ξ£-Type Enjoyer
Posts: 1,337
Lean Rocq
#59 ΒΆ permalink

I started this thread to discuss intensional vs extensional type theory and it is turning into a Lean vs Rocq culture war. Can we please not do this.

I used Rocq as an example in #4 because I was working in Rocq at the time, not because Rocq is uniquely bad. I use Lean 4 too. They both have their annoyances. Both are fine proof assistants. The setoid story in Lean 4 is better due to Quotient and typeclass automation, but neither is free of propositional equality overhead in the general case.

Can we return to the actual topic: the reflection rule, its consequences, and whether there are meaningful use cases for ETT in 2025?

πŸ‘ Like (72) πŸ’¬ Quote πŸ”— Link
β€” posts #60–#89 omitted β€” Lean vs Rocq war in full swing, 3 more deleted posts β€”
🚨

🚨 Moderator Warning β€” Final Notice

Multiple posts in the #60–#89 range have been deleted for rule violations. CoqIsLegacyKat, KernelPanic404, and RocqForeverCat have all received 48h posting suspensions. The next violation in this thread will result in an immediate lock. This is your final warning. Stay on topic. No more proof assistant tribalism.

Issued by: admin-nyanko 🐱 · 2025-11-12 · 09:01 UTC · Warning ID #2025-1112-02
😾
TypeNihilistKat
Definitional β‰  Propositional
Posts: 3,891
Agda HoTT
#90 ΒΆ permalink

Okay. Attempting to salvage the technical content. Let me summarize the actual dichotomy cleanly since it got buried:

Intensional TT (ITT): Definitional equality (≑_def) and propositional equality (a = b) are distinct. Type checking is decidable. Identity types can have higher structure (HoTT). Function extensionality is an optional extra axiom or follows from computational rules (CTT). Used by: Lean 4, Rocq, Agda, all Cubical systems.

Extensional TT (ETT): Adds equality reflection: p : a = b ⊒ a ≑_def b. Propositional and definitional equality collapse. Type checking becomes undecidable. Function extensionality and quotients are "free" but at the cost of decidability. Used by: NuPRL (historical). Incompatible with HoTT/univalence.

The interesting modern space is the various middle grounds: OTT, 2LTT, Quantitative Type Theory, XTT (which has the reflection rule restricted to a strict equality type separate from the HoTT identity type). These try to get the ergonomic wins of ETT without losing decidability.

I think that's the real answer to EqEqEq's original question: nobody chooses raw ETT in 2025. The active research is in finding carefully limited extensionality principles that preserve the good properties of ITT.

πŸ‘ Like (88) πŸ’¬ Quote πŸ”— Link
πŸ¦„
UnivalentUnicorn
∞-Groupoid Gang
Posts: 2,204
HoTT Lean
#91 ΒΆ permalink
↩ TypeNihilistKat wrote (#90):
"...nobody chooses raw ETT in 2025. The active research is in finding carefully limited extensionality principles..."

Strongly agreed. XTT (by Gratzer, Sterling, Birkedal) is the sharpest example: you have a strict equality type s =Λ’ t that does have the reflection rule, and a separate identity type a = b for homotopy. This two-level approach lets you do both crisp definitional reasoning and homotopy-theoretic reasoning in the same system.

Two-Level Type Theory (2LTT) is even more explicit about this: it literally has two separate layers, a strict "outer" layer (which may be extensional) and a homotopy "inner" layer. The strict layer is for metatheoretic bookkeeping, the homotopy layer is for your actual mathematics. You get the best of both worlds without collapsing them.

This is basically the consensus direction in type theory research right now. "ITT vs ETT" as a binary is increasingly obsolete as a framing.

πŸ‘ Like (64) πŸ’¬ Quote πŸ”— Link
β€” posts #92–#114 omitted β€” things deteriorate again β€” 4 more deleted posts β€”
πŸ’€
ProofTermPilled
Types Are Not Real
Posts: 44
#115 ΒΆ permalink

I can't believe this thread has been going for 5 days and nobody has said the obvious: ALL proof assistants are bad and equality is a social construct.

Thank you for coming to my TEDx talk. Univalence just means all your prejudices are valid as long as they're equivalent 😺

πŸ‘ Like (103) πŸ’¬ Quote πŸ”— Link
🐱
EqEqEq
Ξ£-Type Enjoyer
Posts: 1,337
Lean Rocq
#116 ΒΆ permalink

admin-nyanko please just lock this thread at this point. TypeNihilistKat and UnivalentUnicorn wrote genuinely good technical content in posts #90 and #91 and that's probably the best summary this thread will produce. Everything since post #92 has been pure entropy.

I'm sorry for starting this. I thought we could have a nice technical discussion. I was naive.

-- EqEqEq | "I have learned my lesson (propositionally, not definitionally)"
πŸ‘ Like (94) πŸ’¬ Quote πŸ”— Link
πŸ—‘οΈ Post #117 by KernelPanic404 has been removed by admin-nyanko. This user has been issued a 7-day ban. Reason: returning during suspension, repeated personal attacks, explicitly violating Final Warning.
🐾
admin-nyanko
Head Mod & Admin
Posts: 9,042
HoTT Agda
#118 πŸ”’ LOCK POST ΒΆ permalink

πŸ”’ THREAD LOCKED.

I am locking this thread for the following reasons:

1. Rule Β§7 (Be Excellent to Each Other): violated by at least six users across 118 posts.
2. Rule Β§3 (No Ad Hominem): violated at minimum 11 times, 7 posts deleted.
3. Rule Β§11 (No proof assistant tribalism): oh boy.
4. One user circumvented a posting suspension (KernelPanic404, you now have a 7-day ban, congratulations).

I want to acknowledge that posts #1–#6, #56, #90, and #91 were genuinely excellent technical content. Those posts are the reason I didn't lock this thread at post #22. EqEqEq, TypeNihilistKat, UnivalentUnicorn: thank you. You made the forum better.

The rest of you: the distinction between intensional and extensional type theory is a technical question. It has nothing to do with which proof assistant has the best syntax, who is smarter, or whether "cope" is an argument. A type checker cannot decide whether you are being rude. Sadly, I can.

I'll pin the good posts from this thread to the Type Theory Wiki. If you want to continue the technical discussion in a civil manner, open a new thread with a narrower scope β€” I suggest either XTT and strict equality types or UIP vs Univalence.

β€” admin-nyanko 🐾, still caffeinated at 3:47 UTC, questioning life choices

// cgpa.isarabbithole.com β€” "where the types are made up and the proofs don't matter" (they do matter, please write your proofs)
πŸ‘ Like (312) πŸ”’ THREAD LOCKED BY ADMIN-NYANKO
πŸ”’

This thread is locked

Replies are disabled. To discuss related topics, see the links in the lock post above, or
browse Type Theory & Formal Verification for open threads.

πŸ“Ž Related Threads in Type Theory & Formal Verification

XTT and strict equality types: a gentler introduction 32 replies Β· EqEqEq
UIP vs Univalence: can you have both? 61 replies Β· UnivalentUnicorn
[Tutorial] Getting started with Cubical Agda 14 replies Β· TypeNihilistKat
The J Eliminator: path induction from first principles 27 replies Β· EqEqEq
Lean 4 Quotient types: patterns and pitfalls 45 replies Β· EqEqEq
Setoid Hell Survival Guide (Rocq/Coq edition) 38 replies Β· ProofKittenDX
Formalizing the circle SΒΉ as a HIT: step by step 19 replies Β· UnivalentUnicorn