Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4bf0b21
Initial ideas on proof decomposition.
kape1395 Apr 27, 2025
5e5707e
Use visitor to construct the proof steps in the LSP.
kape1395 Jul 27, 2025
44e26de
Some proof decompositions work already, but messy.
kape1395 Sep 14, 2025
d1efcb5
Code formatting of decomposed steps improved.
kape1395 Sep 14, 2025
4d16345
Basic decomp for \E.
kape1395 Sep 15, 2025
9bf23ae
Cleanup.
kape1395 Sep 15, 2025
131b8c9
Normalize the obligation before analysis.
kape1395 Sep 16, 2025
f5ccffe
Name clashes are now resolved when decomposing \E and \A.
kape1395 Sep 21, 2025
39f12e2
Cleanup in tlapm code.
kape1395 Sep 21, 2025
c966acb
Fixing odoc format.
kape1395 Sep 22, 2025
afa473b
Fixing the proof step status.
kape1395 Sep 22, 2025
04e6ee6
Proof step statuses are now fixed.
kape1395 Sep 22, 2025
8d359f7
Cleanup.
kape1395 Sep 23, 2025
e5ed589
Have I fixed the ix'es?
kape1395 Oct 6, 2025
f75aa65
Minor tuning.
kape1395 Oct 7, 2025
6c51aba
Expand names. Conj improved.
kape1395 Oct 7, 2025
06a5bf9
Cleanup.
kape1395 Oct 8, 2025
9426dc8
Split to sub-modules.
kape1395 Oct 8, 2025
34e33cb
Basic case-split.
kape1395 Oct 8, 2025
a1c69e2
Case-split improved.
kape1395 Oct 8, 2025
df19b69
Cleanup.
kape1395 Oct 9, 2025
42799d1
Split conj assm.
kape1395 Oct 11, 2025
d1775f7
Don't list defs from hidden facts.
kape1395 Oct 11, 2025
642e0c3
Case split: add the CASE assm to the used facts.
kape1395 Oct 11, 2025
4f069d7
Decomp: use "=>" assm.
kape1395 Oct 11, 2025
4e9461a
Decomp: small fixes.
kape1395 Oct 11, 2025
4015ffa
Use quoted strings for the tests.
kape1395 Oct 12, 2025
95ef663
Decomp: use \E assm.
kape1395 Oct 12, 2025
95ab136
Decomp: Use \A assm.
kape1395 Oct 12, 2025
175f2cb
A bit of testing.
kape1395 Oct 12, 2025
7412e3f
Decomp: less hacky "to sub-steps".
kape1395 Oct 12, 2025
95feeff
Should start working on the tests.
kape1395 Oct 13, 2025
013d46e
Some tests for LSP.
kape1395 Oct 13, 2025
124cf80
Apply text edit in the test.
kape1395 Oct 14, 2025
3e50732
Fix the CI build?
kape1395 Oct 14, 2025
c415668
Fix the CI build?
kape1395 Oct 14, 2025
d91f00b
Fix the CI build?
kape1395 Oct 14, 2025
67f79b0
Fix the CI build?
kape1395 Oct 14, 2025
ce284ac
Fix the CI build?
kape1395 Oct 14, 2025
7e3b9ce
Multiline text diff for tests.
kape1395 Oct 14, 2025
17c4387
Some test cases.
kape1395 Oct 18, 2025
718da54
More tests.
kape1395 Oct 18, 2025
6e5dca7
Test for Expand DEF.
kape1395 Oct 18, 2025
09fb135
Tests for using assms.
kape1395 Oct 18, 2025
016f385
Preparing for capturing printed ranges.
kape1395 Oct 18, 2025
72006b3
ocaml formatter updated.
kape1395 Dec 13, 2025
0d27fc7
Merge remote-tracking branch 'origin/main' into lsp-decompose-proof
kape1395 Jan 11, 2026
fc081c4
Cleanup.
kape1395 Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=0.27.0
version=0.28.1
profile=default
61 changes: 49 additions & 12 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,51 @@
{
"words": [
"tlaplus",
"tlaps",
"tlapm",
"zenon",
"opam",
"ocaml",
"caml",
"sandboxing",
"sprintf",
"printexc"
]
"words": [
"tlaplus",
"tlaps",
"tlapm",
"zenon",
"opam",
"ocaml",
"caml",
"sandboxing",
"sprintf",
"printexc",
"Anoninst",
"Hashtbl",
"Pcase",
"Recursives",
"Submod",
"Tuply",
"failwith",
"iteri",
"mapi",
"modunit",
"naxs",
"assm",
"disj",
"Actplus",
"Cdot",
"Defn",
"Deque",
"Gteq",
"Leadsto",
"Lteq",
"Notmem",
"Setminus",
"Tquant",
"Tsub",
"Uminus",
"Unprimable",
"noprops",
"stepno",
"wheredef",
"forall",
"unditto",
"dvar",
"filteri",
"bpragma",
"alcotest",
"yojson",
"patdiff"
]
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ opam-update: # Update the package lists and install updates.
opam upgrade

opam-deps:
opam install ./ --deps-only --yes --working-dir
opam install ./ --deps-only --with-test --yes --working-dir

opam-deps-opt:
opam install --yes eio_main lsp
Expand Down
5 changes: 4 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
ppx_inline_test
ppx_assert
ppx_deriving
ounit2)
(ounit2 :with-test)
(alcotest :with-test)
(ocolor :with-test)
(patdiff :with-test))
(depopts
lsp ; https://github.com/ocaml/ocaml-lsp
eio_main)) ; https://github.com/ocaml-multicore/eio, only available on OCaml version >= 5.
82 changes: 82 additions & 0 deletions lsp/doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Proof Decomposition

The general idea is to keep the decision on making new proof levels for the user.
Thus, if possible, the decomposition commands will try to refine the goal at the current level.

Commands for introducing/reducing levels:

- Convert the leaf proof to steps.
This introduces a new level into the proof.
- Convert QED-only steps to a leaf proof.
This simplifies proof. If only a single step (QED) is left,
then there is no point in keeping the proof with the additional level introduced.

# Decomposition by the goal

Decomposition by the goal works by invoking code actions at the QED step of the current level.
This is because during the steps at that level, the goal is refined, thus the ultimate goal
is known at the QED step, and not at the upped-level step which is decomposed.
Decompose goal is a single command for the user, but it works dependent on the structure of the goal:

## Goal is implication

The step with a goal `G == P => Q` and proof

```tla
<l>q. QED Proof
```

is transformed to

```tla
<l>x. SUFFICES ASSUME P PROVE Q BY DEF G
<l>q. QED Proof
```

or if no operator expansion is needed:

```tla
<l>x. HAVE P
<l>q. QED Proof
```

## Goal is conjunction

If the goal is `P == P1 /\ P2 /\ ... Pn` with the proof

```tla
<l>q. QED ProofP
```

then it is transformed to steps (inserted before the QED):

```tla
<l>1. P1 ProofP
<l>2. P2 ProofP
...
<l>n. Pn ProofP
<l>q. QED BY <l>1, <l>2, ... <l>n DEF P
```

Here `DEF P` is only added, of the goal was an operator, which should be expanded.
All the proof labels are introduced to be unused at that level.

## Goal is disjunction

Assume negations, prove the last disjunct.

## Goal is equivalence

Prove as conjunction of two implications.

## Goal is forall

TAKE or SUFFICE, depending of a need to expand something.

## Goal is exists

TODO: ...

# Decomposition by the assumptions

Only unused assumptions are proposed for the decomposition?
Loading