Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fsgraph] Edge induction principle (fsg_edge_induction) #1138

Merged
merged 3 commits into from
Aug 15, 2023

Conversation

binghe
Copy link
Member

@binghe binghe commented Aug 13, 2023

This PR enriches the fsgraphTheory of finite simple graphs.

Currently there's already the following induction theroem for fsgraph. The idea is to start from empty graph, and then each time adds one node (vertex), together with all new edges connected to it, until the final target graph is constructed:

fsg_induction
⊢ ∀P. P emptyG ∧
      (∀n es g0.
         P g0 ∧ FINITE es ∧ n ∉ nodes g0 ∧
         valid_edges es (n INSERT nodes g0) ∧ (∀e. e ∈ es ⇒ n ∈ e) ⇒
         P (fsgAddEdges es (addNode n () g0))) ⇒
      ∀g. P g

But some graph theory proofs require "edge induction": given a target graph, the induction starts from a graph with the same set of nodes but no edges at all, and each time it adds one edge to the graph, until reaching the final target graph:

fsg_edge_induction
⊢ ∀g P.
    P (fsgAddNodes (nodes g) emptyG) ∧
    (∀g0 x y.
       nodes g0 = nodes g ∧ x ≠ y ∧ {x; y} ⊆ nodes g ∧ {x; y} ∉ fsgedges g0 ∧
       P g0 ⇒
       P (fsgAddEdge x y g0)) ⇒
    P g

where the graph operation for adding just one edge fsgAddEdge is defined (with some supporting theorems):

fsgAddEdge_def
⊢ ∀x y g. fsgAddEdge x y g = addUDEdge x y () g

and the graph operations for adding one node fsgAddNode and a set of nodes `fsgAddNodes:

fsgAddNode_def
⊢ ∀n g. fsgAddNode n g = addNode n () g
fsgAddNodes_def
⊢ ∀N g. fsgAddNodes N g = ITSET fsgAddNode N g

--Chun

@mn200
Copy link
Member

mn200 commented Aug 14, 2023

I'm not totally against the fsgAddEdge constant, but I'd prefer it to follow the pattern of fsgAddEdges and use the two-element set to represent the edge. You could define it

fsgAddEdge e g0 = fsgAddEdges {e} g0

Given how trivial the above seems, I'm not even sure it's really worth defining.

For the induction principle, I'd use valid_edges {e} (nodes g0) /\ e NOTIN fsgedges g0 to capture the various side-conditions.

@binghe
Copy link
Member Author

binghe commented Aug 14, 2023

Thanks for your comments. I have removed fsgAddEdge and used fsgAddEdges and your suggest statements for the edge induction principle. I found this change actually leads to shorter proofs and shorter theorem statements and this is great.

P. S. It's also possible to remove fsgAddNode n and use only fsgAddNodes {n} instead, but the benefits are not significant.

@mn200
Copy link
Member

mn200 commented Aug 15, 2023

Thank you for your work on this!

@mn200 mn200 merged commit 7d7a995 into HOL-Theorem-Prover:develop Aug 15, 2023
2 checks passed
@binghe binghe deleted the fsg_edge_induction branch August 15, 2023 14:21
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.

2 participants