|
| 1 | +# Implementation Plan: Task #167 -- PR #637 Syntactic Sugar and Quality Review |
| 2 | + |
| 3 | +- **Task**: 167 - PR #637 (refactor/modal-primitives) syntactic sugar and quality review |
| 4 | +- **Status**: [IMPLEMENTING] |
| 5 | +- **Effort**: 2 hours |
| 6 | +- **Dependencies**: 165 (syntactic sugar already merged to main) |
| 7 | +- **Research Inputs**: specs/167_pr637_syntactic_sugar_and_quality/reports/01_pr637-research.md |
| 8 | +- **Artifacts**: plans/02_implementation-plan.md (this file) |
| 9 | +- **Standards**: plan-format.md, status-markers.md, artifact-management.md, tasks.md |
| 10 | +- **Type**: cslib |
| 11 | +- **Lean Intent**: true |
| 12 | + |
| 13 | +## Overview |
| 14 | + |
| 15 | +Rebase the `refactor/modal-primitives` branch (PR #637) onto `main` to incorporate task 165's syntactic sugar changes, resolve all 29 merge conflicts across 7 files using documented resolution rules, verify no remaining raw constructors in expression positions, run the full CSLib CI pipeline, and push to the PR branch. The rebase approach is chosen over cherry-pick because the conflicts are exclusively caused by the sugar divergence between branches -- rebasing cleanly integrates both sets of changes. |
| 16 | + |
| 17 | +### Research Integration |
| 18 | + |
| 19 | +Research report `01_pr637-research.md` provides: |
| 20 | +- Complete file inventory: 13 files touched by PR, 7 with merge conflicts |
| 21 | +- Exact sugar replacement table: 21 replacements across `Modal/Basic.lean` (18) and `Modal/LogicalEquivalence.lean` (3) |
| 22 | +- Per-file conflict resolution rules (docstrings from PR, sugar from main, PR's `ImpBotDerived` rename, PR's cleaner proof style for `Denotation.lean`) |
| 23 | +- Quality review: pre-existing typo (`Extention`) flagged as out-of-scope |
| 24 | +- Pi-type binder constraint: `.imp` must stay raw in `change` tactic positions where `->` would parse as function arrow |
| 25 | + |
| 26 | +### Prior Plan Reference |
| 27 | + |
| 28 | +No prior plan. |
| 29 | + |
| 30 | +### Roadmap Alignment |
| 31 | + |
| 32 | +No ROADMAP.md items directly addressed by this PR integration task. |
| 33 | + |
| 34 | +## Goals & Non-Goals |
| 35 | + |
| 36 | +**Goals**: |
| 37 | +- Rebase `refactor/modal-primitives` onto `main` with all conflicts resolved correctly |
| 38 | +- Apply all 21 syntactic sugar replacements (`.diamond`->`diamond`, `.neg`->`not`, `.and`->`and`, `.or`->`or`, `.imp`->`->`, `.box`->`box` in expression positions) |
| 39 | +- Preserve PR's semantic contributions: `ImpBotDerived` rename, expanded docstrings, cleaner proof style in `Denotation.lean` |
| 40 | +- Pass full CI pipeline (lake build, lake test, checkInitImports, lint-style) |
| 41 | +- Push rebased branch to update PR #637 |
| 42 | + |
| 43 | +**Non-Goals**: |
| 44 | +- Fix pre-existing `Extention` -> `Extension` typo (separate PR) |
| 45 | +- Add new features or proofs beyond what PR #637 already includes |
| 46 | +- Modify files not touched by PR #637 |
| 47 | + |
| 48 | +## Risks & Mitigations |
| 49 | + |
| 50 | +| Risk | Impact | Likelihood | Mitigation | |
| 51 | +|------|--------|------------|------------| |
| 52 | +| Rebase conflict resolution error causes build failure | H | M | Follow per-file resolution rules from research; run `lake build` immediately after rebase | |
| 53 | +| `Cslib.lean` import merge is complex (many imports added on main) | M | M | Take main's full import list, then add PR's 2 new entries; verify with `checkInitImports` | |
| 54 | +| Sugar replacement in `change` tactic breaks proof | H | L | Research confirms all `change` positions use prefix operators (not `.imp`), which are safe | |
| 55 | +| Force push to PR branch loses collaborator work | H | L | Use `--force-with-lease` to detect intervening pushes | |
| 56 | + |
| 57 | +## Implementation Phases |
| 58 | + |
| 59 | +**Dependency Analysis**: |
| 60 | +| Wave | Phases | Blocked by | |
| 61 | +|------|--------|------------| |
| 62 | +| 1 | 1 | -- | |
| 63 | +| 2 | 2 | 1 | |
| 64 | +| 3 | 3 | 2 | |
| 65 | + |
| 66 | +Phases within the same wave can execute in parallel. |
| 67 | + |
| 68 | +### Phase 1: Rebase and Conflict Resolution [COMPLETED] |
| 69 | + |
| 70 | +**Goal**: Rebase `refactor/modal-primitives` onto `main`, resolving all 29 merge conflicts across 7 files using the documented resolution rules. |
| 71 | + |
| 72 | +**Tasks**: |
| 73 | +- [x] Checkout `refactor/modal-primitives` branch |
| 74 | +- [x] Run `git rebase main` to trigger the rebase |
| 75 | +- [x] Resolve `Cslib.lean` conflicts (2 markers): take main's full import list, add PR's new imports (`Connectives`, `LogicalEquivalence`) |
| 76 | +- [x] Resolve `Cslib/Foundations/Logic/Connectives.lean` conflicts (3 markers): take PR's `ImpBotDerived` rename and extended docstring |
| 77 | +- [x] Resolve `Cslib/Logics/Modal/Basic.lean` conflicts (15 markers): take main's sugar notation in expression positions, take PR's expanded docstring and primitives documentation |
| 78 | +- [x] Resolve `Cslib/Logics/Modal/Denotation.lean` conflicts (2 markers): take PR's cleaner proof style (`push Not`, bare `simp`, no `Proposition.neg` in simp) |
| 79 | +- [x] Resolve `Cslib/Logics/Modal/LogicalEquivalence.lean` conflicts (5 markers): take PR's copyright (Montesi + Brast-McKie) and docstring, take main's sugar in `Context.fill` match arms *(deviation: altered -- add/add conflict required full file rewrite; final file uses PR's design philosophy (no typeclass) with main's sugar notation)* |
| 80 | +- [x] Resolve `Cslib/Logics/Propositional/Defs.lean` conflicts (2 markers): take PR's docstring, keep main's `biconditional` notation line |
| 81 | +- [x] Resolve `Cslib/Logics/Propositional/NaturalDeduction/Basic.lean` conflict (1 marker): take PR's docstring |
| 82 | +- [x] Complete the rebase with `git rebase --continue` |
| 83 | + |
| 84 | +**Timing**: 1 hour |
| 85 | + |
| 86 | +**Depends on**: none |
| 87 | + |
| 88 | +**Files to modify** (during conflict resolution): |
| 89 | +- `Cslib.lean` -- import list merge |
| 90 | +- `Cslib/Foundations/Logic/Connectives.lean` -- `ImpBotDerived` rename + docstring |
| 91 | +- `Cslib/Logics/Modal/Basic.lean` -- sugar application (18 replacements) + docstring |
| 92 | +- `Cslib/Logics/Modal/Denotation.lean` -- proof style preference |
| 93 | +- `Cslib/Logics/Modal/LogicalEquivalence.lean` -- copyright + sugar (3 replacements) |
| 94 | +- `Cslib/Logics/Propositional/Defs.lean` -- docstring + notation line |
| 95 | +- `Cslib/Logics/Propositional/NaturalDeduction/Basic.lean` -- docstring |
| 96 | + |
| 97 | +**Verification**: |
| 98 | +- `git status` shows clean working tree (no conflict markers remaining) |
| 99 | +- `git log --oneline main..HEAD` shows PR commits rebased on top of main |
| 100 | +- `grep -rn '<<<<' Cslib/ Cslib.lean` returns empty (no residual conflict markers) |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +### Phase 2: Quality Scan and Full CI [COMPLETED] |
| 105 | + |
| 106 | +**Goal**: Verify no remaining raw constructors in expression positions across all PR-touched files, then run the full CSLib CI pipeline. |
| 107 | + |
| 108 | +**Tasks**: |
| 109 | +- [x] Scan all 13 PR-touched files for remaining raw constructors in expression positions (`.imp`, `.bot`, `.neg`, `.and`, `.or`, `.box`, `.diamond` outside pattern match arms and Pi-type binders) |
| 110 | +- [x] If any missed raw constructors found, apply sugar replacements and amend the relevant rebase commit or create a fixup commit *(deviation: skipped -- no raw constructors found in expression positions)* |
| 111 | +- [x] Run `lake build` -- full project build |
| 112 | +- [x] Run `lake test` -- CslibTests suite |
| 113 | +- [x] Run `lake exe checkInitImports` -- verify Cslib.Init imports |
| 114 | +- [x] Run `lake exe lint-style` -- style linting |
| 115 | + |
| 116 | +**Timing**: 45 minutes (mostly build time) |
| 117 | + |
| 118 | +**Depends on**: 1 |
| 119 | + |
| 120 | +**Files to modify**: |
| 121 | +- Potentially any of the 13 PR-touched files if raw constructors are found (expected: none) |
| 122 | + |
| 123 | +**Verification**: |
| 124 | +- All four CI commands exit with code 0 |
| 125 | +- No raw constructors in expression positions across PR-touched files |
| 126 | +- `lake build` produces no errors or warnings related to the changed files |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +### Phase 3: Push to PR Branch [COMPLETED] |
| 131 | + |
| 132 | +**Goal**: Push the rebased branch to the remote, updating PR #637. |
| 133 | + |
| 134 | +**Tasks**: |
| 135 | +- [x] Verify the branch is `refactor/modal-primitives` and is ahead of `origin/refactor/modal-primitives` |
| 136 | +- [x] Run `git push --force-with-lease origin refactor/modal-primitives` |
| 137 | +- [x] Verify push succeeded and PR #637 shows updated commits |
| 138 | + |
| 139 | +**Timing**: 5 minutes |
| 140 | + |
| 141 | +**Depends on**: 2 |
| 142 | + |
| 143 | +**Files to modify**: |
| 144 | +- None (git operation only) |
| 145 | + |
| 146 | +**Verification**: |
| 147 | +- `git push` exits with code 0 |
| 148 | +- `git log --oneline origin/refactor/modal-primitives..refactor/modal-primitives` shows no divergence (branch is at remote) |
| 149 | + |
| 150 | +## Testing & Validation |
| 151 | + |
| 152 | +- [x] `lake build` passes with no errors |
| 153 | +- [x] `lake test` passes all CslibTests |
| 154 | +- [x] `lake exe checkInitImports` passes |
| 155 | +- [x] `lake exe lint-style` passes |
| 156 | +- [x] No residual conflict markers in any file (`grep -rn '<<<<' .`) |
| 157 | +- [x] All 21 sugar replacements applied (verified by absence of raw constructors in expression positions) |
| 158 | +- [x] PR's `ImpBotDerived` rename preserved |
| 159 | +- [x] PR's expanded docstrings preserved |
| 160 | +- [x] PR's `Denotation.lean` proof style preserved |
| 161 | + |
| 162 | +## Artifacts & Outputs |
| 163 | + |
| 164 | +- `specs/167_pr637_syntactic_sugar_and_quality/plans/02_implementation-plan.md` (this file) |
| 165 | +- `specs/167_pr637_syntactic_sugar_and_quality/summaries/02_implementation-summary.md` (after implementation) |
| 166 | +- Updated PR #637 on GitHub with rebased commits |
| 167 | + |
| 168 | +## Rollback/Contingency |
| 169 | + |
| 170 | +- Before rebase: note the current `refactor/modal-primitives` HEAD SHA for recovery |
| 171 | +- If rebase goes wrong: `git rebase --abort` returns to pre-rebase state |
| 172 | +- If push goes wrong: `git push --force-with-lease` will refuse if remote has diverged |
| 173 | +- If CI fails after rebase: fix the issue in a new commit on the branch, re-run CI, then push |
| 174 | +- Full recovery: `git reset --hard {original-SHA}` restores the branch to its pre-rebase state |
0 commit comments