Skip to content

Group all operations on subterms in a single module, simplify on_branches#21681

Open
yannl35133 wants to merge 2 commits intorocq-prover:masterfrom
Yann-Leray:guard-subterms
Open

Group all operations on subterms in a single module, simplify on_branches#21681
yannl35133 wants to merge 2 commits intorocq-prover:masterfrom
Yann-Leray:guard-subterms

Conversation

@yannl35133
Copy link
Contributor

@yannl35133 yannl35133 commented Feb 27, 2026

No description provided.

@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Feb 27, 2026
@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Mar 4, 2026
@yannl35133 yannl35133 added kind: redesign The same functionality is being re-implemented in a different way. kind: internal API, ML documentation... request: full CI Use this label when you want your next push to trigger a full CI. labels Mar 5, 2026
Copy link
Contributor Author

@yannl35133 yannl35133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split off the reimplementation of tree/automaton pruning since it is more difficult to write and to review. This should not change behaviour.

@coqbot-app coqbot-app bot removed request: full CI Use this label when you want your next push to trigger a full CI. needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. labels Mar 5, 2026
@yannl35133 yannl35133 marked this pull request as ready for review March 5, 2026 17:35
@yannl35133 yannl35133 requested a review from a team as a code owner March 5, 2026 17:35
@yannl35133 yannl35133 changed the title Group all operations on subterms in a single module, simplify them all Group all operations on subterms in a single module, simplify on_branches Mar 5, 2026
@ppedrot ppedrot self-assigned this Mar 7, 2026
val is_norec : t -> bool
val is_inductive : env -> inductive -> t -> bool
val is_primitive : env -> Constant.t -> t -> bool
val is_primitive_positive_container : env -> Constant.t -> t -> bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want a faithful name this should rather be is_primitive_array, I find your choice extremely verbose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not my choice, it's already used in get_recargs_approx. Plus it should be about more than arrays, but less than all primitives.

val is_norec : t -> bool
val is_inductive : env -> inductive -> t -> bool
val is_primitive : env -> Constant.t -> t -> bool
val is_primitive_positive_container : env -> Constant.t -> t -> bool
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not my choice, it's already used in get_recargs_approx. Plus it should be about more than arrays, but less than all primitives.

Comment on lines 1188 to 1196
let (ci, (p,_), _iv, c, lbr) = expand_case renv.env (ci, u, pms, p, iv, c, lbr) in
let stack' = push_stack_closures renv l stack in
let stack' = filter_stack_domain cache stack_element_specif Fun.id ?evars renv.env p stack' in
let cases_spec =
branches_specif renv (lazy_subterm_specif cache ?evars renv [] c) ci
in
let cases_spec = Subterm.on_branches renv.env ci.ci_ind (lazy_subterm_specif cache ?evars renv [] c) in
let stl =
Array.mapi (fun i br' ->
let stack_br = push_stack_args (cases_spec.(i)) stack' in
let stack_br = push_stack_args (cases_spec i) stack' in
subterm_specif cache ?evars renv stack_br br')
lbr in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subterm.on_branches can stop constructing a list when this code stops needlessly expanding the case: constructor arguments should just be pushed directly in the renv, they don't need to go in the stack in the first place.

@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Mar 9, 2026
@yannl35133 yannl35133 added the request: full CI Use this label when you want your next push to trigger a full CI. label Mar 10, 2026
@coqbot-app coqbot-app bot removed request: full CI Use this label when you want your next push to trigger a full CI. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. labels Mar 10, 2026
@ppedrot
Copy link
Member

ppedrot commented Mar 11, 2026

@coqbot bench

@ppedrot ppedrot added this to the 9.3+rc1 milestone Mar 11, 2026
Copy link
Member

@ppedrot ppedrot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good enough for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: internal API, ML documentation... kind: redesign The same functionality is being re-implemented in a different way.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants