suffices∀m : ℕ, ∀ (P : Finset (Fin n ×Fin n)) (D : Finset (Fin n)),
(allPositiveRoots n \ P).card = m →InitialRootPatternP→PivotsFromPatternPD→∃c : EliminationChainPD, c.finalEntries = allPositiveRoots n by
exact this _ PD rfl hP hD
intro m
induction m usingNat.strong_induction_on with
| h m ih =>
intro PD hcard hP hD
by_cases hempty : allPositiveRoots n \ P = ∅
· refine ⟨.done, ?_⟩
change P = allPositiveRoots n
apply Finset.Subset.antisymm
· exact fun p hp => (hP p hp).1
· exact Finset.sdiff_eq_empty_iff_subset.mp hempty
· obtain ⟨p, hp, hmin⟩ :=Finset.exists_min_image (allPositiveRoots n \ P)
(fun q => toLex q) (Finset.nonempty_iff_ne_empty.mpr hempty)
havehab : p.1 < p.2:= (Finset.mem_filter.mp (Finset.mem_sdiff.mp hp).1).2havehnot : p ∉P:= (Finset.mem_sdiff.mp hp).2havehless : (allPositiveRoots n \ insert p P).card < m :=by
rw [Finset.sdiff_insert, ← hcard]
exact Finset.card_erase_lt_of_mem hp
obtain ⟨c, hc⟩ := ih _ hless (insert p P) (insert p.1D) rfl
(initialRootPattern_insert_min hP p hp hmin) (pivotsFromPattern_insert hD p.1 p.2)
exact ⟨.step p.1 p.2 (ne_of_lt hab)
(initialRootPattern_stable hP hab hnot)
(initialRootPattern_pivot_notMem hP hD hab hnot) c, hc⟩