Skip to content

Commit f8e8b00

Browse files
updated README
1 parent 136fd96 commit f8e8b00

4 files changed

Lines changed: 33 additions & 7 deletions

File tree

CaseStudies/Neem/Tactics/SalExample.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ example (a b c : Nat) (h : a = b) : a + c = b + c := by
2727
sal
2828

2929

30+
31+
32+

CaseStudies/Neem/WriterMonad_ENflag.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,12 @@ def splitAtMerge (lst : List ((concrete_st) × String × concrete_st)) (mergeLab
204204
open ProofWidgets Jsx in
205205
def renderBranchingTreeFromList (lst : List ((concrete_st) × String × concrete_st)) : Html :=
206206
let (rootPath, afterLMerge) := splitAtMerge lst "LMerge"
207-
let (leftBranch, afterAMerge) := splitAtMerge afterLMerge "AMerge"
208-
let (rightBranch, afterBMerge) := splitAtMerge afterAMerge "BMerge"
207+
let (leftBranchFull, afterAMerge) := splitAtMerge afterLMerge "AMerge"
208+
let (rightBranchFull, afterBMerge) := splitAtMerge afterAMerge "BMerge"
209+
210+
-- Drop the shared LCA operations from branches
211+
let leftBranch := leftBranchFull.drop rootPath.length
212+
let rightBranch := rightBranchFull.drop rootPath.length
209213

210214
let finalNode := match rightBranch.getLast? with
211215
| some ((_, _), _, n1, n2) => (n1, n2)

CaseStudies/Neem/WriterMonad_Set.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,14 @@ def splitAtMerge' {α : Type} [ToString α] [DecidableEq α] [Hashable α] (lst
173173
open ProofWidgets Jsx in
174174
def renderBranchingTreeFromList {α : Type} [ToString α] [DecidableEq α] [Hashable α] (lst : List ((concrete_st_viz α) × String × concrete_st_viz α)) : Html :=
175175
let (rootPath, afterLMerge) := splitAtMerge lst "LMerge"
176-
let (leftBranch, afterAMerge) := splitAtMerge afterLMerge "AMerge"
177-
let (rightBranch, afterBMerge) := splitAtMerge afterAMerge "BMerge"
176+
let (leftBranchFull, afterAMerge) := splitAtMerge afterLMerge "AMerge"
177+
let (rightBranchFull, afterBMerge) := splitAtMerge afterAMerge "BMerge"
178178
let (mergePath,_) := splitAtMerge' lst "LMerge"
179179

180+
let leftBranch := leftBranchFull.drop rootPath.length
181+
let rightBranch := rightBranchFull.drop rootPath.length
182+
183+
180184
let finalNode := match mergePath.getLast? with
181185
| some (_, _, y) => y
182186
| none => {_set := empty, _universe:={}}

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
# Port of the Neem MRDT and CRDT Framework to Lean
22

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.
44

55
## Steps to run
66

77
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.
88

99
# Data structures implemented and description
1010

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+
1227

1328
# Counterexample generation using Plausible
1429

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

Comments
 (0)