lean4 VS wuffs

Compare lean4 vs wuffs and see what are their differences.

lean4

Lean 4 programming language and theorem prover (by leanprover)
Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
lean4 wuffs
52 80
3,687 3,729
4.0% 1.3%
9.9 9.4
5 days ago 5 days ago
Lean C
Apache License 2.0 GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

lean4

Posts with mentions or reviews of lean4. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-20.
  • The Mechanics of Proof
    2 projects | news.ycombinator.com | 20 Mar 2024
  • The Wizardry Frontier
    2 projects | /r/rust | 10 Dec 2023
    Nice read! Rust has pushed, and will continue to push, the limits of practical, bare metal, memory safe languages. And it's interesting to think about what's next, maybe eventually there will be some form of practical theorem proving "for the masses". Lean 4 looks great and has potential, but it's still mostly a language for mathematicians. There has been some research on AI constructed proofs, which could be the best of both worlds because then the type checker can verify that the AI generated code/proof is indeed correct. Tools like Kani are also a step forward in program correctness.
  • Lean4 helped Terence Tao discover a small bug in his recent paper
    10 projects | news.ycombinator.com | 27 Oct 2023
    Yeah, I believe they said intend for it to be used as a general purpose programming language. I used it to complete Advent of Code last year.

    There are some really interesting features for general purpose programming in there. For example: you can code updates to arrays in a functional style (change a value, get a new array back), but if the refcount is 1, it updates in place. This works for inductive types and structures, too. So I was able to efficiently use C-style arrays (O(1) update/lookup) while writing functional code. (paper: https://arxiv.org/abs/1908.05647 )

    Another interesting feature is that the "do" blocks include mutable variables and for loops (with continue / break / return), that gets compiled down to monad operations. (paper: https://dl.acm.org/doi/10.1145/3547640 )

    And I'm impressed that you can add to the syntax of the language, in the same way that the language is implemented, and then use that syntax in the next line of code. (paper: https://lmcs.episciences.org/9362/pdf ). There is an example in the source repository that adds and then uses a JSX-like syntax. (https://github.com/leanprover/lean4/blob/master/tests/playgr... )

  • A Linguagem Lua completa 30 anos!
    3 projects | dev.to | 17 Oct 2023
  • Lean 4.0.0, first official lean4 release
    10 projects | news.ycombinator.com | 7 Sep 2023
  • Looking to start a new community for people who want to use code for everything
    2 projects | /r/finality | 15 Aug 2023
    My latest inspiration to use code to a) replace my video editor, b) learn the basics of EDM production and c) understand a few topics in higher maths. This might sound very strange given there are specialised tools for these jobs. There's iMovie / Adobe Premier for video, there's GarageBand and FL studio for music and old good pen and pencil for math proofs. But these tools have three big limitations. First they have a lot of idiosyncratic learning, you have to spend quite some time getting used to these tools and my experience is that this time is quite upsetting. In contrast, you only have to learn to code one, maybe spend a few hours getting used to the syntax of another language. I'm not sure if that's true for most people but it was true for me using the tools mentioned above and wanted a place to discuss and see other people ideas and experiments. The second issue is that all these custom-made tools, are not composing easily. I can't search for all math proofs that used a single theorem. I can't create a plugin for iMovie and apply it to all my videos. I can't pick easily pick a rhythm from the internet and build upon for fun. There's also the issue of costs and version control, all tools I'm using today are open source and my work is stored in my repositories. This way I can create branches and test my ideas and I'm also confident that I can work in these projects in years.
  • In Which I Claim Rich Hickey Is Wrong
    5 projects | news.ycombinator.com | 24 Jul 2023
    Dafny and Whiley are two examples with explicit verification support. Idris and other dependently typed languages should all be rich enough to express the required predicate but might not necessarily be able to accept a reasonable implementation as proof. Isabelle, Lean, Coq, and other theorem provers definitely can express the capability but aren't going to churn out much in the way of executable programs; they're more useful to guide an implementation in a more practical functional language but then the proof is separated from the implementation, and you could also use tools like TLA+.

    https://dafny.org/

    https://whiley.org/

    https://www.idris-lang.org/

    https://isabelle.in.tum.de/

    https://leanprover.github.io/

    https://coq.inria.fr/

    http://lamport.azurewebsites.net/tla/tla.html

  • Macro-ts: TypeScript compiler with typesafe syntactic macros (2022)
    2 projects | news.ycombinator.com | 30 May 2023
    Lean4 manages to pull off changing the parser on the fly at compile time. You can add new productions, add new syntax node types, and add new tokens. Then define macros or code to process the additional syntax. Here is a sample I found that adds a simple JSX-like syntax starting around line 93 and then uses it at line 169:

    https://github.com/leanprover/lean4/blob/master/tests/playgr...

    I believe most of the language is defined this way, although it is pre-compiled.

    For more details see the lean4 metaprogramming book: https://github.com/arthurpaulino/lean4-metaprogramming-book

  • is dependent haskell still a thing?
    4 projects | /r/haskell | 19 May 2023
    Lean is another alternative. Very fast, built by Microsoft. Dependent types, proof tactics, type classes, monads, nice macro system.
  • What are the current hot topics in type theory and static analysis?
    15 projects | /r/ProgrammingLanguages | 8 May 2023
    Most of the proof assistants out there: Lean, Coq, Dafny, Isabelle, F*, Idris 2, and Agda. And the main concepts are dependent types, Homotopy Type Theory AKA HoTT, and Category Theory. Warning: HoTT and Category Theory are really dense, you're going to really need to research them.

wuffs

Posts with mentions or reviews of wuffs. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-02-04.
  • Still no love for JPEG XL: Browser maker love-in snubs next-gen image format
    7 projects | news.ycombinator.com | 4 Feb 2024
    Maybe this is what you are looking for:

    https://github.com/google/wuffs

    "Wuffs is a memory-safe programming language (and a standard library written in that language) for Wrangling Untrusted File Formats Safely."

  • Just about every Windows/Linux device vulnerable to new LogoFAIL firmware attack
    4 projects | news.ycombinator.com | 6 Dec 2023
    This is one of the reasons I'm a big fan of wuffs[0] - it specifically targets dealing with formats like pictures, safely, and the result drops in to a C codebase to make the compat/migration story easy.

    [0] https://github.com/google/wuffs

  • Google assigns a CVE for libwebp and gives it a 10.0 score
    5 projects | news.ycombinator.com | 26 Sep 2023
    One example for a safer language developed at Google: https://github.com/google/wuffs
    5 projects | news.ycombinator.com | 26 Sep 2023
    There are already huffman-decoding and some parts of webp algorithms in https://github.com/google/wuffs (language that finds missing bounds checks during compilations). In contrary, according to readme, this language allows to write more optimized code (compared to C). WEBP decoding is stated as a midterm target in the roadmap.
  • The WebP 0day
    6 projects | news.ycombinator.com | 21 Sep 2023
    Specifically, since performance is crucial for this type of work, it should be written in WUFFS. WUFFS doesn't emit bounds checks (as Java does and as Rust would where it's unclear why something should be in bounds at runtime) it just rejects programs where it can't see why the indexes are in-bounds.

    https://github.com/google/wuffs

    You can explicitly write the same checks and meet this requirement, but chances are since you believe you're producing a high performance piece of software which doesn't need checks you'll instead be pulled up by the fact the WUFFS tooling won't accept your code and discover you got it wrong.

    This is weaker than full blown formal verification, but not for the purpose we care about in program safety, thus a big improvement on humans writing LGTM.

  • What If OpenDocument Used SQLite?
    8 projects | news.ycombinator.com | 18 Sep 2023
    > parsing encoded files tends to introduce vulnerabilities

    If we are talking about binary formats, now there are systematic solutions like https://github.com/google/wuffs that protect against vulnerabilities. But SQLite is not just a format - it's an evolving ecosystem with constantly added features. And the most prominent issue was not even in core, it was in FTS3. What will SQLite add next? More json-related functions? Maybe BSON? It is useful, but does not help in this situation.

    Regarding traces, there are many forensics tools and even books about forensic analysis of SQLite databases. In well-designed format such tools should not exist in the first place. This is hard requirement: if it requires rewriting the whole file - then so be it.

  • CVE-2023-4863: Heap buffer overflow in WebP (Chrome)
    18 projects | news.ycombinator.com | 12 Sep 2023
    I agree that Wuffs [1] would have been a very good alternative! If it can be made more generally. AFAIK Wuffs is still very limited, in particular it never allows dynamic allocation. Many formats, including those supported by Wuffs the library, need dynamic allocation, so Wuffs code has to be glued with unverified non-Wuffs code [2]. This only works with simpler formats.

    [1] https://github.com/google/wuffs/blob/main/doc/wuffs-the-lang...

    [2] https://github.com/google/wuffs/blob/main/doc/note/memory-sa...

  • NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in the Wild
    3 projects | news.ycombinator.com | 7 Sep 2023
    There are efforts to do that, notably https://github.com/google/wuffs

    RLBox is another interesting option that lets you sandbox C/C++ code.

    I think the main reason is that security is one of those things that people don't care about until it is too late to change. They get to the point of having a fast PDF library in C++ that has all the features. Then they realise that they should have written it in a safer language but by that point it means a complete rewrite.

    The same reason not enough people use Bazel. By the time most people realise they need it, you've already implemented a huge build system using Make or whatever.

  • FaaS in Go with WASM, WASI and Rust
    5 projects | news.ycombinator.com | 7 May 2023
    Here's an off-topic answer.

    Depends on what you want your toy language to do and what sort of runtime support you'd like to lean on.

    JVM is pretty good for a lot of script-y languages, does impose overhead of having a JVM around. Provides GC, Threads, Reflection, consistent semantics. Tons of tools, libraries, support.

    WebAssembly is constrained (for running-in-a-browser safety reasons) but then you get to run your code in a browser, or as a service, etc, and Other People are working hard on the problem of getting your WA to go fast. That used to be a big reason for using JVM, but it turns out that Security Is Darn Hard.

    I have used C in the (distant) past as an IL, and that works up to a point, implementing garbage collection can be a pain if that's a thing that you want. C compilers have had a lot of work on them over the years, and you also have access to some low-level stuff, so if you were E.G. trying to come up with a little language that had super-good performance, C might be a good choice. (See also, [Wuffs](https://github.com/google/wuffs), by Nigel Tao et al at Google).

    A suggestion, if you do target C -- don't work too hard to find isomorphisms between C's data structures and YourToyLang's data structures. Back around 1990, I did my C-generating compiler for Modula-3, and a friend at Xerox PARC used C as a target for Cedar Mesa, and Hans used it in a lower-level way (so I was mapping between M-3 records and C structs, for example, Hans was not) and the lower-level way worked better -- i.e., I chose poorly. It worked, but lower-level worked better.

    If you are targeting a higher-level language, Rust and Go both seem like interesting options to me. Both have the disadvantage that they are still changing slightly but you get interesting "services" from the underlying VM -- for Rust, the borrow checker, plus libraries, for Go, reflection, goroutines, and the GC, plus libraries.

    Rust should get you slightly higher performance, but I'd worry that you couldn't hide the existence of the borrow checker from your toy language, especially if you wanted to interact with Rust libraries from YTL. If you wanted to learn something vaguely publishable/wider-interesting, that question right there ("can I compile a TL to Rust, touch the Rust libraries, and not expose the borrow checker? No+what-I-tried/Yes+this-worked") is not bad.

    I have a minor conflict of interest suggesting Go; I work on Go, usually on the compiler, and machine-generated code makes great test data. But regarded as a VM, I am a little puzzled why it hasn't seen wider use, because the GC is great (for lower-allocation rates than Java however; JVM GC has higher throughout efficiency, but Go has tagless objects, interior pointer support, and tiny pause times. Go-the-language makes it pretty easy to allocate less.) Things Go-as-a-VM currently lacks:

    - tail call elimination (JVM same)

  • Don't carelessly rely on fixed-size unsigned integers overflow
    7 projects | /r/C_Programming | 24 Jan 2023
    Because if you couldn't prevent creation of pointers from the thin air (e.g. by sending them to remove server and then pulling them from said server) then you can not prove anything of that sort and if you limit such operations then you are starting journey on the road to Rust or Wuffs!

What are some alternatives?

When comparing lean4 and wuffs you can also consider the following projects:

z3_tutorial - Jupyter notebooks for tutorial on the Z3 SMT solver

png-decoder - A pure-Rust, no_std compatible PNG decoder

stb - stb single-file public domain libraries for C/C++

coq - Coq is a formal proof management system. It provides a formal language to write mathematical definitions, executable algorithms and theorems together with an environment for semi-interactive development of machine-checked proofs.

Agda - Agda is a dependently typed programming language / interactive theorem prover.

csharplang - The official repo for the design of the C# programming language

ATS-Postiats - ATS2: Unleashing the Potentials of Types and Templates

ts-sql - A SQL database implemented purely in TypeScript type annotations.

image-png - PNG decoding and encoding library in pure Rust

highway - Performance-portable, length-agnostic SIMD with runtime dispatch

rust - Rust for the xtensa architecture. Built in targets for the ESP32 and ESP8266

binrw - A Rust crate for helping parse and rebuild binary data using ✨macro magic✨.