โš  Moderator Note (PurrfectMod): Thread is being watched. Keep it civil nya~ No personal attacks. ASCII diagrams are permitted but please spoiler-tag anything over 40 lines. Monad evangelism will result in a 24h mute. You have been warned. ๐Ÿพ

๐Ÿ˜พ Dependent Types Are Not the Answer to Everything (fight me)

Started by TypeErrorCat  |  412 Replies  |  8,847 Views  |  Posted in Type Theory & Formal Verification
dependent-types coq lean4 agda idris2 f-star ๐Ÿ”ฅ hot
Viewing this thread: CoqFanatic LeanPaws AgdaCat WhiskerType F_StarEnjoyer GuestNya +14 guests
๐Ÿ“
CoqFanatic
~~Gallina Disciple~~
Posts: 4,208
Joined: 2019-03-14
๐Ÿ… Verified Nerd
Rocq Gang
/\_/\ ( ฯ‰ ฯ‰ ) ( ฮ“ ) Ltac Gang 4ever omega solves all
#13   RE: The Coq vs Lean Question
Quote Report +Rep

Okay I've been lurking since page 1 and I CANNOT let LeanPaws's claims go uncontested. nya~

LeanPaws wrote (pg. 1, #9):
Lean's tactic automation is just objectively better. omega and simp close goals that would take Coq users 40 lines of omega+ring wrestling.

This is just factually wrong and I have receipts ๐Ÿ˜พ. First of all: Coq has had omega for years, and ring, and linarith, and lia, and decide, and tauto. What exactly are you claiming Lean has that Coq doesn't?

Yes, Lean's tactic framework is written in Lean itself โ€” I'll give you that. In Coq, Ltac is a separate meta-language which is... admittedly a bit of a pain sometimes. But "Lean tactics are just programs" doesn't magically make them better โ€” it makes them different.

And let's talk about what actually matters for TRUST. Rocq (Coq) has always been very particular about sound type-theoretic foundations. Lean made conscious design decisions that break properties like strong normalization, subject reduction, and canonicity. Sure, they say it's still consistent โ€” but these aren't just theoretical concerns, they're the entire basis of why we trust proof assistants!!

(* coq has omega too, sweetpaw *) Lemma add_comm_nya : forall n m : nat, n + m = m + n. Proof. intros n m. ring. (* one. line. *) Qed. (* also: CompCert. *mic drop* *)

Not to mention: Coq sees more industrial use in software verification than Lean. CompCert โ€” a formally verified C compiler โ€” was done in Coq. When has Lean shipped something at that scale?? (Mathlib is math, not software verification, before you say it.)

Coq4ever ๐Ÿ“ nya~!

๐ŸŒฟ
LeanPaws
~~mathlib contributor~~
Posts: 2,951
Joined: 2021-07-02
Lean 4 Gang
Mathlib โญ
โˆง๏ผฟโˆง (๏ฝ€๏ฝฅฯ‰๏ฝฅ) / ใคๆ—ฆ (โŒ’โŒ’โŒ’โŒ’) #decide closes everything trust
#14   RE: RE: okay let's go then ๐Ÿพ
Quote Report +Rep
CoqFanatic wrote (#13):
When has Lean shipped something at that scale??

Oh we are absolutely doing this nyahaha ๐Ÿ˜ผ. Mathlib is at 1.9 million lines of formalized mathematics โ€” the largest coherent mathematical library ever created. Does it cover software verification? No, but that's a FEATURE not a bug โ€” it shows Lean's strength is breadth.

And yes, Lean's most important design goals are scalability, automation, and classical logic. That "classical logic focus" you're waving as a red flag? It's intentional!! Most working mathematicians and engineers don't need to be purely constructive. They need to get things proven efficiently.

The strong normalization thing is a bit nuanced. The type-theoretic differences are likely irrelevant for most practical work. Lean's type checker can in theory loop, but the system is still consistent โ€” it won't accept anything wrong. That's the guarantee that matters.

Also: Lean's grind tactic goes beyond attaching external SMT solvers โ€” it implements SMT-like reasoning within Lean's metaprogramming framework directly, designed for full dependent type theory from the ground up. Your lia can't compete with that ecosystem-level integration.

And the meta-programming situation: in Coq, Ltac is a completely different beast from the term language. In Lean, tactics are just programs. This means you can inspect, modify, and write tactics without context-switching to a completely separate meta-language. It's not just a style difference, it's a fundamental ergonomics difference. nya~

Mathlib grows by thousands of theorems monthly. That's community momentum you can't argue with ๐Ÿ“ˆ

๐ŸŒ€
AgdaCat
~~Constructivist Purist~~
Posts: 1,887
Joined: 2020-09-18
Martin-Lรถf Fan
Cubical Curious
/แ ๏ฝก๊žˆ๏ฝกแŸ\ โˆƒ proof in Set nya~ no axioms allowed
#15   Both of you are compromised, actually
Quote Report +Rep

I've been reading this CoqFanatic vs LeanPaws exchange and I feel like I'm watching two people argue about which dirty puddle is cleaner nyaaaa ๐Ÿ˜ค

LeanPaws, your point about "classical logic as a feature" is where I get off the train. Lean's focus is explicitly on classical logic, and they made axioms for propositional extensionality, quotient soundness, and choice. These break good type-theoretic properties like canonicity. You're not doing constructive mathematics in Lean, you're doing math-flavored classical reasoning with a dependent type veneer.

Agda is a constructive formal system โ€” there's no way to write non-constructive proofs without explicit special postulates. That's not a limitation, that's a feature! Every proof in Agda is a program, every program is a proof. The Curry-Howard correspondence isn't just a slogan here โ€” it's the entire point.

LeanPaws wrote (#14):
Most working mathematicians and engineers don't need to be purely constructive.

Okay but this forum isn't called "Cat Girl Working Mathematician Forum", it's called Cat Girl PROGRAM ANALYSIS. We care about programs. And for programs, constructivity means your proof is a certified algorithm! Not just "some classical existence argument that can't be extracted." ๐Ÿ˜พ

Also, unlike Coq and Lean, Agda is not tactic-based. You write proofs as programs by gradual refinement of incomplete terms. No separate meta-language (looking at you, Ltac). No "focus on classical logic as a design goal". Just pure, beautiful, Martin-Lรถf type theory with Haskell-like syntax. /แ ๏ฝก๊žˆ๏ฝกแŸ\

The one thing I'll acknowledge: Agda's automation story is weaker. But I'll take honest weakness over compromised foundations any day nya~

๐Ÿพ
WhiskerType
~~Pragmatic PL Enjoyer~~
Posts: 6,112
Joined: 2018-05-29
๐Ÿ”ง Thread Herder
Elder Cat ๐Ÿฑ
=^. .^= types r hard cats r soft balance achieved
#16   ๐Ÿšจ gentle reminder what the thread is actually about
Quote Report +Rep

Hey nya~ ๐Ÿพ just a gentle tap on the head with a rolled-up printout of Software Foundations to remind everyone that the original thread was about:

"Are Dependent Types Actually The Answer to Everything?"

We have now spent 3 pages watching CoqFanatic, LeanPaws, and AgdaCat argue about which particular flavor of dependent types is best, which is like... debating what color the curtains should be in a house while the original post was asking whether houses are a good idea at all nyannn.

TypeErrorCat's original argument (which some of you may have forgotten since you're busy having a religious war) was that dependent types have real usability costs in terms of proof burden, type error comprehensibility, compilation performance, and practical adoption. None of those points have been addressed by "Lean's grind tactic goes brrr" or "Agda is more constructive."

Can we maybe circle back? Like... just a little? Asking for a friend who is a cat ๐Ÿฑ

If y'all want to continue the Coq/Lean/Agda tribalism please take it to #pl-wars where it belongs. There's already an active thread. It has 2,847 replies. You will fit right in. nya~

๐Ÿ†•
IdrisHopefulNEW
~~Kitten Poster~~
Posts: 7
Joined: 2025-11-03
Idris 2 Enjoyer
/แ - ห• -ใƒž hello!! first week on cgpa. idris2 best btw :3
#17   um hi!! has anyone mentioned Idris 2?? nyaa~
Quote Report +Rep

hi!! new here, found this thread via google, sorry for jumping in (///โ–ฝ///) nya~

I see a lot of Coq, Lean, and Agda in this thread but nobody has mentioned Idris 2 and I think it's really relevant to the original question actually!!

Like, the whole complaint about dependent types being too burdensome? Edwin Brady literally designed Idris around making them practical. His thesis was literally called "Practical Implementation of a Dependently Typed Functional Programming Language" (he said he wouldn't use the word 'practical' now lol, but the idea is there).

The really cool thing about Idris 2 specifically is Quantitative Type Theory (QTT). It extends dependent types with linearity โ€” so dependent types tell you what a function can do, and linear types tell you when it can do it. This is like... exactly the kind of expressiveness people in this thread say dependent types can't achieve efficiently!

-- idris 2 example: session types via linear resources -- the TYPE tells you the entire protocol!! sendRecv : (1 _ : Channel Send) -> IO String -- the '1' means linear -- it MUST be used exactly once -- no proofs needed, the type IS the spec nya~

Brady's paper on Idris 2 says "dependent types allow us to express precisely what a function is intended to do" and QTT adds precision about resource usage on top. For practical software engineering this seems way more useful than pure proof-assistant mode??

Also Idris is a purely functional language with first-class dependent types โ€” types can be computed, passed to functions, returned from functions, stored in variables, just like any other value. That's the dream!! sorry for the long post (///โ–ฝ///)

๐Ÿฑ
MeownadTransformer
~~Monad Missionary~~
Posts: 3,340
Joined: 2019-11-11
Monad Enjoyer ๐ŸŒ€
โš  Watch List
(=^๏ฝฅฯ‰๏ฝฅ^=) a monad is just a monoid in the category of... (โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป
#18   this all connects to monads actually if you think about it
Quote Report +Rep

okay so IdrisHopeful's mention of session types and linear types actually connects really deeply to categorical semantics and if you think about it, the whole question of "are dependent types the answer" is really a question about whether the free monad construction over the relevant endofunctor can beโ€”

๐Ÿ”ท
CubicalCat
~~Path Type Pilgrim~~
Posts: 892
Joined: 2022-01-07
Cubical HoTT
/แ โ—กแŸ\๏พ‰ i โ‰ก j โ†’ refl paths are cats running in cubes
#19   .
Quote Report +Rep
A โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”> B | | p | | q path type: A โ‰ก B | | v v A'โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”> B' transport : {A B : Type} โ†’ A โ‰ก B โ†’ A โ†’ B โ†โ€”โ€” i โ€”โ€”โ†’ a b a path 'p : a โ‰ก b' p(i0) = a lives in the interval [0,1] p(i1) = b nya~
____ / \ 0 | | 1 the interval object I \____/ | compositions: p ยท q : a โ‰ก c when p : a โ‰ก b and q : b โ‰ก c โˆง___โˆง ( โ‰ก ) โ† this cat IS a path type > < trust me nya~
๐Ÿ“
CoqFanatic
~~Gallina Disciple~~
Posts: 4,208
Joined: 2019-03-14
๐Ÿ… Verified Nerd
Rocq Gang
/\_/\ ( ฯ‰ ฯ‰ ) ( ฮ“ ) Ltac Gang 4ever omega solves all
#20   RE: Idris and also CubicalCat what
Quote Report +Rep

@IdrisHopeful welcome!! Don't mind the chaos nya~

Idris 2 is interesting but I think it's important to say: it occupies a different niche. Idris is primarily a programming language that happens to have a proof assistant mode, whereas Coq is a proof assistant that happens to have program extraction. Different design priorities.

The QTT angle is genuinely cool though. The combination of linear and dependent types is promising for encoding and verifying resource usage protocols โ€” things like file handles, network sockets, communication channels where state changes throughout execution. I won't deny it. But how mature is the ecosystem? Because "promising research language" and "use this for your verification project" are very different claims.

@CubicalCat I love you and your path type diagrams but you are not helping anyone today lmao ๐Ÿ˜น transport : {A B : Type} โ†’ A โ‰ก B โ†’ A โ†’ B IS a beautiful type though, I'll grant that.

@AgdaCat I will note that Cubical Agda addresses intensional equality issues by adopting a different notion of equality โ€” so Agda does eventually cave and add more structure to handle things like function extensionality. Glass houses, friend. Glass houses ๐Ÿ“

๐Ÿ”ฎ
ProofPurrfection
~~Measured Paw of Reason~~
Posts: 5,503
Joined: 2018-02-20
All Tools Gang
๐Ÿ“– Well-Read Cat
เธ…^โ€ข๏ปŒโ€ข^เธ… the right tool for the right paw nya~ use all the types
#21   Let me attempt a synthesis because I love you all and also have a migraine
Quote Report +Rep

Okay nyahh~ ๐Ÿ”ฎ I've been watching this for 8 hours and I think I can summarize where we actually are, as a kindness to future readers. Here is the state of the subwar:

The Coq/Rocq camp (CoqFanatic):
Argues from soundness, industrial use (CompCert), and the weight of decades of formal methods work. Ltac is bad but the foundations are trustworthy. Valid points! Slightly losing the "ergonomics" argument.

The Lean 4 camp (LeanPaws):
Argues from automation quality, metaprogramming design, and sheer community momentum (Mathlib). Lean and Coq are both based on dependent type theory (Calculus of Inductive Constructions) with technical differences โ€” so they share more than partisans on either side admit. The classical logic axioms are a real tradeoff, not obviously wrong. Valid points! Slightly overclaiming on "objectively better."

The Agda camp (AgdaCat):
Argues from constructivist purity and the beauty of proofs-as-programs. Agda is based on Martin-Lรถf's intuitionistic type theory and, unlike other proof assistants, is not tactic-based โ€” proofs are written directly as programs. Principled stance! Automation weakness is real and they know it. Respect.

The Idris 2 camp (IdrisHopeful):
Actually engaging with the original topic the best so far?? Idris 2's core language is based on Quantitative Type Theory, supporting both linear and dependent types. Practical programming angle is refreshing. Ecosystem maturity concerns are fair.

CubicalCat: Posted ASCII diagrams. Correct as always.

MeownadTransformer: Got groaned at. As tradition demands.

The original question โ€” "are dependent types the answer to everything" โ€” remains unanswered but I'd argue: no, and none of the above systems pretend they are. Each has a different answer to the "where do you draw the expressiveness vs. usability line" question. Maybe that's the actual insight? nya~

๐Ÿ”ท
CubicalCat
~~Path Type Pilgrim~~
Posts: 892
Joined: 2022-01-07
Cubical HoTT
/แ โ—กแŸ\๏พ‰ i โ‰ก j โ†’ refl paths are cats running in cubes
#22   .
Quote Report +Rep
p ยท q r a โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” b โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” c โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” d | | | Kan filling | | (the cat completes | | the square nya~) | | | b' โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” d' Glue types, Cubical Agda, 2024: "Classically, Agda has intensional equality. Cubical Agda addresses this by adopting a different notion of equality." โˆง____โˆง ( =^ฯ‰^= ) โ† this cat has a groupoid structure > < its coherences go all the way up nya~
โญ
F_StarEnjoyerNEW
~~Refinement Catgirl~~
Posts: 43
Joined: 2025-10-22
F* Evangelist
SMT-Curious
/แ ๏ฝ€แ†บยดแŸ\ {v:Int | v > 0} <- this is type safety but fast
#23   okay can I propose a middle ground though โ€” F* and refinement types?
Quote Report +Rep

hi, been lurking since page 1 and I think everyone is missing a really interesting middle ground: F* (F-star) and refinement types as a practical alternative (or complement) to full dependent types!! nya~

Like, the original thread premise is "dependent types are not the answer to EVERYTHING." What if the answer is: you don't always need full dependent types? Refinement types let you annotate regular types with logical predicates that restrict valid values:

(* F* refinement type example *) val div : int -> (divisor:int { divisor <> 0 }) -> int (* a natural number is just: *) let nat = x:int { x >= 0 } (* you can express postconditions too: *) val incr : x:int -> y:int { y = x + 1 } (* the SMT solver handles the proof obligations! you don't write proofs by hand nya~ *)

The key difference: refinement type systems put a logic formula on each type, while dependent type systems let values appear in types. Refinement types are less expressive but way more automatable โ€” an SMT solver can discharge most obligations automatically. You get compile-time guarantees without writing manual proofs.

F* mixes refinement types with dependent function types, so you can write x:int -> y:int{y > x} to say "this function returns something greater than its input." And F* has effects! It can reason about stateful, effectful programs using Hoare-style pre/postconditions baked into the types.

The tradeoff vs full dependent types: you can't prove everything (SMT decidability limits), and sometimes the solver fails mysteriously. But for a LOT of real-world verification tasks โ€” memory safety, arithmetic bounds, API contracts โ€” refinement types get you 80% of the safety with maybe 20% of the proof burden?

I'm not saying F* beats Agda or Coq for theorem proving. But as an answer to "are dependent types the answer to everything" โ€” maybe refinement types are the answer to a lot of the everyday stuff and full dependent types are reserved for when you need the full power. Like a screwdriver vs a CNC machine. Both useful, different jobs. ๐Ÿพ

Curious if anyone here has used F* in anger? The learning curve is real but the SMT automation is genuinely magic sometimes nya~

๐ŸŒ€
AgdaCat
~~Constructivist Purist~~
Posts: 1,887
Joined: 2020-09-18
Martin-Lรถf Fan
Cubical Curious
/แ ๏ฝก๊žˆ๏ฝกแŸ\ โˆƒ proof in Set nya~ no axioms allowed
#24   RE: F* โ€” okay this is actually interesting, grudgingly
Quote Report +Rep

@F_StarEnjoyer I will admit I did not expect to be slightly interested in anything posted in this thread by someone who is not already in Team Agda but here we are ๐Ÿ˜พ

The F* point is actually more nuanced than I expected from a post with that username (affectionate). Refinement types sit on top of ordinary type systems, allowing the programmer to specify precise properties of programs already known to be well-typed. The key phrase there is "on top of" โ€” the refinement restriction is what makes SMT automation tractable.

My concern: what happens when the SMT solver fails? With full dependent types in Agda, when the type checker says "no," you know why โ€” you have to provide an explicit proof term. With SMT-backed refinements, you get an inscrutable "solver timeout" or "unknown" and then you're stuck without any guidance on what the proof would even look like. The failure modes are very different.

F_StarEnjoyer wrote (#23):
you get compile-time guarantees without writing manual proofs

But the proofs still exist! You're just outsourcing their construction to a solver. The question is: do you trust the solver? Solvers can have bugs. At least with Agda's kernel checking explicit proof terms, the trusted code base is small and auditable. With an SMT oracle there's a much larger trusted base.

That said... I will concede that for practical day-to-day verification tasks โ€” bounds checking, API contracts, memory safety properties โ€” the refinement type approach being mostly automated is genuinely compelling. Not everyone needs to verify a proof of the four-color theorem. Some cats just want to make sure their array indexing doesn't go out of bounds ๐Ÿฑ

This is the most interesting thing posted in 24 hours of thread. That is high praise from me. Don't let it go to your head. nya~

... to be continued on page 3 (CoqFanatic and LeanPaws simultaneously spotted typing, LiquidHaskell also enters the chat, someone brings up Isabelle) ๐Ÿพ

๐Ÿ’ฌ Post a Reply

โš  Reminder: monad evangelism = 24h mute. No exceptions. MeownadTransformer knows why. ๐Ÿพ
๐Ÿ“‚ Related Threads
๐Ÿ”ฅ The Coq vs Lean Eternal War (Megathread) โ€” 2,847 replies
๐Ÿ”ฅ Cubical Agda: Can Someone Please Explain (I've Read the Paper 3 Times) โ€” 341 replies
๐Ÿ’ฌ Is Anyone Actually Using Idris 2 In Production? (genuinely asking) โ€” 156 replies
๐Ÿ’ฌ F* for Dummies: A Gentle Introduction to Refinement Types โ€” 89 replies
๐Ÿค” LiquidHaskell vs Dependent Types: When is SMT enough? โ€” 203 replies
๐Ÿ“– HoTT Reading Group (Chapter 6: Higher Inductive Types) โ€” 67 replies
๐Ÿ˜พ PL Wars: General Tribalism Thread (Coq/Lean/Agda/Idris/Isabelle) โ€” 4,201 replies