Skip to content

Commit c4c0a46

Browse files
committed
feat(scripts/autolabel): collect label dependencies transitively (leanprover-community#36242)
Collect label dependencies transitively. if `t-algebraic-geometry -> t-ring-theory` and `t-ring-theory -> t-algebra` are two dependencies where the latter label is dropped from the list of applicable labels, then `t-algebraic-geometry -> t-algebra` is also dropped.
1 parent ab40faf commit c4c0a46

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

scripts/autolabel.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,15 @@ def getMatchingLabels (files : Array FilePath) : Array Label :=
294294
-- return sorted list of labels
295295
applicable |>.qsort (·.toString < ·.toString)
296296

297-
/-- Helper function: union of all labels an all their dependent labels -/
297+
/-- Helper function: union of all labels and all their dependent labels -/
298298
partial def collectLabelsAndDependentLabels (labels: Array Label) : Array Label :=
299299
labels.flatMap fun label ↦
300300
(collectLabelsAndDependentLabels (mathlibLabelData label).dependencies).push label
301301

302302
/-- Reduce a list of labels to not include any which are dependencies of other
303303
labels in the list -/
304304
def dropDependentLabels (labels: Array Label) : Array Label :=
305-
let dependentLabels := labels.flatMap fun label ↦
306-
(mathlibLabelData label).dependencies
305+
let dependentLabels := collectLabelsAndDependentLabels labels
307306
labels.filter (!dependentLabels.contains ·)
308307

309308
/-!

0 commit comments

Comments
 (0)