Skip to content

feat(Combinatorics/HypergraphLike): add incidence compatibility - #43743

Draft
Jun2M wants to merge 20 commits into
leanprover-community:masterfrom
Jun2M:HypergraphLikeCompatible
Draft

Jun2M wants to merge 20 commits into
leanprover-community:masterfrom
Jun2M:HypergraphLikeCompatible

Conversation

@Jun2M

@Jun2M Jun2M commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Adds HyperGraphLike.Compatible and related APIs.

Similar to Graph two hypergraphLikes may assign same label (vertex, edge or incidence) for different part of the graph and make them incompatible in terms of union/intersection and etc. For two hypergraphLikes to be compatible shared active incidence labels must have the same edge, attached vertex, and both source and target roles; retaining only part of an edge fiber is allowed.

Codex assisted with the initial implementation and review, and revised by me.

Co-authored-by: OpenAI Codex [email protected]


@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

PR summary a961407bc2

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Combinatorics.HypergraphLike.Basic (new file) 1013

Declarations diff (regex)

+ Adj.left_mem
+ Adj.of_compatible
+ Adj.right_mem
+ Compatible
+ Compatible.adj_congr
+ Compatible.attach_eq
+ Compatible.disjoint_incs_of_disjoint_edges
+ Compatible.disjoint_incs_of_disjoint_verts
+ Compatible.edgeFiber_subset
+ Compatible.edgeFiber_subset_of_edgeFiber_subset
+ Compatible.edgeMap_eq
+ Compatible.incEdges_eq
+ Compatible.incEdges_eq_of_vertexFiber_eq
+ Compatible.incEdges_subset
+ Compatible.incEdges_subset_of_vertexFiber_subset
+ Compatible.incVerts_eq
+ Compatible.incVerts_eq_of_edgeFiber_eq
+ Compatible.incVerts_subset
+ Compatible.incVerts_subset_of_edgeFiber_subset
+ Compatible.isLink_congr
+ Compatible.isLink_congr_of_edgeFiber_eq
+ Compatible.mem_edgeFiber_iff
+ Compatible.mem_vertexFiber_iff
+ Compatible.of_disjoint_incs
+ Compatible.refl
+ Compatible.rfl
+ Compatible.symm
+ Compatible.vertexFiber_subset
+ Compatible.vertexFiber_subset_of_vertexFiber_subset
+ HyperGraphLike
+ IsLink.adj
+ IsLink.edge_mem
+ IsLink.eq_or_eq_of_isLink_of_order_eq_two
+ IsLink.incVerts_eq_of_order_eq_two
+ IsLink.left_mem
+ IsLink.left_mem_incVerts
+ IsLink.left_unique_of_order_eq_two
+ IsLink.mem_incEdges_left
+ IsLink.mem_incEdges_right
+ IsLink.of_compatible
+ IsLink.of_compatible_of_edgeFiber_subset
+ IsLink.one_lt_order
+ IsLink.pair_subset_incVerts
+ IsLink.right_mem
+ IsLink.right_mem_incVerts
+ IsLink.right_unique_of_order_eq_two
+ IsRegular
+ IsRegular.eq_of_nonempty
+ IsSource.mem
+ IsTarget.mem
+ IsUniform
+ IsUniform.eq_of_nonempty
+ adj_iff_exists_incidence
+ attach
+ attach_image_incs_of_degree_pos
+ attach_mem
+ attach_mem_incVerts
+ attach_preimage_singleton_injOn
+ attach_surjOn_iff
+ biUnion_edgeFiber
+ biUnion_vertexFiber
+ compatible_comm
+ compatible_iff
+ degree
+ degree_attach_pos
+ degree_eq_encard_vertexFiber
+ degree_eq_top_iff
+ degree_eq_zero
+ degree_eq_zero_iff_forall_notMem_incVerts
+ degree_eq_zero_iff_incEdges_eq_empty
+ degree_eq_zero_of_incs_eq_empty
+ degree_le_encard_incs
+ degree_lt_top_iff
+ degree_lt_top_of_finite
+ degree_of_notMem_verts
+ degree_pos
+ degree_pos_iff_exists_mem_incVerts
+ degree_pos_iff_nonempty_incEdges
+ edgeFiber
+ edgeFiber_eq_inter_preimage
+ edgeFiber_subset_incs
+ edgeMap
+ edgeMap_image_incs_of_order_pos
+ edgeMap_mem
+ edgeMap_mem_incEdges
+ edgeMap_preimage_singleton_injOn
+ edgeMap_range_of_order_pos
+ edgeMap_surjOn_iff
+ encard_incEdges_le_degree
+ encard_incVerts_le_order
+ iUnion_edgeFiber
+ iUnion_vertexFiber
+ incEdges
+ incEdges_eq_empty
+ incEdges_eq_image
+ incEdges_nonempty
+ incEdges_of_notMem_verts
+ incEdges_subset_edges
+ incVerts
+ incVerts_eq_empty
+ incVerts_eq_image
+ incVerts_nonempty
+ incVerts_of_notMem_edges
+ incVerts_subset_verts
+ incs_eq_empty_of_edges_eq_empty
+ incs_eq_empty_of_verts_eq_empty
+ instance : Std.Refl (Compatible : Gr → Gr → Prop)
+ instance : Std.Symm (Compatible : Gr → Gr → Prop)
+ isLink_attach
+ isLink_iff_exists_incidence
+ isRegular_of_verts_eq_empty
+ isRegular_zero
+ isUniform_of_edges_eq_empty
+ isUniform_zero
+ mem_edgeFiber
+ mem_edges_of_mem_edgeFiber
+ mem_edges_of_mem_incVerts
+ mem_edges_of_order_pos
+ mem_incEdges
+ mem_incEdges_iff_exists_incidence
+ mem_incVerts_iff_exists_incidence
+ mem_vertexFiber
+ mem_verts_of_degree_pos
+ mem_verts_of_mem_incEdges
+ mem_verts_of_mem_vertexFiber
+ not_adj_of_notMem_verts
+ not_adj_of_notMem_verts_right
+ not_isLink_of_notMem_edges
+ order
+ order_edgeMap_pos
+ order_eq_encard_edgeFiber
+ order_eq_top_iff
+ order_eq_zero
+ order_eq_zero_of_incs_eq_empty
+ order_le_encard_incs
+ order_lt_top_iff
+ order_lt_top_of_finite
+ order_of_notMem_edges
+ order_pos
+ pairwise_disjoint_edgeFiber
+ pairwise_disjoint_vertexFiber
+ sum_degree
+ sum_degree_eq_sum_order
+ sum_order
+ toEdge_eq_edgeMap
+ toVert_eq_attach
+ vertexFiber
+ vertexFiber_eq_inter_preimage
+ vertexFiber_subset_incs

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean -- unavailable)

⚠️ No declarations diff yet: there is no built master snapshot at this PR's merge-base (typically a bors-batch intermediate that CI never built). Merge master into this PR and push to refresh.


No changes to strong technical debt.

Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (weak)
exposed public sections 5062 1

Current commit a961407bc2
Reference commit 38f65a093a

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-combinatorics Combinatorics label Sep 11, 2026
@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Sep 11, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@Jun2M
Jun2M marked this pull request as draft September 21, 2026 23:16
@mathlib-bors

mathlib-bors Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

This pull request is now in draft mode. No active bors state needed cleanup.

While this PR remains draft, bors will ignore commands on this PR. Mark it ready for review before using commands like bors r+ or bors try.

This branch has not been deployed

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

Labels

blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) t-combinatorics Combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant