|
1 | 1 | # Port of the Neem MRDT and CRDT Framework to Lean |
2 | 2 |
|
3 | | -The code is built on top of the [Loom](https://github.com/verse-lab/loom/tree/master) repository. Initially, Loom was used to prove the correctness directly, but eventually pure Lean was used since the structures being verified did not have mutability. Therefore, some proofs use Loom and some do not. |
| 3 | +This repository contains a port of various CRDTs and MRDTs from the Neem framework to Lean. It also comes equipped with a custom tactic called `sal` and a counterexample generation and visualization framework. |
4 | 4 |
|
5 | 5 | ## Steps to run |
6 | 6 |
|
7 | 7 | Clone this repository, and run `lake update` followed by `lake build`. Ensure that the Lean version in `lean-toolchain` stays at `v4.26.0`. The various proofs are in the [Neem](CaseStudies/Neem) directory. Click on each Lean file in VS code to run all the verification conditions. |
8 | 8 |
|
9 | 9 | # Data structures implemented and description |
10 | 10 |
|
11 | | -TODO |
| 11 | +| **RDT** | **dsimp + grind** | **Lean Blaster** | **Fallback to ITP** | |
| 12 | +|----------------------------------|:------:|:------:|:-------------------:| |
| 13 | +| Increment-only counter MRDT | 24 | 0 | 0 | |
| 14 | +| PN-counter MRDT | 24 | 0 | 0 | |
| 15 | +| OR-set MRDT | 21 | 3 | 0 | |
| 16 | +| Enable-Wins Flag MRDT | 9 | 14 | 0 | |
| 17 | +| Efficient OR-Set MRDT | 22 | 2 | 0 | |
| 18 | +| Grows-only set MRDT | 24 | 0 | 0 | |
| 19 | +| Grows-only map MRDT | 22 | 0 | 2 | |
| 20 | +| Replicated Growable Array MRDT | 15 | 9 | 0 | |
| 21 | +| Multi-valued Register MRDT | 24 | 0 | 0 | |
| 22 | +| Increment-only counter CRDT | 24 | 0 | 0 | |
| 23 | +| PN-counter CRDT | 16 | 2 | 6 | |
| 24 | +| Multi-Valued Register CRDT | 24 | 0 | 0 | |
| 25 | +| OR-set CRDT | 4 | 19 | 1 | |
| 26 | + |
12 | 27 |
|
13 | 28 | # Counterexample generation using Plausible |
14 | 29 |
|
15 | | -Our implementation of the `en-wins flag` was erroneous, and it did not pass the `inter_right_1op` VC. Earlier, the counterexample needed to be worked out manually, but we can now automatically generate small counter-examples. The [Plausible](https://github.com/leanprover-community/plausible) generator was used to generate minimal examples. The section of code can be checked out [here](https://github.com/pranavramesh2003/Neem_Loom/blob/master/CaseStudies/Neem/en_wins_flag.lean#L312). We prove that both the pre and post conditions are decidable under a suitable upper bound, and generate counter examples. Subsequently, we use [Logging](https://leanprover.github.io/functional_programming_in_lean/monads.html#logging)-style monads to derive the computation tree for the left and right hand sides of the `ensures` equality. [This file](CaseStudies/Neem/WriterMonad_ENflag.lean) shows the computation path logged as a list. |
| 30 | +Our implementation of the `en-wins flag` was erroneous, and it did not pass the `inter_right_1op` VC. Earlier, the counterexample needed to be worked out manually, but we can now automatically generate small counter-examples. The [Plausible](https://github.com/leanprover-community/plausible) generator was used to generate minimal examples. The section of code can be checked out [here](https://github.com/pranavramesh2003/Neem_Loom/blob/master/CaseStudies/Neem/en_wins_flag.lean#L312). We prove that both the pre and post conditions are decidable under a suitable upper bound, and generate counter examples. Subsequently, we use [Logging](https://leanprover.github.io/functional_programming_in_lean/monads.html#logging)-style monads to derive the computation tree for the left and right hand sides of the `ensures` equality. [This file](CaseStudies/Neem/WriterMonad_ENflag.lean) shows the computation path logged as a list and the subsequent visualization in HTML. |
0 commit comments