chore(Combinatorics/SimpleGraph): avoid structure relation predicates#37878
chore(Combinatorics/SimpleGraph): avoid structure relation predicates#37878YaelDillies wants to merge 2 commits intoleanprover-community:masterfrom
Conversation
…ates Relation predicates used to be `def`s over a `forall`, which was optimal for usability in fields of other structures. This changed in leanprover-community#35591 and leanprover-community#35192 as a byproduct of reducing apparent code duplication. Unfortunately, the usability issue was overlooked. This PR restores usability by dropping the use of those relation classes that are `structure`s, ie `Std.Irrefl` and `Std.Transitive`. It also uses more widely the `simp` auto-param on `SimpleGraph.loopless`.
PR summary f7c1d6ebc9Import changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diff
You can run this locally as follows## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>The doc-module for No changes to technical debt.You can run this locally as
|
| variable {ι : Sort*} {V : Type u} (G : SimpleGraph V) {a b c u v w : V} {e : Sym2 V} | ||
|
|
||
| @[simp] | ||
| protected theorem irrefl {v : V} : ¬G.Adj v v := |
There was a problem hiding this comment.
Since this exists now, can you make this theorem produce an Std.Irrefl?
|
Can you elaborate on the issue with relation classes? I thought the only issue was that I didn't know we can write Also @Vierkantor said that |
|
You can see from the diff that the predicate is largely more often unfolded than its API is used. Empirically, it is useful for the fields to be universal quantifiers, as then the variables can be introduced with I get your point about I am teaching a Lean course in six months, which is why I am caring about usability and discoverability more now. |
Relation predicates used to be
defs over aforall, which was optimal for usability in fields of other structures. This changed in #35591 and #35192 as a byproduct of reducing apparent code duplication. Unfortunately, the usability issue was overlooked.This PR restores usability by dropping the use of those relation classes that are
structures, ieStd.IrreflandStd.Transitive. It also uses more widely thesimpauto-param onSimpleGraph.loopless.I would also be happy to revert #35591 and #35192 since this demonstrates a good use case for the
defversions of the relation predicates.