Skip to content

Refactor ecPhlConseq.ml: break up monolithic dispatcher and document#965

Draft
strub wants to merge 5 commits intomainfrom
conseq-refactor
Draft

Refactor ecPhlConseq.ml: break up monolithic dispatcher and document#965
strub wants to merge 5 commits intomainfrom
conseq-refactor

Conversation

@strub
Copy link
Copy Markdown
Member

@strub strub commented Apr 3, 2026

  • Split the ~500-line t_hi_conseq into 8 per-goal-type functions (hoareS/F, bdHoareS/F, ehoareS/F, equivS/F) with a thin dispatcher
  • Extract shared helpers (t_hi_trivial, t_hi_apply_r, etc.) to module level
  • Unify three identical gen_conseq_nm variants into a single polymorphic one
  • Factor shared proof-term processing pipeline into process_conseq_core
  • Rename process_conseq_1/2 to process_conseq_hs/ss for clarity
  • Add module-level documentation: naming conventions, processing pipeline, section headers, and supported-combination comments for each dispatcher

strub and others added 5 commits April 3, 2026 20:19
- Split the ~500-line t_hi_conseq into 8 per-goal-type functions
  (hoareS/F, bdHoareS/F, ehoareS/F, equivS/F) with a thin dispatcher
- Extract shared helpers (t_hi_trivial, t_hi_apply_r, etc.) to module level
- Unify three identical gen_conseq_nm variants into a single polymorphic one
- Factor shared proof-term processing pipeline into process_conseq_core
- Rename process_conseq_1/2 to process_conseq_hs/ss for clarity
- Add module-level documentation: naming conventions, processing pipeline,
  section headers, and supported-combination comments for each dispatcher

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract cond_F_notmod_core / cond_S_notmod_core shared helpers,
  reducing cond_{hoare,bdHoare}{F,S}_notmod to 3-line wrappers
- Document transitivity_side_cond and t_*_conseq_equiv rules
- Document t_conseqauto algorithm
- Document process_concave tactic processing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add inference-rule comments to every t_* function that generates
subgoals via xmutate1, covering:
- Core consequence rules (hoare, ehoare, bdhoare, equiv, eager)
- Bound change rules (bdHoare)
- Non-modification rules (notmod)
- Concavity / Jensen's inequality (ehoare)
- Cross-logic rules (conjunction, hoare↔bdhoare, equiv↔bdhoare)
- Transitivity via equivalence (hoare/bdhoare/ehoare)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The recursive calls in t_hi_conseq_equivS and t_hi_conseq_equivF
always stay within the same goal type, so the indirection through
t_hi_conseq is unnecessary. Make both functions directly recursive
(let rec) and remove the ~recurse parameter. t_hi_conseq no longer
needs rec either.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce hi_arg type alias for (proofterm option * form) option and
annotate all t_hi_conseq_* dispatchers, helpers (t_hi_apply_r,
t_hi_error, pp_f_node, pp_opt_f), and the main t_hi_conseq dispatcher
with explicit argument and return types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant