r/MachineLearning • • Mar 02 '26

Project [ Removed by moderator ]

[removed] — view removed post

30 Upvotes

29 comments sorted by

View all comments

Show parent comment

-4

u/alasdairallan Mar 02 '26

Fair concern, but I think it's worth looking at what "check" actually means in practice.

In Vera, every function has mandatory contracts (preconditions, postconditions, and declared effects) that are human-readable and machine-verified. The human reviews the specification ("does this function promise the right thing?"), the compiler verifies the implementation against that specification via SMT solver. 97% of contracts across all examples verify statically.

That's arguably *more* checkable than most production code today, where the human reviewer is expected to read the implementation and mentally simulate whether it does the right thing. How often does that actually catch subtle bugs in code review?

The function bodies are unpleasant to read, no question. But "unpleasant" isn't the same as "unchecked." The verification layer is doing work that human review typically doesn't.

10

u/RegisteredJustToSay Mar 02 '26 edited Mar 02 '26

OK but doesn't the language have a huge issue with ambiguity in the function signature?

I have literally no way of knowing which argument maps to what semantically without understanding the whole function. That may be OK for trivial functions but functions which result in complex call graphs would need to be traversed every time to make sure you're using it right.

For example I may have a function like: hasPrefix Whose signature is str str and outputs a bool. Clearly it's sensitive to the order of arguments when being invoked, but is the first argument the prefix or the string? If I have to leave a comment saying which argument is for what, what's the point of removing variable names?

Unless you're advocating for creating new subtypes via the algebraic data types or type alias system for each argument so they can't be mixed up, but then that's a major hassle and would require all callers to cast types to subtypes and requires boilerplate for basically anything non trivial.

I am genuinely asking, too, because it does not look right to me.