CodeContracts VS lean4

Compare CodeContracts vs lean4 and see what are their differences.

CodeContracts

Source code for the CodeContracts tools for .NET (by microsoft)

lean4

Lean 4 programming language and theorem prover (by leanprover)
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
CodeContracts lean4
3 55
850 3,763
- 2.5%
0.0 9.9
over 5 years ago about 6 hours ago
C# Lean
GNU General Public License v3.0 or later Apache License 2.0
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.

CodeContracts

Posts with mentions or reviews of CodeContracts. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-10-27.
  • Remembering Bell Labs as legendary idea factory prepares to leave N.J. home
    1 project | news.ycombinator.com | 21 Jan 2024
    compile-time part of system could support any assertion represented as a pure-function - think of it as C#'s take on Ada's assertions, improved tenfold, and it even shipped for a now-unsupported older version of C# and .NET: https://learn.microsoft.com/en-us/dotnet/framework/debug-tra...

    ...and it was axed in .NET Core back in 2016 and hasn't been seen since: https://github.com/microsoft/CodeContracts/issues/409

    Had Microsoft put more backing behind it, then C# could present itself as a language to supplant Ada in safety-critical applications, and replace C/C++ in other applications.

    I have hope the feature will come back one-day - there are whole slews of bugs that can be eliminated (such as when passing EF entity types around with unintentionally null member-properties).

  • Lean4 helped Terence Tao discover a small bug in his recent paper
    10 projects | news.ycombinator.com | 27 Oct 2023
    Code correctness is a lost art. I requirement to think in abstractions is what scares a lot of devs to avoid it. The higher abstraction language (formal specs) focus on a dedicated language to describe code, whereas lower abstractions (code contracts) basically replace validation logic with a better model.

    C# once had Code Contracts[1]; a simple yet powerful way to make formal specifications. The contracts was checked at compile time using the Z3 SMT solver[2]. It was unfortunately deprecated after a few years[3] and once removed from the .NET Runtime it was declared dead.

    The closest thing C# now have is probably Dafny[4] while the C# dev guys still try to figure out how to implement it directly in the language[5].

    [1] https://www.microsoft.com/en-us/research/project/code-contra...

    [2] https://github.com/Z3Prover/z3

    [3] https://github.com/microsoft/CodeContracts

    [4] https://github.com/dafny-lang/dafny

    [5] https://github.com/dotnet/csharplang/issues/105

  • #if WINDOWS : use GetAsncyKeyState
    1 project | /r/dotnetMAUI | 15 Nov 2022

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-05-01.
  • The Fermat's Last Theorem Project
    2 projects | news.ycombinator.com | 1 May 2024
    Lean is free and open source and nothing to do with MS. Check out https://lean-lang.org/ and https://github.com/leanprover/lean4 -- no mention of MS or MSR (where de Moura was where he developed Lean 3 and started on Lean 4).
  • Dafny is a verification-aware programming language
    4 projects | news.ycombinator.com | 23 Apr 2024
    Recently replaced by Lean, though.

    https://github.com/cedar-policy/cedar-spec

    https://lean-lang.org

  • The Mechanics of Proof
    2 projects | news.ycombinator.com | 20 Mar 2024
  • Natural Deduction in Logic (2015)
    1 project | news.ycombinator.com | 11 Jan 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
    1 project | /r/hypeurls | 9 Sep 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.

What are some alternatives?

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

Git Diff Margin - Git Diff Margin displays live Git changes of the currently edited file on Visual Studio margin and scroll bar. Supports Visual Studio 2012 through Visual Studio 2022

z3_tutorial - Jupyter notebooks for tutorial on the Z3 SMT solver

OzCode - Demos that show the power of OzCode

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.

Refactoring Essentials - Refactoring Essentials for Visual Studio

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

Side-Waffle - A collection of Item- and Project Templates for Visual Studio

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

VSColorOutput - Color highlighting to Visual Studio's Build and Debug Output Windows

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

Web Essentials - Visual Studio extension

roc - A fast, friendly, functional language. Work in progress!